JO
joeyespo/upgrade-requirements.py
Upgrade all your outdated requirements.txt in a single command.
upgrade-requirements.py
Upgrade all your outdated requirements.txt in a single command.
Motivation
Even though pip list --outdated exists, sometimes you just want to
run pip install --upgrade to upgrade a package, then persist it to
your requirements.txt in one big sweep.
Installation
$ pip install upgrade-requirementsUsage
$ upgrade-requirements(Or use the shortcut command upreq.)
Now's a good time to grab a โ while it runs.
After it finishes, run your tests to make sure an individual upgrade didn't
break anything. Then move on to bigger things ๐
Found a problem with an upgraded version?
No worries!
- Revert individual entries in
requirements.txtwith the help of git - Run
pip install -r requirements.txtto downgrade to working versions - Commit the upgraded-and-tweaked
requirements.txtlike normal and carry on ๐
More usages
$ upgrade-requirements -husage: upgrade-requirements [-h] [-r REQUIREMENTS]
optional arguments:
-h, --help show this help message and exit
-r REQUIREMENTS, --requirements REQUIREMENTS
specify the location of the requirements.txt file
Room for improvement
-
This only work with pinned (
==) packages at the moment. The intention is to
get it to work more generally. This can be broken down into three sub-tasks:- Get it to ignore non-pinned requirements instead of fail
- Get it to work with other specifiers, e.g.
>=(how would this work?) - Handle all types of requirement entries
Feel free to open an issue or PR with ideas.