Skip to content

Add apiverity --version, and stop the version drifting - #63

Merged
webdevsamran merged 1 commit into
mainfrom
fix/version-flag
Sep 9, 2026
Merged

Add apiverity --version, and stop the version drifting#63
webdevsamran merged 1 commit into
mainfrom
fix/version-flag

Conversation

@webdevsamran

Copy link
Copy Markdown
Owner

What this fixes

.github/ISSUE_TEMPLATE/bug_report.md line 21 asks every bug reporter to run:

- apiverity version (`apiverity --version`):

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 --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 declared 0.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.toml in a source checkout — the same approach devrepro/__init__.py already uses, adopted here rather than inventing a second one.

Verification

From a clean venv, installed from the built wheel:

$ apiverity --version
apiverity 0.2.0

Before: exit=2, argparse error, no output on stdout.

tests/unit/test_version_is_reportable.py pins three things:

  • --version exits 0 and prints the version
  • __version__ equals the version pyproject.toml declares
  • the bug-report template asks for a command that works

Nothing 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.py needed reformatting, which is how the gap surfaced.

Checks

  • 439 tests pass (436 before, +3 here)
  • coverage 81.05%, floor 72
  • ruff check, ruff format --check, mypy all clean

`.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.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

API Verity — contract review

One comment per PR — updated on each push.

@webdevsamran
webdevsamran merged commit 0458bf2 into main Sep 9, 2026
13 checks passed
@webdevsamran
webdevsamran deleted the fix/version-flag branch September 9, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant