Skip to content

Commit 3ec7528

Browse files
Merge pull request #1 from davidbrochart/readme
Update README
2 parents 1ab125d + 7f50265 commit 3ec7528

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,34 @@
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+
```

jupyter_ydoc/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from .ydoc import YFile, YNotebook # noqa
2-
31
__version__ = "0.1.0"

0 commit comments

Comments
 (0)