piprot is a tool for making sure that a Python project’s requirements.txt is kept up to date to latest package versions. If they are, it would tell you a happy message:

Looks like you've been keeping up to date, time for a delicious beverage!

Otherwise, a message would read like:

$ piprot
Your requirements are 252 days out of date

It’s pretty nice that it even tells you that how long the requirements.txt has been outdated. For more verbose messages:

$ piprot -v
Cython (0.19.1) is 252 days out of date
Jinja2 (2.7.2) is up to date
Decoding the JSON response for Pillow (2.4.0) failed
Your requirements are 252 days out of date

It lists every entry with results of whether are they outdated or not. The version numbers in output are ones listed in requirements.txt. If versions do not exist, it shows error messages.

If you use -x or --verbatim, then you gets a complete requirements.txt, with conjunction of -l or --latest for latest versions:

$ piprot -xl
Cython==0.20 # Updated from 0.19.1
Pillow==2.4.0 # Error checking latest version
# Generated with piprot 0.3.0
# Your requirements are 252 days out of date

The output has updated the version number to latest ones for you, you could simply overwrite the file with this output to update.

For checking the packages on the system, piprot can help, too:

$ pip freeze | piprot -vl -

piprot takes the filename of requirements.txt and - indicates the contents come from standard input.

To update, feed the output back to pip:

$ pip install --upgrade -r <(pip freeze | piprot -xl -)

We can use pip‘s -r to install package via list from a requirements.txt file.

If you are more serious of keeping requirements.txt up to date, maybe you can add a command to setup.py or a special test for making sure everything in the requirements.txt is up to date, some sort of automatically checking.