Skip to content

Commit 7f2654f

Browse files
docs: drop sphinx-pyproject; configure Sphinx directly in docs/conf.py
sphinx-pyproject has not been released in 3 years and does not support Python 3.14/3.15, which pins the docs build to an old Sphinx (8.2.3) and blocks the 3.15 CI work. Move its [tool.sphinx-pyproject] settings into a plain docs/conf.py and depend on Sphinx directly. - docs/conf.py: inline the former [tool.sphinx-pyproject] options; keep name/version/author single-sourced from pyproject.toml via stdlib tomllib. - pyproject.toml: remove the sphinx-pyproject dependency; add sphinx>=8.2 to the docs group. - uv.lock: relock (also picks up qiskit, which was missing from the lock). Verified locally: uv run sphinx-build -c docs . docs/_build/html succeeds on Sphinx 9.1.0 under CPython 3.14.
1 parent 63103f4 commit 7f2654f

3 files changed

Lines changed: 192 additions & 139 deletions

File tree

‎docs/conf.py‎

Lines changed: 110 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,111 @@
1-
from sphinx_pyproject import SphinxConfig
1+
"""Sphinx configuration for TheAlgorithms/Python.
22
3-
project = SphinxConfig("../pyproject.toml", globalns=globals()).name
3+
Migrated off ``sphinx-pyproject`` (unmaintained, no Python 3.14/3.15 support)
4+
to a plain Sphinx ``conf.py``. Project metadata (name/version/author) is still
5+
single-sourced from ``pyproject.toml`` via the stdlib ``tomllib`` parser; the
6+
rest of the options that used to live under ``[tool.sphinx-pyproject]`` are
7+
inlined below.
8+
"""
9+
10+
import tomllib
11+
from pathlib import Path
12+
13+
_pyproject_path = Path(__file__).parent.parent / "pyproject.toml"
14+
_project = tomllib.loads(_pyproject_path.read_text())["project"]
15+
16+
# -- Project information -----------------------------------------------------
17+
project = _project["name"]
18+
version = release = _project["version"]
19+
author = ", ".join(a["name"] for a in _project.get("authors", []) if "name" in a)
20+
copyright = "2014, TheAlgorithms" # noqa: A001
21+
22+
# -- General configuration ---------------------------------------------------
23+
extensions = [
24+
"autoapi.extension",
25+
"myst_parser",
26+
]
27+
28+
templates_path = ["_templates"]
29+
exclude_patterns = [
30+
".*/*",
31+
"docs/",
32+
]
33+
34+
source_suffix = {
35+
".rst": "restructuredtext",
36+
".md": "markdown",
37+
}
38+
39+
# -- autoapi (source tree -> API docs) ---------------------------------------
40+
autoapi_dirs = [
41+
"audio_filters",
42+
"backtracking",
43+
"bit_manipulation",
44+
"blockchain",
45+
"boolean_algebra",
46+
"cellular_automata",
47+
"ciphers",
48+
"computer_vision",
49+
"conversions",
50+
"data_compression",
51+
"data_structures",
52+
"digital_image_processing",
53+
"divide_and_conquer",
54+
"dynamic_programming",
55+
"electronics",
56+
"file_transfer",
57+
"financial",
58+
"fractals",
59+
"fuzzy_logic",
60+
"genetic_algorithm",
61+
"geodesy",
62+
"geometry",
63+
"graphics",
64+
"graphs",
65+
"greedy_methods",
66+
"hashes",
67+
"knapsack",
68+
"linear_algebra",
69+
"linear_programming",
70+
"machine_learning",
71+
"maths",
72+
"matrix",
73+
"networking_flow",
74+
"neural_network",
75+
"other",
76+
"physics",
77+
"project_euler",
78+
"quantum",
79+
"scheduling",
80+
"searches",
81+
"sorts",
82+
"strings",
83+
"web_programming",
84+
]
85+
autoapi_member_order = "groupwise"
86+
# autoapi_python_use_implicit_namespaces = True
87+
88+
# -- MyST (Markdown) ---------------------------------------------------------
89+
myst_enable_extensions = [
90+
"amsmath",
91+
"attrs_inline",
92+
"colon_fence",
93+
"deflist",
94+
"dollarmath",
95+
"fieldlist",
96+
"html_admonition",
97+
"html_image",
98+
# "linkify",
99+
"replacements",
100+
"smartquotes",
101+
"strikethrough",
102+
"substitution",
103+
"tasklist",
104+
]
105+
myst_fence_as_directive = [
106+
"include",
107+
]
108+
109+
# -- HTML output -------------------------------------------------------------
110+
html_theme = "alabaster"
111+
html_static_path = ["_static"]

