From 3d6666fbf3737cd89715c62eb26e4b06a6bc2a6d Mon Sep 17 00:00:00 2001 From: JSv4 Date: Mon, 23 Nov 2026 22:51:13 -0600 Subject: [PATCH 1/5] feat: upgrade Docxodus to v17.0.0 and expose minimum_anchor_word_count Bump the submodule from v14.1.0 to v17.0.0. The redline CLI gained exactly one flag in that range, --minimum-anchor-word-count, so add the matching keyword argument. It accepts any non-negative integer; bool is rejected because it is an int subclass that would reach the CLI as "True". The integration tests drop an entry from a list whose labels sit on their own lines, and check that the spurious moves appear by default and disappear at 2. Co-Authored-By: Claude Opus 5.5 --- docxodus | 2 +- packages/core/src/python_redlines/engines.py | 16 ++- tests/test_docxodus_engine.py | 141 +++++++++++++++---- 3 files changed, 128 insertions(+), 31 deletions(-) diff --git a/docxodus b/docxodus index 1b05750..044d3b1 160000 --- a/docxodus +++ b/docxodus @@ -1 +1 @@ -Subproject commit 1b05750689afc432d24a5e9fd9849a01899a9994 +Subproject commit 044d3b10fbaad5f4ab5d09ff6e2380dbfe5b0dc8 diff --git a/packages/core/src/python_redlines/engines.py b/packages/core/src/python_redlines/engines.py index 89651b3..c912feb 100644 --- a/packages/core/src/python_redlines/engines.py +++ b/packages/core/src/python_redlines/engines.py @@ -162,10 +162,11 @@ def run_redline(self, author_tag: str, original: Union[str, bytes, Path], modifi Additional keyword arguments are passed to _build_command() for engine-specific options. DocxodusEngine supports: case_insensitive, detect_moves, - move_similarity_threshold, move_minimum_word_count, detect_format_changes, - conflate_spaces, date_time. It raises ValueError for unrecognised settings and - for the WmlComparer-era settings removed in Docxodus v11.0.0 (engine, - detail_threshold, simplify_move_markup). XmlPowerToolsEngine ignores kwargs. + move_similarity_threshold, move_minimum_word_count, minimum_anchor_word_count, + detect_format_changes, conflate_spaces, date_time. It raises ValueError for + unrecognised settings and for the WmlComparer-era settings removed in Docxodus + v11.0.0 (engine, detail_threshold, simplify_move_markup). XmlPowerToolsEngine + ignores kwargs. """ scratch_files = [] try: @@ -288,6 +289,7 @@ class DocxodusEngine(BaseEngine): _VALUE_FLAGS = [ ('move_similarity_threshold', '--move-similarity-threshold'), ('move_minimum_word_count', '--move-minimum-word-count'), + ('minimum_anchor_word_count', '--minimum-anchor-word-count'), ('date_time', '--date-time'), ] @@ -322,6 +324,12 @@ def _validate_kwargs(cls, kwargs): if not isinstance(val, int) or val < 1: raise ValueError(f"move_minimum_word_count must be a positive integer, got {val!r}") + if 'minimum_anchor_word_count' in kwargs: + val = kwargs['minimum_anchor_word_count'] + # bool is an int subclass, but would reach the CLI as "True". + if isinstance(val, bool) or not isinstance(val, int) or val < 0: + raise ValueError(f"minimum_anchor_word_count must be a non-negative integer, got {val!r}") + def _build_command(self, author_tag, original_path, modified_path, target_path, **kwargs): self._validate_kwargs(kwargs) diff --git a/tests/test_docxodus_engine.py b/tests/test_docxodus_engine.py index 1113884..69cfe0e 100644 --- a/tests/test_docxodus_engine.py +++ b/tests/test_docxodus_engine.py @@ -7,7 +7,7 @@ from python_redlines.engines import DocxodusEngine -# Measured against the Docxodus v14.1.0 binary on tests/fixtures/. Docxodus +# Measured against the Docxodus v17.0.0 binary on tests/fixtures/. Docxodus # v11.0.0 removed WmlComparer, so DocxDiff is the only algorithm; the count is # neither the 9 the old default reported nor the 11 the old opt-in reported. EXPECTED_REVISIONS = 10 @@ -28,6 +28,39 @@ def modified_docx(): return load_docx_bytes('tests/fixtures/modified.docx') +W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" +NS = {"w": W_NS} + + +def make_document(template_docx, *paragraphs): + """A copy of *template_docx* whose body is exactly these plain paragraphs.""" + document = ET.Element(f"{{{W_NS}}}document") + body = ET.SubElement(document, f"{{{W_NS}}}body") + for text in paragraphs: + run = ET.SubElement(ET.SubElement(body, f"{{{W_NS}}}p"), f"{{{W_NS}}}r") + ET.SubElement(run, f"{{{W_NS}}}t").text = text + + output = io.BytesIO() + with zipfile.ZipFile(io.BytesIO(template_docx)) as template: + with zipfile.ZipFile(output, "w") as archive: + for member in template.infolist(): + data = (ET.tostring(document, encoding="utf-8", xml_declaration=True) + if member.filename == "word/document.xml" + else template.read(member.filename)) + archive.writestr(member, data) + return output.getvalue() + + +def document_root(docx): + """The parsed word/document.xml of a .docx given as bytes.""" + with zipfile.ZipFile(io.BytesIO(docx)) as archive: + return ET.fromstring(archive.read("word/document.xml")) + + +def joined_text(root, path): + return "".join(node.text or "" for node in root.findall(path, NS)) + + def revision_count(stdout): """The integer revision count from a Docxodus 'Redline complete: N revision(s) found' line.""" match = re.search(r"Redline complete: (\d+) revision\(s\) found", stdout) @@ -74,33 +107,68 @@ def test_docxodus_output_is_a_valid_docx_with_tracked_changes(original_docx, mod def test_docxodus_marks_a_single_changed_cjk_character(original_docx): """Guard the CJK granularity fix needed by users upgrading from 0.3.0 (#34).""" - namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - ns = {"w": namespace} - - def make_document(text): - output = io.BytesIO() - with zipfile.ZipFile(io.BytesIO(original_docx)) as template: - document = ET.Element(f"{{{namespace}}}document") - body = ET.SubElement(document, f"{{{namespace}}}body") - paragraph = ET.SubElement(body, f"{{{namespace}}}p") - run = ET.SubElement(paragraph, f"{{{namespace}}}r") - ET.SubElement(run, f"{{{namespace}}}t").text = text - with zipfile.ZipFile(output, "w") as archive: - for member in template.infolist(): - data = (ET.tostring(document, encoding="utf-8", xml_declaration=True) - if member.filename == "word/document.xml" - else template.read(member.filename)) - archive.writestr(member, data) - return output.getvalue() - - before = make_document("本合同的交付日期为三月十五日,双方应按约履行。") - after = make_document("本合同的交付日期为一月十五日,双方应按约履行。") + before = make_document(original_docx, "本合同的交付日期为三月十五日,双方应按约履行。") + after = make_document(original_docx, "本合同的交付日期为一月十五日,双方应按约履行。") redline, _, stderr = DocxodusEngine().run_redline("Reviewer", before, after) assert stderr is None - with zipfile.ZipFile(io.BytesIO(redline)) as archive: - document = ET.fromstring(archive.read("word/document.xml")) - assert "".join(node.text or "" for node in document.findall(".//w:delText", ns)) == "三" - assert "".join(node.text or "" for node in document.findall(".//w:ins//w:t", ns)) == "一" + document = document_root(redline) + assert joined_text(document, ".//w:delText") == "三" + assert joined_text(document, ".//w:ins//w:t") == "一" + + +# --- Minimum anchor word count (new in Docxodus v17.0.0) --- + +LEASE_CLAUSES = [ + "The tenant shall keep the premises in good repair at its own expense.", + "Payment of rent falls due on the first business day of every month.", + "Either party may terminate this lease by giving ninety days of written notice.", + "The landlord shall insure the building against fire and flood damage.", + "Disputes are resolved by arbitration seated in the city of Geneva.", +] + + +def labelled_entries(clauses): + """P1 / clause / P2 / clause / ... with each label on a line of its own.""" + return [text for number, clause in enumerate(clauses, 1) for text in (f"P{number}", clause)] + + +@pytest.fixture +def renumbered_entries(original_docx): + """Dropping the first entry renumbers every later label but leaves its text alone.""" + return ( + make_document(original_docx, *labelled_entries(LEASE_CLAUSES)), + make_document(original_docx, *labelled_entries(LEASE_CLAUSES[1:])), + ) + + +def moved_paragraph_count(redline): + """Paragraphs the redline shows as moved, counted at their destination.""" + return len([p for p in document_root(redline).findall(".//w:p", NS) + if p.find(".//w:moveTo", NS) is not None]) + + +@pytest.mark.parametrize("settings", [{}, {"minimum_anchor_word_count": 0}], ids=["omitted", "zero"]) +def test_renumbered_entries_read_as_moves_by_default(renumbered_entries, settings): + """The behaviour the setting exists to change; 0 must be accepted and mean the default.""" + redline, _, stderr = DocxodusEngine().run_redline("Reviewer", *renumbered_entries, **settings) + assert stderr is None + assert moved_paragraph_count(redline) > 0 + + +def test_minimum_anchor_word_count_matches_renumbered_entries_by_their_text(renumbered_entries): + redline, _, stderr = DocxodusEngine().run_redline( + "Reviewer", *renumbered_entries, minimum_anchor_word_count=2, + ) + assert stderr is None + assert moved_paragraph_count(redline) == 0 + + document = document_root(redline) + deleted = joined_text(document, ".//w:delText") + assert LEASE_CLAUSES[0] in deleted + for clause in LEASE_CLAUSES[1:]: + assert clause not in deleted + # Only label digits are inserted; no surviving clause is re-typed. + assert joined_text(document, ".//w:ins//w:t").strip("P0123456789") == "" # --- Integration tests for comparison settings --- @@ -150,6 +218,7 @@ def test_docxodus_with_all_options(original_docx, modified_docx): detect_moves=True, move_similarity_threshold=0.7, move_minimum_word_count=2, + minimum_anchor_word_count=2, detect_format_changes=False, conflate_spaces=False, date_time="2025-01-01T00:00:00Z", @@ -259,6 +328,14 @@ def test_docxodus_invalid_move_minimum_word_count_type(): engine._build_command("Author", "orig", "mod", "out", move_minimum_word_count=2.5) +@pytest.mark.parametrize("value", [-1, 2.5, "2", None, True, False]) +def test_docxodus_invalid_minimum_anchor_word_count(value): + """bool is an int subclass, and str(True) is not a number the CLI can parse.""" + engine = DocxodusEngine() + with pytest.raises(ValueError, match="minimum_anchor_word_count must be a non-negative integer"): + engine._build_command("Author", "orig", "mod", "out", minimum_anchor_word_count=value) + + # --- Unit tests for _build_command flag construction --- def test_build_command_default(): @@ -286,6 +363,7 @@ def test_build_command_with_all_flags(): detect_moves=True, move_similarity_threshold=0.7, move_minimum_word_count=2, + minimum_anchor_word_count=2, detect_format_changes=False, conflate_spaces=False, date_time="2025-01-01T00:00:00Z", @@ -297,9 +375,20 @@ def test_build_command_with_all_flags(): assert "--no-conflate-spaces" in cmd assert "--move-similarity-threshold=0.7" in cmd assert "--move-minimum-word-count=2" in cmd + assert "--minimum-anchor-word-count=2" in cmd assert "--date-time=2025-01-01T00:00:00Z" in cmd +def test_build_command_passes_a_zero_minimum_anchor_word_count(): + """0 is a legal value here, unlike move_minimum_word_count, and must not be lost as falsy.""" + engine = DocxodusEngine() + cmd = engine._build_command( + "Author", "/tmp/orig.docx", "/tmp/mod.docx", "/tmp/out.docx", + minimum_anchor_word_count=0, + ) + assert "--minimum-anchor-word-count=0" in cmd + + def test_build_command_false_bools_not_added(): """Boolean flags that are False should not be added to the command.""" engine = DocxodusEngine() From 695db5554e2a7b2be0baf72fbc9cc790ce5a4d48 Mon Sep 17 00:00:00 2001 From: JSv4 Date: Mon, 23 Nov 2026 22:51:13 -0600 Subject: [PATCH 2/5] chore: bump to 3.0.0 and document the Docxodus v17 upgrade Comparison output changes and very deeply nested documents are now refused, so follow the 2.0.0 policy of making that an explicit major version. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- README.md | 62 ++++++++++++++++++- docs/quickstart.md | 4 +- packages/core/README.md | 7 ++- .../core/src/python_redlines/__about__.py | 2 +- packages/docxodus/README.md | 2 +- 6 files changed, 68 insertions(+), 11 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 722a0c2..db25c74 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,7 +9,7 @@ Python-Redlines generates `.docx` redline/tracked-changes documents by comparing Two comparison engines are available: - **XmlPowerToolsEngine** — wraps Open-XML-PowerTools WmlComparer (original engine). Deprecated as of 1.0.0: instantiating it emits a `DeprecationWarning`. Still published. -- **DocxodusEngine** — wraps Docxodus v14.1.0, a modernized .NET 10.0 fork with better move detection. +- **DocxodusEngine** — wraps Docxodus v17.0.0, a modernized .NET 10.0 fork with better move detection. Runs `DocxDiff`, its only algorithm — Docxodus v11.0.0 deleted `WmlComparer`. ## Monorepo structure — three published packages diff --git a/README.md b/README.md index 3284226..f0306ae 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ with open("redline.docx", "wb") as f: That's the whole thing. The rest of this README covers the other engines, comparison settings, and how the packages are built and distributed. -Version 2.0.0 bundles Docxodus v14.1.0. Its comparison output can differ from -1.0.0; see [Upgrading to 2.0.0](#upgrading-to-200) before updating an existing deployment. +Version 3.0.0 bundles Docxodus v17.0.0. Its comparison output can differ from +2.0.0; see [Upgrading to 3.0.0](#upgrading-to-300) before updating an existing deployment. ### ⚠️ Breaking in 1.0.0: `WmlComparer` is gone; DocxDiff is the only algorithm @@ -167,7 +167,7 @@ argument raises `ValueError`. ### 1. `DocxodusEngine` — the default **[Docxodus](https://github.com/JSv4/Docxodus)** is an actively-maintained .NET 10.0 document -toolchain. Python-Redlines 2.0.0 bundles Docxodus v14.1.0. Its `DocxDiff` algorithm +toolchain. Python-Redlines 3.0.0 bundles Docxodus v17.0.0. Its `DocxDiff` algorithm models the document as an intermediate representation rather than a stream of runs, which lets it attribute a change to the exact paragraph, cell, row, or section it touched: @@ -266,6 +266,7 @@ redline_bytes, stdout, stderr = engine.run_redline( | `detect_moves` | bool | `False` | Enable move detection | | `move_similarity_threshold` | float | `0.8` | Jaccard threshold for move matching (0.0–1.0) | | `move_minimum_word_count` | int | `3` | Minimum words for move detection | +| `minimum_anchor_word_count` | int | `0` | Words a paragraph needs before it is used to line the two documents up; see [Numbered entries](#numbered-entries) | | `detect_format_changes` | bool | `True` | Detect block-level formatting changes | | `conflate_spaces` | bool | `True` | Treat breaking/non-breaking spaces the same | | `date_time` | str | now | Custom ISO 8601 timestamp for revisions | @@ -273,6 +274,23 @@ redline_bytes, stdout, stderr = engine.run_redline( Anything else raises `ValueError`, including a misspelled setting name. Passing a setting to `XmlPowerToolsEngine` is still silently ignored — it has never accepted any. +### Numbered entries + +Some documents put a short label on its own line before each entry: "P1", then the entry's +text, then "P2", and so on. Adding or removing an entry changes every later label, and the +comparison can then report the entries' unchanged text as moved. Setting +`minimum_anchor_word_count=2` (new in 3.0.0) makes it match the entries by their text +instead, so each label just shows its number changing: + +```python +redline_bytes, stdout, stderr = engine.run_redline( + "Reviewer", original, modified, + minimum_anchor_word_count=2, +) +``` + +Leave it at the default, `0`, for other documents. It must be a non-negative integer. + ### Settings removed in 1.0.0 | Setting | Why it is gone | @@ -288,6 +306,44 @@ The 0.3.0-era warning that `detect_moves=True` needed `simplify_move_markup=True "unreadable content" dialog applied to `WmlComparer`'s move markup. It does not apply here — `DocxDiff` emits move markup natively and has no such mitigation, because it needs none. +## Upgrading to 3.0.0 + +3.0.0 bundles Docxodus v17.0.0, up from v14.1.0. The major version makes the change in +comparison output an explicit upgrade. Every existing call and setting still works; one +setting is new. + +1. **Install the matching wrapper and engine through the extra:** + + ```bash + pip install --upgrade 'python-redlines[docxodus]==3.0.0' + ``` + + Update lockfiles or separately pinned companions to 3.0.0 as well. +2. **Review representative redlines and refresh output snapshots.** The project's fixture + still reports 10 revisions, but other documents can differ: + - When only a field's displayed text changes, such as a cross-reference going from 16.4 to + 21.8, just that text is marked. A field in its short form (`w:fldSimple`) used to mark the + whole paragraph as deleted and re-inserted. + - Formatting changes inside table cells, and on paragraph marks, are now tracked. They were + silently left untracked, so revision counts can rise on documents whose text is unchanged. + `detect_format_changes=False` suppresses the paragraph-mark revisions but not run + formatting in cells, which it has never suppressed in body text either. + - A phrase replaced in a paragraph containing a tab or line break is one deletion and one + insertion rather than a run of one-word edits. + - Docxodus also reports changes to heavily rewritten paragraphs, moves among edited + paragraphs, content controls in tables, headers and footers around section breaks, + comments, notes and text boxes. See its + [changelog](https://github.com/JSv4/Docxodus/blob/v17.0.0/CHANGELOG.md) for 14.2.0–17.0.0. +3. **Expect a refusal for very deeply nested documents.** XML nested more than 128 elements + deep in a story or definition part (the body, headers, notes, styles and so on), or more + than 256 in any other part, now raises `EngineExecutionError` with + `xml_depth_limit_exceeded` in the message. Docxodus says real documents nest a few dozen + levels at most. Packages past its size or compression-ratio limits are refused too. +4. **Consider `minimum_anchor_word_count=2`** if your documents number their entries on + separate lines; see [Numbered entries](#numbered-entries). It needs the 3.0.0 engine. + +If upgrading from 1.0.0 or earlier, also apply the steps below. + ## Upgrading to 2.0.0 2.0.0 bundles Docxodus v14.1.0. The major version makes the change in comparison diff --git a/docs/quickstart.md b/docs/quickstart.md index a35f772..6fda127 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -79,8 +79,8 @@ algorithm they configured — see ### See also -- [Upgrading to 2.0.0](https://github.com/JSv4/Python-Redlines#upgrading-to-200) — - engine output changes, matching companion packages and error reporting +- [Upgrading to 3.0.0](https://github.com/JSv4/Python-Redlines#upgrading-to-300) — + engine output changes, a new comparison setting and refused documents - [How to compare two Word documents programmatically in Python](tutorials/how-to-compare-word-documents-python.md) — a step-by-step tutorial covering this same flow in more depth - [Live demo](https://redlines.opensource.legal) — try a comparison in your browser diff --git a/packages/core/README.md b/packages/core/README.md index 922b3ae..61f73ec 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -37,10 +37,11 @@ version as the wrapper. For older releases, pin both packages explicitly (for example, `python-redlines[docxodus]==0.3.0` and `python-redlines-docxodus==0.3.0`). Existing published metadata is unchanged. -2.0.0 bundles Docxodus v14.1.0. Python call signatures and supported settings -are unchanged from 1.0.0, but comparison markup and revision granularity can differ. +3.0.0 bundles Docxodus v17.0.0 and adds one setting, `minimum_anchor_word_count`. +Existing call signatures and settings are unchanged from 2.0.0, but comparison markup +and revision counts can differ, and some very deeply nested documents are now refused. Review representative redlines when upgrading; see the -[2.0.0 migration guide](https://github.com/JSv4/Python-Redlines#upgrading-to-200). +[3.0.0 migration guide](https://github.com/JSv4/Python-Redlines#upgrading-to-300). An unsuccessful engine exit raises `EngineExecutionError`, a subclass of `subprocess.CalledProcessError`. Its message includes the captured stderr and diff --git a/packages/core/src/python_redlines/__about__.py b/packages/core/src/python_redlines/__about__.py index 9a4ea48..6690dce 100644 --- a/packages/core/src/python_redlines/__about__.py +++ b/packages/core/src/python_redlines/__about__.py @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2024-present U.N. Owen # # SPDX-License-Identifier: MIT -__version__ = "2.0.0" +__version__ = "3.0.0" diff --git a/packages/docxodus/README.md b/packages/docxodus/README.md index 80f7571..5acc530 100644 --- a/packages/docxodus/README.md +++ b/packages/docxodus/README.md @@ -3,7 +3,7 @@ Compiled Docxodus redline engine binary for [`python-redlines`](https://pypi.org/project/python-redlines/). -Version 2.0.0 bundles the engine built from Docxodus v14.1.0. +Version 3.0.0 bundles the engine built from Docxodus v17.0.0. This package only contains the platform-specific engine binary. Install it via the `python-redlines` extra rather than directly: From 304d1a51e8418b1e8043a812bffd3245f3630d7e Mon Sep 17 00:00:00 2001 From: JSv4 Date: Mon, 23 Nov 2026 22:59:01 -0600 Subject: [PATCH 3/5] chore!: require Python 3.11 and test 3.11 through 3.14 Python 3.9 reached end of life on 2025-10-31 and 3.10 on 2026-10-01, which leaves 3.11 as the oldest supported release. CI could no longer set up 3.9 either: ubuntu-latest is now Ubuntu 26.04, which has no 3.9 build. CI now also covers 3.13 and 3.14, so the ResourceWarning regression test for issue #30, skipped below 3.13, runs there for the first time. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 +- README.md | 12 +++++++----- docs/developer-guide.md | 2 +- .../how-to-compare-word-documents-python.md | 2 +- packages/core/README.md | 1 + packages/core/pyproject.toml | 6 +++--- packages/docxodus/pyproject.toml | 2 +- packages/ooxmlpowertools/pyproject.toml | 2 +- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8229f46..d13dfbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.9', '3.11', '3.12'] + python-version: ['3.11', '3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index f0306ae..9aa2818 100644 --- a/README.md +++ b/README.md @@ -312,14 +312,16 @@ The 0.3.0-era warning that `detect_moves=True` needed `simplify_move_markup=True comparison output an explicit upgrade. Every existing call and setting still works; one setting is new. -1. **Install the matching wrapper and engine through the extra:** +1. **Use Python 3.11 or newer.** Python 3.9 and 3.10 have reached end of life; 2.0.0 was the + last release to support them. CI covers 3.11 to 3.14. +2. **Install the matching wrapper and engine through the extra:** ```bash pip install --upgrade 'python-redlines[docxodus]==3.0.0' ``` Update lockfiles or separately pinned companions to 3.0.0 as well. -2. **Review representative redlines and refresh output snapshots.** The project's fixture +3. **Review representative redlines and refresh output snapshots.** The project's fixture still reports 10 revisions, but other documents can differ: - When only a field's displayed text changes, such as a cross-reference going from 16.4 to 21.8, just that text is marked. A field in its short form (`w:fldSimple`) used to mark the @@ -334,12 +336,12 @@ setting is new. paragraphs, content controls in tables, headers and footers around section breaks, comments, notes and text boxes. See its [changelog](https://github.com/JSv4/Docxodus/blob/v17.0.0/CHANGELOG.md) for 14.2.0–17.0.0. -3. **Expect a refusal for very deeply nested documents.** XML nested more than 128 elements +4. **Expect a refusal for very deeply nested documents.** XML nested more than 128 elements deep in a story or definition part (the body, headers, notes, styles and so on), or more than 256 in any other part, now raises `EngineExecutionError` with `xml_depth_limit_exceeded` in the message. Docxodus says real documents nest a few dozen levels at most. Packages past its size or compression-ratio limits are refused too. -4. **Consider `minimum_anchor_word_count=2`** if your documents number their entries on +5. **Consider `minimum_anchor_word_count=2`** if your documents number their entries on separate lines; see [Numbered entries](#numbered-entries). It needs the 3.0.0 engine. If upgrading from 1.0.0 or earlier, also apply the steps below. @@ -480,7 +482,7 @@ engine — no Word installation, no TOS risk. See ### Prerequisites -- Python 3.9+ +- Python 3.11+ - .NET 10.0 SDK (only for building the engine binaries locally). Install with `apt install dotnet-sdk-10.0`, or `curl -sSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 10.0`. A .NET 8 SDK can no longer build the Docxodus engine, which targets `net10.0`. diff --git a/docs/developer-guide.md b/docs/developer-guide.md index f68e97c..eb06e71 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -2,7 +2,7 @@ ## Prerequisites -- Python 3.9 or higher +- Python 3.11 or higher - .NET 10.0 SDK (to compile the C# engine binaries). The Docxodus engine targets `net10.0`; the Open-XML-PowerTools engine still targets `net8.0` and the .NET 10 SDK builds both. diff --git a/docs/tutorials/how-to-compare-word-documents-python.md b/docs/tutorials/how-to-compare-word-documents-python.md index 3583c6c..8df2bfd 100644 --- a/docs/tutorials/how-to-compare-word-documents-python.md +++ b/docs/tutorials/how-to-compare-word-documents-python.md @@ -18,7 +18,7 @@ openable and reviewable in Microsoft Word, LibreOffice, or Google Docs. ## Prerequisites -- Python 3.9+ +- Python 3.11+ - Two `.docx` files to compare (any two versions of the same Word document) No Microsoft Word installation, no COM automation, and no .NET SDK are required — the diff --git a/packages/core/README.md b/packages/core/README.md index 61f73ec..0ed4f0b 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -40,6 +40,7 @@ example, `python-redlines[docxodus]==0.3.0` and 3.0.0 bundles Docxodus v17.0.0 and adds one setting, `minimum_anchor_word_count`. Existing call signatures and settings are unchanged from 2.0.0, but comparison markup and revision counts can differ, and some very deeply nested documents are now refused. +It requires Python 3.11 or newer; 2.0.0 was the last release to support 3.9 and 3.10. Review representative redlines when upgrading; see the [3.0.0 migration guide](https://github.com/JSv4/Python-Redlines#upgrading-to-300). diff --git a/packages/core/pyproject.toml b/packages/core/pyproject.toml index 9cabd44..b223fa5 100644 --- a/packages/core/pyproject.toml +++ b/packages/core/pyproject.toml @@ -7,7 +7,7 @@ name = "python-redlines" dynamic = ["version", "optional-dependencies"] description = "Open-source DOCX comparison tool to generate native Word tracked changes (redlines) in Python without MS Word dependencies." readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.11" license = "MIT" keywords = [ "docx", @@ -30,10 +30,10 @@ classifiers = [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", ] dependencies = [ diff --git a/packages/docxodus/pyproject.toml b/packages/docxodus/pyproject.toml index b1a4543..15750cc 100644 --- a/packages/docxodus/pyproject.toml +++ b/packages/docxodus/pyproject.toml @@ -7,7 +7,7 @@ name = "python-redlines-docxodus" dynamic = ["version"] description = "Docxodus redline engine binary for python-redlines." readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.11" license = "MIT" authors = [ { name = "John Scrudato IV" }, diff --git a/packages/ooxmlpowertools/pyproject.toml b/packages/ooxmlpowertools/pyproject.toml index 4b09428..80f77b9 100644 --- a/packages/ooxmlpowertools/pyproject.toml +++ b/packages/ooxmlpowertools/pyproject.toml @@ -7,7 +7,7 @@ name = "python-redlines-ooxmlpowertools" dynamic = ["version"] description = "Open-XML-PowerTools redline engine binary for python-redlines." readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.11" license = "MIT" authors = [ { name = "John Scrudato IV" }, From 63a049829e122d9b0a34b8d61347d7a7e4fda096 Mon Sep 17 00:00:00 2001 From: JSv4 Date: Mon, 23 Nov 2026 23:03:59 -0600 Subject: [PATCH 4/5] chore: name Docxodus as the engine in the package descriptions The core description named no engine. The ooxmlpowertools wheel still contains that binary, so its description keeps the name but says it is deprecated and points to python-redlines-docxodus. Co-Authored-By: Claude Opus 5.5 --- packages/core/pyproject.toml | 2 +- packages/ooxmlpowertools/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/pyproject.toml b/packages/core/pyproject.toml index b223fa5..00749e9 100644 --- a/packages/core/pyproject.toml +++ b/packages/core/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "python-redlines" dynamic = ["version", "optional-dependencies"] -description = "Open-source DOCX comparison tool to generate native Word tracked changes (redlines) in Python without MS Word dependencies." +description = "Open-source DOCX comparison tool, powered by the Docxodus engine, to generate native Word tracked changes (redlines) in Python without MS Word dependencies." readme = "README.md" requires-python = ">=3.11" license = "MIT" diff --git a/packages/ooxmlpowertools/pyproject.toml b/packages/ooxmlpowertools/pyproject.toml index 80f77b9..6119241 100644 --- a/packages/ooxmlpowertools/pyproject.toml +++ b/packages/ooxmlpowertools/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "python-redlines-ooxmlpowertools" dynamic = ["version"] -description = "Open-XML-PowerTools redline engine binary for python-redlines." +description = "Deprecated Open-XML-PowerTools redline engine binary for python-redlines. Use python-redlines-docxodus, the current engine, instead." readme = "README.md" requires-python = ">=3.11" license = "MIT" From b7c69ea7f3a813ab63acea651adf1152fa260fa4 Mon Sep 17 00:00:00 2001 From: JSIV <5049984+JSv4@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:24:19 -0600 Subject: [PATCH 5/5] Update README with migration notes for 3.0.0 Clarify migration instructions for upgrading to 3.0.0. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9aa2818..283e349 100644 --- a/README.md +++ b/README.md @@ -344,7 +344,7 @@ setting is new. 5. **Consider `minimum_anchor_word_count=2`** if your documents number their entries on separate lines; see [Numbered entries](#numbered-entries). It needs the 3.0.0 engine. -If upgrading from 1.0.0 or earlier, also apply the steps below. +If upgrading from 1.0.0 or earlier, also review the migration notes below, but use 3.0.0 for their installation commands and companion version pins. ## Upgrading to 2.0.0