Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --version option to show abi3audit version information #123

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

wsfulton
Copy link
Contributor

Current output for new option in a commonly used output format of program name followed by version number:

$ python -m abi3audit --version
abi3audit 0.0.19

Comment on lines 178 to 186
parser.add_argument(
version_group = parser.add_argument_group()
version_group.add_argument(
"-V",
"--version",
action="store_true",
help="show abi3audit version information",
)
main_group = parser.add_argument_group("main arguments")
main_group.add_argument(
Copy link
Member

Choose a reason for hiding this comment

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

I think this makes the parser a lot harder to follow -- could we use action='version' instead? That should handle everything automatically and avoid the need for separate arg groups.

For example:

parser.add_argument("-V", "--version", action='version', version=f"%(prog)s {__version__}")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's much better, I didn't know that argparse had built in support for version display.

@woodruffw
Copy link
Member

Thanks @wsfulton! This is great to have, but I think we can do it with a one-line change instead of parser groups. See my suggestion above 🙂

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM! I can deal with the README CI failure in a follow-up.

@woodruffw woodruffw merged commit 3aae6fd into pypa:main Nov 20, 2024
11 of 12 checks passed
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