Skip to content

Commit 74c87e8

Browse files
committed
Update docs config.
1 parent 0cd03ad commit 74c87e8

7 files changed

Lines changed: 136 additions & 117 deletions

File tree

doc-source/Source.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,27 @@ and can be accessed from the following URL: https://github.com/domdfcoding/flake
77

88
If you have ``git`` installed, you can clone the repository with the following command:
99

10-
.. code-block:: bash
10+
.. prompt:: bash
11+
12+
git clone https://github.com/domdfcoding/flake8_strftime
13+
14+
.. parsed-literal::
1115
12-
$ git clone https://github.com/domdfcoding/flake8_strftime"
13-
> Cloning into 'flake8_strftime'...
14-
> remote: Enumerating objects: 47, done.
15-
> remote: Counting objects: 100% (47/47), done.
16-
> remote: Compressing objects: 100% (41/41), done.
17-
> remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
18-
> Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
19-
> Resolving deltas: 100% (66/66), done.
16+
Cloning into 'flake8_strftime'...
17+
remote: Enumerating objects: 47, done.
18+
remote: Counting objects: 100% (47/47), done.
19+
remote: Compressing objects: 100% (41/41), done.
20+
remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
21+
Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
22+
Resolving deltas: 100% (66/66), done.
2023
2124
| Alternatively, the code can be downloaded in a 'zip' file by clicking:
2225
| :guilabel:`Clone or download` --> :guilabel:`Download Zip`
2326
2427
.. figure:: git_download.png
25-
:alt: Downloading a 'zip' file of the source code.
28+
:alt: Downloading a 'zip' file of the source code.
2629

27-
Downloading a 'zip' file of the source code
30+
Downloading a 'zip' file of the source code
2831

2932

3033
Building from source

doc-source/_templates/sidebar/navigation.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

doc-source/conf.py

Lines changed: 24 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,33 @@
77
import re
88
import sys
99

10-
sys.path.append(os.path.abspath('.'))
11-
sys.path.append(os.path.abspath(".."))
10+
# 3rd party
11+
from sphinx_pyproject import SphinxConfig
1212

13-
# this package
14-
from __pkginfo__ import __version__
13+
sys.path.append('.')
1514

16-
github_username = "domdfcoding"
17-
github_repository = "flake8_strftime"
18-
github_url = f"https://github.com/{github_username}/{github_repository}"
15+
config = SphinxConfig(globalns=globals())
16+
project = config["project"]
17+
author = config["author"]
18+
documentation_summary = config.description
19+
20+
github_url = "https://github.com/{github_username}/{github_repository}".format_map(config)
1921

2022
rst_prolog = f""".. |pkgname| replace:: flake8_strftime
2123
.. |pkgname2| replace:: ``flake8_strftime``
2224
.. |browse_github| replace:: `Browse the GitHub Repository <{github_url}>`__
2325
"""
2426

25-
author = "Dominic Davis-Foster"
26-
project = "flake8_strftime".replace('_', '-')
2727
slug = re.sub(r'\W+', '-', project.lower())
28-
release = version = __version__
29-
copyright = "2020-2021 Dominic Davis-Foster" # pylint: disable=redefined-builtin
30-
language = "en"
31-
package_root = "flake8_strftime"
32-
33-
extensions = [
34-
"sphinx_toolbox",
35-
"sphinx_toolbox.more_autodoc",
36-
"sphinx_toolbox.more_autosummary",
37-
"sphinx_toolbox.tweaks.param_dash",
38-
"sphinx_toolbox.tweaks.latex_toc",
39-
"sphinx.ext.intersphinx",
40-
"sphinx.ext.mathjax",
41-
"sphinxcontrib.httpdomain",
42-
"sphinxcontrib.extras_require",
43-
"sphinx.ext.todo",
44-
"sphinxemoji.sphinxemoji",
45-
"notfound.extension",
46-
"sphinx_copybutton",
47-
"sphinxcontrib.default_values",
48-
"sphinxcontrib.toctree_plus",
49-
"sphinx_debuginfo",
50-
"seed_intersphinx_mapping",
51-
"sphinx_toolbox.pre_commit",
52-
"sphinx_toolbox.flake8",
53-
]
54-
55-
sphinxemoji_style = "twemoji"
56-
todo_include_todos = bool(os.environ.get("SHOW_TODOS", 0))
57-
gitstamp_fmt = "%d %b %Y"
28+
release = version = config.version
5829

