|
10 | 10 | # add these directories to sys.path here. If the directory is relative to the |
11 | 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
12 | 12 |
|
13 | | -import sys |
14 | 13 | import os |
| 14 | +import sys |
15 | 15 | from dataclasses import fields |
16 | 16 | from pathlib import Path |
17 | 17 | from textwrap import dedent |
| 18 | + |
18 | 19 | from pkg_resources import get_distribution |
19 | 20 |
|
20 | | -sys.path.insert(0, os.path.abspath('..')) |
| 21 | +sys.path.insert(0, os.path.abspath("..")) |
21 | 22 |
|
22 | 23 | # do not try to create/read config files |
23 | | -os.environ['STAGPY_ISOLATED'] = 'True' |
| 24 | +os.environ["STAGPY_ISOLATED"] = "True" |
24 | 25 |
|
25 | 26 | import stagpy |
26 | 27 |
|
27 | | -html_theme = 'sphinx_rtd_theme' |
| 28 | +html_theme = "sphinx_rtd_theme" |
28 | 29 |
|
29 | 30 | # -- General configuration ------------------------------------------------ |
30 | 31 |
|
31 | 32 | # If your documentation needs a minimal Sphinx version, state it here. |
32 | | -needs_sphinx = '4.0' |
| 33 | +needs_sphinx = "4.0" |
33 | 34 |
|
34 | 35 | # Add any Sphinx extension module names here, as strings. They can be |
35 | 36 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
36 | 37 | # ones. |
37 | 38 | 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", |
41 | 42 | ] |
42 | 43 |
|
43 | | -root_doc = 'index' |
| 44 | +root_doc = "index" |
44 | 45 |
|
45 | | -autodoc_member_order = 'bysource' |
46 | | -autoclass_content = 'class' |
| 46 | +autodoc_member_order = "bysource" |
| 47 | +autoclass_content = "class" |
47 | 48 |
|
48 | 49 | # Add any paths that contain templates here, relative to this directory. |
49 | | -templates_path = ['_templates'] |
| 50 | +templates_path = ["_templates"] |
50 | 51 |
|
51 | 52 | # -- 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" |
55 | 56 |
|
56 | 57 | # The full version, including alpha/beta/rc tags. |
57 | 58 | release = get_distribution("stagpy").version |
58 | 59 | # The short X.Y version. |
59 | | -version = '.'.join(release.split('.')[:2]) |
| 60 | +version = ".".join(release.split(".")[:2]) |
60 | 61 |
|
61 | 62 | # List of patterns, relative to source directory, that match files and |
62 | 63 | # directories to ignore when looking for source files. |
63 | | -exclude_patterns = ['_build'] |
| 64 | +exclude_patterns = ["_build"] |
64 | 65 |
|
65 | 66 | # The name of the Pygments (syntax highlighting) style to use. |
66 | | -pygments_style = 'sphinx' |
| 67 | +pygments_style = "sphinx" |
67 | 68 |
|
68 | 69 |
|
69 | 70 | # -- Options for HTML output ---------------------------------------------- |
70 | 71 |
|
71 | 72 | # Output file base name for HTML help builder. |
72 | | -htmlhelp_basename = 'StagPydoc' |
| 73 | +htmlhelp_basename = "StagPydoc" |
73 | 74 |
|
74 | 75 |
|
75 | 76 | # -- Options for LaTeX output --------------------------------------------- |
|
78 | 79 | # (source start file, target name, title, |
79 | 80 | # author, documentclass [howto, manual, or own class]). |
80 | 81 | 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 | + ), |
83 | 89 | ] |
84 | 90 |
|
85 | 91 |
|
86 | 92 | # -- Options for manual page output --------------------------------------- |
87 | 93 |
|
88 | 94 | # One entry per manual page. List of tuples |
89 | 95 | # (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)] |
94 | 97 |
|
95 | 98 |
|
96 | 99 | # -- Options for Texinfo output ------------------------------------------- |
|
99 | 102 | # (source start file, target name, title, author, |
100 | 103 | # dir menu entry, description, category) |
101 | 104 | 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 | + ), |
105 | 114 | ] |
106 | 115 |
|
107 | 116 |
|
108 | 117 | # -- Autogenerated configuration options list ----------------------------- |
109 | 118 |
|
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 | + """\ |
114 | 124 | .. |
115 | 125 | This doc is automatically generated in conf.py. |
116 | 126 | Editing it will have no effect. |
|
120 | 130 | ============================= |
121 | 131 |
|
122 | 132 | These tables list configuration options. |
123 | | - """)) |
| 133 | + """ |
| 134 | + ) |
| 135 | + ) |
124 | 136 | for sec_fld in fields(stagpy.conf): |
125 | 137 | sec_name = sec_fld.name |
126 | | - fid.write(dedent( |
127 | | - """ |
| 138 | + fid.write( |
| 139 | + dedent( |
| 140 | + """ |
128 | 141 | .. list-table:: {} |
129 | 142 | :header-rows: 1 |
130 | 143 |
|
131 | 144 | * - Name |
132 | 145 | - Description |
133 | 146 | - CLI, config file? |
134 | | - """.format(sec_name))) |
| 147 | + """.format(sec_name) |
| 148 | + ) |
| 149 | + ) |
135 | 150 | section = getattr(stagpy.conf, sec_name) |
136 | 151 | for fld in fields(section): |
137 | 152 | opt = fld.name |
138 | 153 | entry = section.meta_(opt).entry |
139 | 154 | if entry.in_cli and entry.in_file: |
140 | | - c_f = 'both' |
| 155 | + c_f = "both" |
141 | 156 | elif entry.in_cli: |
142 | | - c_f = 'CLI' |
| 157 | + c_f = "CLI" |
143 | 158 | 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)) |
0 commit comments