Skip to main content

Update Python requirements in a setup.py file to permit latest available versions

Project description

update-req-spec

Build Status License: MIT Code style: black

Update Python requirements in a setup.py file to permit latest available versions.

Motivation

You wish to cap the versions of the dependencies in your library to the major versions that are currently released since you have tested your library against these versions and, given everyone follows semantic versioning, minor updates should remain compatible. But keeping these version ranges up to date with new major releases can be tedious.

update-req-spec makes this a little easier by updating the install_requirements in your setup.py so that the version specifications allow the latest major releases while retaining the minimum permitted versions. Then all you need to do is run your tests and publish a new release.

For example, given:

from setuptools import setup

setup(
    # --- snip ---
    install_requires=[
        "requests",
        "Click>=6.1",
        "attrs~=18.1",
    ],
    # --- snip ---
)

will be transformed to:

from setuptools import setup

setup(
    # --- snip ---
    install_requires=[
        "requests<3",
        "Click>=6.1,<8",
        "attrs>=18.1,<19",
    ],
    # --- snip ---
)

Installation

Install with pipsi:

pipsi install update-req-sepc

or with pip:

python3 -m pip install update-req-spec

Usage

update-req-spec setup.py

If you use a private packge repository:

update-req-spec --index-url http://private-repo.example/ setup.py

# or

export PIP_INDEX_URL=http://private-repo.example/
update-req-spec setup.py

Project details


Download files

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

Files for update-req-spec, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size update_req_spec-1.0.2-py3-none-any.whl (6.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size update-req-spec-1.0.2.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page