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.
Files changed (82) hide show
  1. duty/__init__.py +49 -2
  2. duty/__main__.py +1 -1
  3. duty/_internal/__init__.py +0 -0
  4. duty/_internal/callables/__init__.py +34 -0
  5. duty/{callables → _internal/callables}/_io.py +2 -0
  6. duty/_internal/callables/autoflake.py +132 -0
  7. duty/_internal/callables/black.py +176 -0
  8. duty/_internal/callables/blacken_docs.py +92 -0
  9. duty/_internal/callables/build.py +76 -0
  10. duty/_internal/callables/coverage.py +716 -0
  11. duty/_internal/callables/flake8.py +222 -0
  12. duty/_internal/callables/git_changelog.py +178 -0
  13. duty/_internal/callables/griffe.py +227 -0
  14. duty/_internal/callables/interrogate.py +152 -0
  15. duty/_internal/callables/isort.py +573 -0
  16. duty/_internal/callables/mkdocs.py +256 -0
  17. duty/_internal/callables/mypy.py +496 -0
  18. duty/_internal/callables/pytest.py +475 -0
  19. duty/_internal/callables/ruff.py +399 -0
  20. duty/_internal/callables/safety.py +82 -0
  21. duty/_internal/callables/ssort.py +38 -0
  22. duty/_internal/callables/twine.py +284 -0
  23. duty/_internal/cli.py +322 -0
  24. duty/_internal/collection.py +246 -0
  25. duty/_internal/context.py +111 -0
  26. duty/{debug.py → _internal/debug.py} +13 -15
  27. duty/_internal/decorator.py +111 -0
  28. duty/_internal/exceptions.py +12 -0
  29. duty/_internal/tools/__init__.py +41 -0
  30. duty/{tools → _internal/tools}/_autoflake.py +8 -4
  31. duty/{tools → _internal/tools}/_base.py +15 -2
  32. duty/{tools → _internal/tools}/_black.py +5 -5
  33. duty/{tools → _internal/tools}/_blacken_docs.py +10 -5
  34. duty/{tools → _internal/tools}/_build.py +4 -4
  35. duty/{tools → _internal/tools}/_coverage.py +8 -4
  36. duty/{tools → _internal/tools}/_flake8.py +10 -12
  37. duty/{tools → _internal/tools}/_git_changelog.py +8 -4
  38. duty/{tools → _internal/tools}/_griffe.py +8 -4
  39. duty/{tools → _internal/tools}/_interrogate.py +4 -4
  40. duty/{tools → _internal/tools}/_isort.py +8 -6
  41. duty/{tools → _internal/tools}/_mkdocs.py +8 -4
  42. duty/{tools → _internal/tools}/_mypy.py +5 -5
  43. duty/{tools → _internal/tools}/_pytest.py +8 -4
  44. duty/{tools → _internal/tools}/_ruff.py +11 -5
  45. duty/{tools → _internal/tools}/_safety.py +13 -8
  46. duty/{tools → _internal/tools}/_ssort.py +10 -6
  47. duty/{tools → _internal/tools}/_twine.py +11 -5
  48. duty/_internal/tools/_yore.py +96 -0
  49. duty/_internal/validation.py +266 -0
  50. duty/callables/__init__.py +4 -4
  51. duty/callables/autoflake.py +11 -126
  52. duty/callables/black.py +12 -171
  53. duty/callables/blacken_docs.py +11 -86
  54. duty/callables/build.py +12 -71
  55. duty/callables/coverage.py +12 -711
  56. duty/callables/flake8.py +12 -217
  57. duty/callables/git_changelog.py +12 -173
  58. duty/callables/griffe.py +12 -222
  59. duty/callables/interrogate.py +12 -147
  60. duty/callables/isort.py +12 -568
  61. duty/callables/mkdocs.py +12 -251
  62. duty/callables/mypy.py +11 -490
  63. duty/callables/pytest.py +12 -470
  64. duty/callables/ruff.py +12 -394
  65. duty/callables/safety.py +11 -76
  66. duty/callables/ssort.py +12 -33
  67. duty/callables/twine.py +12 -279
  68. duty/cli.py +10 -316
  69. duty/collection.py +12 -228
  70. duty/completions.bash +9 -9
  71. duty/context.py +12 -107
  72. duty/decorator.py +12 -108
  73. duty/exceptions.py +13 -10
  74. duty/tools.py +63 -0
  75. duty/validation.py +12 -262
  76. {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/METADATA +4 -3
  77. duty-1.6.1.dist-info/RECORD +81 -0
  78. {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/WHEEL +1 -1
  79. {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/entry_points.txt +1 -1
  80. duty/tools/__init__.py +0 -48
  81. duty-1.5.0.dist-info/RECORD +0 -54
  82. {duty-1.5.0.dist-info → duty-1.6.1.dist-info}/licenses/LICENSE +0 -0
duty/callables/flake8.py CHANGED
@@ -1,222 +1,17 @@
1
- """Callable for [Flake8](https://github.com/PyCQA/flake8)."""
1
+ """Deprecated. Use [`duty.tools.flake8`][] instead."""
2
2
 
3
- from __future__ import annotations
3
+ # YORE: Bump 2: Remove file.
4
4
 
5
- import sys
6
- from typing import Literal
5
+ import warnings
6
+ from typing import Any
7
7
 
8
- from failprint.lazy import lazy
8
+ from duty._internal.callables import flake8 as _flake8
9
9
 
10
10
 
11
- @lazy(name="flake8")
12
- def run(
13
- *paths: str,
14
- config: str | None = None,
15
- verbose: bool | None = None,
16
- output_file: str | None = None,
17
- append_config: str | None = None,
18
- isolated: bool | None = None,
19
- enable_extensions: list[str] | None = None,
20
- require_plugins: list[str] | None = None,
21
- quiet: bool | None = None,
22
- color: Literal["auto", "always", "never"] | None = None,
23
- count: bool | None = None,
24
- exclude: list[str] | None = None,
25
- extend_exclude: list[str] | None = None,
26
- filename: list[str] | None = None,
27
- stdin_display_name: str | None = None,
28
- error_format: str | None = None,
29
- hang_closing: bool | None = None,
30
- ignore: list[str] | None = None,
31
- extend_ignore: list[str] | None = None,
32
- per_file_ignores: dict[str, list[str]] | None = None,
33
- max_line_length: int | None = None,
34
- max_doc_length: int | None = None,
35
- indent_size: int | None = None,
36
- select: list[str] | None = None,
37
- extend_select: list[str] | None = None,
38
- disable_noqa: bool | None = None,
39
- show_source: bool | None = None,
40
- no_show_source: bool | None = None,
41
- statistics: bool | None = None,
42
- exit_zero: bool | None = None,
43
- jobs: int | None = None,
44
- tee: bool | None = None,
45
- benchmark: bool | None = None,
46
- bug_report: bool | None = None,
47
- ) -> int:
48
- """Run `flake8`.
49
-
50
- Parameters:
51
- *paths: Paths to check.
52
- config: Path to the config file that will be the authoritative config source.
53
- This will cause Flake8 to ignore all other configuration files.
54
- verbose: Print more information about what is happening in flake8.
55
- This option is repeatable and will increase verbosity each time it is repeated.
56
- output_file: Redirect report to a file.
57
- append_config: Provide extra config files to parse in addition to the files found by Flake8 by default.
58
- These files are the last ones read and so they take the highest precedence when multiple files provide the same option.
59
- isolated: Ignore all configuration files.
60
- enable_extensions: Enable plugins and extensions that are otherwise disabled by default.
61
- require_plugins: Require specific plugins to be installed before running.
62
- quiet: Report only file names, or nothing. This option is repeatable.
63
- color: Whether to use color in output. Defaults to `auto`.
64
- count: Print total number of errors to standard output and set the exit code to 1 if total is not empty.
65
- exclude: Comma-separated list of files or directories to exclude (default: ['.svn', 'CVS', '.bzr', '.hg', '.git', '__pycache__', '.tox', '.nox', '.eggs', '*.egg']).
66
- extend_exclude: Comma-separated list of files or directories to add to the list of excluded ones.
67
- filename: Only check for filenames matching the patterns in this comma-separated list (default: ['*.py']).
68
- stdin_display_name: The name used when reporting errors from code passed via stdin. This is useful for editors piping the file contents to flake8 (default: stdin).
69
- error_format: Format errors according to the chosen formatter.
70
- hang_closing: Hang closing bracket instead of matching indentation of opening bracket's line.
71
- ignore: Comma-separated list of error codes to ignore (or skip). For example, ``--ignore=E4,E51,W234`` (default: E121,E123,E126,E226,E24,E704,W503,W504).
72
- extend_ignore: Comma-separated list of error codes to add to the list of ignored ones. For example, ``--extend-ignore=E4,E51,W234``.
73
- per_file_ignores: A pairing of filenames and violation codes that defines which violations to ignore in a particular file. The filenames can be specified in a manner similar to the ``--exclude`` option and the violations work similarly to the ``--ignore`` and ``--select`` options.
74
- max_line_length: Maximum allowed line length for the entirety of this run (default: 79).
75
- max_doc_length: Maximum allowed doc line length for the entirety of this run (default: None).
76
- indent_size: Number of spaces used for indentation (default: 4).
77
- select: Comma-separated list of error codes to enable. For example, ``--select=E4,E51,W234`` (default: E,F,W,C90).
78
- extend_select: Comma-separated list of error codes to add to the list of selected ones. For example, ``--extend-select=E4,E51,W234``.
79
- disable_noqa: Disable the effect of "# noqa". This will report errors on lines with "# noqa" at the end.
80
- show_source: Show the source generate each error or warning.
81
- no_show_source: Negate --show-source.
82
- statistics: Count errors.
83
- exit_zero: Exit with status code "0" even if there are errors.
84
- jobs: Number of subprocesses to use to run checks in parallel. This is ignored on Windows. The default, "auto", will auto-detect the number of processors available to use (default: auto).
85
- tee: Write to stdout and output-file.
86
- benchmark: Print benchmark information about this run of Flake8.
87
- bug_report: Print information necessary when preparing a bug report.
88
-
89
- Returns:
90
- Success/failure.
91
- """
92
- from flake8.main import main as flake8
93
-
94
- cli_args = list(paths)
95
-
96
- if verbose:
97
- cli_args.append("--verbose")
98
-
99
- if output_file:
100
- cli_args.append("--output-file")
101
- cli_args.append(output_file)
102
-
103
- if append_config:
104
- cli_args.append("--append-config")
105
- cli_args.append(append_config)
106
-
107
- if config:
108
- cli_args.append("--config")
109
- cli_args.append(config)
110
-
111
- if isolated:
112
- cli_args.append("--isolated")
113
-
114
- if enable_extensions:
115
- cli_args.append("--enable-extensions")
116
- cli_args.append(",".join(enable_extensions))
117
-
118
- if require_plugins:
119
- cli_args.append("--require-plugins")
120
- cli_args.append(",".join(require_plugins))
121
-
122
- if quiet:
123
- cli_args.append("--quiet")
124
-
125
- if color:
126
- cli_args.append("--color")
127
- cli_args.append(color)
128
-
129
- if count:
130
- cli_args.append("--count")
131
-
132
- if exclude:
133
- cli_args.append("--exclude")
134
- cli_args.append(",".join(exclude))
135
-
136
- if extend_exclude:
137
- cli_args.append("--extend-exclude")
138
- cli_args.append(",".join(extend_exclude))
139
-
140
- if filename:
141
- cli_args.append("--filename")
142
- cli_args.append(",".join(filename))
143
-
144
- if stdin_display_name:
145
- cli_args.append("--stdin-display-name")
146
- cli_args.append(stdin_display_name)
147
-
148
- if error_format:
149
- cli_args.append("--format")
150
- cli_args.append(error_format)
151
-
152
- if hang_closing:
153
- cli_args.append("--hang-closing")
154
-
155
- if ignore:
156
- cli_args.append("--ignore")
157
- cli_args.append(",".join(ignore))
158
-
159
- if extend_ignore:
160
- cli_args.append("--extend-ignore")
161
- cli_args.append(",".join(extend_ignore))
162
-
163
- if per_file_ignores:
164
- cli_args.append("--per-file-ignores")
165
- cli_args.append(
166
- " ".join(f"{path}:{','.join(codes)}" for path, codes in per_file_ignores.items()),
167
- )
168
-
169
- if max_line_length:
170
- cli_args.append("--max-line-length")
171
- cli_args.append(str(max_line_length))
172
-
173
- if max_doc_length:
174
- cli_args.append("--max-doc-length")
175
- cli_args.append(str(max_doc_length))
176
-
177
- if indent_size:
178
- cli_args.append("--indent-size")
179
- cli_args.append(str(indent_size))
180
-
181
- if select:
182
- cli_args.append("--select")
183
- cli_args.append(",".join(select))
184
-
185
- if extend_select:
186
- cli_args.append("--extend-select")
187
- cli_args.append(",".join(extend_select))
188
-
189
- if disable_noqa:
190
- cli_args.append("--disable-noqa")
191
-
192
- if show_source:
193
- cli_args.append("--show-source")
194
-
195
- if no_show_source:
196
- cli_args.append("--no-show-source")
197
-
198
- if statistics:
199
- cli_args.append("--statistics")
200
-
201
- if exit_zero:
202
- cli_args.append("--exit-zero")
203
-
204
- if jobs:
205
- cli_args.append("--jobs")
206
- cli_args.append(str(jobs))
207
-
208
- if tee:
209
- cli_args.append("--tee")
210
-
211
- if benchmark:
212
- cli_args.append("--benchmark")
213
-
214
- if bug_report:
215
- cli_args.append("--bug-report")
216
-
217
- old_sys_argv = sys.argv
218
- sys.argv = ["flake*", *cli_args]
219
- try:
220
- return flake8()
221
- finally:
222
- sys.argv = old_sys_argv
11
+ def __getattr__(name: str) -> Any:
12
+ warnings.warn(
13
+ "Callables are deprecated in favor of tools, use `duty.tools.flake8` instead of `duty.callables.flake8`.",
14
+ DeprecationWarning,
15
+ stacklevel=2,
16
+ )
17
+ return getattr(_flake8, name)
@@ -1,178 +1,17 @@
1
- """Callable for [git-changelog](https://github.com/pawamoy/git-changelog)."""
1
+ """Deprecated. Use [`duty.tools.git_changelog`][] instead."""
2
2
 
3
- from __future__ import annotations
3
+ # YORE: Bump 2: Remove file.
4
4
 
5
- from typing import Literal
5
+ import warnings
6
+ from typing import Any
6
7
 
7
- from failprint.lazy import lazy
8
+ from duty._internal.callables import git_changelog as _git_changelog
8
9
 
9
10
 
10
- @lazy(name="git_changelog")
11
- def run(
12
- repository: str | None = None,
13
- *,
14
- config_file: str | None = None,
15
- bump: str | None = None,
16
- versioning: Literal["semver", "pep440"] | None = None,
17
- in_place: bool = False,
18
- version_regex: str | None = None,
19
- marker_line: str | None = None,
20
- output: str | None = None,
21
- provider: Literal["github", "gitlab", "bitbucket"] | None = None,
22
- parse_refs: bool = False,
23
- release_notes: bool = False,
24
- input: str | None = None, # noqa: A002
25
- convention: Literal["basic", "angular", "conventional"] | None = None,
26
- sections: list[str] | None = None,
27
- template: str | None = None,
28
- git_trailers: bool = False,
29
- omit_empty_versions: bool = False,
30
- no_zerover: bool = False,
31
- filter_commits: str | None = None,
32
- jinja_context: list[str] | None = None,
33
- version: bool = False,
34
- debug_info: bool = False,
35
- ) -> None:
36
- r"""Run `git-changelog`.
37
-
38
- Parameters:
39
- repository: The repository path, relative or absolute. Default: current working directory.
40
- config_file: Configuration file(s).
41
- bump: Specify the bump from latest version for the set of unreleased commits.
42
- Can be one of `auto`, `major`, `minor`, `patch` or a valid SemVer version (eg. 1.2.3).
43
- For both SemVer and PEP 440 versioning schemes (see -n), `auto` will bump the major number
44
- if a commit contains breaking changes (or the minor number for 0.x versions, see -Z),
45
- else the minor number if there are new features, else the patch number. Default: unset (false).
46
- versioning: Versioning scheme to use when bumping and comparing versions.
47
- The selected scheme will impact the values accepted by the `--bump` option.
48
- Supported: `pep440`, `semver`.
49
-
50
- PEP 440 provides the following bump strategies: `auto`, `epoch`, `release`, `major`, `minor`, `micro`, `patch`,
51
- `pre`, `alpha`, `beta`, `candidate`, `post`, `dev`.
52
- Values `auto`, `major`, `minor`, `micro` can be suffixed with one of `+alpha`, `+beta`, `+candidate`, and/or `+dev`.
53
- Values `alpha`, `beta` and `candidate` can be suffixed with `+dev`.
54
- Examples: `auto+alpha`, `major+beta+dev`, `micro+dev`, `candidate+dev`, etc..
55
-
56
- SemVer provides the following bump strategies: `auto`, `major`, `minor`, `patch`, `release`.
57
- See the docs for more information. Default: unset (`semver`).
58
- in_place: Insert new entries (versions missing from changelog) in-place.
59
- An output file must be specified. With custom templates, you can pass two additional
60
- arguments: `--version-regex` and `--marker-line`.
61
- When writing in-place, an `in_place` variable will be injected in the Jinja context,
62
- allowing to adapt the generated contents (for example to skip changelog headers or footers).
63
- Default: unset (false).
64
- version_regex: A regular expression to match versions in the existing changelog
65
- (used to find the latest release) when writing in-place.
66
- The regular expression must be a Python regex with a `version` named group.
67
- Default: `^## \[(?P<version>v?[^\]]+)`.
68
- marker_line: A marker line at which to insert new entries (versions missing from changelog).
69
- If two marker lines are present in the changelog, the contents between those two lines
70
- will be overwritten (useful to update an 'Unreleased' entry for example). Default: `<!-- insertion marker -->`.
71
- output: Output to given file. Default: standard output.
72
- provider: Explicitly specify the repository provider. Default: unset.
73
- parse_refs: Parse provider-specific references in commit messages (GitHub/GitLab/Bitbucket issues, PRs, etc.).
74
- Default: unset (false).
75
- release_notes: Output release notes to stdout based on the last entry in the changelog. Default: unset (false).
76
- input: Read from given file when creating release notes. Default: `CHANGELOG.md`.
77
- convention: The commit convention to match against. Default: `basic`.
78
- sections: A comma-separated list of sections to render.
79
- See the available sections for each supported convention in the description. Default: unset (None).
80
- template: The Jinja2 template to use.
81
- Prefix it with `path:` to specify the path to a Jinja templated file. Default: `keepachangelog`.
82
- git_trailers: Parse Git trailers in the commit message.
83
- See https://git-scm.com/docs/git-interpret-trailers. Default: unset (false).
84
- omit_empty_versions: Omit empty versions from the output. Default: unset (false).
85
- no_zerover: By default, breaking changes on a 0.x don't bump the major version, maintaining it at 0.
86
- With this option, a breaking change will bump a 0.x version to 1.0.
87
- filter_commits: The Git revision-range filter to use (e.g. `v1.2.0..`). Default: no filter.
88
- jinja_context: Pass additional key/value pairs to the template.
89
- Option can be used multiple times.
90
- The key/value pairs are accessible as 'jinja_context' in the template.
91
- version: Show the current version of the program and exit.
92
- debug_info: Print debug information.
93
- """
94
- from git_changelog.cli import main as git_changelog
95
-
96
- cli_args = []
97
-
98
- if repository:
99
- cli_args.append(repository)
100
-
101
- if config_file:
102
- cli_args.append("--config-file")
103
- cli_args.append(config_file)
104
-
105
- if bump:
106
- cli_args.append("--bump")
107
- cli_args.append(bump)
108
-
109
- if versioning:
110
- cli_args.append("--versioning")
111
- cli_args.append(versioning)
112
-
113
- if in_place:
114
- cli_args.append("--in-place")
115
-
116
- if version_regex:
117
- cli_args.append("--version-regex")
118
- cli_args.append(version_regex)
119
-
120
- if marker_line:
121
- cli_args.append("--marker-line")
122
- cli_args.append(marker_line)
123
-
124
- if output:
125
- cli_args.append("--output")
126
- cli_args.append(output)
127
-
128
- if provider:
129
- cli_args.append("--provider")
130
- cli_args.append(provider)
131
-
132
- if parse_refs:
133
- cli_args.append("--parse-refs")
134
-
135
- if release_notes:
136
- cli_args.append("--release-notes")
137
-
138
- if input:
139
- cli_args.append("--input")
140
- cli_args.append(input)
141
-
142
- if convention:
143
- cli_args.append("--convention")
144
- cli_args.append(convention)
145
-
146
- if sections:
147
- cli_args.append("--sections")
148
- cli_args.append(",".join(sections))
149
-
150
- if template:
151
- cli_args.append("--template")
152
- cli_args.append(template)
153
-
154
- if git_trailers:
155
- cli_args.append("--git-trailers")
156
-
157
- if omit_empty_versions:
158
- cli_args.append("--omit-empty-versions")
159
-
160
- if no_zerover:
161
- cli_args.append("--no-zerover")
162
-
163
- if filter_commits:
164
- cli_args.append("--filter-commits")
165
- cli_args.append(filter_commits)
166
-
167
- if jinja_context:
168
- for key_value in jinja_context:
169
- cli_args.append("--jinja-context")
170
- cli_args.append(key_value)
171
-
172
- if version:
173
- cli_args.append("--version")
174
-
175
- if debug_info:
176
- cli_args.append("--debug-info")
177
-
178
- git_changelog(cli_args)
11
+ def __getattr__(name: str) -> Any:
12
+ warnings.warn(
13
+ "Callables are deprecated in favor of tools, use `duty.tools.git_changelog` instead of `duty.callables.git_changelog`.",
14
+ DeprecationWarning,
15
+ stacklevel=2,
16
+ )
17
+ return getattr(_git_changelog, name)
duty/callables/griffe.py CHANGED
@@ -1,227 +1,17 @@
1
- """Callable for [Griffe](https://github.com/mkdocstrings/griffe)."""
1
+ """Deprecated. Use [`duty.tools.griffe`][] instead."""
2
2
 
3
- from __future__ import annotations
3
+ # YORE: Bump 2: Remove file.
4
4
 
5
- from typing import Literal
5
+ import warnings
6
+ from typing import Any
6
7
 
7
- from failprint.lazy import lazy
8
+ from duty._internal.callables import griffe as _griffe
8
9
 
9
10
 
10
- def run(*args: str, version: bool = False, debug_info: bool = False) -> None:
11
- """Run `griffe`.
12
-
13
- Parameters:
14
- *args: CLI arguments.
15
- version: Show program's version number and exit.
16
- debug_info: Print debug information.
17
- """
18
- from griffe.cli import main as griffe
19
-
20
- cli_args = []
21
-
22
- # --version and --debug-info must appear first.
23
- if version:
24
- cli_args.append("--version")
25
-
26
- if debug_info:
27
- cli_args.append("--debug-info")
28
-
29
- cli_args.extend(args)
30
-
31
- griffe(cli_args)
32
-
33
-
34
- @lazy(name="griffe.check")
35
- def check(
36
- package: str,
37
- *,
38
- against: str | None = None,
39
- base_ref: str | None = None,
40
- color: bool = False,
41
- verbose: bool = False,
42
- format: Literal["oneline", "verbose", "markdown", "github"] | None = None, # noqa: A002
43
- search: list[str] | None = None,
44
- sys_path: bool = False,
45
- find_stubs_packages: bool = False,
46
- extensions: str | list[str] | None = None,
47
- inspection: bool | None = None,
48
- log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] | None = None,
49
- version: bool = False,
50
- debug_info: bool = False,
51
- ) -> None:
52
- """Check for API breakages or possible improvements.
53
-
54
- Parameters:
55
- package: Package to find, load and check, as path.
56
- against: Older Git reference (commit, branch, tag) to check against. Default: load latest tag.
57
- base_ref: Git reference (commit, branch, tag) to check. Default: load current code.
58
- color: Force enable/disable colors in the output.
59
- verbose: Verbose output.
60
- format: Output format.
61
- search: Paths to search packages into.
62
- sys_path: Whether to append `sys.path` to search paths specified with `-s`.
63
- find_stubs_packages: Whether to look for stubs-only packages and merge them with concrete ones.
64
- extensions: A comma-separated list or a JSON list of extensions to load.
65
- inspection: Whether to disallow or force inspection (dynamic analysis).
66
- By default, Griffe tries to use static analysis and falls back to dynamic analysis when it can't.
67
- log_level: Set the log level: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`.
68
- version: Show program's version number and exit.
69
- debug_info: Print debug information.
70
- """
71
- cli_args = []
72
-
73
- if package:
74
- cli_args.append(package)
75
-
76
- if against:
77
- cli_args.append("--against")
78
- cli_args.append(against)
79
-
80
- if base_ref:
81
- cli_args.append("--base-ref")
82
- cli_args.append(base_ref)
83
-
84
- if color is True:
85
- cli_args.append("--color")
86
- elif color is False:
87
- cli_args.append("--no-color")
88
-
89
- if verbose:
90
- cli_args.append("--verbose")
91
-
92
- if format:
93
- cli_args.append("--format")
94
- cli_args.append(format)
95
-
96
- if search:
97
- for path in search:
98
- cli_args.append("--search")
99
- cli_args.append(path)
100
-
101
- if sys_path:
102
- cli_args.append("--sys-path")
103
-
104
- if find_stubs_packages:
105
- cli_args.append("--find-stubs-packages")
106
-
107
- if extensions:
108
- cli_args.append("--extensions")
109
- if isinstance(extensions, str):
110
- cli_args.append(extensions)
111
- else:
112
- cli_args.append(",".join(extensions))
113
-
114
- if inspection is True:
115
- cli_args.append("--force-inspection")
116
- elif inspection is False:
117
- cli_args.append("--no-inspection")
118
-
119
- if log_level:
120
- cli_args.append("--log-level")
121
- cli_args.append(log_level)
122
-
123
- run("check", *cli_args, version=version, debug_info=debug_info)
124
-
125
-
126
- @lazy(name="griffe.dump")
127
- def dump(
128
- *packages: str,
129
- full: bool = False,
130
- output: str | None = None,
131
- docstyle: str | None = None,
132
- docopts: str | None = None,
133
- resolve_aliases: bool = False,
134
- resolve_implicit: bool = False,
135
- resolve_external: bool | None = None,
136
- stats: bool = False,
137
- search: list[str] | None = None,
138
- sys_path: bool = False,
139
- find_stubs_packages: bool = False,
140
- extensions: str | list[str] | None = None,
141
- inspection: bool | None = None,
142
- log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] | None = None,
143
- version: bool = False,
144
- debug_info: bool = False,
145
- ) -> None:
146
- """Load package-signatures and dump them as JSON.
147
-
148
- Parameters:
149
- packages: Packages to find, load and dump.
150
- full: Whether to dump full data in JSON.
151
- output: Output file. Supports templating to output each package in its own file, with `{package}`.
152
- docstyle: The docstring style to parse.
153
- docopts: The options for the docstring parser.
154
- resolve_aliases: Whether to resolve aliases.
155
- resolve_implicit: Whether to resolve implicitely exported aliases as well. Aliases are explicitely exported when defined in `__all__`.
156
- resolve_external: Whether to resolve aliases pointing to external/unknown modules (not loaded directly).
157
- Default is to resolve only from one module to its private sibling (`ast` -> `_ast`).
158
- stats: Show statistics at the end.
159
- search: Paths to search packages into.
160
- sys_path: Whether to append `sys.path` to search paths specified with `-s`.
161
- find_stubs_packages: Whether to look for stubs-only packages and merge them with concrete ones.
162
- extensions: A comma-separated list or a JSON list of extensions to load.
163
- inspection: Whether to disallow or force inspection (dynamic analysis).
164
- By default, Griffe tries to use static analysis and falls back to dynamic analysis when it can't.
165
- log_level: Set the log level: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`.
166
- version: Show program's version number and exit.
167
- debug_info: Print debug information.
168
- """
169
- cli_args = list(packages)
170
-
171
- if full:
172
- cli_args.append("--full")
173
-
174
- if output:
175
- cli_args.append("--output")
176
- cli_args.append(output)
177
-
178
- if docstyle:
179
- cli_args.append("--docstyle")
180
- cli_args.append(docstyle)
181
-
182
- if docopts:
183
- cli_args.append("--docopts")
184
- cli_args.append(docopts)
185
-
186
- if resolve_aliases:
187
- cli_args.append("--resolve-aliases")
188
-
189
- if resolve_implicit:
190
- cli_args.append("--resolve-implicit")
191
-
192
- if resolve_external is True:
193
- cli_args.append("--resolve-external")
194
- elif resolve_external is False:
195
- cli_args.append("--no-resolve-external")
196
-
197
- if stats:
198
- cli_args.append("--stats")
199
-
200
- if search:
201
- for path in search:
202
- cli_args.append("--search")
203
- cli_args.append(path)
204
-
205
- if sys_path:
206
- cli_args.append("--sys-path")
207
-
208
- if find_stubs_packages:
209
- cli_args.append("--find-stubs-packages")
210
-
211
- if extensions:
212
- cli_args.append("--extensions")
213
- if isinstance(extensions, str):
214
- cli_args.append(extensions)
215
- else:
216
- cli_args.append(",".join(extensions))
217
-
218
- if inspection is True:
219
- cli_args.append("--force-inspection")
220
- elif inspection is False:
221
- cli_args.append("--no-inspection")
222
-
223
- if log_level:
224
- cli_args.append("--log-level")
225
- cli_args.append(log_level)
226
-
227
- run("check", *cli_args, version=version, debug_info=debug_info)
11
+ def __getattr__(name: str) -> Any:
12
+ warnings.warn(
13
+ "Callables are deprecated in favor of tools, use `duty.tools.griffe` instead of `duty.callables.griffe`.",
14
+ DeprecationWarning,
15
+ stacklevel=2,
16
+ )
17
+ return getattr(_griffe, name)