Skip to content

Add --version flag to the CLI#374

Open
AndreyVMarkelov wants to merge 1 commit into
mainfrom
feat/cli-version
Open

Add --version flag to the CLI#374
AndreyVMarkelov wants to merge 1 commit into
mainfrom
feat/cli-version

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a stone --version flag and exposes the package version programmatically as stone.__version__. Useful for bug reports and scripting.

$ stone --version
stone 3.5.1

Changes

  • stone/__init__.py — defines __version__, read from installed package metadata via importlib.metadata.version("stone"), with a 0.0.0.dev0 fallback when running from an uninstalled source tree.
  • stone/cli.py — adds a --version argument (argparse version action). Long form only, since -v is already --verbose.
  • test/test_cli.pytest_version_flag verifies --version exits 0, prints the version, and short-circuits before the mandatory positional args.

Testing

  • --version works from the CLI and appears in --help/usage.
  • Both __version__ code paths exercised: metadata present → real version; PackageNotFoundError → fallback.
  • Full test suite passes (182 tests); flake8 clean.

Expose the installed package version as stone.__version__ (read from
importlib.metadata, with a source-tree fallback) and wire it to a
`stone --version` flag. Useful for bug reports and scripting.
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