-
Notifications
You must be signed in to change notification settings - Fork 433
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
Refactor argument parser construction #239
Conversation
9abe700
to
c225b54
Compare
This does not conflict with the pipxrc PR. |
pipx/main.py
Outdated
@@ -30,6 +31,7 @@ | |||
|
|||
|
|||
__version__ = "0.14.0.0" | |||
__version_info__ = tuple(int(n) for n in __version__.split(".")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sometimes make beta releases, such as "0.14.1.0b0"
. Can the int
cast be omitted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention of __version_info__
is to sort properly, which a double-digit string wouldn't do - if 4 segments and an optional beta segment is the only case to account for I don't mind making this logic more complete.
bdf9ec1
to
a97a88b
Compare
I updated pipx's unit tests and some of pipx's code, but now there is a merge conflict in this PR. But it should be more straightforward to write tests now and measure coverage. |
a97a88b
to
184dd9b
Compare
pipx/main.py
Outdated
mkdir(constants.PIPX_LOCAL_VENVS) | ||
mkdir(constants.LOCAL_BIN_DIR) | ||
mkdir(constants.PIPX_VENV_CACHEDIR) | ||
mkdir(PIPX_LOCAL_VENVS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests patch the value of these constants, so they need the constants.
prefix
184dd9b
to
f9ff5f4
Compare
pipx/main.py
Outdated
_, __version_info__, subver, *_ = parse_version(__version__)._key # type: ignore | ||
if isinstance(subver, tuple): | ||
while len(__version_info__) < 4: | ||
__version_info__ += (0,) | ||
__version_info__ += subver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you mind adding a unit test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Are we set on only allowing a version with 1 to 4 components, plus an optional a/b/c component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it will always be something like 0.1.2.3.4, 0.1.2.3.4b0, 0.1.2.3.4rc0, etc.
f9ff5f4
to
2dc2e86
Compare
Each subparser is added in its own function
2dc2e86
to
f24d9a0
Compare
dest="command", description="Get help for commands with pipx COMMAND --help" | ||
) | ||
|
||
def _add_install(subparsers): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can all these functions have types added to them?
Looks good, thanks! I'll merge now and we can add types later if we want. |
Each subparser is added in its own function