Skip to content

Commit 9efa262

Browse files
committed
Updated configuration files.
1 parent 766688b commit 9efa262

File tree

8 files changed

+112
-34
lines changed

8 files changed

+112
-34
lines changed

.github/workflows/docs_test_action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
- name: Install and Build 🔧
1515
uses: ammaraskar/sphinx-action@master
1616
with:
17-
pre-build-command: apt-get update && apt-get install gcc python3-dev -y && python -m pip install tox
17+
pre-build-command: apt-get update && apt-get install gcc python3-dev git -y && python -m pip install tox
1818
docs-folder: "doc-source/"
1919
build-command: "tox -e docs -- "

.isort.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ known_third_party =
1616
colorama
1717
coverage
1818
coverage_pyver_pragma
19+
enum_tools
1920
faker
2021
github
2122
importlib_resources

.pre-commit-config.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ repos:
2222
- id: mixed-line-ending
2323

2424
- repo: https://github.com/domdfcoding/pre-commit-hooks
25-
rev: v0.0.2
25+
rev: v0.0.3
2626
hooks:
2727
- id: requirements-txt-sorter
28+
args: [--allow-git]
2829
- id: check-docstring-first
2930

31+
- repo: https://github.com/domdfcoding/flake8-dunder-all
32+
rev: v0.0.4
33+
hooks:
34+
- id: ensure-dunder-all
35+
files: ^domdf_python_tools/.*\.py$
36+
3037
- repo: https://github.com/pre-commit/pygrep-hooks
3138
rev: v1.5.1
3239
hooks:
@@ -57,13 +64,3 @@ repos:
5764
hooks:
5865
- id: forbid-crlf
5966
- id: remove-crlf
60-
61-
# - repo: https://github.com/shellcheck-py/shellcheck-py
62-
# rev: v0.7.1.1
63-
# hooks:
64-
# - id: shellcheck
65-
66-
# - repo: https://github.com/adrienverge/yamllint
67-
# rev: v1.23.0
68-
# hooks:
69-
# - id: yamllint
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""
2+
Sphinx's autodoc module allows for default options to be set,
3+
and allows for those defaults to be disabled for an auto* directive and different values given instead.
4+
5+
However, it does not appear to be possible to augment the defaults,
6+
such as to globally exclude certain members and then exclude additional members of a single class.
7+
8+
This module monkeypatches in that behaviour.
9+
"""
10+
11+
# stdlib
12+
from typing import Any, Dict, Type
13+
14+
# 3rd party
15+
import sphinx.ext.autodoc.directive
16+
from docutils.utils import assemble_option_dict
17+
from sphinx.application import Sphinx
18+
from sphinx.config import Config
19+
from sphinx.ext.autodoc import Documenter, Options
20+
21+
22+
def process_documenter_options(
23+
documenter: "Type[Documenter]",
24+
config: Config,
25+
options: Dict,
26+
) -> Options:
27+
"""
28+
Recognize options of Documenter from user input.
29+
30+
:param documenter:
31+
:param config:
32+
:param options:
33+
:return:
34+
"""
35+
36+
for name in sphinx.ext.autodoc.directive.AUTODOC_DEFAULT_OPTIONS:
37+
if name not in documenter.option_spec:
38+
continue
39+
else:
40+
negated = options.pop('no-' + name, True) is None
41+
if name in config.autodoc_default_options and not negated:
42+
43+
default_value = config.autodoc_default_options[name]
44+
existing_value = options.get(name, None)
45+
46+
values = list(filter(None, [default_value, existing_value]))
47+
48+
if values:
49+
options[name] = ",".join(values)
50+
else:
51+
options[name] = None
52+
53+
return Options(assemble_option_dict(options.items(), documenter.option_spec))
54+
55+
56+
def setup(app: Sphinx) -> Dict[str, Any]:
57+
"""
58+
Setup Sphinx Extension.
59+
60+
:param app:
61+
62+
:return:
63+
"""
64+
65+
sphinx.ext.autodoc.directive.process_documenter_options = process_documenter_options
66+
67+
return {}

doc-source/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
# User-configurable lines
1919
# End of user-configurable lines
2020

21-
github_url = "https://github.com/domdfcoding/domdf_python_tools"
21+
github_username = "domdfcoding"
22+
github_repository = "domdf_python_tools"
23+
github_url = f"https://github.com/{github_username}/{github_repository}"
24+
2225

2326
rst_prolog = f""".. |pkgname| replace:: domdf_python_tools
2427
.. |pkgname2| replace:: ``domdf_python_tools``
@@ -51,6 +54,8 @@
5154
'sphinxcontrib.default_values',
5255
'sphinxcontrib.toctree_plus',
5356
'seed_intersphinx_mapping',
57+
'autodoc_augment_defaults',
58+
'sphinx.ext.autosectionlabel',
5459
'sphinx_autodoc_typehints',
5560
]
5661

