Add devrepro --version - #37
Merged
Merged
Conversation
`devrepro --version` exited 2 with "No such option", while `.github/ISSUE_TEMPLATE/bug_report.md` asks reporters for a DevRepro version without telling them how to obtain one. Found by installing the built wheel into a clean venv and running the command a new user runs first. `__version__` was already correct here — it derives from installed metadata (`devrepro/__init__.py`), which is the pattern api-verity-lab has now adopted after its own literal drifted. What was missing was a way to ask for it. Typer needs a root callback to hang a group-level option on, so `_root` is added purely to carry the eager `--version`. Being eager matters: the app is `no_args_is_help=True`, so a non-eager option would be overridden by the demand for a subcommand. `tests/test_version_is_reportable.py` covers the flag, checks it works without a subcommand, asserts `__version__` matches pyproject, and pins that adding the callback did not hide the 37 existing commands. Also widens CI's lint scope to `scripts/`, which holds the secret scanner, the action-pin checker and the docs-site checker — none of which were linted or format-checked before.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
devrepro --versionexited 2 withNo such option: --version, while.github/ISSUE_TEMPLATE/bug_report.mdasks reporters for a "DevRepro version" without telling them how to get one.Found during a final verification pass, by installing the built wheel into a clean venv and running the first command a new user runs.
What was already right
__version__here is not the problem —devrepro/__init__.pyalready derives it from installed metadata, with a documented rationale. (The sibling projectapi-verity-labhad drifted to a hardcoded0.1.0against a declared0.2.0; it has now adopted this repo's pattern.)What was missing was any way to ask for it.
Implementation note
Typer needs a root callback to hang a group-level option on, so
_rootexists purely to carry--version.It has to be eager. The app is
no_args_is_help=True, so a non-eager option would be overridden by Typer's demand for a subcommand and the flag would still not answer on its own.test_version_flag_does_not_require_a_subcommandpins that.Verification
From a clean venv, installed from the built wheel:
Before:
exit=2,No such option.tests/test_version_is_reportable.pycovers the flag, that it works without a subcommand, that__version__matches pyproject, and — because adding a root callback to a Typer app can hide the command list — that all the existing commands are still there. Verified separately from the clean install: 37 commands, unchanged.Also here
CI's lint scope now includes
scripts/, which holds the secret scanner, the action-pin checker and the docs-site checker. None of them were linted or format-checked. They pass clean; this keeps them that way.The bug-report template now names the command it wants output from.
Checks
cryptographynot installed locally); 242 before, +4 hereruff check,ruff format --check,mypyall clean