Skip to content
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

Merged
merged 3 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/source/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,27 @@ We may eventually refactor ``AbstractFileSystem`` to split the default implement
the set of methods that you might implement in a new backend, and the
documented end-user API.

For now, new backends must register themselves on import
In order to register a new backend with fsspec, new backends should register
themselves using the `entry_points <https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html#entry-points-and-automatic-script-creation>`_
facility from setuptools. In particular, if you want to register a new
filesystem protocol ``myfs`` which is provided by the ``MyFS`` class in
the ``myfs`` package, add the following to your ``setup.py``:

.. code-block:: python

setuptools.setup(
...
entry_points={
'fsspec.specs': [
'myfs=myfs.MyFS',
],
},
...
)


Alternatively, the previous method of registering a new backend can be used.
That is, new backends must register themselves on import
(``register_implementation``) or post a PR to the ``fsspec`` repo
asking to be included in ``fsspec.registry.known_implementations``.

Expand Down
2 changes: 1 addition & 1 deletion fsspec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
entry_points = entry_points()
for spec in entry_points.get("fsspec.specs", []):
err_msg = f"Unable to load filesystem from {spec}"
register_implementation(spec.name, spec.module, errtxt=err_msg)
register_implementation(spec.name, spec.value.replace(":", "."), errtxt=err_msg)