@@ -96,13 +101,16 @@
96101
man_pages = [('index', slug, project, [author], 1)]
97102
texinfo_documents = [('index', slug, project, author, slug, project, 'Miscellaneous')]
98103

104+
toctree_plus_types = {"class", "function", "method", "data"}
105+
99106

100107
autodoc_default_options = {
101108
'members': None, # Include all members (methods).
102109
'special-members': None,
103110
"autosummary": None,
104111
'exclude-members': ','.join([ # Exclude "standard" methods.
105112
"__dict__",
113+
"__class__",
106114
"__dir__",
107115
"__weakref__",
108116
"__module__",
@@ -117,7 +125,7 @@
117125
"__getnewargs__",
118126
"__abstractmethods__",
119127
"__hash__",
120-
])
128+
]),
121129
}
122130

123131

doc-source/requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
autodocsumm
2-
default_values>=0.0.7
1+
autodocsumm>=0.2.0
2+
default_values>=0.0.8
33
domdf_sphinx_theme>=0.0.11
44
extras_require
55
pytz>=2019.1
6-
seed_intersphinx_mapping
6+
seed_intersphinx_mapping>=0.1.0
77
sphinx>=3.0.3
88
sphinx-copybutton>=0.2.12
99
sphinx-notfound-page
1010
sphinx-prompt>=1.2.0
1111
sphinx-tabs>=1.1.13
12-
sphinx_autodoc_typehints>=1.11.0
1312
sphinxcontrib-httpdomain>=1.7.0
1413
sphinxemoji>=0.1.6
15-
toctree_plus>=0.0.1
14+
toctree_plus>=0.0.2
15+
git+git://github.com/domdfcoding/sphinx-autodoc-typehints.git@typevar-as-pydata

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# * metadata
44
# * options
55
# * options.packages.find
6-
# * options.entry_points
76
# * mypy
87
[metadata]
98
name = domdf_python_tools

tox.ini

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ python =
2929
setenv =
3030
PYTHONDEVMODE = 1
3131
PIP_USE_FEATURE=2020-resolver
32+
PYTEST_ADDOPTS = --color yes
3233
deps = -r{toxinidir}/tests/requirements.txt
3334
commands =
3435
python --version
35-
python -m pytest --cov=domdf_python_tools -r aR tests/ {posargs}
36+
python -m pytest --cov=domdf_python_tools -r aR tests/ --durations 25 {posargs}
3637

3738

3839
[testenv:docs]
@@ -77,6 +78,8 @@ deps =
7778
flake8-pytest-style
7879
flake8-docstrings
7980
flake8-typing-imports
81+
flake8-sphinx-links
82+
flake8-dunder-all
8083
git+https://github.com/domdfcoding/flake8-rst-docstrings.git
8184
flake8-builtins
8285
pygments
@@ -150,24 +153,27 @@ commands =
150153

151154
[flake8]
152155
max-line-length = 120
153-
select = E301 E303 E304 E305 E306 E502 W291 W293 W391 E226 E225 E241 E231 W292 E265 E101 E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E227 E228 E242 E251 E261 E262 E271 E272 E402 E703 E711 E712 E713 E714 E721 W504 E302 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 PT001 PT002 PT003 PT004 PT005 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q000 Q001 Q002 Q003 A001 A002 A003 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417
156+
select = E301 E303 E304 E305 E306 E502 W291 W293 W391 E226 E225 E241 E231 W292 E265 E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E227 E228 E242 E251 E261 E262 E271 E272 E402 E703 E711 E712 E713 E714 E721 W504 E302 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT004 PT005 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q000 Q001 Q002 Q003 A001 A002 A003 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
154157
exclude = .git,__pycache__,doc-source,old,build,dist,make_conda_recipe.py,__pkginfo__.py,setup.py
155158
rst-roles =
156-
class,
157-
func,
158-
mod,
159-
py:obj,
160-
py:class,
161-
ref,
162-
meth,
163-
exc,
164-
attr,
159+
class
160+
func
161+
mod
162+
py:obj
163+
py:class
164+
ref
165+
meth
166+
exc
167+
attr
165168
rst-directives =
166-
envvar,
167-
exception,
169+
envvar
170+
exception
168171
seealso
172+
TODO
173+
versionadded
174+
versionchanged
169175
per-file-ignores =
170-
tests/*: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417
176+
tests/*: D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000
171177
pytest-parametrize-names-type = csv
172178
inline-quotes = "
173179
multiline-quotes = """

0 commit comments

Comments
 (0)