-
Notifications
You must be signed in to change notification settings - Fork 52
[DO NOT MERGE!] Fix unicode entrypoint issue #254
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
base: main
Are you sure you want to change the base?
Conversation
Fix for unicode identifiers
Thanks, done! I also have a doubt - in the test files, entrypoints are not quoted. However, in a yaml file, the value (attrs) would always be quoted and the key (module) could optionally be quoted as well. I also did not understand the |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Fixes #252 |
It's a legacy distutils/setuptools thing, that allowed for a conditional installation of the entrypoint based on the chosen extra. It's not a standard anymore, but we should keep it working and the new implementation should consider it a viable (although ignored) part of an entrypoint spec. |
@julienmalard do you plan on working on this PR? |
Thanks for the reminder, @Secrus ! I've added the code to parse and ignore extras, as well as a relevant test. Please let me know if this looks good. |
Hello @Secrus |
@julienmalard I have consulted with @pradyunsg, and we decided that while technically correct, we shouldn't introduce that change while other parts of the ecosystem (like |
Thanks @Secrus for the update. For reference, this works with Poetry. |
assert attrs is not None | ||
assert isinstance(attrs, str) | ||
assert len(attrs), "Attributes are empty" | ||
assert attrs.isidentifier(), f"{attrs} is not a valid identifier" |
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.
We should raise proper exceptions, instead of assertion errors, for issues related to the user provided inputs. (the older asserts were there to guide type checkers).
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 can do that @pradyunsg
By the way, is the discussion here satisfactory? In brief, they have confirmed that our proposed change here is standards-compliant (more so than the original one) and note that other tools in the ecosystem may require a similar patch as well for unicode to fully function.
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.
We should raise proper exceptions, instead of assertion errors, for issues related to the user provided inputs. (the older asserts were there to guide type checkers).
Is there a particular Exception class you would recommend?
Fixes: #252
Test for valid unicode Python identifiers (https://peps.python.org/pep-3131/) in entrypoints. Should reproduce #252 .