Skip to content

Commit 80774d0

Browse files
committed
Document the workaround for #485 in the openers page of the documentation
1 parent 44d691f commit 80774d0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/source/openers.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,25 @@ To open a filesysem with a FS URL, you can use :meth:`~fs.opener.registry.Regist
5656

5757
from fs import open_fs
5858
projects_fs = open_fs('osfs://~/projects')
59+
60+
61+
Manually registering Openers
62+
----------------------------
63+
64+
The ``fs.opener`` registry uses an entry point to install external openers
65+
(see :ref:`extension`), and it does so once, when you import `fs` for the first
66+
time. In some rare cases where entry points are not available (for instance,
67+
when running an embedded interpreter) or when extensions are installed *after*
68+
the interpreter has started (for instance in a notebook, see
69+
`PyFilesystem2#485 <https://github.com/PyFilesystem/pyfilesystem2/issues/485>`_).
70+
71+
However, a new opener can be installed manually at any time with the
72+
`fs.opener.registry.install` method. For instance, here's how the opener for
73+
the `s3fs <https://github.com/PyFilesystem/s3fs>`_ extension can be added to
74+
the registry::
75+
76+
import fs.opener
77+
from fs_s3fs.opener import S3FSOpener
78+
79+
fs.opener.registry.install(S3FSOpener)
80+
# fs.open_fs("s3fs://...") should now work

0 commit comments

Comments
 (0)