Skip to content

Commit 318b45f

Browse files
committed
Format docs/conf.py
1 parent 10b0d41 commit 318b45f

File tree

2 files changed

+61
-46
lines changed

2 files changed

+61
-46
lines changed

docs/conf.py

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,67 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212

13-
import sys
1413
import os
14+
import sys
1515
from dataclasses import fields
1616
from pathlib import Path
1717
from textwrap import dedent
18+
1819
from pkg_resources import get_distribution
1920

20-
sys.path.insert(0, os.path.abspath('..'))
21+
sys.path.insert(0, os.path.abspath(".."))
2122

2223
# do not try to create/read config files
23-
os.environ['STAGPY_ISOLATED'] = 'True'
24+
os.environ["STAGPY_ISOLATED"] = "True"
2425

2526
import stagpy
2627

27-
html_theme = 'sphinx_rtd_theme'
28+
html_theme = "sphinx_rtd_theme"
2829

2930
# -- General configuration ------------------------------------------------
3031

3132
# If your documentation needs a minimal Sphinx version, state it here.
32-
needs_sphinx = '4.0'
33+
needs_sphinx = "4.0"
3334

3435
# Add any Sphinx extension module names here, as strings. They can be
3536
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3637
# ones.
3738
extensions = [
38-
'sphinx.ext.mathjax',
39-
'sphinx.ext.autodoc',
40-
'sphinx.ext.napoleon',
39+
"sphinx.ext.mathjax",
40+
"sphinx.ext.autodoc",
41+
"sphinx.ext.napoleon",
4142
]
4243

43-
root_doc = 'index'
44+
root_doc = "index"
4445

45-
autodoc_member_order = 'bysource'
46-
autoclass_content = 'class'
46+
autodoc_member_order = "bysource"
47+
autoclass_content = "class"
4748

4849
# Add any paths that contain templates here, relative to this directory.
49-
templates_path = ['_templates']
50+
templates_path = ["_templates"]
5051

5152
# -- Project information -----------------------------------------------------
52-
project = 'StagPy'
53-
copyright = '2015 - 2023, Adrien Morison, Martina Ulvrova, Stéphane Labrosse'
54-
author = 'Adrien Morison, Martina Ulvrova, Stéphane Labrosse'
53+
project = "StagPy"
54+
copyright = "2015 - 2023, Adrien Morison, Martina Ulvrova, Stéphane Labrosse"
55+
author = "Adrien Morison, Martina Ulvrova, Stéphane Labrosse"
5556

5657
# The full version, including alpha/beta/rc tags.
5758
release = get_distribution("stagpy").version
5859
# The short X.Y version.
59-
version = '.'.join(release.split('.')[:2])
60+
version = ".".join(release.split(".")[:2])
6061

6162
# List of patterns, relative to source directory, that match files and
6263
# directories to ignore when looking for source files.
63-
exclude_patterns = ['_build']
64+
exclude_patterns = ["_build"]
6465

6566
# The name of the Pygments (syntax highlighting) style to use.
66-
pygments_style = 'sphinx'
67+
pygments_style = "sphinx"
6768

6869

6970
# -- Options for HTML output ----------------------------------------------
7071

7172
# Output file base name for HTML help builder.
72-
htmlhelp_basename = 'StagPydoc'
73+
htmlhelp_basename = "StagPydoc"
7374

7475

7576
# -- Options for LaTeX output ---------------------------------------------
@@ -78,19 +79,21 @@
7879
# (source start file, target name, title,
7980
# author, documentclass [howto, manual, or own class]).
8081
latex_documents = [
81-
(root_doc, 'StagPy.tex', 'StagPy Documentation',
82-
r'Adrien Morison \and Martina Ulvrova \and Stéphane Labrosse', 'manual'),
82+
(
83+
root_doc,
84+
"StagPy.tex",
85+
"StagPy Documentation",
86+
r"Adrien Morison \and Martina Ulvrova \and Stéphane Labrosse",
87+
"manual",
88+
),
8389
]
8490

8591

8692
# -- Options for manual page output ---------------------------------------
8793

8894
# One entry per manual page. List of tuples
8995
# (source start file, name, description, authors, manual section).
90-
man_pages = [
91-
(root_doc, 'stagpy', 'StagPy Documentation',
92-
[author], 1)
93-
]
96+
man_pages = [(root_doc, "stagpy", "StagPy Documentation", [author], 1)]
9497

9598

9699
# -- Options for Texinfo output -------------------------------------------
@@ -99,18 +102,25 @@
99102
# (source start file, target name, title, author,
100103
# dir menu entry, description, category)
101104
texinfo_documents = [
102-
(root_doc, 'StagPy', 'StagPy Documentation',
103-
author, 'StagPy', 'One line description of project.',
104-
'Miscellaneous'),
105+
(
106+
root_doc,
107+
"StagPy",
108+
"StagPy Documentation",
109+
author,
110+
"StagPy",
111+
"One line description of project.",
112+
"Miscellaneous",
113+
),
105114
]
106115

107116

108117
# -- Autogenerated configuration options list -----------------------------
109118

110-
dfile = Path('.') / 'sources' / 'config_opts.rst'
111-
with dfile.open('w') as fid:
112-
fid.write(dedent(
113-
"""\
119+
dfile = Path(".") / "sources" / "config_opts.rst"
120+
with dfile.open("w") as fid:
121+
fid.write(
122+
dedent(
123+
"""\
114124
..
115125
This doc is automatically generated in conf.py.
116126
Editing it will have no effect.
@@ -120,28 +130,33 @@
120130
=============================
121131
122132
These tables list configuration options.
123-
"""))
133+
"""
134+
)
135+
)
124136
for sec_fld in fields(stagpy.conf):
125137
sec_name = sec_fld.name
126-
fid.write(dedent(
127-
"""
138+
fid.write(
139+
dedent(
140+
"""
128141
.. list-table:: {}
129142
:header-rows: 1
130143
131144
* - Name
132145
- Description
133146
- CLI, config file?
134-
""".format(sec_name)))
147+
""".format(sec_name)
148+
)
149+
)
135150
section = getattr(stagpy.conf, sec_name)
136151
for fld in fields(section):
137152
opt = fld.name
138153
entry = section.meta_(opt).entry
139154
if entry.in_cli and entry.in_file:
140-
c_f = 'both'
155+
c_f = "both"
141156
elif entry.in_cli:
142-
c_f = 'CLI'
157+
c_f = "CLI"
143158
else:
144-
c_f = 'config file'
145-
fid.write(' * - {}\n'.format(opt))
146-
fid.write(' - {}\n'.format(entry.doc))
147-
fid.write(' - {}\n'.format(c_f))
159+
c_f = "config file"
160+
fid.write(" * - {}\n".format(opt))
161+
fid.write(" - {}\n".format(entry.doc))
162+
fid.write(" - {}\n".format(c_f))

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ skip_install = true
3434
deps =
3535
ruff==0.3.4
3636
commands =
37-
ruff check --select I --fix stagpy tests
38-
ruff format stagpy tests
37+
ruff check --select I --fix .
38+
ruff format .
3939

4040
[testenv:fmt-check]
4141
skip_install = true
4242
deps = {[testenv:fmt]deps}
4343
commands =
44-
ruff check --select I stagpy tests
45-
ruff format --check stagpy tests
44+
ruff check --select I .
45+
ruff format --check .
4646

4747
[gh]
4848
python =

0 commit comments

Comments
 (0)