flit
flit copied to clipboard
Validate entry_points.txt on install, fail if necessary ?
A bad groupname can prevent other packages from starting as pkg_resources can raise raise ValueError("Invalid group name", group)
I get the impression you hit this? What was the example? I think it makes sense to verify them when building the package.
On 28 Dec 2016 6:31 p.m., "Matthias Bussonnier" [email protected] wrote:
A bad groupname can prevent other packages from starting as pkg_resources can raise raise ValueError("Invalid group name", group)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/takluyver/flit/issues/96, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUA9Qydn7xQcSl100bqoUorZNGh0iBBks5rMqr4gaJpZM4LXGrp .
I get the impression you hit this? What was the example? I think it makes sense to verify them when building the package.
Yes, I did a package flitlicenses
with an entrypoint group named [flit-licenses]
(dash is invalid) and IPython was broken on startup (because pkg_resources scan and validate even non-IPython entrypoints...). Obviously I fixed it immediately and it was my fault, but I would still have prefered to be warned at install time with failure that later. And I was lucky enough to know from where it was coming.
Flit now validates the object reference part of entry points (like flit:main
), but it doesn't do anything with the group name. Do you know what rules pkg_resources
checks it against?
The errors seems to come from here: https://github.com/pypa/setuptools/blob/7f310da972ee9d979b8b0bfb9c19cabe91bf94a2/pkg_resources/init.py#L2410-L2413
The validator is here: https://github.com/pypa/setuptools/blob/7f310da972ee9d979b8b0bfb9c19cabe91bf94a2/pkg_resources/init.py#L2295
MODULE = re.compile(r"\w+(\.\w+)*$").match
(don’t know why github does not show snippets here)
Thanks @merwok - PRs to validate the group names welcome.
better to use the documented pkg_resources class function pkg_resources.EntryPoint.parse_group("group.name", [])
, instead of MODULE
.