Skip to content

Commit 401e08c

Browse files
authored
⬆️ Support python>=3.10, sphinx >=7,<9, docutils>=0.19,<0.22 (#952)
dropping support for lower versions
1 parent d3d7fbb commit 401e08c

30 files changed

+175
-229
lines changed

.github/workflows/test-formats.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v4
22-
- name: Set up Python 3.9
22+
- name: Set up Python 3.10
2323
uses: actions/setup-python@v5
2424
with:
25-
python-version: 3.9
25+
python-version: "3.10"
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
@@ -43,34 +43,33 @@ jobs:
4343

4444
steps:
4545
- uses: actions/checkout@v4
46-
- name: Set up Python 3.9
46+
- name: Set up Python 3.10
4747
uses: actions/setup-python@v5
4848
with:
49-
python-version: 3.9
49+
python-version: "3.10"
5050
- name: Install dependencies
5151
run: |
5252
python -m pip install --upgrade pip
5353
pip install -e .[linkify,rtd]
5454
- name: Build docs
5555
run: |
5656
sphinx-build -nW --keep-going -b ${{ matrix.format }} docs/ docs/_build/${{ matrix.format }}
57-
# TODO https://github.com/sphinx-doc/sphinx/issues/12594
58-
# - name: Make PDF
59-
# uses: xu-cheng/latex-action@v2
60-
# with:
61-
# working_directory: docs/_build/latex
62-
# root_file: "mystparser.tex"
63-
# # https://github.com/marketplace/actions/github-action-for-latex#it-fails-due-to-xindy-cannot-be-found
64-
# pre_compile: |
65-
# ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/xindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/xindy
66-
# ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/texindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/texindy
67-
# wget https://sourceforge.net/projects/xindy/files/xindy-source-components/2.4/xindy-kernel-3.0.tar.gz
68-
# tar xf xindy-kernel-3.0.tar.gz
69-
# cd xindy-kernel-3.0/src
70-
# apk add make
71-
# apk add clisp --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
72-
# make
73-
# cp -f xindy.mem /opt/texlive/texdir/bin/x86_64-linuxmusl/
74-
# cd ../../
75-
# env:
76-
# XINDYOPTS: -L english -C utf8 -M sphinx.xdy
57+
- name: Make PDF
58+
uses: xu-cheng/latex-action@v2
59+
with:
60+
working_directory: docs/_build/latex
61+
root_file: "mystparser.tex"
62+
# https://github.com/marketplace/actions/github-action-for-latex#it-fails-due-to-xindy-cannot-be-found
63+
pre_compile: |
64+
ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/xindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/xindy
65+
ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/texindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/texindy
66+
wget https://sourceforge.net/projects/xindy/files/xindy-source-components/2.4/xindy-kernel-3.0.tar.gz
67+
tar xf xindy-kernel-3.0.tar.gz
68+
cd xindy-kernel-3.0/src
69+
apk add make
70+
apk add clisp --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
71+
make
72+
cp -f xindy.mem /opt/texlive/texdir/bin/x86_64-linuxmusl/
73+
cd ../../
74+
env:
75+
XINDYOPTS: -L english -C utf8 -M sphinx.xdy

.github/workflows/tests.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,32 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v4
17-
- name: Set up Python 3.9
17+
- name: Set up Python 3.10
1818
uses: actions/setup-python@v5
1919
with:
20-
python-version: "3.9"
20+
python-version: "3.10"
2121
- uses: pre-commit/action@v3.0.1
2222

2323
tests:
2424

2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
29-
sphinx: [">=7,<8"]
28+
python-version: ["3.10", "3.11", "3.12"]
29+
sphinx: [">=8,<9"]
3030
os: [ubuntu-latest]
3131
include:
3232
- os: ubuntu-latest
33-
python-version: "3.8"
34-
sphinx: ">=6,<7"
33+
python-version: "3.10"
34+
sphinx: ">=7,<8"
3535
- os: windows-latest
36-
python-version: "3.8"
37-
sphinx: ">=6,<7"
36+
python-version: "3.10"
37+
sphinx: ">=7,<8"
3838

3939
runs-on: ${{ matrix.os }}
4040

41+
name: "pytest: py${{ matrix.python-version }}, sphinx${{ matrix.sphinx }}, on ${{ matrix.os }}"
42+
4143
steps:
4244
- uses: actions/checkout@v4
4345
- name: Set up Python ${{ matrix.python-version }}
@@ -53,7 +55,7 @@ jobs:
5355
pytest --cov=myst_parser --cov-report=xml --cov-report=term-missing
5456
coverage xml
5557
- name: Upload to Codecov
56-
if: github.repository == 'executablebooks/MyST-Parser' && matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest'
58+
if: github.repository == 'executablebooks/MyST-Parser' && matrix.python-version == 3.10 && matrix.os == 'ubuntu-latest'
5759
uses: codecov/codecov-action@v4
5860
with:
5961
token: ${{ secrets.CODECOV_TOKEN }}
@@ -70,15 +72,15 @@ jobs:
7072
strategy:
7173
fail-fast: false
7274
matrix:
73-
docutils-version: ["0.18", "0.19", "0.20", "0.21"]
75+
docutils-version: ["0.19", "0.20", "0.21"]
7476

7577
steps:
7678
- name: Checkout source
7779
uses: actions/checkout@v4
78-
- name: Set up Python 3.9
80+
- name: Set up Python 3.10
7981
uses: actions/setup-python@v5
8082
with:
81-
python-version: "3.9"
83+
python-version: "3.10"
8284
- name: Install setup
8385
run: |
8486
python -m pip install --upgrade pip
@@ -130,10 +132,10 @@ jobs:
130132
steps:
131133
- name: Checkout source
132134
uses: actions/checkout@v4
133-
- name: Set up Python 3.8
135+
- name: Set up Python 3.10
134136
uses: actions/setup-python@v5
135137
with:
136-
python-version: "3.8"
138+
python-version: "3.10"
137139
- name: install flit
138140
run: |
139141
pip install flit~=3.4
@@ -153,10 +155,10 @@ jobs:
153155
steps:
154156
- name: Checkout source
155157
uses: actions/checkout@v4
156-
- name: Set up Python 3.8
158+
- name: Set up Python 3.10
157159
uses: actions/setup-python@v5
158160
with:
159-
python-version: "3.8"
161+
python-version: "3.10"
160162
- name: install flit and tomlkit
161163
run: |
162164
pip install flit~=3.4 tomlkit

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.5.2
24+
rev: v0.5.5
2525
hooks:
2626
- id: ruff
2727
args: [--fix]
2828
- id: ruff-format
2929

3030
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.10.1
31+
rev: v1.11.1
3232
hooks:
3333
- id: mypy
3434
args: [--config-file=pyproject.toml]

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.9"
6+
python: "3.10"
77

88
python:
99
install:

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ with some minor changes to parsing behaviour:
6969
* No significant changes, see <https://docutils.sourceforge.io/RELEASE-NOTES.html#release-0-20-2023-05-04>
7070

7171
* ⬆️ UPGRADE: Add support for `sphinx` v7, and remove v5 support (<gh-pr:776>)
72-
* No significant changes, see <https://www.sphinx-doc.org/en/master/changes.html>
72+
* No significant changes, see <https://www.sphinx-doc.org/en/master/changes/index.html>
7373

7474
* ⬆️ UPGRADE: Remove Python 3.7 support and add testing for Python 3.11 (<gh-pr:772>)
7575

docs/conf.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7-
import hashlib
87
from datetime import date
9-
from pathlib import Path
108

119
from sphinx.application import Sphinx
1210

@@ -56,7 +54,7 @@
5654
suppress_warnings = ["myst.strikethrough"]
5755

5856
intersphinx_mapping = {
59-
"python": ("https://docs.python.org/3.7", None),
57+
"python": ("https://docs.python.org/3.10", None),
6058
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
6159
"markdown_it": ("https://markdown-it-py.readthedocs.io/en/latest", None),
6260
}
@@ -234,16 +232,4 @@ def setup(app: Sphinx):
234232
app.add_directive("myst-to-html", MystToHTMLDirective)
235233
app.add_post_transform(StripUnsupportedLatex)
236234
app.add_post_transform(NumberSections)
237-
app.connect("html-page-context", add_version_to_css)
238235
app.add_lexer("myst", MystLexer)
239-
240-
241-
def add_version_to_css(app: Sphinx, pagename, templatename, context, doctree):
242-
"""Add the version number to the local.css file, to bust the cache for changes."""
243-
if app.builder.name != "html":
244-
return
245-
if "_static/local.css" in context.get("css_files", {}):
246-
css = Path(app.srcdir, "_static/local.css").read_text("utf8")
247-
hashed = hashlib.sha256(css.encode("utf-8")).hexdigest()
248-
index = context["css_files"].index("_static/local.css")
249-
context["css_files"][index] = f"_static/local.css?hash={hashed}"

docs/index.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,6 @@ to modify parsing behaviour and access extended syntax features.
102102
[Convert existing ReStructuredText files to Markdown][rst-to-myst]
103103
: Use the [rst-to-myst] CLI or [the MySTyc interactive web interface](https://astrojuanlu.github.io/mystyc/).
104104

105-
[MyST-NB](https://myst-nb.readthedocs.io)
106-
: A Sphinx and Docutils extension for compiling Jupyter Notebooks into high quality documentation formats, built on top of the MyST-Parser.
107-
108-
[Jupyter Book](https://jupyterbook.org)
109-
: An open source project for building beautiful, publication-quality books and documents from computational material, built on top of the MyST-Parser and MyST-NB.
110-
111-
[The Jupyter Book gallery](https://executablebooks.org/en/latest/gallery)
112-
: Examples of documents built with MyST.
113-
114-
[Javascript MyST parser][mystjs]
115-
: The [mystjs] Javascript parser, allows you to parse MyST in websites.
116-
117105
[markdown-it-py]
118106
: A CommonMark-compliant and extensible Markdown parser, used by MyST-Parser to parse source text to tokens.
119107

@@ -182,4 +170,3 @@ apidocs/index.rst
182170
[markdown-it-py]: https://markdown-it-py.readthedocs.io/
183171
[markdown-it]: https://markdown-it.github.io/
184172
[rst-to-myst]: https://rst-to-myst.readthedocs.io
185-
[mystjs]: https://github.com/executablebooks/mystjs

myst_parser/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Helpers for cross compatibility across dependency versions."""
22

3-
from typing import Callable, Iterable
3+
from collections.abc import Callable, Iterable
44

55
from docutils.nodes import Element
66

myst_parser/_docs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import contextlib
66
import io
7-
from typing import Sequence, Union, get_args, get_origin
7+
from collections.abc import Sequence
8+
from typing import Union, get_args, get_origin
89

910
from docutils import nodes
1011
from docutils.core import Publisher
@@ -28,7 +29,7 @@ class StripUnsupportedLatex(SphinxPostTransform):
2829

2930
default_priority = 900
3031

31-
def run(self):
32+
def run(self, **kwargs):
3233
if self.app.builder.format != "latex":
3334
return
3435
from docutils import nodes
@@ -46,7 +47,7 @@ class NumberSections(SphinxPostTransform):
4647
default_priority = 710 # same as docutils.SectNum
4748
formats = ("html",)
4849

49-
def run(self):
50+
def run(self, **kwargs):
5051
min_heading_level = 2
5152
max_heading_level = 3
5253
stack: list[tuple[list[int], nodes.Element]] = [([], self.document)]

myst_parser/config/dc_validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from __future__ import annotations
44

55
import dataclasses as dc
6-
from typing import Any, Protocol, Sequence
6+
from collections.abc import Sequence
7+
from typing import Any, Protocol
78

89

910
def validate_field(inst: Any, field: dc.Field, value: Any) -> None:

0 commit comments

Comments
 (0)