Skip to main content

A command-line tool that helps you find Python versions that support all libraries in your requirements.txt file

Project description

PyReqVer - Python Requirements Version Checker

PyReqVer is a command-line tool that helps you find Python versions that support all libraries in your requirements.txt file. It analyzes each package's compatibility information from PyPI and determines the intersection of Python versions that support all your dependencies.

Features

  • Analyzes packages in requirements.txt files
  • Fetches Python version compatibility data from PyPI
  • Identifies common Python versions supported by all packages
  • Handles complex version specifiers and classifiers
  • Provides clear output showing compatible Python versions
  • Uses concurrent requests for efficient package information retrieval

Installation

From Source

  1. Clone or download this repository
  2. Install dependencies:
    pip install -r requirements.txt
    

Using pip (if published)

pip install pyreqver

Usage

Basic Usage

python main.py path/to/your/requirements.txt

Example:

python main.py requirements.txt

Command Line Arguments

  • requirements: Path to the requirements.txt file (required)

Output Example

requests available on: ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6', '3.5', '2.7']
scikit-learn available on: ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6', '3.5']
pandas available on: ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6', '3.5', '2.7']
matplotlib available on: ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6', '3.5']
numpy available on: ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6', '3.5', '2.7']
--------------------------------------------------------------------------------
Supported Python versions for all libraries: ['3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6', '3.5']

How It Works

  1. Parsing Requirements: The tool reads and parses the requirements.txt file to extract package names.
  2. Fetching Package Information: For each package, it queries PyPI's JSON API to get metadata about available versions and their Python version compatibility.
  3. Analyzing Compatibility: It examines two sources of compatibility information:
    • The requires_python field in package metadata
    • Package classifiers that indicate Python version support
  4. Finding Common Versions: It calculates the intersection of Python versions that support all packages in your requirements.
  5. Displaying Results: The tool shows which Python versions each package supports and highlights the versions that are compatible with all packages.

Technical Details

  • Uses the packaging library to handle version specifiers
  • Implements caching to avoid redundant API calls
  • Uses concurrent requests for efficient package information retrieval
  • Handles various edge cases like missing package information or incomplete metadata

Dependencies

  • requests>=2.25.0: For HTTP requests to PyPI
  • packaging>=21.0: For parsing version specifiers and handling version comparisons

Limitations

  1. Requires an internet connection to fetch package information from PyPI
  2. Some packages may not have explicit Python version support information
  3. Results are based on package metadata and may not reflect actual runtime compatibility
  4. The tool checks for declared compatibility, not actual functionality across Python versions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Notes

  1. This tool requires an internet connection to fetch package information from PyPI
  2. Some packages may not have explicit Python version support information
  3. Results are for reference only, please ensure to test your code for compatibility on the selected Python version
  4. The tool may not work correctly with packages that use non-standard versioning schemes

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

pyreqver-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

pyreqver-0.1.0-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyreqver-0.1.0.tar.gz.

File metadata

  • Download URL: pyreqver-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for pyreqver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f92d241c91af313ecf67de45e8f0d5f2994a674ffab33a4f53f6243c2a8e6e21
MD5 59a5e0d27f18a40aece5d04d0e394e8e
BLAKE2b-256 ab7e36de2d7fa279ea92e087bf5df67f27493a3a6791f49cb5dab6c476be51e8

See more details on using hashes here.

File details

Details for the file pyreqver-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pyreqver-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for pyreqver-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eb41ce40af36a45fdf3ab161bc3ab9fc19545fac86826196d0c2771cdef9e461
MD5 6a4306c744433f1c63f3670dfb3677a1
BLAKE2b-256 9c4a9d8977f72ec54ead2c6ac9d23089f11f1a1e277bca217b97d1704bd65b6d

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