Skip to content

Commit 9926a7c

Browse files
committed
Restore Python 3.10 support with version-specific Sphinx 8 handling
- Add Python 3.10 support back (removed in v1.1.0, EOL October 2026) - Update test matrix to 11 environments (exclude py313-sphinx6 due to deprecation warnings) - Implement version-specific Sphinx 8 constraints in tox.ini: * Python 3.10 limited to Sphinx 8.1.x (max 8.1.3) * Python 3.11+ uses Sphinx 8.2+ (Sphinx 8.2.0+ requires Python >=3.11) - Add version detection logic to test files for fixture selection - Create .sphinx8.1 fixtures for Python 3.10/Sphinx 8.1.x compatibility - Update CI workflow to include Python 3.10 in test matrix - Document changes in CHANGELOG.md with version limitations
1 parent 73aee15 commit 9926a7c

File tree

55 files changed

+1077
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1077
-17
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
python-version: ["3.11", "3.12", "3.13"]
26+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2727
sphinx-version: ["6", "7", "8"]
28+
exclude:
29+
# Python 3.13 with Sphinx 6 generates many deprecation warnings
30+
# from Sphinx's use of deprecated datetime methods. Unlikely combination.
31+
- python-version: "3.13"
32+
sphinx-version: "6"
2833
steps:
2934
- uses: actions/checkout@v4
3035
- name: Set up Python ${{ matrix.python-version }}
@@ -42,10 +47,10 @@ jobs:
4247
- name: Create cov
4348
run: coverage xml
4449
- name: Upload to Codecov
45-
if: false && (matrix.python-version == '3.11' && matrix.sphinx-version == '8')
50+
if: false && (matrix.python-version == '3.10' && matrix.sphinx-version == '8')
4651
uses: codecov/codecov-action@v4
4752
with:
48-
name: sphinx-exercise-pytest-py3.11-sphinx8
53+
name: sphinx-exercise-pytest-py3.10-sphinx8
4954
token: "${{ secrets.CODECOV_TOKEN }}"
5055
flags: pytests
5156
file: ./coverage.xml
@@ -56,10 +61,10 @@ jobs:
5661
runs-on: ubuntu-latest
5762
steps:
5863
- uses: actions/checkout@v4
59-
- name: Set up Python 3.11
64+
- name: Set up Python 3.10
6065
uses: actions/setup-python@v4
6166
with:
62-
python-version: "3.11"
67+
python-version: "3.10"
6368
- name: Install dependencies
6469
run: |
6570
python -m pip install --upgrade pip
@@ -78,10 +83,10 @@ jobs:
7883
steps:
7984
- name: Checkout source
8085
uses: actions/checkout@v4
81-
- name: Set up Python 3.11
86+
- name: Set up Python 3.10
8287
uses: actions/setup-python@v4
8388
with:
84-
python-version: "3.11"
89+
python-version: "3.10"
8590
- name: Build package
8691
run: |
8792
pip install wheel build

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Improved 👌
6+
7+
- **Restored Python 3.10 support** - Re-added compatibility with Python 3.10 as it remains actively supported until October 2026
8+
- Updated test matrix to include Python 3.10 with Sphinx 6, 7, and 8
9+
- Test matrix now covers 11 combinations (excludes Python 3.13 + Sphinx 6 due to deprecation warnings)
10+
- **Note**: Python 3.10 is limited to Sphinx 8.1.x (max 8.1.3) due to Sphinx 8.2+ requiring Python >=3.11. This is handled automatically in the test configuration.
11+
312
## [v1.1.0](https://github.com/executablebooks/sphinx-exercise/tree/v1.1.0) (2025-10-22)
413