‎pyproject.toml‎

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ dependencies = [
2525
"rich>=13.9.4",
2626
"scikit-learn>=1.5.2",
2727
"scipy>=1.16.2",
28-
"sphinx-pyproject>=0.3",
2928
"statsmodels>=0.14.4",
3029
"sympy>=1.13.3",
3130
"tweepy>=4.14",
@@ -40,8 +39,8 @@ test = [
4039
]
4140
docs = [
4241
"myst-parser>=4",
42+
"sphinx>=8.2",
4343
"sphinx-autoapi>=3.4",
44-
"sphinx-pyproject>=0.3",
4544
]
4645
euler-validate = [
4746
"httpx>=0.28.1",
@@ -185,86 +184,3 @@ report.omit = [
185184
"project_euler/*",
186185
]
187186
report.sort = "Cover"
188-
189-
[tool.sphinx-pyproject]
190-
copyright = "2014, TheAlgorithms"
191-
autoapi_dirs = [
192-
"audio_filters",
193-
"backtracking",
194-
"bit_manipulation",
195-
"blockchain",
196-
"boolean_algebra",
197-
"cellular_automata",
198-
"ciphers",
199-
"computer_vision",
200-
"conversions",
201-
"data_compression",
202-
"data_structures",
203-
"digital_image_processing",
204-
"divide_and_conquer",
205-
"dynamic_programming",
206-
"electronics",
207-
"file_transfer",
208-
"financial",
209-
"fractals",
210-
"fuzzy_logic",
211-
"genetic_algorithm",
212-
"geodesy",
213-
"geometry",
214-
"graphics",
215-
"graphs",
216-
"greedy_methods",
217-
"hashes",
218-
"knapsack",
219-
"linear_algebra",
220-
"linear_programming",
221-
"machine_learning",
222-
"maths",
223-
"matrix",
224-
"networking_flow",
225-
"neural_network",
226-
"other",
227-
"physics",
228-
"project_euler",
229-
"quantum",
230-
"scheduling",
231-
"searches",
232-
"sorts",
233-
"strings",
234-
"web_programming",
235-
]
236-
autoapi_member_order = "groupwise"
237-
# autoapi_python_use_implicit_namespaces = true
238-
exclude_patterns = [
239-
".*/*",
240-
"docs/",
241-
]
242-
extensions = [
243-
"autoapi.extension",
244-
"myst_parser",
245-
]
246-
html_static_path = [ "_static" ]
247-
html_theme = "alabaster"
248-
myst_enable_extensions = [
249-
"amsmath",
250-
"attrs_inline",
251-
"colon_fence",
252-
"deflist",
253-
"dollarmath",
254-
"fieldlist",
255-
"html_admonition",
256-
"html_image",
257-
# "linkify",
258-
"replacements",
259-
"smartquotes",
260-
"strikethrough",
261-
"substitution",
262-
"tasklist",
263-
]
264-
myst_fence_as_directive = [
265-
"include",
266-
]
267-
templates_path = [ "_templates" ]
268-
source_suffix.".rst" = "restructuredtext"
269-
source_suffix.".md" = "markdown"
270-
# ".txt" = "markdown"

0 commit comments

Comments
 (0)