« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 1577 ms

🔧 Build the docs on Python 3.13 and Sphinx 9, add Python 3.14 (#462) · executablebooks/markdown-it-py@95a215e

Source: https://github.com/executablebooks/markdown-it-py/commit/95a215eaba31abddcad97d701ee7fd9dbd4d2620

Repository navigation

Commit 95a215e


Browse files
chrisjsewell authored 🔧 Build the docs on Python 3.13 and Sphinx 9, add Python 3.14 (#462 ) ## What and why **Docs (Read the Docs).** `docs/requirements.txt` pinned MyST-Parser to its `update-markdown-parser` git branch until a release allowed markdown-it-py v4. myst-parser 5 does, so the pin and its `.readthedocs.yml` line are removed. myst-parser 5 needs Python >= 3.11, so on 3.10 the `rtd` extra no longer resolves (`uv pip compile --python-version 3.10` gives "No solution found"). RTD therefore moves to `ubuntu-24.04` and Python `"3.13"`. On 3.13 the `rtd` extra resolves to Sphinx 9.2.0, myst-parser 5.1.0 and docutils 0.22.4, which the docs had never been built with, and `docs/conf.py` needed three fixes: - `run_apidoc` used `sphinx.ext.apidoc.OPTIONS`, which is gone from Sphinx 8.2 (`sphinx.ext.apidoc` became a package), so the build crashed with an `AttributeError`. `ignore-module-all` is now set through `autodoc_default_options`, which applies it to every `automodule`, as the old code did. (Sphinx's `--automodule-options` flag is not a substitute: Sphinx 9.2 ignores it for package files, so `markdown_it.rst` documented `MarkdownIt` a second time and nine ambiguous-reference warnings followed.) - `Token` gets a one-line docstring. Without one, autodoc reads the signature from the docstring that `dataclass` generates, whose annotations are strings it cannot resolve (`'dict[str` and `'dict[Any` reference warnings). - The Python intersphinx inventory moves from 3.10 to 3.13: the 3.10 inventory has no `re.Pattern` class, which the annotations of the parser modules use. **Python versions.** 3.14 is added to the `tests` matrix, the tox test environments and the classifiers. 3.10 stays. The PyPy cell moves from `pypy-3.10` to `pypy-3.11`: PyPy 3.10's last release was 7.3.19. ## How it was tested - Docs, the way RTD builds them: fresh clone of this branch, fresh Python 3.13.13 venv, `python -m pip install ".[linkify,rtd]"`, then from `docs/` `python -m sphinx -T -nW --keep-going -b html -d _build/doctrees -D language=en . <out>`: **green, 0 warnings** (Sphinx 9.2.0, myst-parser 5.1.0, docutils 0.22.4, sphinx-book-theme 1.4.0, mdit-py-plugins 0.6.1). Both intersphinx inventories loaded; nothing was ignored. - The same build before each fix: master's `conf.py` crashes (`AttributeError: module 'sphinx.ext.apidoc' has no attribute 'OPTIONS'`); with `--automodule-options` instead, 12 warnings; with `autodoc_default_options`, 3 warnings (`re.Pattern`, `'dict[str`, `'dict[Any`); with the docstring and the 3.13 inventory, 0. - Tests, as CI runs them (`pip install -e .[testing,linkify]`, `get_cmark_spec.py`, `pytest tests/ --cov=markdown_it`): CPython 3.14.7 1032 passed; PyPy 3.11.17 (PyPy 8.0.1) 1032 passed. `tox -e py314` and `tox -e py310` (tox-uv): 1032 passed each. - `pre-commit run --all-files`: all hooks pass. ## Notes for the reviewer - The tox `envlist` stays `py310`: 3.14 is added to the four `py{...}` factor lists, which is what makes `tox -e py314` (and `py314-plugins`, `-bench-*`) work. Adding `py314` to `envlist` would make a bare `tox` fail on machines without 3.14. - The tox `docs-{update,clean}` envs have no `basepython`, so they now need Python >= 3.11 to resolve, like RTD. - A few long signatures render as plain text rather than linked parameters (e.g. `Token`, whose `nesting: Literal[-1, 0, 1]` Sphinx 9.2 does not parse); no warning is emitted. This is cosmetic and left alone here. - No 3.15 yet: it is added once there is a green cell for it.
1 parent dc2b933 commit 95a215e

7 files changed

Lines changed: 15 additions & 12 deletions

File tree

‎.github/workflows/tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ jobs:
35 35 strategy:
36 36 fail-fast: false
37 37 matrix:
38 - python-version: ['pypy-3.10', '3.10', '3.11', '3.12', '3.13']
38 + python-version: ['pypy-3.11', '3.10', '3.11', '3.12', '3.13', '3.14']
39 39
40 40 steps:
41 41 - uses: actions/checkout@v7

‎.readthedocs.yml‎

Lines changed: 2 additions & 3 deletions
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
1 1 version: 2
2 2
3 3 build:
4 - os: ubuntu-22.04
4 + os: ubuntu-24.04
5 5 tools:
6 - python: "3.10"
6 + python: "3.13"
7 7
8 8 python:
9 9 install:
10 - - requirements: docs/requirements.txt
11 10 - method: pip
12 11 path: .
13 12 extra_requirements:

‎docs/conf.py‎

Lines changed: 5 additions & 2 deletions
Original file line number Diff line number Diff line change
@@ -86,8 +86,12 @@
86 86 # html_static_path = ["_static"]
87 87
88 88
89 +# document each object where it is defined, not where it is re-exported via __all__
90 +# (set here rather than through sphinx.ext.apidoc.OPTIONS, which Sphinx 8.2 removed)
91 +autodoc_default_options = {"ignore-module-all": True}
92 +
89 93 intersphinx_mapping = {
90 - "python": ("https://docs.python.org/3.10", None),
94 + "python": ("https://docs.python.org/3.13", None),
91 95 "mdit-py-plugins": ("https://mdit-py-plugins.readthedocs.io/en/latest/", None),
92 96 }
93 97
@@ -129,7 +133,6 @@ def run_apidoc(app):
129 133
130 134 argv = ["-M", "--separate", "-o", api_folder, module_path, *ignore_paths]
131 135
132 - apidoc.OPTIONS.append("ignore-module-all")
133 136 apidoc.main(argv)
134 137
135 138 # we don't use this

‎docs/requirements.txt‎

Lines changed: 0 additions & 2 deletions This file was deleted.

‎markdown_it/token.py‎

Lines changed: 2 additions & 0 deletions
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ def convert_attrs(value: Any) -> Any:
20 20
21 21 @dc.dataclass(slots=True)
22 22 class Token:
23 + """A single token in the stream produced by the parser."""
24 +
23 25 type: str
24 26 """Type of the token (string, e.g. "paragraph_open")"""
25 27

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ classifiers = [
18 18 "Programming Language :: Python :: 3.11",
19 19 "Programming Language :: Python :: 3.12",
20 20 "Programming Language :: Python :: 3.13",
21 + "Programming Language :: Python :: 3.14",
21 22 "Programming Language :: Python :: Implementation :: CPython",
22 23 "Programming Language :: Python :: Implementation :: PyPy",
23 24 "Topic :: Software Development :: Libraries :: Python Modules",

‎tox.ini‎

Lines changed: 4 additions & 4 deletions
Original file line number Diff line number Diff line change
@@ -9,13 +9,13 @@ envlist = py310
9 9 [testenv]
10 10 usedevelop = true
11 11
12 -[testenv:py{310,311,312,313}]
12 +[testenv:py{310,311,312,313,314}]
13 13 extras =
14 14 linkify
15 15 testing
16 16 commands = pytest {posargs:tests/}
17 17
18 -[testenv:py{310,311,312,313}-plugins]
18 +[testenv:py{310,311,312,313,314}-plugins]
19 19 extras = testing
20 20 changedir = {envtmpdir}
21 21 allowlist_externals =
@@ -27,11 +27,11 @@ commands_pre =
27 27 commands =
28 28 pytest {posargs}
29 29
30 -[testenv:py{310,311,312,313}-bench-core]
30 +[testenv:py{310,311,312,313,314}-bench-core]
31 31 extras = benchmarking
32 32 commands = pytest benchmarking/bench_core.py {posargs}
33 33
34 -[testenv:py{310,311,312,313}-bench-packages]
34 +[testenv:py{310,311,312,313,314}-bench-packages]
35 35 extras = benchmarking,compare
36 36 commands = pytest benchmarking/bench_packages.py {posargs}
37 37