Skip to main content

Are your dependencies ready for new Python?

Project description

python_readiness

Are your dependencies ready for new Python?

Installation

pip install python_readiness

Alternatives include:

  • uvx python_readiness
  • It's a single file script that contains PEP 723 metadata

Usage

Check if a specific package is ready for a specific Python:

python_readiness -p numpy --python 3.11

This will print the requirement you need to ensure that numpy supports that Python:

λ python_readiness -p numpy --python 3.13
numpy>=2.1.0      # has_classifier_and_explicit_wheel
λ python_readiness -p numpy --python 3.12
numpy>=1.26.0     # has_classifier_and_explicit_wheel
λ python_readiness -p numpy --python 3.11
numpy>=1.23.3     # has_classifier_and_explicit_wheel
λ python_readiness -p 'numpy>=2' --python 3.11
numpy>=2          # has_classifier_and_explicit_wheel (existing requirement ensures support)

Check if a requirements file is ready for a specific Python:

python_readiness -r requirements.txt --python 3.13

This will output new requirements that ensure your environment is restricted to versions that will support the specified Python version. In particular, look at lines containing "previously". These are the minimum versions you will need to upgrade to for support.

I find this really useful for updating constraints files when incrementally upgrading a large codebase to a new Python.

Check if your current environment is ready for the latest Python:

python_readiness

Check if another virtual environment is ready for the latest Python:

python_readiness -e path/to/.venv

See all options:

python_readiness --help

What are the exact definitions of readiness this uses?

Take a look at the code, in particular support_from_files.

It's primarily based on wheel tags and classifiers, but looks at some other metadata and has a few interesting tricks.

python_readiness currently classifies package versions as one of the following levels of support:

Explicitly supported:

  • has_classifier_and_explicit_wheel
    Both has_classifier and has_explicit_wheel are true.
  • has_classifier
    Has a trove classifier for the corresponding Python version.
  • has_explicit_wheel
    Has a wheel that specifically supports the corresponding Python version (includes abi3 wheels targeting specifically that Python)
  • is_requires_python_lower_bound
    Niche, but if Requires-Python: >=3.9 then the package explicitly supports 3.9.

Potentially supported:

  • has_viable_wheel
    Has a wheel that is installable on the Python version, but has no explicit indication that upstream has ever run it with that Python version.
  • totally_unknown
    This is usually because the package only provides an sdist.

Unsupported:

  • unsupported

Also, if you're interested in looking at the code — the bisection code we use to find earliest supported versions is interesting, since it can handle non-monotonic support, e.g. in the case of backports.

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

python_readiness-2.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

python_readiness-2.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file python_readiness-2.2.tar.gz.

File metadata

  • Download URL: python_readiness-2.2.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for python_readiness-2.2.tar.gz
Algorithm Hash digest
SHA256 d34a471edd937eb0a64eee68796b4216b3ae0e69e3b93cd48f606cd85e048f60
MD5 56f99b0b7bfd48b55a74f9d260add08c
BLAKE2b-256 70ecb47eddc8ded58f7e18f7ebbdc3f618e5017c453a9bd01b594918cb6ca8bd

See more details on using hashes here.

File details

Details for the file python_readiness-2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_readiness-2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20b2ce042bdd054c8df437ef4bac553d81c9a97587847afc446c5825c35c68c8
MD5 8cd7d033b5d6bb59631cc35eaca51866
BLAKE2b-256 24e9a717577f622e810d6a0ca616c99dce71509a200472d0124fc1e59605ecc9

See more details on using hashes here.

Supported by

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