514
### New ✨

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "A Sphinx extension for producing exercises and solutions."
99
readme = "README.md"
1010
license = { file = "LICENSE" }
11-
requires-python = ">=3.11"
11+
requires-python = ">=3.10"
1212
authors = [
1313
{ name = "QuantEcon", email = "[email protected]" },
1414
]
@@ -22,6 +22,7 @@ classifiers = [
2222
"Natural Language :: English",
2323
"Operating System :: OS Independent",
2424
"Programming Language :: Python",
25+
"Programming Language :: Python :: 3.10",
2526
"Programming Language :: Python :: 3.11",
2627
"Programming Language :: Python :: 3.12",
2728
"Programming Language :: Python :: 3.13",

tests/test_exercise_references.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
import pytest
33
import sphinx
44

5-
SPHINX_VERSION = f".sphinx{sphinx.version_info[0]}"
5+
# Sphinx 8.1.x (Python 3.10 only) has different XML output than 8.2+
6+
# Use .sphinx8.1 for 8.1.x, .sphinx8 for 8.2+ (the standard)
7+
if sphinx.version_info[0] == 8 and sphinx.version_info[1] == 1:
8+
SPHINX_VERSION = f".sphinx{sphinx.version_info[0]}.{sphinx.version_info[1]}"
9+
else:
10+
SPHINX_VERSION = f".sphinx{sphinx.version_info[0]}"
611

712

813
@pytest.mark.sphinx("html", testroot="mybook")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<p>This is a reference <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">Exercise 1</span></a>.</p>
2+
<p>This is a second reference <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some text 1</span></a>.</p>
3+
<p>This is a third reference <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some text 1</span></a>.</p>
4+
<p>This is a fourth reference <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some text Exercise</span></a>.</p>
5+
<p class="topless"><a href="_enum_numref_title.html" title="previous chapter">_enum_numref_title</a></p>
6+
<p class="topless"><a href="_unenum_mathtitle_label.html" title="next chapter">_unenum_mathtitle_label</a></p>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<p>This is a reference <a class="reference internal" href="_enum_notitle_label.html#text-exc-notitle"><span class="std std-numref">Exercise 2</span></a>.</p>
2+
<p>This is a second reference <a class="reference internal" href="_enum_notitle_label.html#text-exc-notitle"><span class="std std-numref">some text 2</span></a>.</p>
3+
<p>This is a third reference <a class="reference internal" href="_enum_notitle_label.html#text-exc-notitle"><span class="std std-numref">some text 2</span></a>.</p>
4+
<p>This is a fourth reference <a class="reference internal" href="_enum_notitle_label.html#text-exc-notitle"><span class="std std-numref">some text Exercise</span></a>.</p>
5+
<p class="topless"><a href="_enum_ref_mathtitle.html" title="previous chapter">_enum_ref_mathtitle</a></p>
6+
<p class="topless"><a href="_enum_numref_title.html" title="next chapter">_enum_numref_title</a></p>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<p>This reference does not include math <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some 3 text %s test Exercise</span></a>.</p>
2+
<p>This reference does not include math <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some 3 text %s test</span></a>.</p>
3+
<p>This reference does not include math <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some Exercise text %s test</span></a>.</p>
4+
<p>This reference does not include math <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some Exercise text 3 test</span></a>.</p>
5+
<p>This reference does not include math <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some 3 text test</span></a>.</p>
6+
<p>This reference includes math <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some 1 text %s test Exercise</span></a>.</p>
7+
<p>This reference includes math <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some 1 text %s test</span></a>.</p>
8+
<p>This reference includes math <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some Exercise text %s test</span></a>.</p>
9+
<p>This reference includes math <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some Exercise text 1 test</span></a>.</p>
10+
<p>This reference includes math <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">some 1 text test</span></a>.</p>
11+
<p class="topless"><a href="_unenum_numref_mathtitle.html" title="previous chapter">_unenum_numref_mathtitle</a></p>
12+
<p class="topless"><a href="_enum_duplicate_label.html" title="next chapter">_enum_duplicate_label</a></p>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<p>This is a reference <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">Exercise 3</span></a>.</p>
2+
<p>This is a second reference <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some text 3</span></a>.</p>
3+
<p>This is a third reference <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some text 3</span></a>.</p>
4+
<p>This is a fourth reference <a class="reference internal" href="_enum_title_class_label.html#test-exc-label"><span class="std std-numref">some text Exercise</span></a>.</p>
5+
<p class="topless"><a href="_enum_numref_notitle.html" title="previous chapter">_enum_numref_notitle</a></p>
6+
<p class="topless"><a href="_enum_numref_mathtitle.html" title="next chapter">_enum_numref_mathtitle</a></p>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p>This is a reference <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-numref">Exercise 1</span></a>.</p>
2+
<p>This is a second reference <a class="reference internal" href="_enum_mathtitle_label.html#test-exc-label-math"><span class="std std-ref">some text</span></a>.</p>
3+
<p class="topless"><a href="_enum_ref_title.html" title="previous chapter">_enum_ref_title</a></p>
4+
<p class="topless"><a href="_enum_numref_notitle.html" title="next chapter">_enum_numref_notitle</a></p>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p>This is a reference <a class="reference internal" href="_enum_notitle_label.html#text-exc-notitle"><span class="std std-numref">Exercise 2</span></a>.</p>
2+
<p>This is a second reference <a class="reference internal" href="_enum_notitle_label.html#text-exc-notitle"><span class="std std-ref">some text</span></a>.</p>
3+
<p class="topless"><a href="_enum_title_nolabel.html" title="previous chapter">_enum_title_nolabel</a></p>
4+
<p class="topless"><a href="_enum_ref_title.html" title="next chapter">_enum_ref_title</a></p>

0 commit comments

Comments
 (0)