Skip to content

feat(cli): add --version flag and show version in help - #38

Merged
dlopez-bioinfo merged 3 commits into
masterfrom
feat/cli-version-option
Sep 9, 2026
Merged

feat(cli): add --version flag and show version in help#38
dlopez-bioinfo merged 3 commits into
masterfrom
feat/cli-version-option

Conversation

@dlopez-bioinfo

Copy link
Copy Markdown
Collaborator

What

  • Register a top-level --version option on the CLI group: afquery --version now prints afquery <version> instead of failing with Error: No such option '--version'.
  • Show AFQuery v<version> in the group help header (afquery --help and afquery with no arguments).
  • Remove the hand-maintained Commands: ... line from the group docstring; Click already renders a complete Commands: section.
  • Document the global --version / --help options in the CLI reference.

Why

The installable client had no way to report its own version. The number is read from afquery.__version__, which hatch-vcs populates from the release tag at build time, so this needs no manual bump on future releases.

Tests

Added tests/test_cli.py coverage for --version, the help header, and the command listing. Full suite green locally (603 passed).

Register a top-level --version option on the CLI group and render
"AFQuery v<version>" in the group help header. The version is read from
afquery.__version__ (populated by hatch-vcs from the release tag), so it
needs no manual update per release.

Drop the hand-maintained "Commands: ..." line from the group docstring;
Click already generates a complete Commands section.
Add a "Global options" section to the CLI reference covering --version
and --help.
@codecov-commenter

codecov-commenter commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.69%. Comparing base (6c27849) to head (f34d2ea).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   88.67%   88.69%   +0.01%     
==========================================
  Files          22       22              
  Lines        3073     3077       +4     
  Branches      482      482              
==========================================
+ Hits         2725     2729       +4     
  Misses        229      229              
  Partials      119      119              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dlopez-bioinfo

Copy link
Copy Markdown
Collaborator Author

Notes / known limitations:

  • Editable installs: --version reads afquery.__version__ from the hatch-vcs _version.py, which is frozen at build time. pip install -e . checkouts that have advanced since the last build will show a stale number. Installable artifacts (PyPI wheel, Docker image, tag builds) are exact. importlib.metadata was considered and is no better here.
  • version naming: the global --version flag now sits alongside the existing version subcommand group (database version label). Renaming that group (e.g. db-version) would be a breaking CLI change and is left as a possible follow-up.

@dlopez-bioinfo
dlopez-bioinfo merged commit 313c4c7 into master Sep 9, 2026
3 checks passed
@dlopez-bioinfo
dlopez-bioinfo deleted the feat/cli-version-option branch September 9, 2026 11:22
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.

2 participants