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
Don't require hardcoded name in python_distribution.provides #17522
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ def _normalize_entry_points( | |
raise ValueError( | ||
softwrap( | ||
f""" | ||
The `entry_points` in `setup_py()` must be a dictionary, | ||
The `entry_points` in `python_artifact()` must be a dictionary, | ||
but was {all_entry_points!r} with type {type(all_entry_points).__name__}. | ||
""" | ||
) | ||
|
@@ -42,7 +42,7 @@ def _values_to_entry_points(values): | |
raise ValueError( | ||
softwrap( | ||
f""" | ||
The values of the `entry_points` dictionary in `setup_py()` must be | ||
The values of the `entry_points` dictionary in `python_artifact()` must be | ||
a list of strings or a dictionary of string to string, | ||
but got {values!r} of type {type(values).__name__}. | ||
""" | ||
|
@@ -62,19 +62,6 @@ def __init__(self, **kwargs): | |
:param kwargs: Passed to `setuptools.setup | ||
<https://pythonhosted.org/setuptools/setuptools.html>`_. | ||
""" | ||
if "name" not in kwargs: | ||
raise ValueError("`setup_py()` requires `name` to be specified.") | ||
name = kwargs["name"] | ||
if not isinstance(name, str): | ||
raise ValueError( | ||
softwrap( | ||
f""" | ||
The `name` in `setup_py()` must be a string, but was {repr(name)} with type | ||
{type(name)}. | ||
""" | ||
) | ||
) | ||
|
||
if "entry_points" in kwargs: | ||
# coerce entry points from Dict[str, List[str]] to Dict[str, Dict[str, str]] | ||
kwargs["entry_points"] = _normalize_entry_points(kwargs["entry_points"]) | ||
|
@@ -87,11 +74,6 @@ def __init__(self, **kwargs): | |
# Instead we stringify and precompute a hash to use in our own __hash__, since we know | ||
# that this object is immutable. | ||
self._hash: int = hash(json.dumps(kwargs, sort_keys=True)) | ||
self._name: str = name | ||
|
||
@property | ||
def name(self) -> str: | ||
return self._name | ||
|
||
@property | ||
def kwargs(self) -> Dict[str, Any]: | ||
|
@@ -104,6 +86,3 @@ def __eq__(self, other: Any) -> bool: | |
|
||
def __hash__(self) -> int: | ||
return self._hash | ||
|
||
def __str__(self) -> str: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran all the tests, and manually built some dists, with this |
||
return self.name |
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
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
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.
I ran all the tests, and manually built some dists, to verify that this property isn't used.