upgrade-py-direct-reqs 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Miteshkumar N Raval
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include README.md
2
+ include LICENSE
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: upgrade-py-direct-reqs
3
+ Version: 0.1.1
4
+ Summary: Upgrade only direct dependencies in requirements.txt or pyproject.toml
5
+ Author-email: Miteshkumar Raval <mraval@nasagram.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/mitesh-raval/upgrade-py-direct-reqs
8
+ Project-URL: Repository, https://github.com/mitesh-raval/upgrade-py-direct-reqs
9
+ Project-URL: Issues, https://github.com/mitesh-raval/upgrade-py-direct-reqs/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pip>=21.0
17
+ Dynamic: license-file
18
+
19
+ # upgrade-py-direct-reqs
20
+
21
+ **Upgrade only direct dependencies listed in `requirements.txt` safely.**
22
+
23
+ A Python CLI tool that lets you review and upgrade **only direct dependencies** in a project’s `requirements.txt` (or `pyproject.toml` in future versions), while keeping your pinned versions up to date.
24
+
25
+ Developed by Miteshkumar N Raval with guidance and scripting assistance from OpenAI ChatGPT.
26
+
27
+ ---
28
+
29
+ ## Features
30
+
31
+ - Lists outdated direct dependencies.
32
+ - Prompts for confirmation before upgrading.
33
+ - Updates `requirements.txt` with new pinned versions.
34
+ - Cross-platform: works on Linux, macOS, and Windows.
35
+ - CLI installable via [pipx](https://pypa.github.io/pipx/).
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ # Recommended: install globally using pipx
43
+ pipx install upgrade-py-direct-reqs
44
+ ```
45
+
46
+ Or via pip in a venv:
47
+
48
+ ```bash
49
+ pip install upgrade-py-direct-reqs
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Usage
55
+
56
+ ```bash
57
+ # Explicitly specify your requirements file
58
+ upgrade-py-direct-reqs path/to/requirements.txt
59
+ ```
60
+
61
+ - The CLI will list outdated direct dependencies.
62
+ - You can review versions and confirm before upgrading.
63
+ - After upgrade, the `requirements.txt` file is updated with pinned versions.
64
+
65
+ ---
66
+
67
+ ## Example
68
+
69
+ ### Before
70
+
71
+ `requirements.txt`:
72
+ ```txt
73
+ requests==2.30.0
74
+ flask==2.2.5
75
+ ```
76
+
77
+ ### Command
78
+ ```bash
79
+ upgrade-py-direct-reqs requirements.txt
80
+ ```
81
+
82
+ ### Output (sample)
83
+ ```
84
+ 📦 Outdated direct dependencies:
85
+
86
+ requests: 2.30.0 → 2.32.3
87
+ flask: 2.2.5 → 3.0.3
88
+
89
+ ⚠️ Please review package revisions listed above before upgrading.
90
+ Check release notes on pypi.org for BREAKING changes or necessary code updates.
91
+
92
+ Proceed with upgrade? (y/n): y
93
+ ⬆️ Upgrading 2 packages...
94
+ ✅ Requirements updated: requirements.txt
95
+ ```
96
+
97
+ ### After
98
+
99
+ `requirements.txt`:
100
+ ```txt
101
+ requests==2.32.3
102
+ flask==3.0.3
103
+ ```
104
+
105
+ ---
106
+
107
+ ## License
108
+
109
+ This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,91 @@
1
+ # upgrade-py-direct-reqs
2
+
3
+ **Upgrade only direct dependencies listed in `requirements.txt` safely.**
4
+
5
+ A Python CLI tool that lets you review and upgrade **only direct dependencies** in a project’s `requirements.txt` (or `pyproject.toml` in future versions), while keeping your pinned versions up to date.
6
+
7
+ Developed by Miteshkumar N Raval with guidance and scripting assistance from OpenAI ChatGPT.
8
+
9
+ ---
10
+
11
+ ## Features
12
+
13
+ - Lists outdated direct dependencies.
14
+ - Prompts for confirmation before upgrading.
15
+ - Updates `requirements.txt` with new pinned versions.
16
+ - Cross-platform: works on Linux, macOS, and Windows.
17
+ - CLI installable via [pipx](https://pypa.github.io/pipx/).
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ # Recommended: install globally using pipx
25
+ pipx install upgrade-py-direct-reqs
26
+ ```
27
+
28
+ Or via pip in a venv:
29
+
30
+ ```bash
31
+ pip install upgrade-py-direct-reqs
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ # Explicitly specify your requirements file
40
+ upgrade-py-direct-reqs path/to/requirements.txt
41
+ ```
42
+
43
+ - The CLI will list outdated direct dependencies.
44
+ - You can review versions and confirm before upgrading.
45
+ - After upgrade, the `requirements.txt` file is updated with pinned versions.
46
+
47
+ ---
48
+
49
+ ## Example
50
+
51
+ ### Before
52
+
53
+ `requirements.txt`:
54
+ ```txt
55
+ requests==2.30.0
56
+ flask==2.2.5
57
+ ```
58
+
59
+ ### Command
60
+ ```bash
61
+ upgrade-py-direct-reqs requirements.txt
62
+ ```
63
+
64
+ ### Output (sample)
65
+ ```
66
+ 📦 Outdated direct dependencies:
67
+
68
+ requests: 2.30.0 → 2.32.3
69
+ flask: 2.2.5 → 3.0.3
70
+
71
+ ⚠️ Please review package revisions listed above before upgrading.
72
+ Check release notes on pypi.org for BREAKING changes or necessary code updates.
73
+
74
+ Proceed with upgrade? (y/n): y
75
+ ⬆️ Upgrading 2 packages...
76
+ ✅ Requirements updated: requirements.txt
77
+ ```
78
+
79
+ ### After
80
+
81
+ `requirements.txt`:
82
+ ```txt
83
+ requests==2.32.3
84
+ flask==3.0.3
85
+ ```
86
+
87
+ ---
88
+
89
+ ## License
90
+
91
+ This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "upgrade-py-direct-reqs"
7
+ version = "0.1.1"
8
+ description = "Upgrade only direct dependencies in requirements.txt or pyproject.toml"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Miteshkumar Raval", email = "mraval@nasagram.com" }
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+ dependencies = [
21
+ "pip>=21.0"
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/mitesh-raval/upgrade-py-direct-reqs"
26
+ Repository = "https://github.com/mitesh-raval/upgrade-py-direct-reqs"
27
+ Issues = "https://github.com/mitesh-raval/upgrade-py-direct-reqs/issues"
28
+
29
+ [project.scripts]
30
+ upgrade-py-direct-reqs = "upgrade_py_direct_reqs.cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ """upgrade-py-direct-reqs
2
+
3
+ A CLI tool to upgrade only direct dependencies listed in requirements.txt.
4
+ """
5
+
6
+ __version__ = "0.1.0"
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ upgrade-py-direct-reqs
4
+
5
+ Upgrade only direct dependencies listed in requirements.txt safely.
6
+ """
7
+
8
+ import argparse
9
+ import json
10
+ import subprocess
11
+ import sys
12
+ import tempfile
13
+ from pathlib import Path
14
+
15
+ # pylint: disable=R1710 # inconsistent-return-statements
16
+
17
+
18
+ def run_cmd(cmd, capture=False):
19
+ try:
20
+ if capture:
21
+ return subprocess.check_output(cmd, text=True).strip()
22
+ subprocess.run(cmd, check=True)
23
+ except subprocess.CalledProcessError:
24
+ print(f"❌ Command failed: {' '.join(cmd)}")
25
+ sys.exit(1)
26
+
27
+
28
+ def list_outdated():
29
+ output = subprocess.check_output(
30
+ [sys.executable, "-m", "pip", "list", "-o", "--format=json"], text=True
31
+ )
32
+ data = json.loads(output)
33
+ return {
34
+ pkg["name"].lower(): (pkg["version"], pkg["latest_version"]) for pkg in data
35
+ }
36
+
37
+
38
+ def load_requirements(req_path):
39
+ deps = {}
40
+ with open(req_path, encoding="utf-8") as f:
41
+ for line in f:
42
+ line = line.strip()
43
+ if line and not line.startswith("#"):
44
+ pkg = line.split("==")[0].lower()
45
+ deps[pkg] = line
46
+ return deps
47
+
48
+
49
+ def main():
50
+ parser = argparse.ArgumentParser(
51
+ description="Upgrade only direct dependencies from requirements.txt"
52
+ )
53
+ parser.add_argument("requirements", help="Path to requirements.txt")
54
+ args = parser.parse_args()
55
+
56
+ req_path = Path(args.requirements).resolve()
57
+ if not req_path.exists():
58
+ print(f"❌ requirements file not found: {req_path}")
59
+ sys.exit(1)
60
+
61
+ print(f"📄 Using requirements: {req_path}\n")
62
+
63
+ outdated = list_outdated()
64
+ direct = load_requirements(req_path)
65
+
66
+ candidates = {pkg: outdated[pkg] for pkg in outdated if pkg in direct}
67
+
68
+ if not candidates:
69
+ print("✅ No direct dependencies are outdated.\n")
70
+ return
71
+
72
+ print("📦 Outdated direct dependencies:")
73
+ for pkg, (current, latest) in candidates.items():
74
+ print(f" {pkg}: {current} → {latest}")
75
+ print()
76
+
77
+ print("⚠️ Please review package revisions listed above before upgrading.")
78
+ print(
79
+ " Check release notes on pypi.org for BREAKING changes or necessary code updates."
80
+ )
81
+ print()
82
+
83
+ confirm = input("Proceed with upgrade? (y/n): ").strip().lower()
84
+ if confirm != "y":
85
+ print("❌ Upgrade cancelled.\n")
86
+ return
87
+
88
+ with tempfile.NamedTemporaryFile("w", delete=False, encoding="utf-8") as tmp:
89
+ for pkg in candidates:
90
+ tmp.write(pkg + "\n")
91
+ upgrade_file = tmp.name
92
+
93
+ print(f"⬆️ Upgrading {len(candidates)} packages...\n")
94
+ run_cmd([sys.executable, "-m", "pip", "install", "--upgrade", "-r", upgrade_file])
95
+
96
+ print("📌 Repinning direct dependencies into requirements.txt...")
97
+ freeze_output = run_cmd([sys.executable, "-m", "pip", "freeze"], capture=True)
98
+ frozen = {line.split("==")[0].lower(): line for line in freeze_output.splitlines()}
99
+
100
+ with open(req_path, "w", encoding="utf-8") as f:
101
+ for pkg_name, pkg_line in direct.items():
102
+ if pkg_name in frozen:
103
+ f.write(f"{frozen[pkg_name]}\n")
104
+ else:
105
+ f.write(pkg_line + "\n")
106
+
107
+ print(f"✅ Requirements updated: {req_path}\n")
108
+
109
+
110
+ if __name__ == "__main__":
111
+ main()
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: upgrade-py-direct-reqs
3
+ Version: 0.1.1
4
+ Summary: Upgrade only direct dependencies in requirements.txt or pyproject.toml
5
+ Author-email: Miteshkumar Raval <mraval@nasagram.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/mitesh-raval/upgrade-py-direct-reqs
8
+ Project-URL: Repository, https://github.com/mitesh-raval/upgrade-py-direct-reqs
9
+ Project-URL: Issues, https://github.com/mitesh-raval/upgrade-py-direct-reqs/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pip>=21.0
17
+ Dynamic: license-file
18
+
19
+ # upgrade-py-direct-reqs
20
+
21
+ **Upgrade only direct dependencies listed in `requirements.txt` safely.**
22
+
23
+ A Python CLI tool that lets you review and upgrade **only direct dependencies** in a project’s `requirements.txt` (or `pyproject.toml` in future versions), while keeping your pinned versions up to date.
24
+
25
+ Developed by Miteshkumar N Raval with guidance and scripting assistance from OpenAI ChatGPT.
26
+
27
+ ---
28
+
29
+ ## Features
30
+
31
+ - Lists outdated direct dependencies.
32
+ - Prompts for confirmation before upgrading.
33
+ - Updates `requirements.txt` with new pinned versions.
34
+ - Cross-platform: works on Linux, macOS, and Windows.
35
+ - CLI installable via [pipx](https://pypa.github.io/pipx/).
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ # Recommended: install globally using pipx
43
+ pipx install upgrade-py-direct-reqs
44
+ ```
45
+
46
+ Or via pip in a venv:
47
+
48
+ ```bash
49
+ pip install upgrade-py-direct-reqs
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Usage
55
+
56
+ ```bash
57
+ # Explicitly specify your requirements file
58
+ upgrade-py-direct-reqs path/to/requirements.txt
59
+ ```
60
+
61
+ - The CLI will list outdated direct dependencies.
62
+ - You can review versions and confirm before upgrading.
63
+ - After upgrade, the `requirements.txt` file is updated with pinned versions.
64
+
65
+ ---
66
+
67
+ ## Example
68
+
69
+ ### Before
70
+
71
+ `requirements.txt`:
72
+ ```txt
73
+ requests==2.30.0
74
+ flask==2.2.5
75
+ ```
76
+
77
+ ### Command
78
+ ```bash
79
+ upgrade-py-direct-reqs requirements.txt
80
+ ```
81
+
82
+ ### Output (sample)
83
+ ```
84
+ 📦 Outdated direct dependencies:
85
+
86
+ requests: 2.30.0 → 2.32.3
87
+ flask: 2.2.5 → 3.0.3
88
+
89
+ ⚠️ Please review package revisions listed above before upgrading.
90
+ Check release notes on pypi.org for BREAKING changes or necessary code updates.
91
+
92
+ Proceed with upgrade? (y/n): y
93
+ ⬆️ Upgrading 2 packages...
94
+ ✅ Requirements updated: requirements.txt
95
+ ```
96
+
97
+ ### After
98
+
99
+ `requirements.txt`:
100
+ ```txt
101
+ requests==2.32.3
102
+ flask==3.0.3
103
+ ```
104
+
105
+ ---
106
+
107
+ ## License
108
+
109
+ This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/upgrade-py-direct-reqs/__init__.py
6
+ src/upgrade-py-direct-reqs/cli.py
7
+ src/upgrade_py_direct_reqs.egg-info/PKG-INFO
8
+ src/upgrade_py_direct_reqs.egg-info/SOURCES.txt
9
+ src/upgrade_py_direct_reqs.egg-info/dependency_links.txt
10
+ src/upgrade_py_direct_reqs.egg-info/entry_points.txt
11
+ src/upgrade_py_direct_reqs.egg-info/requires.txt
12
+ src/upgrade_py_direct_reqs.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ upgrade-py-direct-reqs = upgrade_py_direct_reqs.cli:main