pyupcheck 0.2.0__tar.gz → 0.2.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.
- pyupcheck-0.2.1/PKG-INFO +197 -0
- pyupcheck-0.2.1/README.md +175 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/__init__.py +1 -1
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/cli.py +5 -2
- pyupcheck-0.2.1/depshift/welcome.py +36 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/pyproject.toml +1 -1
- pyupcheck-0.2.1/pyupcheck.egg-info/PKG-INFO +197 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/pyupcheck.egg-info/SOURCES.txt +1 -0
- pyupcheck-0.2.0/PKG-INFO +0 -254
- pyupcheck-0.2.0/README.md +0 -232
- pyupcheck-0.2.0/pyupcheck.egg-info/PKG-INFO +0 -254
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/LICENSE +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/analyzer.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/cache.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/changelog.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/config.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/deps.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/report.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/depshift/scanner.py +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/pyupcheck.egg-info/dependency_links.txt +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/pyupcheck.egg-info/entry_points.txt +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/pyupcheck.egg-info/requires.txt +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/pyupcheck.egg-info/top_level.txt +0 -0
- {pyupcheck-0.2.0 → pyupcheck-0.2.1}/setup.cfg +0 -0
pyupcheck-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyupcheck
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Check if upgrading a Python dependency will break your code
|
|
5
|
+
Author: AgbaDev
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AgbaDev/pyupcheck
|
|
8
|
+
Project-URL: Issues, https://github.com/AgbaDev/pyupcheck/issues
|
|
9
|
+
Keywords: cli,dependency,upgrade,migration,breaking-changes
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: httpx>=0.24.0
|
|
19
|
+
Requires-Dist: rich>=13.0.0
|
|
20
|
+
Requires-Dist: click>=8.0.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# pyupcheck
|
|
24
|
+
|
|
25
|
+
Check if upgrading a Python dependency will break your code.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ pyupcheck check-all
|
|
29
|
+
|
|
30
|
+
Found 12 dependencies to check
|
|
31
|
+
|
|
32
|
+
flask 2.3.3 -> 3.1.3 OK (15 usages safe)
|
|
33
|
+
requests 2.28.0 -> 2.34.2 2 BREAKING
|
|
34
|
+
x src/api.py:23 resp = requests.get(url, verify=False)
|
|
35
|
+
Removed: `verify` parameter no longer accepted
|
|
36
|
+
django 4.2.0 -> 5.0.6 1 deprecated
|
|
37
|
+
! core/models.py:8 from django.utils import timezone
|
|
38
|
+
Deprecated: use datetime.timezone instead
|
|
39
|
+
|
|
40
|
+
2 breaking | 1 deprecated across 12 packages
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install pyupcheck
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Commands
|
|
50
|
+
|
|
51
|
+
### `check` - check one package
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pyupcheck check flask 3.0.0 # against specific version
|
|
55
|
+
pyupcheck check flask # against latest
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `check-all` - check every dependency
|
|
59
|
+
|
|
60
|
+
Reads `requirements.txt` and `pyproject.toml` (PEP 621 and Poetry), checks every dependency against its latest version.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pyupcheck check-all
|
|
64
|
+
pyupcheck check-all --format html -o report.html
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `outdated` - list stale dependencies
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pyupcheck outdated
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Flags major version bumps separately since they carry the most risk.
|
|
74
|
+
|
|
75
|
+
### `diff` - changelog diff between versions
|
|
76
|
+
|
|
77
|
+
See breaking/deprecated changes between any two versions without scanning code:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pyupcheck diff django 4.2.0 5.0.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `scan` - list your usages of a package
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pyupcheck scan requests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### `versions` and `cache-clear`
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pyupcheck versions flask
|
|
93
|
+
pyupcheck cache-clear
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Output formats
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pyupcheck check flask -f json # machine-readable
|
|
100
|
+
pyupcheck check flask -f md -o r.md # markdown report
|
|
101
|
+
pyupcheck check flask -f html -o r.html # styled HTML report
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## CI integration
|
|
105
|
+
|
|
106
|
+
Exit code is 1 when the `--fail-on` condition is met:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pyupcheck check-all --fail-on breaking # default
|
|
110
|
+
pyupcheck check-all --fail-on deprecated # stricter
|
|
111
|
+
pyupcheck check-all --fail-on any # strictest
|
|
112
|
+
pyupcheck check-all --fail-on never # report only
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
GitHub Actions example:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
- name: Check dependency upgrades
|
|
119
|
+
run: |
|
|
120
|
+
pip install pyupcheck
|
|
121
|
+
pyupcheck check-all --fail-on breaking --quiet
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Pre-commit hook (`.pre-commit-config.yaml`):
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
- repo: local
|
|
128
|
+
hooks:
|
|
129
|
+
- id: pyupcheck
|
|
130
|
+
name: pyupcheck
|
|
131
|
+
entry: pyupcheck check-all --quiet
|
|
132
|
+
language: system
|
|
133
|
+
pass_filenames: false
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
`pyproject.toml`:
|
|
139
|
+
|
|
140
|
+
```toml
|
|
141
|
+
[tool.pyupcheck]
|
|
142
|
+
exclude = ["migrations", "legacy"]
|
|
143
|
+
ignore = ["internal-package"]
|
|
144
|
+
fail_on = "breaking"
|
|
145
|
+
min_severity = "deprecated"
|
|
146
|
+
cache = true
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Or `.pyupcheckignore`:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
migrations/ # trailing slash = directory
|
|
153
|
+
legacy/
|
|
154
|
+
internal-package # no slash = package to skip
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Features
|
|
158
|
+
|
|
159
|
+
- AST-based scanning: imports, from-imports, aliases, attribute chains, calls
|
|
160
|
+
- Jupyter notebook (`.ipynb`) scanning, magics stripped automatically
|
|
161
|
+
- Changelog sources: GitHub releases, raw changelog files, PyPI descriptions
|
|
162
|
+
- 24h response cache (`--no-cache` to bypass, `cache-clear` to wipe)
|
|
163
|
+
- Severity filtering with `--min-severity`
|
|
164
|
+
- Quiet mode (`-q`) for hooks and scripts
|
|
165
|
+
|
|
166
|
+
## Limitations
|
|
167
|
+
|
|
168
|
+
- Changelog parsing relies on maintainers writing structured changelogs
|
|
169
|
+
- Dynamic attribute access (`getattr(pkg, name)`) is not detected
|
|
170
|
+
- GitHub API is rate limited to 60 req/hr unauthenticated; pass `--github-token` or set `GITHUB_TOKEN` for higher limits
|
|
171
|
+
|
|
172
|
+
## Contributing
|
|
173
|
+
|
|
174
|
+
Contributions are welcome. Here is how to get started:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
git clone https://github.com/AgbaDev/pyupcheck.git
|
|
178
|
+
cd pyupcheck
|
|
179
|
+
pip install -e ".[dev]"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Things that would genuinely improve the tool:
|
|
183
|
+
|
|
184
|
+
- Better changelog parsing for packages that use unconventional formats (e.g. Sphinx-based changelogs, HISTORY files)
|
|
185
|
+
- Support for `setup.cfg` and `setup.py` dependency parsing
|
|
186
|
+
- Detection of dynamic attribute access patterns (`getattr`, `__import__`)
|
|
187
|
+
- `pip-tools` and `conda` lockfile support
|
|
188
|
+
- A `--watch` mode that monitors your lockfile for changes and alerts on risky upgrades
|
|
189
|
+
- Test coverage
|
|
190
|
+
|
|
191
|
+
To contribute, open an issue describing what you want to work on, then submit a pull request. Please include a short test or example showing the bug or feature.
|
|
192
|
+
|
|
193
|
+
If you find a package whose changelog pyupcheck fails to parse correctly, open an issue with the package name and version range. That is the most common and most impactful thing to fix.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# pyupcheck
|
|
2
|
+
|
|
3
|
+
Check if upgrading a Python dependency will break your code.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
$ pyupcheck check-all
|
|
7
|
+
|
|
8
|
+
Found 12 dependencies to check
|
|
9
|
+
|
|
10
|
+
flask 2.3.3 -> 3.1.3 OK (15 usages safe)
|
|
11
|
+
requests 2.28.0 -> 2.34.2 2 BREAKING
|
|
12
|
+
x src/api.py:23 resp = requests.get(url, verify=False)
|
|
13
|
+
Removed: `verify` parameter no longer accepted
|
|
14
|
+
django 4.2.0 -> 5.0.6 1 deprecated
|
|
15
|
+
! core/models.py:8 from django.utils import timezone
|
|
16
|
+
Deprecated: use datetime.timezone instead
|
|
17
|
+
|
|
18
|
+
2 breaking | 1 deprecated across 12 packages
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install pyupcheck
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
### `check` - check one package
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pyupcheck check flask 3.0.0 # against specific version
|
|
33
|
+
pyupcheck check flask # against latest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `check-all` - check every dependency
|
|
37
|
+
|
|
38
|
+
Reads `requirements.txt` and `pyproject.toml` (PEP 621 and Poetry), checks every dependency against its latest version.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pyupcheck check-all
|
|
42
|
+
pyupcheck check-all --format html -o report.html
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `outdated` - list stale dependencies
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pyupcheck outdated
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Flags major version bumps separately since they carry the most risk.
|
|
52
|
+
|
|
53
|
+
### `diff` - changelog diff between versions
|
|
54
|
+
|
|
55
|
+
See breaking/deprecated changes between any two versions without scanning code:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pyupcheck diff django 4.2.0 5.0.0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `scan` - list your usages of a package
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pyupcheck scan requests
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `versions` and `cache-clear`
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pyupcheck versions flask
|
|
71
|
+
pyupcheck cache-clear
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Output formats
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pyupcheck check flask -f json # machine-readable
|
|
78
|
+
pyupcheck check flask -f md -o r.md # markdown report
|
|
79
|
+
pyupcheck check flask -f html -o r.html # styled HTML report
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## CI integration
|
|
83
|
+
|
|
84
|
+
Exit code is 1 when the `--fail-on` condition is met:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pyupcheck check-all --fail-on breaking # default
|
|
88
|
+
pyupcheck check-all --fail-on deprecated # stricter
|
|
89
|
+
pyupcheck check-all --fail-on any # strictest
|
|
90
|
+
pyupcheck check-all --fail-on never # report only
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
GitHub Actions example:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
- name: Check dependency upgrades
|
|
97
|
+
run: |
|
|
98
|
+
pip install pyupcheck
|
|
99
|
+
pyupcheck check-all --fail-on breaking --quiet
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Pre-commit hook (`.pre-commit-config.yaml`):
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
- repo: local
|
|
106
|
+
hooks:
|
|
107
|
+
- id: pyupcheck
|
|
108
|
+
name: pyupcheck
|
|
109
|
+
entry: pyupcheck check-all --quiet
|
|
110
|
+
language: system
|
|
111
|
+
pass_filenames: false
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
`pyproject.toml`:
|
|
117
|
+
|
|
118
|
+
```toml
|
|
119
|
+
[tool.pyupcheck]
|
|
120
|
+
exclude = ["migrations", "legacy"]
|
|
121
|
+
ignore = ["internal-package"]
|
|
122
|
+
fail_on = "breaking"
|
|
123
|
+
min_severity = "deprecated"
|
|
124
|
+
cache = true
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or `.pyupcheckignore`:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
migrations/ # trailing slash = directory
|
|
131
|
+
legacy/
|
|
132
|
+
internal-package # no slash = package to skip
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Features
|
|
136
|
+
|
|
137
|
+
- AST-based scanning: imports, from-imports, aliases, attribute chains, calls
|
|
138
|
+
- Jupyter notebook (`.ipynb`) scanning, magics stripped automatically
|
|
139
|
+
- Changelog sources: GitHub releases, raw changelog files, PyPI descriptions
|
|
140
|
+
- 24h response cache (`--no-cache` to bypass, `cache-clear` to wipe)
|
|
141
|
+
- Severity filtering with `--min-severity`
|
|
142
|
+
- Quiet mode (`-q`) for hooks and scripts
|
|
143
|
+
|
|
144
|
+
## Limitations
|
|
145
|
+
|
|
146
|
+
- Changelog parsing relies on maintainers writing structured changelogs
|
|
147
|
+
- Dynamic attribute access (`getattr(pkg, name)`) is not detected
|
|
148
|
+
- GitHub API is rate limited to 60 req/hr unauthenticated; pass `--github-token` or set `GITHUB_TOKEN` for higher limits
|
|
149
|
+
|
|
150
|
+
## Contributing
|
|
151
|
+
|
|
152
|
+
Contributions are welcome. Here is how to get started:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
git clone https://github.com/AgbaDev/pyupcheck.git
|
|
156
|
+
cd pyupcheck
|
|
157
|
+
pip install -e ".[dev]"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Things that would genuinely improve the tool:
|
|
161
|
+
|
|
162
|
+
- Better changelog parsing for packages that use unconventional formats (e.g. Sphinx-based changelogs, HISTORY files)
|
|
163
|
+
- Support for `setup.cfg` and `setup.py` dependency parsing
|
|
164
|
+
- Detection of dynamic attribute access patterns (`getattr`, `__import__`)
|
|
165
|
+
- `pip-tools` and `conda` lockfile support
|
|
166
|
+
- A `--watch` mode that monitors your lockfile for changes and alerts on risky upgrades
|
|
167
|
+
- Test coverage
|
|
168
|
+
|
|
169
|
+
To contribute, open an issue describing what you want to work on, then submit a pull request. Please include a short test or example showing the bug or feature.
|
|
170
|
+
|
|
171
|
+
If you find a package whose changelog pyupcheck fails to parse correctly, open an issue with the package name and version range. That is the most common and most impactful thing to fix.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT
|
|
@@ -168,9 +168,12 @@ def _print_terminal_result(r: dict, quiet: bool):
|
|
|
168
168
|
|
|
169
169
|
@click.group()
|
|
170
170
|
@click.version_option(__version__, prog_name="pyupcheck")
|
|
171
|
-
|
|
171
|
+
@click.pass_context
|
|
172
|
+
def main(ctx):
|
|
172
173
|
"""pyupcheck - Check if upgrading a Python dependency will break your code."""
|
|
173
|
-
|
|
174
|
+
if ctx.invoked_subcommand is not None:
|
|
175
|
+
from depshift.welcome import show_if_first_run
|
|
176
|
+
show_if_first_run(console)
|
|
174
177
|
|
|
175
178
|
|
|
176
179
|
@main.command()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Show a welcome banner on first run."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
MARKER = Path.home() / ".cache" / "pyupcheck" / ".welcomed"
|
|
7
|
+
|
|
8
|
+
BANNER = """
|
|
9
|
+
[bold cyan] ██████╗ ██╗ ██╗██╗ ██╗██████╗ ██████╗██╗ ██╗███████╗ ██████╗██╗ ██╗[/]
|
|
10
|
+
[bold cyan]██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗██╔════╝██║ ██║██╔════╝██╔════╝██║ ██╔╝[/]
|
|
11
|
+
[bold cyan]██████╔╝ ╚████╔╝ ██║ ██║██████╔╝██║ ███████║█████╗ ██║ █████╔╝ [/]
|
|
12
|
+
[bold cyan]██╔═══╝ ╚██╔╝ ██║ ██║██╔═══╝ ██║ ██╔══██║██╔══╝ ██║ ██╔═██╗ [/]
|
|
13
|
+
[bold cyan]██║ ██║ ╚██████╔╝██║ ╚██████╗██║ ██║███████╗╚██████╗██║ ██╗[/]
|
|
14
|
+
[bold cyan]╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝[/]
|
|
15
|
+
|
|
16
|
+
[bold white] Know if a dependency upgrade will break your code before you run it.[/]
|
|
17
|
+
|
|
18
|
+
[dim]Version[/] [green]0.2.1[/]
|
|
19
|
+
[dim]PyPI[/] [blue]https://pypi.org/project/pyupcheck[/]
|
|
20
|
+
[dim]GitHub[/] [blue]https://github.com/Astronomox/pyupcheck-Astronomox[/]
|
|
21
|
+
[dim]Author[/] [cyan]AgbaDev (Astronomox)[/]
|
|
22
|
+
[dim]Issues[/] [blue]https://github.com/Astronomox/pyupcheck-Astronomox/issues[/]
|
|
23
|
+
|
|
24
|
+
[dim] Run [bold]pyupcheck --help[/][dim] to get started.[/]
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def show_if_first_run(console):
|
|
29
|
+
if MARKER.exists():
|
|
30
|
+
return
|
|
31
|
+
try:
|
|
32
|
+
MARKER.parent.mkdir(parents=True, exist_ok=True)
|
|
33
|
+
MARKER.touch()
|
|
34
|
+
except Exception:
|
|
35
|
+
pass
|
|
36
|
+
console.print(BANNER)
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyupcheck
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Check if upgrading a Python dependency will break your code
|
|
5
|
+
Author: AgbaDev
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AgbaDev/pyupcheck
|
|
8
|
+
Project-URL: Issues, https://github.com/AgbaDev/pyupcheck/issues
|
|
9
|
+
Keywords: cli,dependency,upgrade,migration,breaking-changes
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: httpx>=0.24.0
|
|
19
|
+
Requires-Dist: rich>=13.0.0
|
|
20
|
+
Requires-Dist: click>=8.0.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# pyupcheck
|
|
24
|
+
|
|
25
|
+
Check if upgrading a Python dependency will break your code.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ pyupcheck check-all
|
|
29
|
+
|
|
30
|
+
Found 12 dependencies to check
|
|
31
|
+
|
|
32
|
+
flask 2.3.3 -> 3.1.3 OK (15 usages safe)
|
|
33
|
+
requests 2.28.0 -> 2.34.2 2 BREAKING
|
|
34
|
+
x src/api.py:23 resp = requests.get(url, verify=False)
|
|
35
|
+
Removed: `verify` parameter no longer accepted
|
|
36
|
+
django 4.2.0 -> 5.0.6 1 deprecated
|
|
37
|
+
! core/models.py:8 from django.utils import timezone
|
|
38
|
+
Deprecated: use datetime.timezone instead
|
|
39
|
+
|
|
40
|
+
2 breaking | 1 deprecated across 12 packages
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install pyupcheck
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Commands
|
|
50
|
+
|
|
51
|
+
### `check` - check one package
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pyupcheck check flask 3.0.0 # against specific version
|
|
55
|
+
pyupcheck check flask # against latest
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `check-all` - check every dependency
|
|
59
|
+
|
|
60
|
+
Reads `requirements.txt` and `pyproject.toml` (PEP 621 and Poetry), checks every dependency against its latest version.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pyupcheck check-all
|
|
64
|
+
pyupcheck check-all --format html -o report.html
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `outdated` - list stale dependencies
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pyupcheck outdated
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Flags major version bumps separately since they carry the most risk.
|
|
74
|
+
|
|
75
|
+
### `diff` - changelog diff between versions
|
|
76
|
+
|
|
77
|
+
See breaking/deprecated changes between any two versions without scanning code:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pyupcheck diff django 4.2.0 5.0.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `scan` - list your usages of a package
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pyupcheck scan requests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### `versions` and `cache-clear`
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pyupcheck versions flask
|
|
93
|
+
pyupcheck cache-clear
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Output formats
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pyupcheck check flask -f json # machine-readable
|
|
100
|
+
pyupcheck check flask -f md -o r.md # markdown report
|
|
101
|
+
pyupcheck check flask -f html -o r.html # styled HTML report
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## CI integration
|
|
105
|
+
|
|
106
|
+
Exit code is 1 when the `--fail-on` condition is met:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pyupcheck check-all --fail-on breaking # default
|
|
110
|
+
pyupcheck check-all --fail-on deprecated # stricter
|
|
111
|
+
pyupcheck check-all --fail-on any # strictest
|
|
112
|
+
pyupcheck check-all --fail-on never # report only
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
GitHub Actions example:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
- name: Check dependency upgrades
|
|
119
|
+
run: |
|
|
120
|
+
pip install pyupcheck
|
|
121
|
+
pyupcheck check-all --fail-on breaking --quiet
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Pre-commit hook (`.pre-commit-config.yaml`):
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
- repo: local
|
|
128
|
+
hooks:
|
|
129
|
+
- id: pyupcheck
|
|
130
|
+
name: pyupcheck
|
|
131
|
+
entry: pyupcheck check-all --quiet
|
|
132
|
+
language: system
|
|
133
|
+
pass_filenames: false
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
`pyproject.toml`:
|
|
139
|
+
|
|
140
|
+
```toml
|
|
141
|
+
[tool.pyupcheck]
|
|
142
|
+
exclude = ["migrations", "legacy"]
|
|
143
|
+
ignore = ["internal-package"]
|
|
144
|
+
fail_on = "breaking"
|
|
145
|
+
min_severity = "deprecated"
|
|
146
|
+
cache = true
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Or `.pyupcheckignore`:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
migrations/ # trailing slash = directory
|
|
153
|
+
legacy/
|
|
154
|
+
internal-package # no slash = package to skip
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Features
|
|
158
|
+
|
|
159
|
+
- AST-based scanning: imports, from-imports, aliases, attribute chains, calls
|
|
160
|
+
- Jupyter notebook (`.ipynb`) scanning, magics stripped automatically
|
|
161
|
+
- Changelog sources: GitHub releases, raw changelog files, PyPI descriptions
|
|
162
|
+
- 24h response cache (`--no-cache` to bypass, `cache-clear` to wipe)
|
|
163
|
+
- Severity filtering with `--min-severity`
|
|
164
|
+
- Quiet mode (`-q`) for hooks and scripts
|
|
165
|
+
|
|
166
|
+
## Limitations
|
|
167
|
+
|
|
168
|
+
- Changelog parsing relies on maintainers writing structured changelogs
|
|
169
|
+
- Dynamic attribute access (`getattr(pkg, name)`) is not detected
|
|
170
|
+
- GitHub API is rate limited to 60 req/hr unauthenticated; pass `--github-token` or set `GITHUB_TOKEN` for higher limits
|
|
171
|
+
|
|
172
|
+
## Contributing
|
|
173
|
+
|
|
174
|
+
Contributions are welcome. Here is how to get started:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
git clone https://github.com/AgbaDev/pyupcheck.git
|
|
178
|
+
cd pyupcheck
|
|
179
|
+
pip install -e ".[dev]"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Things that would genuinely improve the tool:
|
|
183
|
+
|
|
184
|
+
- Better changelog parsing for packages that use unconventional formats (e.g. Sphinx-based changelogs, HISTORY files)
|
|
185
|
+
- Support for `setup.cfg` and `setup.py` dependency parsing
|
|
186
|
+
- Detection of dynamic attribute access patterns (`getattr`, `__import__`)
|
|
187
|
+
- `pip-tools` and `conda` lockfile support
|
|
188
|
+
- A `--watch` mode that monitors your lockfile for changes and alerts on risky upgrades
|
|
189
|
+
- Test coverage
|
|
190
|
+
|
|
191
|
+
To contribute, open an issue describing what you want to work on, then submit a pull request. Please include a short test or example showing the bug or feature.
|
|
192
|
+
|
|
193
|
+
If you find a package whose changelog pyupcheck fails to parse correctly, open an issue with the package name and version range. That is the most common and most impactful thing to fix.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|