Skip to content

Commit c3c3613

Browse files
authored
chore: upgrade sphinx to v6 (#218)
* chore: upgrade sphinx to v6 * chore: allow writing docs using markdown
1 parent 11e1f45 commit c3c3613

File tree

5 files changed

+47
-152
lines changed

5 files changed

+47
-152
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ coverage: venv
1414
venv/bin/coverage html
1515
xdg-open htmlcov/index.html
1616

17-
docs:
17+
export SPHINXBUILD=../venv/bin/sphinx-build
18+
docs: venv
1819
$(MAKE) -C docs clean
1920
$(MAKE) -C docs html
2021
xdg-open docs/_build/html/index.html

docs/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Minimal makefile for Sphinx documentation
22
#
33

4-
# You can set these variables from the command line.
5-
SPHINXOPTS =
6-
SPHINXBUILD = python -msphinx
7-
SPHINXPROJ = hcloud
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = _build
1010

docs/conf.py

100755100644
Lines changed: 28 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,56 @@
1-
#!/usr/bin/env python3
2-
#
3-
# hcloud documentation build configuration file, created by
4-
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
5-
#
6-
# This file is execfile()d with the current directory set to its
7-
# containing dir.
8-
#
9-
# Note that not all possible configuration values are present in this
10-
# autogenerated file.
11-
#
12-
# All configuration values have a default; values that are commented out
13-
# serve to show the default.
14-
15-
# If extensions (or modules to document with autodoc) are in another
16-
# directory, add these directories to sys.path here. If the directory is
17-
# relative to the documentation root, use os.path.abspath to make it
18-
# absolute, like shown here.
19-
#
201
import os
212
import sys
3+
from datetime import datetime
224

235
sys.path.insert(0, os.path.abspath(".."))
246
from hcloud.__version__ import VERSION # noqa
257

26-
# -- General configuration ---------------------------------------------
27-
28-
# If your documentation needs a minimal Sphinx _version, state it here.
8+
# Configuration file for the Sphinx documentation builder.
299
#
30-
# needs_sphinx = '1.0'
10+
# For the full list of built-in configuration values, see the documentation:
11+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
3112

32-
# Add any Sphinx extension module names here, as strings. They can be
33-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
34-
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
13+
# -- Project information -----------------------------------------------------
14+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
3515

36-
# Add any paths that contain templates here, relative to this directory.
37-
templates_path = ["_templates"]
38-
39-
# The suffix(es) of source filenames.
40-
# You can specify multiple suffix as a list of string:
41-
#
42-
# source_suffix = ['.rst', '.md']
43-
# source_suffix = '.rst'
44-
45-
# The master toctree document.
46-
master_doc = "index"
47-
48-
# General information about the project.
4916
project = "Hetzner Cloud Python"
50-
copyright = "2019, Hetzner Cloud GmbH"
5117
author = "Hetzner Cloud GmbH"
18+
copyright = f"{datetime.now().year}, {author}"
5219

53-
# The version info for the project you're documenting, acts as replacement
54-
# for |version| and |release|, also used in various other places throughout
55-
# the built documents.
56-
#
57-
# The short X.Y _version.
5820
version = VERSION
59-
# The full _version, including alpha/beta/rc tags.
6021
release = VERSION
6122

62-
# The language for content autogenerated by Sphinx. Refer to documentation
63-
# for a list of supported languages.
64-
#
65-
# This is also used if you do content translation via gettext catalogs.
66-
# Usually you set "language" from the command line for these cases.
67-
language = "en"
23+
# -- General configuration ---------------------------------------------------
24+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
6825

69-
# List of patterns, relative to source directory, that match files and
70-
# directories to ignore when looking for source files.
71-
# This patterns also effect to html_static_path and html_extra_path
26+
extensions = ["myst_parser", "sphinx.ext.autodoc", "sphinx.ext.viewcode"]
27+
templates_path = ["_templates"]
7228
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7329

74-
# The name of the Pygments (syntax highlighting) style to use.
75-
pygments_style = "sphinx"
76-
77-
# If true, `todo` and `todoList` produce output, else they produce nothing.
78-
todo_include_todos = False
30+
source_suffix = {
31+
".rst": "restructuredtext",
32+
".md": "markdown",
33+
}
7934

80-
# If true, the current module name will be prepended to all description
81-
# unit titles (such as .. function::).
35+
# A boolean that decides whether module names are prepended to all object names (for
36+
# object types where a “module” of some kind is defined), e.g. for py:function
37+
# directives. Default is True.
8238
add_module_names = False
8339

84-
# -- Options for HTML output -------------------------------------------
40+
# -- Options for HTML output -------------------------------------------------
41+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
8542

86-
# The theme to use for HTML and HTML Help pages. See the documentation for
87-
# a list of builtin themes.
88-
#
8943
html_theme = "sphinx_rtd_theme"
44+
html_static_path = ["_static"]
45+
9046
html_logo = "_static/logo-hetzner-online.svg"
9147
html_favicon = "_static/favicon.png"
92-
# Theme options are theme-specific and customize the look and feel of a
93-
# theme further. For a list of options available for each theme, see the
94-
# documentation.
95-
#
96-
html_theme_options = {"logo_only": True, "style_nav_header_background": "#EFEFEF"}
48+
# Theme options are theme-specific and customize the look and feel of a theme further.
49+
# For a list of options available for each theme, see the documentation.
50+
html_theme_options = {
51+
"logo_only": True,
52+
"style_nav_header_background": "#efefef",
53+
}
9754
html_css_files = [
9855
"custom.css",
9956
]
100-
101-
# Add any paths that contain custom static files (such as style sheets) here,
102-
# relative to this directory. They are copied after the builtin static files,
103-
# so a file named "default.css" will overwrite the builtin "default.css".
104-
html_static_path = ["_static"]
105-
106-
# -- Options for HTMLHelp output ---------------------------------------
107-
108-
# Output file base name for HTML help builder.
109-
htmlhelp_basename = "hclouddoc"
110-
111-
# -- Options for LaTeX output ------------------------------------------
112-
113-
latex_elements = {
114-
# The paper size ('letterpaper' or 'a4paper').
115-
#
116-
# 'papersize': 'letterpaper',
117-
# The font size ('10pt', '11pt' or '12pt').
118-
#
119-
# 'pointsize': '10pt',
120-
# Additional stuff for the LaTeX preamble.
121-
#
122-
# 'preamble': '',
123-
# Latex figure (float) alignment
124-
#
125-
# 'figure_align': 'htbp',
126-
}
127-
128-
# Grouping the document tree into LaTeX files. List of tuples
129-
# (source start file, target name, title, author, documentclass
130-
# [howto, manual, or own class]).
131-
latex_documents = [
132-
(
133-
master_doc,
134-
"hcloud.tex",
135-
"Hetzner Cloud Python Documentation",
136-
"Hetzner Cloud GmbH",
137-
"manual",
138-
)
139-
]
140-
141-
# -- Options for manual page output ------------------------------------
142-
143-
# One entry per manual page. List of tuples
144-
# (source start file, name, description, authors, manual section).
145-
man_pages = [(master_doc, "Hetzner Cloud Python Documentation", [author], 1)]
146-
147-
# -- Options for Texinfo output ----------------------------------------
148-
149-
# Grouping the document tree into Texinfo files. List of tuples
150-
# (source start file, target name, title, author,
151-
# dir menu entry, description, category)
152-
texinfo_documents = [
153-
(
154-
master_doc,
155-
"Hetzner Cloud Python Documentation",
156-
author,
157-
"HCloud-python is a library for the Hetzner Cloud API.",
158-
"Miscellaneous",
159-
)
160-
]
161-
162-
source_suffix = [".rst"]

docs/make.bat

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,31 @@ pushd %~dp0
55
REM Command file for Sphinx documentation
66

77
if "%SPHINXBUILD%" == "" (
8-
set SPHINXBUILD=python -msphinx
8+
set SPHINXBUILD=sphinx-build
99
)
1010
set SOURCEDIR=.
1111
set BUILDDIR=_build
12-
set SPHINXPROJ=hcloud
13-
14-
if "%1" == "" goto help
1512

1613
%SPHINXBUILD% >NUL 2>NUL
1714
if errorlevel 9009 (
1815
echo.
19-
echo.The Sphinx module was not found. Make sure you have Sphinx installed,
20-
echo.then set the SPHINXBUILD environment variable to point to the full
21-
echo.path of the 'sphinx-build' executable. Alternatively you may add the
22-
echo.Sphinx directory to PATH.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
2320
echo.
2421
echo.If you don't have Sphinx installed, grab it from
25-
echo.http://sphinx-doc.org/
22+
echo.https://www.sphinx-doc.org/
2623
exit /b 1
2724
)
2825

29-
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3029
goto end
3130

3231
:help
33-
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3433

3534
:end
3635
popd

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@
4242
],
4343
extras_require={
4444
"docs": [
45-
"sphinx==1.8.1",
46-
"sphinx-rtd-theme==0.4.2",
45+
"sphinx>=6.2.1,<7.0",
46+
"sphinx-rtd-theme>=1.2.2,<1.3",
47+
"myst-parser>=2.0.0,<2.1",
4748
],
4849
"test": [
4950
"coverage>=7.2.7,<7.3",

0 commit comments

Comments
 (0)