upcheck 0.1.0__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,33 @@
1
+ # Byte-compiled / cache
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Test, coverage and type-check caches
18
+ .pytest_cache/
19
+ .mypy_cache/
20
+ .ruff_cache/
21
+ .coverage
22
+ .coverage.*
23
+ coverage.xml
24
+ htmlcov/
25
+
26
+ # Docs build
27
+ site/
28
+
29
+ # Editors / OS
30
+ .idea/
31
+ .vscode/
32
+ .DS_Store
33
+ Thumbs.db
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-26
10
+
11
+ ### Added
12
+
13
+ - `upcheck` CLI and library: check direct dependencies against a target Python
14
+ version, ABI and platform.
15
+ - Wheel tag matching for CPython (`cp3XX`), stable ABI (`abi3`), free-threaded
16
+ builds (`cp3XXt`, `abi3t`), and pure-Python wheels.
17
+ - Platform matching for `win_arm64`, `win_amd64`, manylinux/musllinux and macOS
18
+ (including `universal2`).
19
+ - Requirement discovery from `pyproject.toml` and pip requirements files, with
20
+ environment-marker filtering.
21
+ - Human-readable and `--json` reports, exit code `1` on blockers.
22
+ - Suggestions pointing at the newest release that does ship a compatible wheel.
upcheck-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
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.
upcheck-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.5
2
+ Name: upcheck
3
+ Version: 0.1.0
4
+ Summary: Check whether your dependencies install on a target Python version, ABI and platform.
5
+ Project-URL: Homepage, https://github.com/OWNER/upcheck
6
+ Project-URL: Repository, https://github.com/OWNER/upcheck
7
+ Project-URL: Issues, https://github.com/OWNER/upcheck/issues
8
+ Project-URL: Changelog, https://github.com/OWNER/upcheck/blob/main/CHANGELOG.md
9
+ Author-email: pydev88 <pydev88@proton.me>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: arm64,ci,free-threading,packaging,python-version,upgrade,wheels
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: 3.15
23
+ Classifier: Topic :: Software Development :: Build Tools
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: packaging>=24.2
27
+ Description-Content-Type: text/markdown
28
+
29
+ # upcheck
30
+
31
+ [![CI](https://github.com/OWNER/upcheck/actions/workflows/ci.yml/badge.svg)](https://github.com/OWNER/upcheck/actions/workflows/ci.yml)
32
+ [![PyPI](https://img.shields.io/pypi/v/upcheck.svg)](https://pypi.org/project/upcheck/)
33
+ [![Python versions](https://img.shields.io/pypi/pyversions/upcheck.svg)](https://pypi.org/project/upcheck/)
34
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
35
+
36
+ **Will your dependencies install on that Python?** `upcheck` answers before you
37
+ upgrade, not after `pip` fails.
38
+
39
+ It reads your requirements, asks PyPI which wheels exist, and reports the
40
+ packages that have no compatible wheel for a target Python version, ABI
41
+ (free-threaded) and platform:
42
+
43
+ ```console
44
+ $ upcheck . --python 3.15 --platform windows-arm64
45
+ target Python 3.15 (GIL) on windows-arm64
46
+ packages 3
47
+
48
+ BLOCKERS (1)
49
+ grpcio 1.85.4 no compatible wheel
50
+ WARNINGS (1)
51
+ psycopg2-binary 2.9.13 sdist only: needs a build toolchain
52
+ OK (1)
53
+ packaging 26.4 wheel available
54
+
55
+ result 1 ok, 1 warnings, 1 blockers
56
+ ```
57
+
58
+ ## Install
59
+
60
+ ```console
61
+ pip install upcheck
62
+ # or
63
+ uv tool install upcheck
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ ```console
69
+ upcheck [PATH] [--python 3.15] [--platform windows-arm64] [--json]
70
+ ```
71
+
72
+ `PATH` may be a project directory (reads `pyproject.toml`, then
73
+ `requirements.txt`), a `pyproject.toml`, or a requirements file.
74
+
75
+ | Flag | Meaning |
76
+ | --- | --- |
77
+ | `-p`, `--python` | Target version: `3.15`, `315`, `cp315`, or `3.15t` for free-threaded |
78
+ | `--platform` | `windows-arm64`, `windows-x86_64`, `linux-x86_64`, `linux-aarch64`, `macos-arm64`, `macos-x86_64`, `any` |
79
+ | `--free-threaded` | Force a free-threaded (GIL-disabled) target |
80
+ | `--no-sdist` | Treat source-only releases as blockers instead of warnings |
81
+ | `--no-suggest` | Skip scanning older releases for a version that does have a wheel |
82
+ | `--json` | Machine-readable output |
83
+ | `-j`, `--jobs` | Concurrent PyPI requests (default 8) |
84
+ | `--timeout` | Per-request timeout in seconds (default 20) |
85
+
86
+ Both `--python` and `--platform` default to the interpreter and machine running
87
+ the command.
88
+
89
+ ### Exit codes
90
+
91
+ | Code | Meaning |
92
+ | --- | --- |
93
+ | `0` | Nothing blocks the target (warnings and unknown packages are allowed) |
94
+ | `1` | At least one blocker |
95
+ | `2` | Bad arguments, unreadable project, or unsupported requirements |
96
+
97
+ ### In CI
98
+
99
+ ```yaml
100
+ - name: Check the next Python
101
+ run: |
102
+ pipx run upcheck . --python 3.15 --platform linux-x86_64
103
+ ```
104
+
105
+ Use `--json` when you want to post-process the result:
106
+
107
+ ```json
108
+ {
109
+ "target": {"python": "3.15", "free_threaded": false, "platform": "windows-arm64"},
110
+ "summary": {"ok": 41, "warnings": 1, "blockers": 1, "unknown": 0},
111
+ "packages": [
112
+ {
113
+ "name": "grpcio",
114
+ "requested": ">=1.80",
115
+ "version": "1.85.4",
116
+ "status": "blocker",
117
+ "detail": "no compatible wheel",
118
+ "wheel": null,
119
+ "suggestion": null
120
+ }
121
+ ],
122
+ "exit_code": 1
123
+ }
124
+ ```
125
+
126
+ ## What it checks
127
+
128
+ 1. Direct requirements from `[project].dependencies` or a requirements file.
129
+ 2. Environment markers (`sys_platform`, `python_version`, …) against the target.
130
+ 3. The newest release satisfying each specifier.
131
+ 4. Whether that release ships a wheel whose tags fit the target:
132
+ - CPython ABI: `cp315` on 3.15, `abi3` forward-compatible, `abi3t` for
133
+ free-threaded 3.15+
134
+ - platforms: `win_arm64`, `manylinux`/`musllinux`, `macosx` + `universal2`
135
+ 5. If not, an sdist means "warning"; nothing means "blocker".
136
+ 6. Optional: the newest older release that does have a compatible wheel.
137
+
138
+ ## Limitations (v0.1)
139
+
140
+ - Direct dependencies only; transitive resolution is left to pip/uv.
141
+ - Manylinux and macOS deployment targets are not version-ranked.
142
+ - Private indexes are not configurable yet (the client supports it, the CLI
143
+ does not).
144
+ - `uv.lock`/`pylock.toml` are not read yet.
145
+ - No source-level API checks: this release answers "can it install?", not
146
+ "will it run?".
147
+
148
+ ## Development
149
+
150
+ ```console
151
+ uv sync
152
+ uv run pytest
153
+ uv run ruff check . && uv run ruff format .
154
+ uv run mypy
155
+ ```
156
+
157
+ Without uv:
158
+
159
+ ```console
160
+ python -m venv .venv
161
+ .venv\Scripts\activate # Windows (bash: source .venv/Scripts/activate)
162
+ pip install -e . --group dev
163
+ pytest
164
+ ```
165
+
166
+ ## Release
167
+
168
+ 1. Bump `version` in `pyproject.toml` and add a `CHANGELOG.md` entry.
169
+ 2. Commit, tag and push: `git tag -a v0.1.0 -m v0.1.0 && git push --tags`.
170
+ 3. The `Release` workflow builds the sdist/wheel and publishes with Trusted
171
+ Publishing (no API tokens).
172
+
173
+ Before the first release, add a GitHub publisher on PyPI:
174
+ owner `OWNER`, repository `upcheck`, workflow `release.yml`, environment `pypi`.
175
+ For a dry run, configure the same on <https://test.pypi.org> (environment
176
+ `testpypi`) and trigger the workflow manually.
177
+
178
+ Manual dry run without GitHub:
179
+
180
+ ```console
181
+ python -m build
182
+ python -m twine upload --repository testpypi dist/*
183
+ ```
184
+
185
+ ## License
186
+
187
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,159 @@
1
+ # upcheck
2
+
3
+ [![CI](https://github.com/OWNER/upcheck/actions/workflows/ci.yml/badge.svg)](https://github.com/OWNER/upcheck/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/upcheck.svg)](https://pypi.org/project/upcheck/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/upcheck.svg)](https://pypi.org/project/upcheck/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ **Will your dependencies install on that Python?** `upcheck` answers before you
9
+ upgrade, not after `pip` fails.
10
+
11
+ It reads your requirements, asks PyPI which wheels exist, and reports the
12
+ packages that have no compatible wheel for a target Python version, ABI
13
+ (free-threaded) and platform:
14
+
15
+ ```console
16
+ $ upcheck . --python 3.15 --platform windows-arm64
17
+ target Python 3.15 (GIL) on windows-arm64
18
+ packages 3
19
+
20
+ BLOCKERS (1)
21
+ grpcio 1.85.4 no compatible wheel
22
+ WARNINGS (1)
23
+ psycopg2-binary 2.9.13 sdist only: needs a build toolchain
24
+ OK (1)
25
+ packaging 26.4 wheel available
26
+
27
+ result 1 ok, 1 warnings, 1 blockers
28
+ ```
29
+
30
+ ## Install
31
+
32
+ ```console
33
+ pip install upcheck
34
+ # or
35
+ uv tool install upcheck
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```console
41
+ upcheck [PATH] [--python 3.15] [--platform windows-arm64] [--json]
42
+ ```
43
+
44
+ `PATH` may be a project directory (reads `pyproject.toml`, then
45
+ `requirements.txt`), a `pyproject.toml`, or a requirements file.
46
+
47
+ | Flag | Meaning |
48
+ | --- | --- |
49
+ | `-p`, `--python` | Target version: `3.15`, `315`, `cp315`, or `3.15t` for free-threaded |
50
+ | `--platform` | `windows-arm64`, `windows-x86_64`, `linux-x86_64`, `linux-aarch64`, `macos-arm64`, `macos-x86_64`, `any` |
51
+ | `--free-threaded` | Force a free-threaded (GIL-disabled) target |
52
+ | `--no-sdist` | Treat source-only releases as blockers instead of warnings |
53
+ | `--no-suggest` | Skip scanning older releases for a version that does have a wheel |
54
+ | `--json` | Machine-readable output |
55
+ | `-j`, `--jobs` | Concurrent PyPI requests (default 8) |
56
+ | `--timeout` | Per-request timeout in seconds (default 20) |
57
+
58
+ Both `--python` and `--platform` default to the interpreter and machine running
59
+ the command.
60
+
61
+ ### Exit codes
62
+
63
+ | Code | Meaning |
64
+ | --- | --- |
65
+ | `0` | Nothing blocks the target (warnings and unknown packages are allowed) |
66
+ | `1` | At least one blocker |
67
+ | `2` | Bad arguments, unreadable project, or unsupported requirements |
68
+
69
+ ### In CI
70
+
71
+ ```yaml
72
+ - name: Check the next Python
73
+ run: |
74
+ pipx run upcheck . --python 3.15 --platform linux-x86_64
75
+ ```
76
+
77
+ Use `--json` when you want to post-process the result:
78
+
79
+ ```json
80
+ {
81
+ "target": {"python": "3.15", "free_threaded": false, "platform": "windows-arm64"},
82
+ "summary": {"ok": 41, "warnings": 1, "blockers": 1, "unknown": 0},
83
+ "packages": [
84
+ {
85
+ "name": "grpcio",
86
+ "requested": ">=1.80",
87
+ "version": "1.85.4",
88
+ "status": "blocker",
89
+ "detail": "no compatible wheel",
90
+ "wheel": null,
91
+ "suggestion": null
92
+ }
93
+ ],
94
+ "exit_code": 1
95
+ }
96
+ ```
97
+
98
+ ## What it checks
99
+
100
+ 1. Direct requirements from `[project].dependencies` or a requirements file.
101
+ 2. Environment markers (`sys_platform`, `python_version`, …) against the target.
102
+ 3. The newest release satisfying each specifier.
103
+ 4. Whether that release ships a wheel whose tags fit the target:
104
+ - CPython ABI: `cp315` on 3.15, `abi3` forward-compatible, `abi3t` for
105
+ free-threaded 3.15+
106
+ - platforms: `win_arm64`, `manylinux`/`musllinux`, `macosx` + `universal2`
107
+ 5. If not, an sdist means "warning"; nothing means "blocker".
108
+ 6. Optional: the newest older release that does have a compatible wheel.
109
+
110
+ ## Limitations (v0.1)
111
+
112
+ - Direct dependencies only; transitive resolution is left to pip/uv.
113
+ - Manylinux and macOS deployment targets are not version-ranked.
114
+ - Private indexes are not configurable yet (the client supports it, the CLI
115
+ does not).
116
+ - `uv.lock`/`pylock.toml` are not read yet.
117
+ - No source-level API checks: this release answers "can it install?", not
118
+ "will it run?".
119
+
120
+ ## Development
121
+
122
+ ```console
123
+ uv sync
124
+ uv run pytest
125
+ uv run ruff check . && uv run ruff format .
126
+ uv run mypy
127
+ ```
128
+
129
+ Without uv:
130
+
131
+ ```console
132
+ python -m venv .venv
133
+ .venv\Scripts\activate # Windows (bash: source .venv/Scripts/activate)
134
+ pip install -e . --group dev
135
+ pytest
136
+ ```
137
+
138
+ ## Release
139
+
140
+ 1. Bump `version` in `pyproject.toml` and add a `CHANGELOG.md` entry.
141
+ 2. Commit, tag and push: `git tag -a v0.1.0 -m v0.1.0 && git push --tags`.
142
+ 3. The `Release` workflow builds the sdist/wheel and publishes with Trusted
143
+ Publishing (no API tokens).
144
+
145
+ Before the first release, add a GitHub publisher on PyPI:
146
+ owner `OWNER`, repository `upcheck`, workflow `release.yml`, environment `pypi`.
147
+ For a dry run, configure the same on <https://test.pypi.org> (environment
148
+ `testpypi`) and trigger the workflow manually.
149
+
150
+ Manual dry run without GitHub:
151
+
152
+ ```console
153
+ python -m build
154
+ python -m twine upload --repository testpypi dist/*
155
+ ```
156
+
157
+ ## License
158
+
159
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,118 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "upcheck"
7
+ version = "0.1.0"
8
+ description = "Check whether your dependencies install on a target Python version, ABI and platform."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "pydev88", email = "pydev88@proton.me" }]
14
+ keywords = [
15
+ "packaging",
16
+ "wheels",
17
+ "upgrade",
18
+ "python-version",
19
+ "free-threading",
20
+ "arm64",
21
+ "ci",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 3 - Alpha",
25
+ "Environment :: Console",
26
+ "Intended Audience :: Developers",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3 :: Only",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Programming Language :: Python :: 3.14",
33
+ "Programming Language :: Python :: 3.15",
34
+ "Topic :: Software Development :: Build Tools",
35
+ "Typing :: Typed",
36
+ ]
37
+ dependencies = ["packaging>=24.2"]
38
+
39
+ [project.scripts]
40
+ upcheck = "upcheck.cli:main"
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/OWNER/upcheck"
44
+ Repository = "https://github.com/OWNER/upcheck"
45
+ Issues = "https://github.com/OWNER/upcheck/issues"
46
+ Changelog = "https://github.com/OWNER/upcheck/blob/main/CHANGELOG.md"
47
+
48
+ # PEP 735 dependency groups: dev-only tooling, installed by `uv sync`
49
+ # (default) or `pip install --group dev`.
50
+ [dependency-groups]
51
+ dev = [
52
+ "build>=1.2.2",
53
+ "mypy>=1.14",
54
+ "pre-commit>=4.0",
55
+ "pytest>=8.3",
56
+ "pytest-cov>=6.0",
57
+ "ruff>=0.9",
58
+ "twine>=6.1",
59
+ ]
60
+ docs = ["mkdocs-material>=9.5", "mkdocstrings[python]>=0.27"]
61
+
62
+ [tool.hatch.build.targets.wheel]
63
+ packages = ["src/upcheck"]
64
+
65
+ [tool.hatch.build.targets.sdist]
66
+ include = [
67
+ "src/upcheck",
68
+ "tests",
69
+ "README.md",
70
+ "CHANGELOG.md",
71
+ "LICENSE",
72
+ "pyproject.toml",
73
+ ]
74
+
75
+ [tool.ruff]
76
+ line-length = 100
77
+ target-version = "py311"
78
+ src = ["src", "tests"]
79
+ extend-exclude = ["build", "dist", "site", "docs"]
80
+
81
+ [tool.ruff.lint]
82
+ select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF", "S", "PT", "C4"]
83
+
84
+ [tool.ruff.lint.per-file-ignores]
85
+ "tests/**" = ["S101", "S603"]
86
+
87
+ [tool.ruff.lint.isort]
88
+ known-first-party = ["upcheck"]
89
+
90
+ [tool.mypy]
91
+ python_version = "3.11"
92
+ strict = true
93
+ files = ["src"]
94
+ pretty = true
95
+
96
+ [tool.pytest.ini_options]
97
+ minversion = "8.0"
98
+ testpaths = ["src", "tests"]
99
+ addopts = [
100
+ "-ra",
101
+ "--strict-markers",
102
+ "--strict-config",
103
+ "--doctest-modules",
104
+ "--cov=upcheck",
105
+ "--cov-report=term-missing",
106
+ ]
107
+ filterwarnings = ["error"]
108
+
109
+ [tool.coverage.run]
110
+ branch = true
111
+ source = ["upcheck"]
112
+ omit = ["*/__main__.py"]
113
+
114
+ [tool.coverage.report]
115
+ show_missing = true
116
+ skip_covered = true
117
+ fail_under = 90
118
+ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "raise NotImplementedError"]
@@ -0,0 +1,16 @@
1
+ """upcheck: will your dependencies install on that Python?"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+
7
+ from .core import check_project
8
+ from .report import PackageCheck, Report, Status
9
+ from .target import Target
10
+
11
+ __all__ = ["PackageCheck", "Report", "Status", "Target", "__version__", "check_project"]
12
+
13
+ try:
14
+ __version__ = version("upcheck")
15
+ except PackageNotFoundError: # pragma: no cover - running from a raw checkout
16
+ __version__ = "0.0.0"
@@ -0,0 +1,6 @@
1
+ """Support ``python -m upcheck``."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,135 @@
1
+ """Command-line interface for upcheck."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from collections.abc import Sequence
8
+ from pathlib import Path
9
+
10
+ from . import __version__
11
+ from .core import ProjectSource, check_project
12
+ from .pypi import PyPIClient
13
+ from .report import render_json, render_text
14
+ from .requirements import RequirementsError
15
+ from .target import Target
16
+
17
+
18
+ def build_parser() -> argparse.ArgumentParser:
19
+ """Create the argument parser for the ``upcheck`` command."""
20
+ parser = argparse.ArgumentParser(
21
+ prog="upcheck",
22
+ description=(
23
+ "Check whether a project's dependencies can install on a target "
24
+ "Python version, ABI and platform."
25
+ ),
26
+ )
27
+ parser.add_argument(
28
+ "path",
29
+ nargs="?",
30
+ default=".",
31
+ help="project directory, pyproject.toml, or requirements file (default: .)",
32
+ )
33
+ parser.add_argument(
34
+ "-p",
35
+ "--python",
36
+ dest="python_version",
37
+ default=None,
38
+ metavar="VERSION",
39
+ help="target Python version, e.g. 3.15 or 3.15t (default: running interpreter)",
40
+ )
41
+ parser.add_argument(
42
+ "--platform",
43
+ default=None,
44
+ metavar="PLATFORM",
45
+ help=(
46
+ "target platform: windows-arm64, windows-x86_64, linux-x86_64, "
47
+ "linux-aarch64, macos-arm64, macos-x86_64, any "
48
+ "(default: this machine)"
49
+ ),
50
+ )
51
+ parser.add_argument(
52
+ "--free-threaded",
53
+ action="store_true",
54
+ help="target a free-threaded (GIL-disabled) build",
55
+ )
56
+ parser.add_argument(
57
+ "--no-sdist",
58
+ action="store_true",
59
+ help="treat source-only releases as blockers instead of warnings",
60
+ )
61
+ parser.add_argument(
62
+ "--no-suggest",
63
+ action="store_true",
64
+ help="do not scan older releases for a version that has a wheel",
65
+ )
66
+ parser.add_argument(
67
+ "--json",
68
+ action="store_true",
69
+ help="emit machine-readable JSON",
70
+ )
71
+ parser.add_argument(
72
+ "-j",
73
+ "--jobs",
74
+ type=int,
75
+ default=8,
76
+ metavar="N",
77
+ help="concurrent PyPI requests (default: 8)",
78
+ )
79
+ parser.add_argument(
80
+ "--timeout",
81
+ type=float,
82
+ default=20.0,
83
+ metavar="SECONDS",
84
+ help="per-request timeout (default: 20)",
85
+ )
86
+ parser.add_argument(
87
+ "-V",
88
+ "--version",
89
+ action="version",
90
+ version=f"%(prog)s {__version__}",
91
+ )
92
+ return parser
93
+
94
+
95
+ def main(
96
+ argv: Sequence[str] | None = None,
97
+ *,
98
+ client: ProjectSource | None = None,
99
+ ) -> int:
100
+ """Run upcheck. Returns 0 when nothing blocks, 1 on blockers, 2 on usage errors."""
101
+ args = build_parser().parse_args(argv)
102
+
103
+ if args.jobs < 1:
104
+ print("upcheck: --jobs must be at least 1", file=sys.stderr)
105
+ return 2
106
+
107
+ try:
108
+ target = Target.parse(
109
+ args.python_version,
110
+ args.platform,
111
+ free_threaded=True if args.free_threaded else None,
112
+ )
113
+ except ValueError as exc:
114
+ print(f"upcheck: {exc}", file=sys.stderr)
115
+ return 2
116
+
117
+ try:
118
+ report = check_project(
119
+ Path(args.path),
120
+ target,
121
+ client=client or PyPIClient(timeout=args.timeout),
122
+ jobs=args.jobs,
123
+ allow_sdist=not args.no_sdist,
124
+ suggest=not args.no_suggest,
125
+ )
126
+ except RequirementsError as exc:
127
+ print(f"upcheck: {exc}", file=sys.stderr)
128
+ return 2
129
+
130
+ print(render_json(report) if args.json else render_text(report), end="")
131
+ return 0 if report.ok else 1
132
+
133
+
134
+ if __name__ == "__main__": # pragma: no cover
135
+ raise SystemExit(main())