-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Update vendored library: packaging #7559
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
Merged
chrahunt
merged 3 commits into
pypa:master
from
chrahunt:maint/use-packaging-tags-update-vendored
Jan 6, 2020
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Update packaging to 20.0. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
__summary__ = "Core utilities for Python packages" | ||
__uri__ = "https://github.com/pypa/packaging" | ||
|
||
__version__ = "19.2" | ||
__version__ = "20.0" | ||
|
||
__author__ = "Donald Stufft and individual contributors" | ||
__email__ = "[email protected]" | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""For neatly implementing static typing in packaging. | ||
|
||
`mypy` - the static type analysis tool we use - uses the `typing` module, which | ||
provides core functionality fundamental to mypy's functioning. | ||
|
||
Generally, `typing` would be imported at runtime and used in that fashion - | ||
it acts as a no-op at runtime and does not have any run-time overhead by | ||
design. | ||
|
||
As it turns out, `typing` is not vendorable - it uses separate sources for | ||
Python 2/Python 3. Thus, this codebase can not expect it to be present. | ||
To work around this, mypy allows the typing import to be behind a False-y | ||
optional to prevent it from running at runtime and type-comments can be used | ||
to remove the need for the types to be accessible directly during runtime. | ||
|
||
This module provides the False-y guard in a nicely named fashion so that a | ||
curious maintainer can reach here to read this. | ||
|
||
In packaging, all static-typing related imports should be guarded as follows: | ||
|
||
from pip._vendor.packaging._typing import MYPY_CHECK_RUNNING | ||
|
||
if MYPY_CHECK_RUNNING: | ||
from typing import ... | ||
|
||
Ref: https://github.com/python/mypy/issues/3216 | ||
""" | ||
|
||
MYPY_CHECK_RUNNING = False | ||
|
||
if MYPY_CHECK_RUNNING: # pragma: no cover | ||
import typing | ||
|
||
cast = typing.cast | ||
else: | ||
# typing's cast() is needed at runtime, but we don't want to import typing. | ||
# Thus, we use a dummy no-op version, which we tell mypy to ignore. | ||
def cast(type_, value): # type: ignore | ||
return value |
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
Empty file.
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.
Hmm, I don't think there's much point in doing this -- we're shadowing the relevant modules through
.pyi
files in the vendor directory.