-
Notifications
You must be signed in to change notification settings - Fork 345
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
document the use of entry_points to register new backends #548
Conversation
While implementing this for an own backend (fsspec/ipfsspec#2), I discovered that this is not working in Python 3.8 as in that version |
Currently I think of two possible ways to solve this:
|
Given the current situation, we should probably support both "package.module.class" and "package.module:class", sorry. Should be simple if ":" in spec:
mod, class = spec.split(":", 1)
else:
mod, class = spec.rsplit(".", 1) |
If I get it right, at this place the only thing required would be a dotted string, without splitting it into There's however one more thing which bothers me. If any backend library which uses the import fsspec will crash. We could either not bother and hope that prior to a wider adoption of the entry point, users will have upgrade the |
I don't see a problem with the current implementation here. If someone follows the cods, it will work, and if someone uses the entrypoints convention, it will also work. Is there any case where the part after the ":" might be more complex? I don't think so - or at least, we don't need to support it. |
I also don't see a problem with this implementation. According to the setuptools manual, there will only be Should I update the docs to recommend |
I don't think so, because the code doesn't actually handle it - it will attempt to It would be reasonable to respect the exact intention of ":" in the given string, if it's there. |
Ok, that's reasonable. I'll leave it as is. |
I just found out that registering new backends is now possible using
entry_points
, thanks to #515. I think that this feature needs at least some basic documentation, so this is what this PR is for.One think to note is that it actually works a little different from what is written in #515:
This is from the initial message in 515
and this is what actually works:
The change of
[]
to{}
seems to be a typo, but I am not sure if that is the case for:
->.
. According to the setuptools manual, the syntax for defining entry points is:and thus the original comment in #515 would be correct in this regard, but the code is maybe wrong.
This PR documents what currently works. But probably we should change the code and the docs such that the filesystem object will be separated by a
:
in theentry_points
.