Upgrade only direct dependencies in requirements.txt or pyproject.toml
Project description
upgrade-py-direct-reqs
Upgrade only direct dependencies listed in requirements.txt safely.
A Python CLI tool that lets you review and upgrade only direct dependencies in a project’s requirements.txt or pyproject.toml, while keeping your pinned versions up to date.
Developed by Miteshkumar N Raval with guidance and scripting assistance from coding agents.
Features
- Lists outdated direct dependencies.
- Prompts for confirmation before upgrading.
- Supports both
requirements.txtandpyproject.toml(with[project.dependencies]). - Updates
requirements.txtwith new pinned versions. - Cross-platform: works on Linux, macOS, and Windows.
- CLI installable via pip in a virtual environment or globally.
Installation
# Recommended: install inside your existing project virtual environment
source myenv/bin/activate # or myenv\Scripts\activate on Windows
pip install upgrade-py-direct-reqs
Usage
# Explicitly specify your requirements file
upgrade-py-direct-reqs requirements.txt
# Or specify your pyproject.toml
upgrade-py-direct-reqs pyproject.toml
- The CLI lists outdated direct dependencies.
- Review versions and confirm before upgrading.
- After upgrade, the
requirements.txtfile is updated with pinned versions.
Example
Before
requirements.txt:
requests==2.30.0
flask==2.2.5
Command
upgrade-py-direct-reqs requirements.txt
Output (sample)
📦 Outdated direct dependencies:
requests: 2.30.0 → 2.32.3
flask: 2.2.5 → 3.0.3
⚠️ Please review package revisions listed above before upgrading.
Check release notes on pypi.org for BREAKING changes or necessary code updates.
Proceed with upgrade? (y/n): y
⬆️ Upgrading 2 packages...
✅ Requirements updated: requirements.txt
After
requirements.txt:
requests==2.32.3
flask==3.0.3
Test instructions
To run CLI tests with pytest:
1. Ensure pytest is installed in your environment: pip install pytest
2. Run tests from the project root:
pytest tests/test_cli.py
3. Tests cover:
- requirements.txt only
- pyproject.toml only
- conflicting dependencies in both files
- empty requirements.txt
- invalid toml file name (refer PEP 621 for more details)
License
This project is licensed under the MIT License — see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file upgrade_py_direct_reqs-0.2.2.tar.gz.
File metadata
- Download URL: upgrade_py_direct_reqs-0.2.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa111fc9bd54c45a22f829442f0956e68666a857c13bc9f1570a743f9c4ae546
|
|
| MD5 |
d35c57e7cf592ed1fa510adae32dc356
|
|
| BLAKE2b-256 |
1bb25e43a4ef105f0dc0c6d753db2975b223ba275c524d6bc2410afb40b8f5e8
|
File details
Details for the file upgrade_py_direct_reqs-0.2.2-py3-none-any.whl.
File metadata
- Download URL: upgrade_py_direct_reqs-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
594e1509c78f8495adcfd3cc1cd5b62706220844948ac4470d0f54829cbd4400
|
|
| MD5 |
eabc2a14641e2131db0ba750b8ac8942
|
|
| BLAKE2b-256 |
035b41d33b9b2795ac9964bc8480be0f0029de018181e152cd9ca7eae1607135
|