Add apiverity --version, and stop the version drifting - #63
Merged
Conversation
`.github/ISSUE_TEMPLATE/bug_report.md` asks every bug reporter to run `apiverity --version`. That flag did not exist: argparse rejected it and exited 2. Found by installing the built wheel into a clean venv and running the command a new user would run first. Two separate defects, both fixed here: 1. No `--version` flag. Added to the root parser. 2. The version it would have printed was wrong. `apiverity/__init__.py` hardcoded `__version__ = "0.1.0"` while `pyproject.toml` said 0.2.0, so the flag would have named a release that was never cut. It now derives from the installed distribution's own metadata, with a pyproject fallback for source checkouts — the same approach `devrepro/__init__.py` already uses, and for the same reason. `tests/unit/test_version_is_reportable.py` pins both: the flag exits 0 and prints the version, and `__version__` equals the version pyproject declares. Nothing compared those two before, which is why the drift went unnoticed. Also widens CI's lint scope to `.github/scripts`, which holds Python that runs in CI but was never linted or format-checked.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
API Verity — contract reviewOne comment per PR — updated on each push. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
.github/ISSUE_TEMPLATE/bug_report.mdline 21 asks every bug reporter to run:That flag did not exist. It exited 2 with an argparse error.
Found during a final verification pass, by building the wheel and installing it into a clean venv — then running the first command a new user runs.
Two defects, not one
1. No
--versionflag. Added to the root parser.2. The version it would have printed was wrong.
apiverity/__init__.pyhardcoded__version__ = "0.1.0"whilepyproject.tomldeclared0.2.0. So even once the flag existed, it would have named a release that was never cut.It now derives from the installed distribution's own metadata, falling back to reading
pyproject.tomlin a source checkout — the same approachdevrepro/__init__.pyalready uses, adopted here rather than inventing a second one.Verification
From a clean venv, installed from the built wheel:
Before:
exit=2, argparse error, no output on stdout.tests/unit/test_version_is_reportable.pypins three things:--versionexits 0 and prints the version__version__equals the versionpyproject.tomldeclaresNothing compared the package version to pyproject before, which is why the drift sat there unnoticed.
Also here
CI's lint scope now includes
.github/scripts, which holds Python that runs in CI but was never linted or format-checked.pr_summary.pyneeded reformatting, which is how the gap surfaced.Checks
ruff check,ruff format --check,mypyall clean