Skip to content

Commit 53dc18a

Browse files
tonybaloneyCopilot
andauthored
Modernize Sphinx docs build and ReadTheDocs config (#253)
- conf.py: Remove boilerplate (LaTeX, epub, texinfo, man page configs) - conf.py: Fix language = None to language = 'en' (Sphinx 9 warning) - conf.py: Update sphinx_click.ext to sphinx_click (modern module name) - conf.py: Remove unused extensions (doctest, coverage) - conf.py: Gracefully handle missing wily import (for RTD builds where the Rust backend is not compiled) - requirements_docs.txt: Remove v1 deps (progress, colorlog, tabulate, dataclasses, radon, gitpython, plotly, wily itself) - requirements_docs.txt: Pin sphinx and sphinx-click with version ranges - readthedocs.yml: Update to v2 config format with Python 3.12 - ci.rst: Fix title underline length warning Sphinx build now passes with -W (warnings as errors). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 73d1097 commit 53dc18a

4 files changed

Lines changed: 22 additions & 165 deletions

File tree

docs/requirements_docs.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
wily
2-
sphinx
3-
sphinx-click
4-
click
5-
progress
6-
colorlog
7-
plotly
8-
tabulate
9-
dataclasses
10-
radon
11-
gitpython
12-
urllib3>=2.6.3 # not directly required, pinned by Snyk to avoid a vulnerability
1+
sphinx>=7,<9
2+
sphinx-click>=5,<7
3+
click>=7,<9

docs/source/ci.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Wily can be called after your tests have completed.
6868
6969
7070
GitHub Workflows
71-
+++++++++
71+
++++++++++++++++
7272

7373
When using Wily in a Github Workflows, you need to specify to the checkout step to check out the head of the branch and not the merge commit
7474

docs/source/conf.py

Lines changed: 9 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
#
2-
# Configuration file for the Sphinx documentation builder.
3-
#
4-
# This file does only contain a selection of the most common options. For a
5-
# full list see the documentation:
6-
# http://www.sphinx-doc.org/en/master/config
7-
8-
# -- Path setup --------------------------------------------------------------
9-
10-
# If extensions (or modules to document with autodoc) are in another directory,
11-
# add these directories to sys.path here. If the directory is relative to the
12-
# documentation root, use os.path.abspath to make it absolute, like shown here.
13-
#
14-
"""Docstring to fix pydocstyle D100 Missing docstring in public module."""
1+
"""Sphinx configuration for wily documentation."""
152

163
import os.path
174
import sys
@@ -24,74 +11,35 @@
2411
copyright = "2018, Anthony Shaw"
2512
author = "Anthony Shaw"
2613

27-
# The short X.Y version
28-
import wily
14+
try:
15+
import wily
2916

30-
version = wily.__version__
31-
# The full version, including alpha/beta/rc tags
32-
release = "develop"
17+
version = wily.__version__
18+
except ImportError:
19+
version = "dev"
3320

21+
release = version
3422

3523
# -- General configuration ---------------------------------------------------
3624

37-
# If your documentation needs a minimal Sphinx version, state it here.
38-
#
39-
# needs_sphinx = '1.0'
40-
41-
# Add any Sphinx extension module names here, as strings. They can be
42-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
43-
# ones.
4425
extensions = [
45-
"sphinx_click.ext",
26+
"sphinx_click",
4627
"sphinx.ext.autodoc",
47-
"sphinx.ext.doctest",
4828
"sphinx.ext.todo",
49-
"sphinx.ext.coverage",
5029
"sphinx.ext.viewcode",
5130
"sphinx.ext.githubpages",
5231
]
5332

54-
# Add any paths that contain templates here, relative to this directory.
5533
templates_path = ["_templates"]
56-
57-
# The suffix(es) of source filenames.
58-
# You can specify multiple suffix as a list of string:
59-
#
60-
# source_suffix = ['.rst', '.md']
6134
source_suffix = ".rst"
62-
63-
# The master toctree document.
6435
master_doc = "index"
65-
66-
# The language for content autogenerated by Sphinx. Refer to documentation
67-
# for a list of supported languages.
68-
#
69-
# This is also used if you do content translation via gettext catalogs.
70-
# Usually you set "language" from the command line for these cases.
71-
language = None
72-
73-
# List of patterns, relative to source directory, that match files and
74-
# directories to ignore when looking for source files.
75-
# This pattern also affects html_static_path and html_extra_path.
36+
language = "en"
7637
exclude_patterns = []
7738

78-
# The name of the Pygments (syntax highlighting) style to use.
79-
pygments_style = None
80-
81-
8239
# -- Options for HTML output -------------------------------------------------
8340

84-
# The theme to use for HTML and HTML Help pages. See the documentation for
85-
# a list of builtin themes.
86-
#
8741
html_theme = "alabaster"
8842

89-
# Theme options are theme-specific and customize the look and feel of a theme
90-
# further. For a list of options available for each theme, see the
91-
# documentation.
92-
#
93-
# html_theme_options = {}
94-
9543
html_theme_options = {
9644
"logo": "logo_below.png",
9745
"logo_name": False,
@@ -107,102 +55,14 @@
10755
},
10856
}
10957

