Caution! This project cannot be used concurrently with the PyReqVer_CN project due to overlapping functionality and conflicting commands. Any interesting issues that arise from their simultaneous use are not within the scope of resolution by the maintainers.
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.
- 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
- Clone or download this repository
- Install dependencies:
pip install -r requirements.txt
pip install pyreqverpython main.py path/to/your/requirements.txtExample:
python main.py requirements.txtrequirements: Path to the requirements.txt file (required)
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']
- Parsing Requirements: The tool reads and parses the requirements.txt file to extract package names.
- Fetching Package Information: For each package, it queries PyPI's JSON API to get metadata about available versions and their Python version compatibility.
- Analyzing Compatibility: It examines two sources of compatibility information:
- The
requires_pythonfield in package metadata - Package classifiers that indicate Python version support
- The
- Finding Common Versions: It calculates the intersection of Python versions that support all packages in your requirements.
- Displaying Results: The tool shows which Python versions each package supports and highlights the versions that are compatible with all packages.
- Uses the
packaginglibrary 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
requests>=2.25.0: For HTTP requests to PyPIpackaging>=21.0: For parsing version specifiers and handling version comparisons
- Requires an internet connection to fetch package information from PyPI
- Some packages may not have explicit Python version support information
- Results are based on package metadata and may not reflect actual runtime compatibility
- The tool checks for declared compatibility, not actual functionality across Python versions
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- This tool requires an internet connection to fetch package information from PyPI
- Some packages may not have explicit Python version support information
- Results are for reference only, please ensure to test your code for compatibility on the selected Python version
- The tool may not work correctly with packages that use non-standard versioning schemes