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

Provide a Sub-Command for the Output of Version Information #12

Closed
gkapfham opened this issue Aug 24, 2023 · 4 comments · Fixed by #73
Closed

Provide a Sub-Command for the Output of Version Information #12

gkapfham opened this issue Aug 24, 2023 · 4 comments · Fixed by #73
Assignees
Labels
enhancement New feature or request in-progress Work is actively happening on this issue

Comments

@gkapfham
Copy link
Collaborator

Right now it is not possible for a person who uses chasten to see what
version of the program that they have installed. This means that there should
be a command like chasten version that should display version information of
the tool itself and, potentially, the version of key packages used by chasten.

@Jaclynpqc Jaclynpqc self-assigned this Sep 12, 2023
@Jaclynpqc Jaclynpqc added the enhancement New feature or request label Sep 12, 2023
@gkapfham gkapfham added the in-progress Work is actively happening on this issue label Sep 12, 2023
@CalebKendra CalebKendra self-assigned this Sep 12, 2023
@gkapfham
Copy link
Collaborator Author

FIXME: add griffin

@simojo simojo added this to the Week 4 Features milestone Sep 12, 2023
@Jaclynpqc
Copy link
Collaborator

Jaclynpqc commented Sep 14, 2023

Here are some approaches to implement chasten --version:

  1. Using click.version_option decorator to implement --version option

  2. Python argparse module: Parsers for command-line options, arguments and sub-commands

@Jaclynpqc
Copy link
Collaborator

Jaclynpqc commented Sep 17, 2023

The latest updates related to this issue can be found in the 'version_command' branch

Implemented Features and Improvements

  1. 'version' Sub-Command Implementation: This implementation allows for obtaining the Chasten version by running chasten version
  2. Improvements to 'util.get_chasten_version()' Function: The updated version includes a fallback mechanism using 'pkg_resources' to retrieve the Chasten version if 'importlib_metadata' fails due to the package not being fully installed in certain environments like 'poetry shell' or 'poetry run'. The combination of both 'importlib. metadata' and 'pkg_resources' ensures more reliable version retrieval in various scenarios. It covers cases where 'importlib. metadata' may not work.

Thoughts: I'm also considering implementing a message "Package version not available" to give users more information as to why version retrieval fails, other than simply returning the default version.

I would appreciate your suggestions to improve my code. @CalebKendra @gkapfham

@CalebKendra
Copy link
Collaborator

The latest updates related to this issue can be found in the 'version_command' branch

Implemented Features and Improvements

  1. 'version' Sub-Command Implementation: This implementation allows for obtaining the Chasten version by running chasten version
  2. Improvements to 'util.get_chasten_version()' Function: The updated version includes a fallback mechanism using 'pkg_resources' to retrieve the Chasten version if 'importlib_metadata' fails due to the package not being fully installed in certain environments like 'poetry shell' or 'poetry run'. The combination of both 'importlib. metadata' and 'pkg_resources' ensures more reliable version retrieval in various scenarios. It covers cases where 'importlib. metadata' may not work.

Thoughts: I'm also considering implementing a message "Package version not available" to give users more information as to why version retrieval fails, other than simply returning the default version.

I would appreciate your suggestions to improve my code. @CalebKendra @gkapfham

Your solution on the version_command branch looks good to me, I like the implementation you built better then my own since your version gives a typer "command" and mine gives a typer "option", this leads to less bugs as this way chasten is not confused when you give it no "command" but just the --version option.

This also avoids the confusion you would get when using the --version option on another command such as configure as we only want to give the PyPi version of chasten.

I am going to add a few formating bits but besides that I like it.

@CalebKendra CalebKendra linked a pull request Sep 18, 2023 that will close this issue
@CalebKendra CalebKendra removed a link to a pull request Sep 19, 2023
@CalebKendra CalebKendra linked a pull request Sep 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in-progress Work is actively happening on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants