File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 33
44# jupyter_ydoc
55
6- Document structures for collaborative editing using Ypy
6+ ` jupyter_ydoc ` provides [ Ypy] ( https://github.com/y-crdt/ypy ) -based data structures for various
7+ documents used in the Jupyter ecosystem. Built-in documents include:
8+ - ` YFile ` : a generic text document.
9+ - ` YNotebook ` : a Jupyter notebook document.
10+
11+ These documents are registered in an entry point under the ` jupyter_ydoc ` group as ` "file" ` and
12+ ` "notebook" ` , respectively. You can access them as follows:
13+
14+ ``` py
15+ import sys
16+ import jupyter_ydoc
17+
18+ # See compatibility note on `group` keyword in https://docs.python.org/3/library/importlib.metadata.html#entry-points
19+ if sys.version_info < (3 , 10 ):
20+ from importlib_metadata import entry_points
21+ else :
22+ from importlib.metadata import entry_points
23+
24+ ydocs = {ep.name: ep.load() for ep in entry_points(group = " jupyter_ydoc" )}
25+ print (ydocs)
26+ # {'file': <class 'jupyter_ydoc.ydoc.YFile'>, 'notebook': <class 'jupyter_ydoc.ydoc.YNotebook'>}
27+ ```
28+
29+ The ` jupyter_ydoc ` entry point group can be populated with your own document, e.g. by adding the
30+ following to your package's ` setup.cfg ` :
31+
32+ ```
33+ [options.entry_points]
34+ jupyter_ydoc =
35+ my_document = my_package.my_file:MyDocumentClass
36+ ```
Original file line number Diff line number Diff line change 1- from .ydoc import YFile , YNotebook # noqa
2-
31__version__ = "0.1.0"
You can’t perform that action at this time.
0 commit comments