59-
templates_path = ["_templates"]
60-
html_static_path = ["_static"]
61-
source_suffix = ".rst"
62-
master_doc = "index"
63-
suppress_warnings = ["image.nonlocal_uri"]
64-
pygments_style = "default"
30+
todo_include_todos = bool(os.environ.get("SHOW_TODOS", 0))
6531

6632
intersphinx_mapping = {
6733
"python": ("https://docs.python.org/3/", None),
6834
"sphinx": ("https://www.sphinx-doc.org/en/stable/", None),
6935
}
7036

71-
html_theme = "furo"
7237
html_theme_options = {
7338
"light_css_variables": {
7439
"toc-title-font-size": "12pt",
@@ -81,8 +46,6 @@
8146
"admonition-font-size": "12pt",
8247
},
8348
}
84-
html_theme_path = ["../.."]
85-
html_show_sourcelink = True # True will show link to source
8649

8750
html_context = {}
8851
htmlhelp_basename = slug
@@ -91,51 +54,23 @@
9154
man_pages = [("index", slug, project, [author], 1)]
9255
texinfo_documents = [("index", slug, project, author, slug, project, "Miscellaneous")]
9356

94-
toctree_plus_types = {
95-
"class",
96-
"function",
97-
"method",
98-
"data",
99-
"enum",
100-
"flag",
101-
"confval",
102-
"directive",
103-
"role",
104-
"confval",
105-
"protocol",
106-
"typeddict",
107-
"namedtuple",
108-
"exception",
109-
}
57+
toctree_plus_types = set(config["toctree_plus_types"])
11058

111-
add_module_names = False
112-
hide_none_rtype = True
113-
all_typevars = True
114-
overloads_location = "bottom"
115-
116-
117-
autodoc_exclude_members = [ # Exclude "standard" methods.
118-
"__dict__",
119-
"__class__",
120-
"__dir__",
121-
"__weakref__",
122-
"__module__",
123-
"__annotations__",
124-
"__orig_bases__",
125-
"__parameters__",
126-
"__subclasshook__",
127-
"__init_subclass__",
128-
"__attrs_attrs__",
129-
"__init__",
130-
"__new__",
131-
"__getnewargs__",
132-
"__abstractmethods__",
133-
"__hash__",
134-
]
13559
autodoc_default_options = {
13660
"members": None, # Include all members (methods).
13761
"special-members": None,
13862
"autosummary": None,
13963
"show-inheritance": None,
140-
"exclude-members": ','.join(autodoc_exclude_members),
64+
"exclude-members": ','.join(config["autodoc_exclude_members"]),
14165
}
66+
67+
latex_elements = {
68+
"printindex": "\\begin{flushleft}\n\\printindex\n\\end{flushleft}",
69+
}
70+
71+
72+
def setup(app):
73+
# 3rd party
74+
from sphinx_toolbox.latex import better_header_layout
75+
76+
app.connect("config-inited", lambda app, config: better_header_layout(config))

doc-source/index.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,18 @@ Installation
153153
contributing
154154
Source
155155

156+
.. sidebar-links::
157+
:caption: Links
158+
:github:
159+
:pypi: flake8_strftime
160+
161+
156162
.. start links
157163
158164
.. only:: html
159165

160166
View the :ref:`Function Index <genindex>` or browse the `Source Code <_modules/index.html>`__.
161167

162-
`Browse the GitHub Repository <https://github.com/domdfcoding/flake8_strftime>`__
168+
:github:repo:`Browse the GitHub Repository <domdfcoding/flake8_strftime>`
163169

164170
.. end links

doc-source/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ sphinx-copybutton>=0.2.12
1010
sphinx-debuginfo>=0.1.0
1111
sphinx-notfound-page>=0.5
1212
sphinx-prompt>=1.1.0
13+
sphinx-pyproject>=0.1.0
1314
sphinx-tabs>=1.1.13
14-
sphinx-toolbox>=2.1.0
15+
sphinx-toolbox>=2.10.0
1516
sphinxcontrib-httpdomain>=1.7.0
1617
sphinxemoji>=0.1.6
1718
tabulate>=0.8.7

