Skip to content

Add devrepro --version - #37

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

Add devrepro --version#37
webdevsamran merged 1 commit into
mainfrom
fix/version-flag

Conversation

@webdevsamran

Copy link
Copy Markdown
Owner

What this fixes

devrepro --version exited 2 with No such option: --version, while .github/ISSUE_TEMPLATE/bug_report.md asks 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__.py already derives it from installed metadata, with a documented rationale. (The sibling project api-verity-lab had drifted to a hardcoded 0.1.0 against a declared 0.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 _root exists 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_subcommand pins that.

Verification

From a clean venv, installed from the built wheel:

$ devrepro --version
devrepro 0.2.0

Before: exit=2, No such option.

tests/test_version_is_reportable.py covers 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

  • 245 pass, 1 skip (cryptography not installed locally); 242 before, +4 here
  • coverage 71.64%, floor 70
  • ruff check, ruff format --check, mypy all clean

`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.
@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.

@webdevsamran
webdevsamran merged commit 0edaa25 into main Sep 9, 2026
18 checks passed
@webdevsamran
webdevsamran deleted the fix/version-flag branch September 9, 2026 13:12
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