Metadata-Version: 2.4
Name: upgrade-py-direct-reqs
Version: 0.2.2
Summary: Upgrade only direct dependencies in requirements.txt or pyproject.toml
Author-email: Miteshkumar Raval <mraval@nasagram.com>
Maintainer-email: Miteshkumar Raval <mraval@nasagram.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/mitesh-raval/upgrade-py-direct-reqs
Project-URL: Repository, https://github.com/mitesh-raval/upgrade-py-direct-reqs
Project-URL: Issues, https://github.com/mitesh-raval/upgrade-py-direct-reqs/issues
Keywords: dependencies,upgrades,upgrade packages,requirements upgrade
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pip>=21.0
Requires-Dist: toml>=0.10.2
Dynamic: license-file

# 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.txt` and `pyproject.toml` (with `[project.dependencies]`).
- Updates `requirements.txt` with new pinned versions.
- Cross-platform: works on Linux, macOS, and Windows.
- CLI installable via pip in a virtual environment or globally.

---

## Installation

```bash
# 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

```bash
# 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.txt` file is updated with pinned versions.

---

## Example

### Before

`requirements.txt`:
```txt
requests==2.30.0
flask==2.2.5
```

### Command
```bash
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`:
```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](LICENSE) file for details.
