Skip to content

Commit 87e421c

Browse files
committed
Update sphinx config and package metadata.
1 parent cc0a542 commit 87e421c

File tree

5 files changed

+126
-151
lines changed

5 files changed

+126
-151
lines changed

__pkginfo__.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@
1111
# This script based on https://github.com/rocky/python-uncompyle6/blob/master/__pkginfo__.py
1212
#
1313

14-
# stdlib
15-
import pathlib
14+
__all__ = ["extras_require"]
1615

17-
__all__ = [
18-
"__copyright__",
19-
"__version__",
20-
"repo_root",
21-
"install_requires",
22-
"extras_require",
23-
]
24-
25-
__copyright__ = """
26-
2020-2021 Dominic Davis-Foster <[email protected]>
27-
"""
28-
29-
__version__ = "0.2.1"
30-
repo_root = pathlib.Path(__file__).parent
31-
install_requires = (repo_root / "requirements.txt").read_text(encoding="utf-8").split('\n')
3216
extras_require = {}

doc-source/conf.py

Lines changed: 27 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-sphinx-links"
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_sphinx_links
2123
.. |pkgname2| replace:: ``flake8_sphinx_links``
2224
.. |browse_github| replace:: `Browse the GitHub Repository <{github_url}>`__
2325
"""
2426

25-
author = "Dominic Davis-Foster"
26-
project = "flake8_sphinx_links".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_sphinx_links"
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,53 +54,28 @@
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"]),
65+
}
66+
67+
latex_elements = {
68+
"printindex": "\\begin{flushleft}\n\\printindex\n\\end{flushleft}",
69+
"tableofcontents": "\\pdfbookmark[0]{\\contentsname}{toc}\\sphinxtableofcontents",
14170
}
14271

72+
73+
def setup(app):
74+
# 3rd party
75+
from sphinx_toolbox.latex import better_header_layout
76+
77+
app.connect("config-inited", lambda app, config: better_header_layout(config))
78+
79+
14380
nitpicky = True
81+
autosummary_widths_builders = ["latex"]

pyproject.toml

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ name = "flake8_sphinx_links"
77
version = "0.2.1"
88
description = "A Flake8 plugin to check docstrings for double backticked strings which should be links to the Python documentation."
99
readme = "README.rst"
10-
keywords = [ "flake8", "sphinx", "documentation",]
10+
keywords = [ "documentation", "flake8", "sphinx",]
1111
dynamic = [ "requires-python", "classifiers", "dependencies",]
12+
1213
[[project.authors]]
13-
1414
name = "Dominic Davis-Foster"
15+
16+
1517

1618
[project.license]
1719
file = "LICENSE"
@@ -35,5 +37,98 @@ 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 = "python-formate"
46+
github_repository = "flake8-sphinx-links"
47+
author = "Dominic Davis-Foster"
48+
project = "flake8-sphinx-links"
49+
copyright = "2020-2021 Dominic Davis-Foster"
50+
language = "en"
51+
package_root = "flake8_sphinx_links"
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.extras_require",
63+
"sphinx.ext.todo",
64+
"sphinxemoji.sphinxemoji",
65+
"notfound.extension",
66+
"sphinx_copybutton",
67+
"sphinxcontrib.default_values",
68+
"sphinxcontrib.toctree_plus",
69+
"sphinx_debuginfo",
70+
"sphinx_licenseinfo",
71+
"seed_intersphinx_mapping",
72+
"sphinx_toolbox.pre_commit",
73+
"sphinx_toolbox.flake8",
74+
"sphinx_toolbox_experimental.html_section",
75+
"sphinx_toolbox_experimental.autosummary_widths",
76+
"sphinx_toolbox_experimental.needspace",
77+
]
78+
sphinxemoji_style = "twemoji"
79+
gitstamp_fmt = "%d %b %Y"
80+
templates_path = [ "_templates",]
81+
html_static_path = [ "_static",]
82+
source_suffix = ".rst"
83+
master_doc = "index"
84+
suppress_warnings = [ "image.nonlocal_uri",]
85+
pygments_style = "default"
86+
html_theme = "furo"
87+
html_theme_path = [ "../..",]
88+
html_show_sourcelink = true
89+
toctree_plus_types = [
90+
"class",
91+
"confval",
92+
"data",
93+
"directive",
94+
"enum",
95+
"exception",
96+
"flag",
97+
"function",
98+
"namedtuple",
99+
"protocol",
100+
"role",
101+
"typeddict",
102+
]
103+
add_module_names = false
104+
hide_none_rtype = true
105+
all_typevars = true
106+
overloads_location = "bottom"
107+
autodoc_exclude_members = [
108+
"__dict__",
109+
"__class__",
110+
"__dir__",
111+
"__weakref__",
112+
"__module__",
113+
"__annotations__",
114+
"__orig_bases__",
115+
"__parameters__",
116+
"__subclasshook__",
117+
"__init_subclass__",
118+
"__attrs_attrs__",
119+
"__init__",
120+
"__new__",
121+
"__getnewargs__",
122+
"__abstractmethods__",
123+
"__hash__",
124+
]
125+
126+
[tool.mypy]
127+
python_version = "3.6"
128+
namespace_packages = true
129+
check_untyped_defs = true
130+
warn_unused_ignores = true
131+
no_implicit_optional = true
132+
38133
[project.entry-points."flake8.extension"]
39134
SXL = "flake8_sphinx_links:Plugin"

setup.cfg

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,6 @@
66
# * mypy
77
# * options.entry_points
88

9-
[metadata]
10-
name = flake8_sphinx_links
11-
author = Dominic Davis-Foster
12-
author_email = [email protected]
13-
license = MIT License
14-
keywords = flake8, sphinx, documentation
15-
long_description = file: README.rst
16-
long_description_content_type = text/x-rst
17-
platforms = Windows, macOS, Linux
18-
url = https://github.com/domdfcoding/flake8-sphinx-links
19-
project_urls =
20-
Documentation = https://flake8-sphinx-links.readthedocs.io/en/latest
21-
Issue Tracker = https://github.com/domdfcoding/flake8-sphinx-links/issues
22-
Source Code = https://github.com/domdfcoding/flake8-sphinx-links
23-
classifiers =
24-
Development Status :: 4 - Beta
25-
Framework :: Flake8
26-
Intended Audience :: Developers
27-
License :: OSI Approved :: MIT License
28-
Operating System :: OS Independent
29-
Programming Language :: Python
30-
Programming Language :: Python :: 3 :: Only
31-
Programming Language :: Python :: 3.6
32-
Programming Language :: Python :: 3.7
33-
Programming Language :: Python :: 3.8
34-
Programming Language :: Python :: 3.9
35-
Programming Language :: Python :: Implementation :: CPython
36-
Programming Language :: Python :: Implementation :: PyPy
37-
Topic :: Utilities
38-
Typing :: Typed
39-
40-
[options]
41-
python_requires = >=3.6.1
42-
zip_safe = False
43-
include_package_data = True
44-
packages = find:
45-
46-
[options.packages.find]
47-
exclude =
48-
doc-source
49-
tests
50-
tests.*
51-
529
[mypy]
5310
python_version = 3.6
5411
namespace_packages = True

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ inline-quotes = "
102102
multiline-quotes = """
103103
docstring-quotes = """
104104
count = True
105+
min_python_version = 3.6.1
105106
106107
[coverage:run]
107108
plugins = coverage_pyver_pragma

0 commit comments

Comments
 (0)