duty 1.5.0__py3-none-any.whl → 1.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- duty/__init__.py +49 -2
- duty/__main__.py +1 -1
- duty/_internal/__init__.py +0 -0
- duty/_internal/callables/__init__.py +34 -0
- duty/{callables → _internal/callables}/_io.py +2 -0
- duty/_internal/callables/autoflake.py +132 -0
- duty/_internal/callables/black.py +176 -0
- duty/_internal/callables/blacken_docs.py +92 -0
- duty/_internal/callables/build.py +76 -0
- duty/_internal/callables/coverage.py +716 -0
- duty/_internal/callables/flake8.py +222 -0
- duty/_internal/callables/git_changelog.py +178 -0
- duty/_internal/callables/griffe.py +227 -0
- duty/_internal/callables/interrogate.py +152 -0
- duty/_internal/callables/isort.py +573 -0
- duty/_internal/callables/mkdocs.py +256 -0
- duty/_internal/callables/mypy.py +496 -0
- duty/_internal/callables/pytest.py +475 -0
- duty/_internal/callables/ruff.py +399 -0
- duty/_internal/callables/safety.py +82 -0
- duty/_internal/callables/ssort.py +38 -0
- duty/_internal/callables/twine.py +284 -0
- duty/_internal/cli.py +322 -0
- duty/_internal/collection.py +246 -0
- duty/_internal/context.py +111 -0
- duty/{debug.py → _internal/debug.py} +13 -15
- duty/_internal/decorator.py +111 -0
- duty/_internal/exceptions.py +12 -0
- duty/_internal/tools/__init__.py +41 -0
- duty/{tools → _internal/tools}/_autoflake.py +8 -4
- duty/{tools → _internal/tools}/_base.py +15 -2
- duty/{tools → _internal/tools}/_black.py +5 -5
- duty/{tools → _internal/tools}/_blacken_docs.py +10 -5
- duty/{tools → _internal/tools}/_build.py +4 -4
- duty/{tools → _internal/tools}/_coverage.py +8 -4
- duty/{tools → _internal/tools}/_flake8.py +10 -12
- duty/{tools → _internal/tools}/_git_changelog.py +8 -4
- duty/{tools → _internal/tools}/_griffe.py +8 -4
- duty/{tools → _internal/tools}/_interrogate.py +4 -4
- duty/{tools → _internal/tools}/_isort.py +8 -6
- duty/{tools → _internal/tools}/_mkdocs.py +8 -4
- duty/{tools → _internal/tools}/_mypy.py +5 -5
- duty/{tools → _internal/tools}/_pytest.py +8 -4
- duty/{tools → _internal/tools}/_ruff.py +11 -5
- duty/{tools → _internal/tools}/_safety.py +13 -8
- duty/{tools → _internal/tools}/_ssort.py +10 -6
- duty/{tools → _internal/tools}/_twine.py +11 -5
- duty/_internal/tools/_yore.py +96 -0
- duty/_internal/validation.py +266 -0
- duty/callables/__init__.py +4 -4
- duty/callables/autoflake.py +11 -126
- duty/callables/black.py +12 -171
- duty/callables/blacken_docs.py +11 -86
- duty/callables/build.py +12 -71
- duty/callables/coverage.py +12 -711
- duty/callables/flake8.py +12 -217
- duty/callables/git_changelog.py +12 -173
- duty/callables/griffe.py +12 -222
- duty/callables/interrogate.py +12 -147
- duty/callables/isort.py +12 -568
- duty/callables/mkdocs.py +12 -251
- duty/callables/mypy.py +11 -490
- duty/callables/pytest.py +12 -470
- duty/callables/ruff.py +12 -394
- duty/callables/safety.py +11 -76
- duty/callables/ssort.py +12 -33
- duty/callables/twine.py +12 -279
- duty/cli.py +10 -316
- duty/collection.py +12 -228
- duty/completions.bash +9 -9
- duty/context.py +12 -107
- duty/decorator.py +12 -108
- duty/exceptions.py +13 -10
- duty/tools.py +63 -0
- duty/validation.py +12 -262
- {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/METADATA +4 -3
- duty-1.6.1.dist-info/RECORD +81 -0
- {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/WHEEL +1 -1
- {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/entry_points.txt +1 -1
- duty/tools/__init__.py +0 -48
- duty-1.5.0.dist-info/RECORD +0 -54
- {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# YORE: Bump 2: Remove file.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from failprint import lazy
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def run(*args: str, quiet: bool = False, verbose: bool = False) -> None:
|
|
9
|
+
"""Run `mkdocs`.
|
|
10
|
+
|
|
11
|
+
Parameters:
|
|
12
|
+
*args: CLI arguments.
|
|
13
|
+
quiet: Silence warnings.
|
|
14
|
+
verbose: Enable verbose output.
|
|
15
|
+
"""
|
|
16
|
+
from mkdocs.__main__ import cli as mkdocs # noqa: PLC0415
|
|
17
|
+
|
|
18
|
+
cli_args = list(args)
|
|
19
|
+
|
|
20
|
+
if quiet and "-q" not in cli_args:
|
|
21
|
+
cli_args.append("--quiet")
|
|
22
|
+
|
|
23
|
+
if verbose and "-v" not in cli_args:
|
|
24
|
+
cli_args.append("--verbose")
|
|
25
|
+
|
|
26
|
+
mkdocs(cli_args)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@lazy(name="mkdocs.build")
|
|
30
|
+
def build(
|
|
31
|
+
*,
|
|
32
|
+
config_file: str | None = None,
|
|
33
|
+
clean: bool | None = None,
|
|
34
|
+
strict: bool | None = None,
|
|
35
|
+
theme: str | None = None,
|
|
36
|
+
directory_urls: bool | None = None,
|
|
37
|
+
site_dir: str | None = None,
|
|
38
|
+
quiet: bool = False,
|
|
39
|
+
verbose: bool = False,
|
|
40
|
+
) -> None:
|
|
41
|
+
"""Build the MkDocs documentation.
|
|
42
|
+
|
|
43
|
+
Parameters:
|
|
44
|
+
config_file: Provide a specific MkDocs config.
|
|
45
|
+
clean: Remove old files from the site_dir before building (the default).
|
|
46
|
+
strict: Enable strict mode. This will cause MkDocs to abort the build on any warnings.
|
|
47
|
+
theme: The theme to use when building your documentation.
|
|
48
|
+
directory_urls: Use directory URLs when building pages (the default).
|
|
49
|
+
site_dir: The directory to output the result of the documentation build.
|
|
50
|
+
quiet: Silence warnings.
|
|
51
|
+
verbose: Enable verbose output.
|
|
52
|
+
"""
|
|
53
|
+
cli_args = []
|
|
54
|
+
|
|
55
|
+
if clean is True:
|
|
56
|
+
cli_args.append("--clean")
|
|
57
|
+
elif clean is False:
|
|
58
|
+
cli_args.append("--dirty")
|
|
59
|
+
|
|
60
|
+
if config_file:
|
|
61
|
+
cli_args.append("--config-file")
|
|
62
|
+
cli_args.append(config_file)
|
|
63
|
+
|
|
64
|
+
if strict is True:
|
|
65
|
+
cli_args.append("--strict")
|
|
66
|
+
|
|
67
|
+
if theme:
|
|
68
|
+
cli_args.append("--theme")
|
|
69
|
+
cli_args.append(theme)
|
|
70
|
+
|
|
71
|
+
if directory_urls is True:
|
|
72
|
+
cli_args.append("--use-directory-urls")
|
|
73
|
+
elif directory_urls is False:
|
|
74
|
+
cli_args.append("--no-directory-urls")
|
|
75
|
+
|
|
76
|
+
if site_dir:
|
|
77
|
+
cli_args.append("--site_dir")
|
|
78
|
+
cli_args.append(site_dir)
|
|
79
|
+
|
|
80
|
+
run("build", *cli_args, quiet=quiet, verbose=verbose)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@lazy(name="mkdocs.gh_deploy")
|
|
84
|
+
def gh_deploy(
|
|
85
|
+
*,
|
|
86
|
+
config_file: str | None = None,
|
|
87
|
+
clean: bool | None = None,
|
|
88
|
+
message: str | None = None,
|
|
89
|
+
remote_branch: str | None = None,
|
|
90
|
+
remote_name: str | None = None,
|
|
91
|
+
force: bool | None = None,
|
|
92
|
+
no_history: bool | None = None,
|
|
93
|
+
ignore_version: bool | None = None,
|
|
94
|
+
shell: bool | None = None,
|
|
95
|
+
strict: bool | None = None,
|
|
96
|
+
theme: str | None = None,
|
|
97
|
+
directory_urls: bool | None = None,
|
|
98
|
+
site_dir: str | None = None,
|
|
99
|
+
quiet: bool = False,
|
|
100
|
+
verbose: bool = False,
|
|
101
|
+
) -> None:
|
|
102
|
+
"""Deploy your documentation to GitHub Pages.
|
|
103
|
+
|
|
104
|
+
Parameters:
|
|
105
|
+
config_file: Provide a specific MkDocs config.
|
|
106
|
+
clean: Remove old files from the site_dir before building (the default).
|
|
107
|
+
message: A commit message to use when committing to the GitHub Pages remote branch.
|
|
108
|
+
Commit {sha} and MkDocs {version} are available as expansions.
|
|
109
|
+
remote_branch: The remote branch to commit to for GitHub Pages. This overrides the value specified in config.
|
|
110
|
+
remote_name: The remote name to commit to for GitHub Pages. This overrides the value specified in config
|
|
111
|
+
force: Force the push to the repository.
|
|
112
|
+
no_history: Replace the whole Git history with one new commit.
|
|
113
|
+
ignore_version: Ignore check that build is not being deployed with an older version of MkDocs.
|
|
114
|
+
shell: Use the shell when invoking Git.
|
|
115
|
+
strict: Enable strict mode. This will cause MkDocs to abort the build on any warnings.
|
|
116
|
+
theme: The theme to use when building your documentation.
|
|
117
|
+
directory_urls: Use directory URLs when building pages (the default).
|
|
118
|
+
site_dir: The directory to output the result of the documentation build.
|
|
119
|
+
quiet: Silence warnings.
|
|
120
|
+
verbose: Enable verbose output.
|
|
121
|
+
"""
|
|
122
|
+
cli_args = []
|
|
123
|
+
|
|
124
|
+
if clean is True:
|
|
125
|
+
cli_args.append("--clean")
|
|
126
|
+
elif clean is False:
|
|
127
|
+
cli_args.append("--dirty")
|
|
128
|
+
|
|
129
|
+
if message:
|
|
130
|
+
cli_args.append("--message")
|
|
131
|
+
cli_args.append(message)
|
|
132
|
+
|
|
133
|
+
if remote_branch:
|
|
134
|
+
cli_args.append("--remote-branch")
|
|
135
|
+
cli_args.append(remote_branch)
|
|
136
|
+
|
|
137
|
+
if remote_name:
|
|
138
|
+
cli_args.append("--remote-name")
|
|
139
|
+
cli_args.append(remote_name)
|
|
140
|
+
|
|
141
|
+
if force:
|
|
142
|
+
cli_args.append("--force")
|
|
143
|
+
|
|
144
|
+
if no_history:
|
|
145
|
+
cli_args.append("--no-history")
|
|
146
|
+
|
|
147
|
+
if ignore_version:
|
|
148
|
+
cli_args.append("--ignore-version")
|
|
149
|
+
|
|
150
|
+
if shell:
|
|
151
|
+
cli_args.append("--shell")
|
|
152
|
+
|
|
153
|
+
if config_file:
|
|
154
|
+
cli_args.append("--config-file")
|
|
155
|
+
cli_args.append(config_file)
|
|
156
|
+
|
|
157
|
+
if strict is True:
|
|
158
|
+
cli_args.append("--strict")
|
|
159
|
+
|
|
160
|
+
if theme:
|
|
161
|
+
cli_args.append("--theme")
|
|
162
|
+
cli_args.append(theme)
|
|
163
|
+
|
|
164
|
+
if directory_urls is True:
|
|
165
|
+
cli_args.append("--use-directory-urls")
|
|
166
|
+
elif directory_urls is False:
|
|
167
|
+
cli_args.append("--no-directory-urls")
|
|
168
|
+
|
|
169
|
+
if site_dir:
|
|
170
|
+
cli_args.append("--site_dir")
|
|
171
|
+
cli_args.append(site_dir)
|
|
172
|
+
|
|
173
|
+
run("gh-deploy", *cli_args, quiet=quiet, verbose=verbose)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@lazy(name="mkdocs.new")
|
|
177
|
+
def new(project_directory: str, *, quiet: bool = False, verbose: bool = False) -> None:
|
|
178
|
+
"""Create a new MkDocs project.
|
|
179
|
+
|
|
180
|
+
Parameters:
|
|
181
|
+
project_directory: Where to create the project.
|
|
182
|
+
quiet: Silence warnings.
|
|
183
|
+
verbose: Enable verbose output.
|
|
184
|
+
"""
|
|
185
|
+
run("new", project_directory, quiet=quiet, verbose=verbose)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@lazy(name="mkdocs.serve")
|
|
189
|
+
def serve(
|
|
190
|
+
*,
|
|
191
|
+
config_file: str | None = None,
|
|
192
|
+
dev_addr: str | None = None,
|
|
193
|
+
livereload: bool | None = None,
|
|
194
|
+
dirtyreload: bool | None = None,
|
|
195
|
+
watch_theme: bool | None = None,
|
|
196
|
+
watch: list[str] | None = None,
|
|
197
|
+
strict: bool | None = None,
|
|
198
|
+
theme: str | None = None,
|
|
199
|
+
directory_urls: bool | None = None,
|
|
200
|
+
quiet: bool = False,
|
|
201
|
+
verbose: bool = False,
|
|
202
|
+
) -> None:
|
|
203
|
+
"""Run the builtin development server.
|
|
204
|
+
|
|
205
|
+
Parameters:
|
|
206
|
+
config_file: Provide a specific MkDocs config.
|
|
207
|
+
dev_addr: IP address and port to serve documentation locally (default: localhost:8000).
|
|
208
|
+
livereload: Enable/disable the live reloading in the development server.
|
|
209
|
+
dirtyreload: nable the live reloading in the development server, but only re-build files that have changed.
|
|
210
|
+
watch_theme: Include the theme in list of files to watch for live reloading. Ignored when live reload is not used.
|
|
211
|
+
watch: Directories or files to watch for live reloading.
|
|
212
|
+
strict: Enable strict mode. This will cause MkDocs to abort the build on any warnings.
|
|
213
|
+
theme: The theme to use when building your documentation.
|
|
214
|
+
directory_urls: Use directory URLs when building pages (the default).
|
|
215
|
+
quiet: Silence warnings.
|
|
216
|
+
verbose: Enable verbose output.
|
|
217
|
+
"""
|
|
218
|
+
cli_args = []
|
|
219
|
+
|
|
220
|
+
if dev_addr:
|
|
221
|
+
cli_args.append("--dev-addr")
|
|
222
|
+
cli_args.append(dev_addr)
|
|
223
|
+
|
|
224
|
+
if livereload is True:
|
|
225
|
+
cli_args.append("--livereload")
|
|
226
|
+
elif livereload is False:
|
|
227
|
+
cli_args.append("--no-livereload")
|
|
228
|
+
|
|
229
|
+
if dirtyreload:
|
|
230
|
+
cli_args.append("--dirtyreload")
|
|
231
|
+
|
|
232
|
+
if watch_theme:
|
|
233
|
+
cli_args.append("--watch-theme")
|
|
234
|
+
|
|
235
|
+
if watch:
|
|
236
|
+
for path in watch:
|
|
237
|
+
cli_args.append("--watch")
|
|
238
|
+
cli_args.append(path)
|
|
239
|
+
|
|
240
|
+
if config_file:
|
|
241
|
+
cli_args.append("--config-file")
|
|
242
|
+
cli_args.append(config_file)
|
|
243
|
+
|
|
244
|
+
if strict is True:
|
|
245
|
+
cli_args.append("--strict")
|
|
246
|
+
|
|
247
|
+
if theme:
|
|
248
|
+
cli_args.append("--theme")
|
|
249
|
+
cli_args.append(theme)
|
|
250
|
+
|
|
251
|
+
if directory_urls is True:
|
|
252
|
+
cli_args.append("--use-directory-urls")
|
|
253
|
+
elif directory_urls is False:
|
|
254
|
+
cli_args.append("--no-directory-urls")
|
|
255
|
+
|
|
256
|
+
run("serve", *cli_args, quiet=quiet, verbose=verbose)
|