Skip to main content

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

Project description

Tests Coverage Version Supported Python Versions https://wakatime.com/badge/github/alanhamlett/pip-update-requirements.svg

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.

--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.

--skip TEXT

Comma separated list of packages to skip updating.

--index-url TEXT

Base URL of the Python Package Index. Can be provided multiple times for extra index urls.

--cert PATH

Path to PEM-encoded CA certificate bundle. If provided, overrides the default.

--no-ssl-verify

Disable TLS cert verification.

--only TEXT

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

--minor TEXT

Comma separated list of packages to only update minor versions, never major. Use “*” to limit every package to minor version updates.

--patch TEXT

Comma separated list of packages to only update patch versions, never major or minor. Use “*” to limit every package to patch version updates.

--pre TEXT

Comma separated list of packages to allow updating to pre-release versions. Use “*” to allow all packages to be updated to pre-release versions. By default packages are only updated to stable versions.

-z, --nonzero-exit-code

Exit with status 10 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-7.0.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pur-7.0.0-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pur-7.0.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.12

File hashes

Hashes for pur-7.0.0.tar.gz
Algorithm Hash digest
SHA256 d0239ef9572a22b06e17719e49a61101b72b5a49a833425769902f089fff4753
MD5 f358a7977c59f8448001dc7cf9f484f4
BLAKE2b-256 7397f8f3b5472e2a5f066431a567970784ba1af19e469d03b976327975cb0af6

See more details on using hashes here.

File details

Details for the file pur-7.0.0-py3-none-any.whl.

File metadata

  • Download URL: pur-7.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.12

File hashes

Hashes for pur-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae94adb4bb2378aebee6b74894f83b0e36e3ce0142c7e394cb0b080517721660
MD5 691a45f1548840056d486d17550bf409
BLAKE2b-256 ec1cba80623a3fbe34040a3e26a79cc71268cb11eb3fbbcac0d4e2ec9e478430

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