Skip to main content

Update packages in a requirements.txt file to latest versions.

Project description

Tests Coverage Version Supported Python Versions

pip-update-requirements

Update the packages in a requirements.txt file.

Purring Cat

Installation

pip install pur

Usage

Give pur your requirements.txt file and it updates all your packages to the latest versions.

For example, given a requirements.txt file:

flask==0.9
sqlalchemy==0.9.10
alembic==0.8.4

Running pur on that file updates the packages to current latest versions:

$ pur -r requirements.txt
Updated flask: 0.9 -> 1.0.2
Updated sqlalchemy: 0.9.10 -> 1.2.8
Updated alembic: 0.8.4 -> 0.9.9
All requirements up-to-date.

Pur never modifies your environment or installed packages, it only modifies your requirements.txt file.

You can also use Pur directly from Python:

$ python
Python 3.6.1
>>> from pur import update_requirements
>>> print([x[0]['message'] for x in update_requirements(input_file='requirements.txt').values()])
['Updated flask: 0.9 -> 1.0.2', 'Updated sqlalchemy: 0.9.10 -> 1.2.8', 'Updated alembic: 0.8.4 -> 0.9.9']
>>> print(open('requirements.txt').read())
flask==1.0.2
sqlalchemy==1.2.8
alembic==0.9.9

Options

-r, --requirement PATH

The requirements.txt file to update; Defaults to using requirements.txt from the current directory if it exist.

-o, --output PATH

Output updated packages to this file; Defaults to overwriting the input requirements.txt file.

-i, --interactive

Interactively prompts before updating each package.

-f, --force

Force updating packages even when a package has no version specified in the input requirements.txt file.

-d, --dry-run

Output changes to STDOUT instead of overwriting the requirements.txt file.

-n, --no-recursive

Prevents updating nested requirements files.

-s, --skip TEXT

Comma separated list of packages to skip updating.

--only TEXT

Comma separated list of packages. Only these packages will be updated.

-z, --nonzero-exit-code

Exit with status l0 when all packages up-to-date, 11 when some packages were updated. Defaults to exit status zero on success and non-zero on failure.

--version

Show the version and exit.

--help

Show this message and exit.

Contributing

Before contributing a pull request, make sure tests pass:

virtualenv venv
. venv/bin/activate
pip install tox
tox

Many thanks to all contributors!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pur-5.0.0.tar.gz (1.2 MB view details)

Uploaded Source

File details

Details for the file pur-5.0.0.tar.gz.

File metadata

  • Download URL: pur-5.0.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pur-5.0.0.tar.gz
Algorithm Hash digest
SHA256 91ef8eedfe175035c560ed072e9975e189da0df76a97f815caee67aed4257de7
MD5 69b91b8e06bc35d66e47c989b96ef6dd
BLAKE2b-256 f159e19ea68c4d3e7a32fea9bfb93abcbb4d4fbfedfe12e8192883fb07cd5ab7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page