Automatic upgrade of python modules and packages
Automatic upgrade of Python modules and packages
:::python from autoupgrade import AutoUpgrade AutoUpgrade("pip").upgrade_if_needed()
The above will upgrade “pip” if there is a new version of pip out there. The upgrade will be unattended and the python script will be restarted
pip install autoupgrade
or install latest from repo:
pip install https://bitbucket.org/jorkar/autoupgrade/get/master.tar.gz
:::python class AutoUpgrade(__builtin__.object)
AutoUpgrade class, holds one package
:::python __init__(self, pkg, index=None, verbose=False)
Args: pkg (str): name of package index (str): alternative index, if not given default from pip will be used. Include full index url, e.g. https://example.com/simple
Check if pkg has a later version Returns true if later version exists.
Restart application with same args as it was started. Does not return
:::python upgrade(self, dependencies=False)
Upgrade the package unconditionaly Args: dependencies, update dependencies if True (see pip–no-deps)
:::python upgrade_if_needed(self, restart=True, dependencies=False)
Upgrade the package if there is a later version available. Args: restart, restart app if True dependencies, update dependencies if True (see pip –no-deps)
Currently tested on Linux with Python 2.7. Should be usable on Windows and *nix.
Test for Python 3 will be done some time.
Corrections: - Issue #2, Index did not work when specified - Issue #3, Autoupgrade should not print to console (added verbose flag to keep backward compatibility - Issue #4, Support for pip > 0.6
Corrections: - Issue #1, Extra index did not work for all servers.
- Fixed bug when version contains characters.
- Fixed vital fault in 0.1.2
- Setup file fixes
- Removed verbose output as default
- Return value fixed of upgrade()
- Dependencies updated
- Homepage: https://bitbucket.org/jorkar/autoupgrade