Skip to content

Conversation

lshgdut
Copy link

@lshgdut lshgdut commented Oct 14, 2025

Add features to Specify CLI:

  • version sub command
  • --version flag for root command

Closed issues: #486 #811

@lshgdut lshgdut requested a review from localden as a code owner October 14, 2025 02:36
@lshgdut lshgdut changed the title fix: add version command to Specify CLI #811 fix: add version command to Specify CLI #811 Oct 14, 2025
@localden localden requested a review from Copilot October 15, 2025 17:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds version display functionality to the Specify CLI by implementing both a version subcommand and a --version flag for the root command. The changes utilize Python's importlib.metadata to dynamically retrieve the package version.

  • Added version subcommand that displays the application version
  • Added --version flag to the root command callback for immediate version display
  • Integrated importlib.metadata to dynamically fetch package version information

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

import ssl
import truststore

__version__ = importlib.metadata.version(__package__)
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line will fail if __package__ is None (which happens when the module is run as a script). Consider using a fallback like importlib.metadata.version('specify_cli') or adding error handling.

Suggested change
__version__ = importlib.metadata.version(__package__)
__version__ = importlib.metadata.version(__package__ or "specify_cli")

Copilot uses AI. Check for mistakes.


def show_version():
"""Show the application version."""
typer.echo(f"{__package__} {__version__}")
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will output 'None' for the package name if __package__ is None. Consider using a hardcoded package name like 'specify_cli' or the actual package name constant.

Copilot uses AI. Check for mistakes.

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