110-
# Add any paths that contain custom static files (such as style sheets) here,
111-
# relative to this directory. They are copied after the builtin static files,
112-
# so a file named "default.css" will overwrite the builtin "default.css".
11358
html_static_path = ["_static"]
11459

115-
# Custom sidebar templates, must be a dictionary that maps document names
116-
# to template names.
117-
#
118-
# The default sidebars (for documents that don't match any pattern) are
119-
# defined by theme itself. Builtin themes are using these templates by
120-
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
121-
# 'searchbox.html']``.
122-
#
123-
# html_sidebars = {}
12460
html_sidebars = {
12561
"**": ["about.html", "navigation.html", "searchbox.html"],
12662
}
12763

128-
129-
# -- Options for HTMLHelp output ---------------------------------------------
130-
131-
# Output file base name for HTML help builder.
13264
htmlhelp_basename = "wilydoc"
13365

134-
135-
# -- Options for LaTeX output ------------------------------------------------
136-
137-
latex_elements = {
138-
# The paper size ('letterpaper' or 'a4paper').
139-
#
140-
# 'papersize': 'letterpaper',
141-
# The font size ('10pt', '11pt' or '12pt').
142-
#
143-
# 'pointsize': '10pt',
144-
# Additional stuff for the LaTeX preamble.
145-
#
146-
# 'preamble': '',
147-
# Latex figure (float) alignment
148-
#
149-
# 'figure_align': 'htbp',
150-
}
151-
152-
# Grouping the document tree into LaTeX files. List of tuples
153-
# (source start file, target name, title,
154-
# author, documentclass [howto, manual, or own class]).
155-
latex_documents = [
156-
(master_doc, "wily.tex", "wily Documentation", "Anthony Shaw", "manual")
157-
]
158-
159-
160-
# -- Options for manual page output ------------------------------------------
161-
162-
# One entry per manual page. List of tuples
163-
# (source start file, name, description, authors, manual section).
164-
man_pages = [(master_doc, "wily", "wily Documentation", [author], 1)]
165-
166-
167-
# -- Options for Texinfo output ----------------------------------------------
168-
169-
# Grouping the document tree into Texinfo files. List of tuples
170-
# (source start file, target name, title, author,
171-
# dir menu entry, description, category)
172-
texinfo_documents = [
173-
(
174-
master_doc,
175-
"wily",
176-
"wily Documentation",
177-
author,
178-
"wily",
179-
"One line description of project.",
180-
"Miscellaneous",
181-
)
182-
]
183-
184-
185-
# -- Options for Epub output -------------------------------------------------
186-
187-
# Bibliographic Dublin Core info.
188-
epub_title = project
189-
190-
# The unique identifier of the text. This can be a ISBN number
191-
# or the project homepage.
192-
#
193-
# epub_identifier = ''
194-
195-
# A unique identification for the text.
196-
#
197-
# epub_uid = ''
198-
199-
# A list of files that should not be packed into the epub file.
200-
epub_exclude_files = ["search.html"]
201-
202-
203-
# -- Extension configuration -------------------------------------------------
204-
20566
# -- Options for todo extension ----------------------------------------------
20667

207-
# If true, `todo` and `todoList` produce output, else they produce nothing.
20868
todo_include_todos = True

readthedocs.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
version: 2
2+
13
build:
2-
image: latest
4+
os: ubuntu-24.04
5+
tools:
6+
python: "3.12"
37

4-
requirements_file: docs/requirements_docs.txt
8+
sphinx:
9+
configuration: docs/source/conf.py
510

611
python:
7-
version: 3.6
12+
install:
13+
- requirements: docs/requirements_docs.txt

0 commit comments

Comments
 (0)