jupyter-ydoc 3.3.0__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.
Files changed (44) hide show
  1. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/check-release.yml +1 -1
  2. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/license-header.yml +1 -1
  3. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/test.yml +2 -2
  4. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.pre-commit-config.yaml +1 -1
  5. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/CHANGELOG.md +34 -2
  6. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/PKG-INFO +1 -1
  7. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/javascript/package.json +1 -1
  8. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/_version.py +1 -1
  9. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/ynotebook.py +8 -3
  10. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/yunicode.py +39 -7
  11. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/dependabot.yml +0 -0
  12. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/auto_author_assign.yml +0 -0
  13. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/enforce-label.yml +0 -0
  14. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/prep-release.yml +0 -0
  15. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.github/workflows/publish-release.yml +0 -0
  16. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.gitignore +0 -0
  17. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.licenserc.yaml +0 -0
  18. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.yarn/releases/yarn-3.4.1.cjs +0 -0
  19. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/.yarnrc.yml +0 -0
  20. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/LICENSE +0 -0
  21. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/README.md +0 -0
  22. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/Makefile +0 -0
  23. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/make.bat +0 -0
  24. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/_static/jupyter_logo.svg +0 -0
  25. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/_static/logo-icon.png +0 -0
  26. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/conf.py +0 -0
  27. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/custom.md +0 -0
  28. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/index.md +0 -0
  29. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/javascript_api.rst +0 -0
  30. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/overview.md +0 -0
  31. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/python_api.rst +0 -0
  32. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/docs/source/schema.md +0 -0
  33. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/__init__.py +0 -0
  34. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/py.typed +0 -0
  35. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/utils.py +0 -0
  36. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/ybasedoc.py +0 -0
  37. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/yblob.py +0 -0
  38. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/jupyter_ydoc/yfile.py +0 -0
  39. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/lerna.json +0 -0
  40. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/package.json +0 -0
  41. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/pyproject.toml +0 -0
  42. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/pytest.ini +0 -0
  43. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/readthedocs.yml +0 -0
  44. {jupyter_ydoc-3.3.0 → jupyter_ydoc-3.3.2}/yarn.lock +0 -0
@@ -19,7 +19,7 @@ jobs:
19
19
  node-version: ["14.x"]
20
20
  steps:
21
21
  - name: Checkout
22
- uses: actions/checkout@v5
22
+ uses: actions/checkout@v6
23
23
  - name: Base Setup
24
24
  uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
25
25
  - name: Install Dependencies
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  steps:
15
15
  - name: Checkout
16
- uses: actions/checkout@v5
16
+ uses: actions/checkout@v6
17
17
  with:
18
18
  token: ${{ secrets.GITHUB_TOKEN }}
19
19
 
@@ -11,7 +11,7 @@ jobs:
11
11
  name: pre-commit
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v5
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@v5
44
+ uses: actions/checkout@v6
45
45
  - name: Install mamba
46
46
  uses: mamba-org/setup-micromamba@v2
47
47
  with:
@@ -17,7 +17,7 @@ repos:
17
17
  exclude: ^\.yarn
18
18
 
19
19
  - repo: https://github.com/astral-sh/ruff-pre-commit
20
- rev: v0.14.5
20
+ rev: v0.14.6
21
21
  hooks:
22
22
  - id: ruff
23
23
  args: [--fix, --show-fixes]
@@ -2,6 +2,40 @@
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
+
25
+ ## 3.3.1
26
+
27
+ ([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.3.0...0a0d0bc23b5894db0b00c5b073861025757c72db))
28
+
29
+ ### Bugs fixed
30
+
31
+ - Hard-reload a cell if its outputs change and include `stream` [#362](https://github.com/jupyter-server/jupyter_ydoc/pull/362) ([@krassowski](https://github.com/krassowski))
32
+
33
+ ### Contributors to this release
34
+
35
+ ([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2025-11-21&to=2025-11-21&type=c))
36
+
37
+ [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Akrassowski+updated%3A2025-11-21..2025-11-21&type=Issues)
38
+
5
39
  ## 3.3.0
6
40
 
7
41
  ([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.2.1...91d2742a5faff878f7d802e994922e7c3bcf9d33))
@@ -20,8 +54,6 @@
20
54
 
21
55
  [@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2025-11-18..2025-11-21&type=Issues) | [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Akrassowski+updated%3A2025-11-18..2025-11-21&type=Issues)
22
56
 
23
- <!-- <END NEW CHANGELOG ENTRY> -->
24
-
25
57
  ## 3.2.1
26
58
 
27
59
  ([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.2.0...af869e7be801c1ca49c30256e30f2683ce03749c))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jupyter-ydoc
3
- Version: 3.3.0
3
+ Version: 3.3.2
4
4
  Summary: Document structures for collaborative editing using Ypy
5
5
  Project-URL: Homepage, https://jupyter.org
6
6
  Project-URL: Source, https://github.com/jupyter-server/jupyter_ydoc
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyter/ydoc",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "type": "module",
5
5
  "description": "Jupyter document structures for collaborative editing using YJS",
6
6
  "homepage": "https://github.com/jupyter-server/jupyter_ydoc",
@@ -1,4 +1,4 @@
1
1
  # This file is auto-generated by Hatchling. As such, do not:
2
2
  # - modify
3
3
  # - track in version control e.g. be sure to add to .gitignore
4
- __version__ = VERSION = '3.3.0'
4
+ __version__ = VERSION = '3.3.2'
@@ -345,9 +345,14 @@ class YNotebook(YBaseDoc):
345
345
  for key in shared_keys:
346
346
  if old_cell[key] != new_cell[key]:
347
347
  value = new_cell[key]
348
- if key == "output" and value:
349
- # outputs require complex handling - some have Text type nested;
350
- # for now skip creating them; clearing all outputs is fine
348
+ if (
349
+ key == "outputs"
350
+ and value
351
+ and any(output.get("output_type") == "stream" for output in value)
352
+ ):
353
+ # Outputs with stream require complex handling as they have
354
+ # the Text type nested inside; for now skip creating them.
355
+ # Clearing all outputs is fine.
351
356
  return False
352
357
 
353
358
  if key in _CELL_KEY_TYPE_MAP:
@@ -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
- if self.get() == value:
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
- # clear document
74
- self._ysource.clear()
75
- # initialize document
76
- if value:
77
- self._ysource += value
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