Skip to content

Commit 59c194e

Browse files
committed
Update docs.
1 parent ac347f3 commit 59c194e

File tree

10 files changed

+44
-17
lines changed

10 files changed

+44
-17
lines changed

doc-source/api/testing.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=================================
2+
:mod:`domdf_python_tools.testing`
3+
=================================
4+
5+
.. automodule:: domdf_python_tools.testing

doc-source/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from __pkginfo__ import __version__
1414

1515
# User-configurable lines
16+
import domdf_python_tools
17+
domdf_python_tools.__docs = True
1618
# End of user-configurable lines
1719

1820
github_username = "domdfcoding"
@@ -37,6 +39,7 @@
3739
'sphinx_toolbox',
3840
'sphinx_toolbox.more_autodoc',
3941
'sphinx_toolbox.more_autosummary',
42+
'sphinx_toolbox.tweaks.param_dash',
4043
'sphinx.ext.intersphinx',
4144
'sphinx.ext.mathjax',
4245
'sphinxcontrib.httpdomain',
@@ -48,7 +51,6 @@
4851
'sphinxcontrib.default_values',
4952
'sphinxcontrib.toctree_plus',
5053
'seed_intersphinx_mapping',
51-
'sphinx.ext.autosectionlabel',
5254
]
5355

5456
sphinxemoji_style = 'twemoji'
@@ -136,6 +138,3 @@
136138
"__hash__",
137139
]),
138140
}
139-
140-
141-
set_type_checking_flag = True

doc-source/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ autodocsumm>=0.2.0
22
default_values>=0.2.0
33
domdf_sphinx_theme>=0.1.0
44
extras_require>=0.2.0
5+
pandas>=1.1.2
56
seed_intersphinx_mapping>=0.1.1
67
sphinx>=3.0.3
78
sphinx-copybutton>=0.2.12
89
sphinx-notfound-page>=0.5
910
sphinx-prompt>=1.1.0
1011
sphinx-tabs>=1.1.13
11-
sphinx-toolbox>=0.8.1
12+
sphinx-toolbox>=1.0.0
1213
sphinxcontrib-httpdomain>=1.7.0
1314
sphinxemoji>=0.1.6
1415
toctree_plus>=0.0.4

domdf_python_tools/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929
__license__: str = "LGPLv3+"
3030
__version__: str = "0.8.3"
3131
__email__: str = "[email protected]"
32+
33+
__docs = False

domdf_python_tools/testing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"""
55
Handy functions for testing code.
66
7-
Requires `pytest <https://docs.pytest.org/en/stable/>`_ to be installed.
7+
.. extras-require:: testing
8+
:__pkginfo__:
89
910
.. versionadded:: 0.4.9
1011
"""

domdf_python_tools/typing.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@
3939
# stdlib
4040
import os
4141
import pathlib
42+
import typing
4243
from decimal import Decimal
4344
from json import JSONDecoder, JSONEncoder
44-
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union
45+
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
4546

4647
# 3rd party
4748
from typing_extensions import Protocol, runtime_checkable
4849

49-
if TYPE_CHECKING:
50+
# this package
51+
import domdf_python_tools
52+
53+
if typing.TYPE_CHECKING or domdf_python_tools.__docs:
5054
# 3rd party
5155
from pandas._typing import FrameOrSeries # type: ignore
5256

domdf_python_tools/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@
5454
import inspect
5555
import itertools
5656
import sys
57+
import typing
5758
from pprint import pformat
58-
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Union
59+
from typing import Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Union
5960

6061
# 3rd party
6162
import deprecation # type: ignore
@@ -66,7 +67,7 @@
6667
from domdf_python_tools.terminal_colours import Colour, Fore
6768
from domdf_python_tools.typing import HasHead, String
6869

69-
if TYPE_CHECKING:
70+
if typing.TYPE_CHECKING or domdf_python_tools.__docs:
7071
# 3rd party
7172
from pandas import DataFrame, Series # type: ignore
7273

domdf_python_tools/versions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#
2525

2626
# stdlib
27+
import re
2728
from typing import Generator, Sequence, Tuple, Union
2829

2930
__all__ = ["Version"]
@@ -176,13 +177,13 @@ def from_str(cls, version_string: str) -> "Version":
176177
177178
:param version_string: The version number.
178179
179-
:return: The created Version
180+
:return: The created :class:`~domdf_python_tools.versions.Version`.
180181
"""
181182

182183
return cls(*_iter_string(version_string))
183184

184185
@classmethod
185-
def from_tuple(cls, version_tuple: Tuple[Union[str, int], Union[str, int], Union[str, int]]) -> "Version":
186+
def from_tuple(cls, version_tuple: Tuple[Union[str, int], ...]) -> "Version":
186187
"""
187188
Create a :class:`~.Version` from a :class:`tuple`.
188189
@@ -200,7 +201,7 @@ def from_float(cls, version_float: float) -> "Version":
200201
201202
:param version_float: The version number.
202203
203-
:return: The created Version
204+
:return: The created :class:`~domdf_python_tools.versions.Version`.
204205
"""
205206

206207
return cls.from_str(str(version_float))

repo_helper.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ classifiers:
4040
extras_require:
4141
dates:
4242
- pytz>=2019.1
43+
testing:
44+
- pytest>=6.0.0
4345

4446
keywords:
4547
- utilities
@@ -50,5 +52,8 @@ yapf_exclude:
5052
manifest_additional:
5153
- "include domdf_python_tools/google-10000-english-no-swears.txt"
5254

53-
sphinx_conf_epilogue:
54-
- set_type_checking_flag = True
55+
sphinx_conf_preamble:
56+
- import domdf_python_tools
57+
- domdf_python_tools.__docs = True
58+
59+
tox_testenv_extras: all

tox.ini

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ setenv =
3131
PIP_USE_FEATURE=2020-resolver
3232
PYTEST_ADDOPTS = --color yes
3333
deps = -r{toxinidir}/tests/requirements.txt
34+
35+
extras = all
3436
commands =
3537
python --version
3638
python -m pytest --cov=domdf_python_tools -r aR tests/ --durations 25 {posargs}
@@ -40,6 +42,8 @@ commands =
4042
setenv = SHOW_TODOS = 1
4143
basepython = python3.8
4244
changedir = {toxinidir}/doc-source
45+
46+
extras = all
4347
deps =
4448
-r{toxinidir}/requirements.txt
4549
-r{toxinidir}/doc-source/requirements.txt
@@ -108,7 +112,7 @@ commands = isort domdf_python_tools tests
108112

109113
[testenv:mypy]
110114
basepython = python3.6
111-
115+
extras = all
112116
ignore_errors = true
113117
changedir = {toxinidir}
114118
deps =
@@ -122,7 +126,7 @@ commands = mypy domdf_python_tools tests {posargs}
122126
[testenv:pyup]
123127
basepython = python3.6
124128
skip_install = true
125-
129+
extras = all
126130
ignore_errors = true
127131
changedir={toxinidir}
128132
deps = pyupgrade-directories
@@ -190,6 +194,10 @@ rst-directives =
190194
versionremoved
191195
autofunction
192196
confval
197+
rst:directive
198+
rst:directive:option
199+
rst:role
200+
pre-commit-shield
193201
per-file-ignores =
194202
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
195203
pytest-parametrize-names-type = csv

0 commit comments

Comments
 (0)