pyproject.toml

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ name = "flake8_strftime"
77
version = "0.3.1"
88
description = "A flake8 plugin which checks for use of platform specific strftime codes."
99
readme = "README.rst"
10-
keywords = [ "flake8", "date", "time", "datetime", "strftime",]
10+
keywords = [ "date", "datetime", "flake8", "strftime", "time",]
1111
dynamic = [ "requires-python", "classifiers", "dependencies",]
12+
1213
[[project.authors]]
13-
email = "dominic@davis-foster.co.uk"
1414
name = "Dominic Davis-Foster"
15+
email = "dominic@davis-foster.co.uk"
16+
1517

1618
[project.license]
1719
file = "LICENSE"
@@ -35,5 +37,89 @@ python-implementations = [ "CPython", "PyPy",]
3537
platforms = [ "Windows", "macOS", "Linux",]
3638
license-key = "MIT"
3739

40+
[tool.mkrecipe]
41+
conda-channels = [ "conda-forge", "domdfcoding",]
42+
extras = "all"
43+
44+
[tool.sphinx-pyproject]
45+
github_username = "domdfcoding"
46+
github_repository = "flake8_strftime"
47+
author = "Dominic Davis-Foster"
48+
project = "flake8-strftime"
49+
copyright = "2020-2021 Dominic Davis-Foster"
50+
language = "en"
51+
package_root = "flake8_strftime"
52+
extensions = [
53+
"sphinx_toolbox",
54+
"sphinx_toolbox.more_autodoc",
55+
"sphinx_toolbox.more_autosummary",
56+
"sphinx_toolbox.documentation_summary",
57+
"sphinx_toolbox.tweaks.param_dash",
58+
"sphinx_toolbox.tweaks.latex_layout",
59+
"sphinx_toolbox.tweaks.latex_toc",
60+
"sphinx.ext.intersphinx",
61+
"sphinx.ext.mathjax",
62+
"sphinxcontrib.httpdomain",
63+
"sphinxcontrib.extras_require",
64+
"sphinx.ext.todo",
65+
"sphinxemoji.sphinxemoji",
66+
"notfound.extension",
67+
"sphinx_copybutton",
68+
"sphinxcontrib.default_values",
69+
"sphinxcontrib.toctree_plus",
70+
"sphinx_debuginfo",
71+
"seed_intersphinx_mapping",
72+
"sphinx_toolbox.pre_commit",
73+
"sphinx_toolbox.flake8",
74+
]
75+
sphinxemoji_style = "twemoji"
76+
gitstamp_fmt = "%d %b %Y"
77+
templates_path = [ "_templates",]
78+
html_static_path = [ "_static",]
79+
source_suffix = ".rst"
80+
master_doc = "index"
81+
suppress_warnings = [ "image.nonlocal_uri",]
82+
pygments_style = "default"
83+
html_theme = "furo"
84+
html_theme_path = [ "../..",]
85+
html_show_sourcelink = true
86+
toctree_plus_types = [
87+
"class",
88+
"confval",
89+
"data",
90+
"directive",
91+
"enum",
92+
"exception",
93+
"flag",
94+
"function",
95+
"method",
96+
"namedtuple",
97+
"protocol",
98+
"role",
99+
"typeddict",
100+
]
101+
add_module_names = false
102+
hide_none_rtype = true
103+
all_typevars = true
104+
overloads_location = "bottom"
105+
autodoc_exclude_members = [
106+
"__dict__",
107+
"__class__",
108+
"__dir__",
109+
"__weakref__",
110+
"__module__",
111+
"__annotations__",
112+
"__orig_bases__",
113+
"__parameters__",
114+
"__subclasshook__",
115+
"__init_subclass__",
116+
"__attrs_attrs__",
117+
"__init__",
118+
"__new__",
119+
"__getnewargs__",
120+
"__abstractmethods__",
121+
"__hash__",
122+
]
123+
38124
[project.entry-points."flake8.extension"]
39125
STRFTIME = "flake8_strftime:Plugin"

repo_helper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use_whey: true
1414
min_coverage: 100
1515
sphinx_html_theme: furo
1616
standalone_contrib_guide: true
17-
mypy_version: "0.812"
17+
preserve_custom_theme: true
1818

1919
conda_channels:
2020
- conda-forge

0 commit comments

Comments
 (0)