Skip to main content

Check Python package requirements for updates

Project description

req-update-check

Tests Coverage Status Code style: ruff

A Python tool to check your requirements.txt file for package updates, with optional file caching for better performance.

Features

  • Check for available updates in your requirements.txt file
  • Show update severity (major/minor/patch)
  • Display package homepages and changelogs when available
  • Optional file caching for faster repeated checks
  • Support for comments and inline comments in requirements.txt
  • Ignores pre-release versions (alpha, beta, release candidates)

Installation

Install from PyPI:

pip install req-update-check

Or install from the repo directly:

pip install git+https://github.com/ontherivt/req-update-check.git

Or install from source:

git clone https://github.com/ontherivt/req-update-check.git
cd req-update-check
pip install -e .

Usage

Basic usage:

req-update-check requirements.txt

Command Line Options

req-update-check [-h] [--no-cache] [--cache-dir CACHE_DIR] requirements_file

Arguments:

  • requirements_file: Path to your requirements.txt file

Note: You can also provide a pyproject.toml file, but only if you're using python 3.11+.

Options:

  • --no-cache: Disable file caching
  • --cache-dir: Custom cache directory (default: ~/.req-update-check-cache)

Example Output

File caching enabled
The following packages need to be updated:

requests: 2.28.0 -> 2.31.0 [minor]
    Pypi page: https://pypi.python.org/project/requests/
    Homepage: https://requests.readthedocs.io
    Changelog: https://requests.readthedocs.io/en/latest/community/updates/#release-history

redis: 4.5.0 -> 5.0.1 [major]
    Pypi page: https://pypi.python.org/project/redis/
    Homepage: https://github.com/redis/redis-py
    Changelog: https://github.com/redis/redis-py/blob/master/CHANGES

Using file Caching

The tool supports file caching to improve performance when checking multiple times. You can configure the cache storage:

req-update-check --cache-dir ~/.your-cache-dir requirements.txt

Requirements.txt Format

The tool supports requirements.txt files with the following formats:

package==1.2.3
package == 1.2.3  # with spaces
package==1.2.3  # with inline comments
# Full line comments

Note: Currently only supports exact version specifiers (==). Support for other specifiers (like >=, ~=) is planned for future releases.

Python API

You can also use req-update-check as a Python library:

from req_update_check import Requirements

# Without file cache
req = Requirements('requirements.txt', allow_cache=False)
req.check_packages()
req.report()

# With file cache defaults
req = Requirements('requirements.txt')
req.check_packages()
req.report()

Development

To set up for development:

  1. Clone the repository
  2. Create a virtual environment: python -m venv venv
  3. Activate the virtual environment: source venv/bin/activate (Unix) or venv\Scripts\activate (Windows)
  4. Install development dependencies: pip install -e ".[dev]"

To run tests:

  1. python -m unittest

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.

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

req_update_check-0.2.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

req_update_check-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file req_update_check-0.2.0.tar.gz.

File metadata

  • Download URL: req_update_check-0.2.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for req_update_check-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bd38efc7e194d4549436c178480d9160222b86dae80013a58e5b4c2db93aec75
MD5 ebdc650d80dc0757bec41c0a35b29557
BLAKE2b-256 757d16b7f611f6cd3fe090a1fffa4cf17c67efe8012a5b405fb71813c43c1e4e

See more details on using hashes here.

File details

Details for the file req_update_check-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for req_update_check-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbd9c9bef48e2c5bb5fa8a8f60413ebd9ea167f2a03ac6e3ebd732b5a85a9b3e
MD5 bbf3160c0238bf1f7d57f79ee5cc57c6
BLAKE2b-256 637c993ce601e0b68f5882ed76de6d5a91c435d8be21422fa24a6b5046c7ec68

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