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 coding agents with guidance from Miteshkumar N Raval.
Features
- Lists outdated direct dependencies.
plancommand provides deterministic, zero-mutation upgrade planning.- Supports both
requirements.txtandpyproject.toml(with[project.dependencies]). upgradecommand applies upgrades with optional package selection.- 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
# Optional: install the CLI globally with pipx
pipx install upgrade-py-direct-reqs
Important: Even when installed via
pipx, activate your project's virtual environment before runningupgrade-py-direct-reqsso upgrades are applied to the correct environment.
Usage
# Plan updates (default command, no file mutation)
upgrade-py-direct-reqs plan requirements.txt
# Plan with machine-readable output for CI/agents
upgrade-py-direct-reqs plan requirements.txt --json --diff
# Upgrade specific packages only
upgrade-py-direct-reqs upgrade requirements.txt requests fastapi --yes
# Allow major bumps explicitly
upgrade-py-direct-reqs upgrade pyproject.toml --allow-major --yes
# Show updr version
upgrade-py-direct-reqs --version
planis safe by default and never mutates files.upgradeperforms installation and rewrites direct dependency entries.- Package names are normalized for matching (
requests,Requests,requests>=...).
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:
pip install .[dev]
pytest tests/test_cli.py
Current automated coverage in tests/test_cli.py includes:
- invalid TOML filename validation (
pyproject.tomlnaming rule) - normalized package-name matching behavior in plan mode
- upgrade path behavior when dependencies are not installed
- plan
--jsonbehavior in missing-installation guard paths
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.4.0.tar.gz.
File metadata
- Download URL: upgrade_py_direct_reqs-0.4.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ebb9a34e3e7b847207d36304529b33be9a37d89a5c433b3c9c4d2f943540c9a
|
|
| MD5 |
3dc9886fe84df618ae7ed5eb654106ef
|
|
| BLAKE2b-256 |
6cc2cf8697aaab4dadebe0ec4ab9398d169ac7a498dcb1e47f8f77ea5a42b647
|
File details
Details for the file upgrade_py_direct_reqs-0.4.0-py3-none-any.whl.
File metadata
- Download URL: upgrade_py_direct_reqs-0.4.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f078568470054ba3fc4784da96e4ec8fd81172e8c15abb87c4590d8aa723dc22
|
|
| MD5 |
c24e8d494d0e5e6ad99ef7b6dad079d9
|
|
| BLAKE2b-256 |
40e9002296c628bcf0f6707277556719397118b37e92a508d8e990b4534b8e6a
|