jupyter-ydoc 3.3.1__tar.gz → 3.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/check-release.yml +1 -1
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/license-header.yml +1 -1
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/test.yml +2 -2
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.pre-commit-config.yaml +1 -1
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/CHANGELOG.md +20 -2
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/PKG-INFO +1 -1
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/javascript/package.json +1 -1
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/_version.py +1 -1
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/yunicode.py +39 -7
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/dependabot.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/auto_author_assign.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/enforce-label.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/prep-release.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.github/workflows/publish-release.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.gitignore +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.licenserc.yaml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.yarn/releases/yarn-3.4.1.cjs +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/.yarnrc.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/LICENSE +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/README.md +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/Makefile +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/make.bat +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/_static/jupyter_logo.svg +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/_static/logo-icon.png +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/conf.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/custom.md +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/index.md +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/javascript_api.rst +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/overview.md +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/python_api.rst +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/docs/source/schema.md +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/__init__.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/py.typed +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/utils.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/ybasedoc.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/yblob.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/yfile.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/jupyter_ydoc/ynotebook.py +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/lerna.json +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/package.json +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/pyproject.toml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/pytest.ini +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/readthedocs.yml +0 -0
- {jupyter_ydoc-3.3.1 → jupyter_ydoc-3.3.2}/yarn.lock +0 -0
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
name: pre-commit
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v6
|
|
15
15
|
- uses: actions/setup-python@v6
|
|
16
16
|
- uses: pre-commit/action@v3.0.1
|
|
17
17
|
with:
|
|
@@ -41,7 +41,7 @@ jobs:
|
|
|
41
41
|
shell: bash -l {0}
|
|
42
42
|
steps:
|
|
43
43
|
- name: Checkout repository
|
|
44
|
-
uses: actions/checkout@
|
|
44
|
+
uses: actions/checkout@v6
|
|
45
45
|
- name: Install mamba
|
|
46
46
|
uses: mamba-org/setup-micromamba@v2
|
|
47
47
|
with:
|
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- <START NEW CHANGELOG ENTRY> -->
|
|
4
4
|
|
|
5
|
+
## 3.3.2
|
|
6
|
+
|
|
7
|
+
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.3.1...87e205209dbfed2d367424e6913c88916e77d98e))
|
|
8
|
+
|
|
9
|
+
### Enhancements made
|
|
10
|
+
|
|
11
|
+
- Perform granular updates if reloading textual files [#366](https://github.com/jupyter-server/jupyter_ydoc/pull/366) ([@krassowski](https://github.com/krassowski))
|
|
12
|
+
|
|
13
|
+
### Maintenance and upkeep improvements
|
|
14
|
+
|
|
15
|
+
- Bump actions/checkout from 5 to 6 [#363](https://github.com/jupyter-server/jupyter_ydoc/pull/363) ([@dependabot](https://github.com/dependabot))
|
|
16
|
+
|
|
17
|
+
### Contributors to this release
|
|
18
|
+
|
|
19
|
+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2025-11-21&to=2025-12-01&type=c))
|
|
20
|
+
|
|
21
|
+
[@dependabot](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adependabot+updated%3A2025-11-21..2025-12-01&type=Issues) | [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Akrassowski+updated%3A2025-11-21..2025-12-01&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Apre-commit-ci+updated%3A2025-11-21..2025-12-01&type=Issues)
|
|
22
|
+
|
|
23
|
+
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
24
|
+
|
|
5
25
|
## 3.3.1
|
|
6
26
|
|
|
7
27
|
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.3.0...0a0d0bc23b5894db0b00c5b073861025757c72db))
|
|
@@ -16,8 +36,6 @@
|
|
|
16
36
|
|
|
17
37
|
[@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Akrassowski+updated%3A2025-11-21..2025-11-21&type=Issues)
|
|
18
38
|
|
|
19
|
-
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
20
|
-
|
|
21
39
|
## 3.3.0
|
|
22
40
|
|
|
23
41
|
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.2.1...91d2742a5faff878f7d802e994922e7c3bcf9d33))
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
4
|
from collections.abc import Callable
|
|
5
|
+
from difflib import SequenceMatcher
|
|
5
6
|
from functools import partial
|
|
6
7
|
from typing import Any
|
|
7
8
|
|
|
@@ -9,6 +10,9 @@ from pycrdt import Awareness, Doc, Text
|
|
|
9
10
|
|
|
10
11
|
from .ybasedoc import YBaseDoc
|
|
11
12
|
|
|
13
|
+
# Heuristic threshold as recommended in difflib documentation
|
|
14
|
+
SIMILARITY_THREESHOLD = 0.6
|
|
15
|
+
|
|
12
16
|
|
|
13
17
|
class YUnicode(YBaseDoc):
|
|
14
18
|
"""
|
|
@@ -35,7 +39,7 @@ class YUnicode(YBaseDoc):
|
|
|
35
39
|
:type awareness: :class:`pycrdt.Awareness`, optional.
|
|
36
40
|
"""
|
|
37
41
|
super().__init__(ydoc, awareness)
|
|
38
|
-
self._ysource = self._ydoc.get("source", type=Text)
|
|
42
|
+
self._ysource: Text = self._ydoc.get("source", type=Text)
|
|
39
43
|
self.undo_manager.expand_scope(self._ysource)
|
|
40
44
|
|
|
41
45
|
@property
|
|
@@ -64,17 +68,45 @@ class YUnicode(YBaseDoc):
|
|
|
64
68
|
:param value: The content of the document.
|
|
65
69
|
:type value: str
|
|
66
70
|
"""
|
|
67
|
-
|
|
71
|
+
old_value = self.get()
|
|
72
|
+
if old_value == value:
|
|
68
73
|
# no-op if the values are already the same,
|
|
69
74
|
# to avoid side-effects such as cursor jumping to the top
|
|
70
75
|
return
|
|
71
76
|
|
|
72
77
|
with self._ydoc.transaction():
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
matcher = SequenceMatcher(a=old_value, b=value)
|
|
79
|
+
|
|
80
|
+
if (
|
|
81
|
+
matcher.real_quick_ratio() >= SIMILARITY_THREESHOLD
|
|
82
|
+
and matcher.ratio() >= SIMILARITY_THREESHOLD
|
|
83
|
+
):
|
|
84
|
+
operations = matcher.get_opcodes()
|
|
85
|
+
offset = 0
|
|
86
|
+
for tag, i1, i2, j1, j2 in operations:
|
|
87
|
+
match tag:
|
|
88
|
+
case "replace":
|
|
89
|
+
self._ysource[i1 + offset : i2 + offset] = value[j1:j2]
|
|
90
|
+
offset += (j2 - j1) - (i2 - i1)
|
|
91
|
+
case "delete":
|
|
92
|
+
del self._ysource[i1 + offset : i2 + offset]
|
|
93
|
+
offset -= i2 - i1
|
|
94
|
+
case "insert":
|
|
95
|
+
self._ysource.insert(i1 + offset, value[j1:j2])
|
|
96
|
+
offset += j2 - j1
|
|
97
|
+
case "equal":
|
|
98
|
+
pass
|
|
99
|
+
case _:
|
|
100
|
+
raise ValueError(f"Unknown tag '{tag}' in sequence matcher")
|
|
101
|
+
else:
|
|
102
|
+
# for very different strings, just replace the whole content;
|
|
103
|
+
# this avoids generating a huge number of operations
|
|
104
|
+
|
|
105
|
+
# clear document
|
|
106
|
+
self._ysource.clear()
|
|
107
|
+
# initialize document
|
|
108
|
+
if value:
|
|
109
|
+
self._ysource += value
|
|
78
110
|
|
|
79
111
|
def observe(self, callback: Callable[[str, Any], None]) -> None:
|
|
80
112
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|