Relax requirements about module names to also allow dash characters#164
Merged
Conversation
Owner
Author
|
@henryiii, I don't know what are your thoughts on this. If you have any (conceptual) concerns, maybe pypa/setuptools#4316 is a good place to discuss? |
abravalheri
commented
Apr 21, 2024
Comment on lines
+292
to
+308
| def python_module_name_relaxed(value: str) -> bool: | ||
| """Similar to :obj:`python_module_name`, but relaxed to also accept | ||
| dash characters (``-``) and cover special cases like ``pip-run``. | ||
|
|
||
| It is recommended, however, that beginners avoid dash characters, | ||
| as they require advanced knowledge about Python internals. | ||
|
|
||
| The following are disallowed: | ||
|
|
||
| * names starting/ending in dashes, | ||
| * names ending in ``-stubs`` (potentially collide with :obj:`pep561_stub_name`). | ||
| """ | ||
| if value.startswith("-") or value.endswith("-"): | ||
| return False | ||
| if value.endswith("-stubs"): | ||
| return False # Avoid collision with PEP 561 | ||
| return python_module_name(value.replace("-", "_")) |
Owner
Author
There was a problem hiding this comment.
@jaraco would this be enough to support the use case?
I am trying to remain still a bit conservative...
There was a problem hiding this comment.
Yes, this seems perfectly reasonable to me. Thanks!
jaraco
approved these changes
Jul 26, 2024
Collaborator
|
Sorry, forgot or missed this. I think this is reasonable. |
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.
Closes #162.
See details of the discussion in pypa/setuptools#4316 (comment).