Add Type Annotations for git_version.py#365
Merged
Callek merged 11 commits intopython-versioneer:masterfrom Apr 17, 2023
Merged
Add Type Annotations for git_version.py#365Callek merged 11 commits intopython-versioneer:masterfrom
git_version.py#365Callek merged 11 commits intopython-versioneer:masterfrom
Conversation
…eelname generation for platform
…r typing (mostly in editors)
…xceptions to scope the base class properly for availability of e.errno
effigies
approved these changes
Apr 17, 2023
Contributor
effigies
left a comment
There was a problem hiding this comment.
Thanks for this, and thanks for the offer to maintain. You should have received an invite for write access to the repository, so you should be able to trigger CI on your own once you accept.
Overall LGTM. I would consider adding type checking commands to the tox script, or possibly adding a type-checking environment.
We do have it at least for the Line 59 in 9d14bb5 |
Collaborator
Author
|
(oops commented with a test account I was using for something else for work) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Over in #298 it was suggested we wanted type annotations and that a PR would be welcome.
This PR does roughly the minimum to enable type annotations on
git_version.pyIf I have further time I'll create new PRs for the rest of the src repo, add typing in tests, as well as do some better Typing in a few places (TypedDict, better typing on the decorators and vcs hooks, etc.)
But in the meantime wanted to submit this.
Additional changes that are not strictly typing:
exception OSError as einstead of relying on thesys.exc_infoto get the exception class. This is ok now that py2.7 is no longer supported [and necessary for better typing since the former method typed it asBaseExceptionwhich didn't haveerrnoas a property..with_in the binary wheel name expectation.# --STRIP DURING BUILDwas used) to actual imports that didn't fail the tests. This so that python editors (such as VSCode) gave better type hinting in the various files, without the need to type-hint all the redefinitions themselves