-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pkg_resources
type the declared global variables
#4267
Merged
abravalheri
merged 6 commits into
pypa:main
from
Avasam:pkg_resources-type-global-variables
May 13, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
85a68ec
`pkg_resources` type the declared global variables
Avasam 01a0690
Merge branch 'main' into pkg_resources-type-global-variables
Avasam 57f26ff
Merge branch 'main' into pkg_resources-type-global-variables
Avasam acaa310
Merge branch 'main' of https://github.com/pypa/setuptools into pkg_re…
Avasam faa9f75
Merge branch 'main' of https://github.com/pypa/setuptools into pkg_re…
Avasam 51411c6
unused Any
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Typed the dynamically defined variables from `pkg_resources` -- by :user:`Avasam` |
This file contains 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
Oops, something went wrong.
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.
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.
My question here is:
Instead of "re-declaring" the global variables, wouldn't it make more sense to ditch the
@_call_aside
and just run the majority of the body of_initialize*
functions directly on the global scope?@jaraco, do you know if
_call_aside()
/_initialize_master_working_set()
/_initialize()
are used inpkg_resources
just for the sake of organising the code, or is this very small delay on the execution a trick that solves a specific problem?(I do like the way the code is organised right now, but if changes are needed for type-checking, I would prefer not having double book keeping. Of course we can decide that the type-checking here is not worth the trouble).
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.
FWIW, you already have to for other checkers (just as a note, most of these variables were moved from the top of the file, so this PR doesn't introduce double book-keeping).
That being said, I agree it'd be nicer if we didn't have to, but I wouldn't want to revamp
pkg_resources
too much outside of making it a fully typed package to take it out of typeshed. Unless it's a simple change.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 did a quick search, and it seems that there might be packages out there depending on
pkg_resources._initialize*
:So we probably cannot avoid the double book keeping...