duty 1.2.0__tar.gz → 1.4.0__tar.gz

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 (69) hide show
  1. {duty-1.2.0 → duty-1.4.0}/PKG-INFO +8 -5
  2. {duty-1.2.0 → duty-1.4.0}/README.md +2 -2
  3. {duty-1.2.0 → duty-1.4.0}/pyproject.toml +11 -49
  4. duty-1.4.0/src/duty/callables/__init__.py +41 -0
  5. duty-1.4.0/src/duty/callables/build.py +76 -0
  6. duty-1.4.0/src/duty/callables/git_changelog.py +178 -0
  7. duty-1.4.0/src/duty/callables/griffe.py +227 -0
  8. duty-1.4.0/src/duty/callables/twine.py +284 -0
  9. {duty-1.2.0 → duty-1.4.0}/src/duty/cli.py +2 -0
  10. {duty-1.2.0 → duty-1.4.0}/src/duty/context.py +6 -1
  11. {duty-1.2.0 → duty-1.4.0}/src/duty/debug.py +4 -1
  12. duty-1.4.0/src/duty/tools/__init__.py +48 -0
  13. duty-1.4.0/src/duty/tools/_autoflake.py +138 -0
  14. duty-1.4.0/src/duty/tools/_base.py +66 -0
  15. duty-1.4.0/src/duty/tools/_black.py +184 -0
  16. duty-1.4.0/src/duty/tools/_blacken_docs.py +115 -0
  17. duty-1.4.0/src/duty/tools/_build.py +84 -0
  18. duty-1.4.0/src/duty/tools/_coverage.py +721 -0
  19. duty-1.4.0/src/duty/tools/_flake8.py +230 -0
  20. duty-1.4.0/src/duty/tools/_git_changelog.py +186 -0
  21. duty-1.4.0/src/duty/tools/_griffe.py +226 -0
  22. duty-1.4.0/src/duty/tools/_interrogate.py +160 -0
  23. duty-1.4.0/src/duty/tools/_isort.py +579 -0
  24. duty-1.4.0/src/duty/tools/_mkdocs.py +271 -0
  25. duty-1.4.0/src/duty/tools/_mypy.py +502 -0
  26. duty-1.4.0/src/duty/tools/_pytest.py +483 -0
  27. duty-1.4.0/src/duty/tools/_ruff.py +451 -0
  28. duty-1.4.0/src/duty/tools/_safety.py +97 -0
  29. duty-1.4.0/src/duty/tools/_ssort.py +44 -0
  30. duty-1.4.0/src/duty/tools/_twine.py +289 -0
  31. {duty-1.2.0 → duty-1.4.0}/src/duty/validation.py +24 -6
  32. duty-1.2.0/src/duty/callables/__init__.py +0 -33
  33. duty-1.2.0/tests/__init__.py +0 -7
  34. duty-1.2.0/tests/conftest.py +0 -1
  35. duty-1.2.0/tests/fixtures/arguments.py +0 -6
  36. duty-1.2.0/tests/fixtures/basic.py +0 -6
  37. duty-1.2.0/tests/fixtures/booleans.py +0 -6
  38. duty-1.2.0/tests/fixtures/code.py +0 -6
  39. duty-1.2.0/tests/fixtures/list.py +0 -11
  40. duty-1.2.0/tests/fixtures/multiple.py +0 -11
  41. duty-1.2.0/tests/fixtures/precedence.py +0 -6
  42. duty-1.2.0/tests/fixtures/validation.py +0 -46
  43. duty-1.2.0/tests/test_cli.py +0 -247
  44. duty-1.2.0/tests/test_collection.py +0 -70
  45. duty-1.2.0/tests/test_context.py +0 -99
  46. duty-1.2.0/tests/test_decorator.py +0 -26
  47. duty-1.2.0/tests/test_running.py +0 -114
  48. duty-1.2.0/tests/test_validation.py +0 -147
  49. {duty-1.2.0 → duty-1.4.0}/LICENSE +0 -0
  50. {duty-1.2.0 → duty-1.4.0}/src/duty/__init__.py +0 -0
  51. {duty-1.2.0 → duty-1.4.0}/src/duty/__main__.py +0 -0
  52. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/_io.py +0 -0
  53. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/autoflake.py +0 -0
  54. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/black.py +0 -0
  55. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/blacken_docs.py +0 -0
  56. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/coverage.py +0 -0
  57. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/flake8.py +0 -0
  58. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/interrogate.py +0 -0
  59. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/isort.py +0 -0
  60. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/mkdocs.py +0 -0
  61. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/mypy.py +0 -0
  62. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/pytest.py +0 -0
  63. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/ruff.py +0 -0
  64. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/safety.py +0 -0
  65. {duty-1.2.0 → duty-1.4.0}/src/duty/callables/ssort.py +0 -0
  66. {duty-1.2.0 → duty-1.4.0}/src/duty/collection.py +0 -0
  67. {duty-1.2.0 → duty-1.4.0}/src/duty/decorator.py +0 -0
  68. {duty-1.2.0 → duty-1.4.0}/src/duty/exceptions.py +0 -0
  69. {duty-1.2.0 → duty-1.4.0}/src/duty/py.typed +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: duty
3
- Version: 1.2.0
3
+ Version: 1.4.0
4
4
  Summary: A simple task runner.
5
- Keywords: task-runner task runner cross-platform
6
- Author-Email: Timothée Mazzucotelli <pawamoy@pm.me>
5
+ Keywords: task-runner,task,runner,cross-platform
6
+ Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
7
7
  License: ISC
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Classifier: Topic :: Documentation
19
20
  Classifier: Topic :: Software Development
20
21
  Classifier: Topic :: Utilities
@@ -28,15 +29,17 @@ Project-URL: Discussions, https://github.com/pawamoy/duty/discussions
28
29
  Project-URL: Gitter, https://gitter.im/duty/community
29
30
  Project-URL: Funding, https://github.com/sponsors/pawamoy
30
31
  Requires-Python: >=3.8
32
+ Requires-Dist: eval-type-backport; python_version < "3.10"
31
33
  Requires-Dist: failprint!=1.0.0,>=0.11
34
+ Requires-Dist: typing-extensions>=4.0; python_version < "3.11"
32
35
  Description-Content-Type: text/markdown
33
36
 
34
37
  # duty
35
38
 
36
39
  [![ci](https://github.com/pawamoy/duty/workflows/ci/badge.svg)](https://github.com/pawamoy/duty/actions?query=workflow%3Aci)
37
- [![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)](https://pawamoy.github.io/duty/)
40
+ [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/duty/)
38
41
  [![pypi version](https://img.shields.io/pypi/v/duty.svg)](https://pypi.org/project/duty/)
39
- [![gitpod](https://img.shields.io/badge/gitpod-workspace-blue.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/duty)
42
+ [![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/duty)
40
43
  [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#duty:gitter.im)
41
44
 
42
45
  A simple task runner.
@@ -1,9 +1,9 @@
1
1
  # duty
2
2
 
3
3
  [![ci](https://github.com/pawamoy/duty/workflows/ci/badge.svg)](https://github.com/pawamoy/duty/actions?query=workflow%3Aci)
4
- [![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)](https://pawamoy.github.io/duty/)
4
+ [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/duty/)
5
5
  [![pypi version](https://img.shields.io/pypi/v/duty.svg)](https://pypi.org/project/duty/)
6
- [![gitpod](https://img.shields.io/badge/gitpod-workspace-blue.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/duty)
6
+ [![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/duty)
7
7
  [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#duty:gitter.im)
8
8
 
9
9
  A simple task runner.
@@ -8,7 +8,7 @@ build-backend = "pdm.backend"
8
8
  name = "duty"
9
9
  description = "A simple task runner."
10
10
  authors = [
11
- { name = "Timothée Mazzucotelli", email = "pawamoy@pm.me" },
11
+ { name = "Timothée Mazzucotelli", email = "dev@pawamoy.fr" },
12
12
  ]
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.8"
@@ -30,15 +30,18 @@ classifiers = [
30
30
  "Programming Language :: Python :: 3.10",
31
31
  "Programming Language :: Python :: 3.11",
32
32
  "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
33
34
  "Topic :: Documentation",
34
35
  "Topic :: Software Development",
35
36
  "Topic :: Utilities",
36
37
  "Typing :: Typed",
37
38
  ]
38
39
  dependencies = [
40
+ "eval-type-backport; python_version < '3.10'",
39
41
  "failprint>=0.11,!=1.0.0",
42
+ "typing-extensions>=4.0; python_version < '3.11'",
40
43
  ]
41
- version = "1.2.0"
44
+ version = "1.4.0"
42
45
 
43
46
  [project.license]
44
47
  text = "ISC"
@@ -56,58 +59,17 @@ Funding = "https://github.com/sponsors/pawamoy"
56
59
  [project.scripts]
57
60
  duty = "duty.cli:main"
58
61
 
59
- [tool.pdm]
60
- plugins = [
61
- "pdm-multirun",
62
- ]
63
-
64
62
  [tool.pdm.version]
65
63
  source = "scm"
66
64
 
67
65
  [tool.pdm.build]
68
66
  package-dir = "src"
69
67
  editable-backend = "editables"
70
-
71
- [tool.pdm.dev-dependencies]
72
- ci-quality = [
73
- "duty[docs,quality,typing,security]",
74
- ]
75
- ci-tests = [
76
- "duty[tests]",
77
- ]
78
- docs = [
79
- "black>=23.9",
80
- "markdown-callouts>=0.3",
81
- "markdown-exec>=1.7",
82
- "mkdocs>=1.5",
83
- "mkdocs-coverage>=1.0",
84
- "mkdocs-gen-files>=0.5",
85
- "mkdocs-git-committers-plugin-2>=1.2",
86
- "mkdocs-literate-nav>=0.6",
87
- "mkdocs-material>=9.4",
88
- "mkdocs-minify-plugin>=0.7",
89
- "mkdocstrings[python]>=0.23",
90
- "tomli>=2.0; python_version < '3.11'",
68
+ source-includes = [
69
+ "share",
91
70
  ]
92
- maintain = [
93
- "black>=23.9",
94
- "blacken-docs>=1.16",
95
- "git-changelog>=2.3",
96
- ]
97
- quality = [
98
- "ruff>=0.0",
99
- ]
100
- tests = [
101
- "pytest>=7.4",
102
- "pytest-cov>=4.1",
103
- "pytest-randomly>=3.15",
104
- "pytest-xdist>=3.3",
105
- ]
106
- typing = [
107
- "mypy>=1.5",
108
- "types-markdown>=3.5",
109
- "types-pyyaml>=6.0",
110
- ]
111
- security = [
112
- "safety>=2.3",
71
+
72
+ [tool.pdm.build.wheel-data]
73
+ data = [
74
+ { path = "share/**/*", relative-to = "." },
113
75
  ]
@@ -0,0 +1,41 @@
1
+ """Module containing callables for many tools.
2
+
3
+ These callables are **deprecated** in favor of our new [tools][duty.tools].
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import warnings
9
+
10
+ from failprint.lazy import lazy
11
+
12
+ from duty.callables import (
13
+ autoflake, # noqa: F401
14
+ black, # noqa: F401
15
+ blacken_docs, # noqa: F401
16
+ build, # noqa: F401
17
+ coverage, # noqa: F401
18
+ flake8, # noqa: F401
19
+ git_changelog, # noqa: F401
20
+ griffe, # noqa: F401
21
+ interrogate, # noqa: F401
22
+ isort, # noqa: F401
23
+ mkdocs, # noqa: F401
24
+ mypy, # noqa: F401
25
+ pytest, # noqa: F401
26
+ ruff, # noqa: F401
27
+ safety, # noqa: F401
28
+ ssort, # noqa: F401
29
+ twine, # noqa: F401
30
+ )
31
+
32
+ __all__ = ["lazy"]
33
+
34
+ warnings.warn(
35
+ "Callables are deprecated in favor of our new `duty.tools`. "
36
+ "They are easier to use and provide more functionality "
37
+ "like automatically computing `command` values in `ctx.run()` calls. "
38
+ "Old callables will be removed in a future version.",
39
+ DeprecationWarning,
40
+ stacklevel=1,
41
+ )
@@ -0,0 +1,76 @@
1
+ """Callable for [build](https://github.com/pypa/build)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Literal
6
+
7
+ from failprint.lazy import lazy
8
+
9
+
10
+ @lazy(name="build")
11
+ def run(
12
+ srcdir: str | None = None,
13
+ *,
14
+ version: bool = False,
15
+ verbose: bool = False,
16
+ sdist: bool = False,
17
+ wheel: bool = False,
18
+ outdir: str | None = None,
19
+ skip_dependency_check: bool = False,
20
+ no_isolation: bool = False,
21
+ installer: Literal["pip", "uv"] | None = None,
22
+ config_setting: list[str] | None = None,
23
+ ) -> None:
24
+ """Run `build`.
25
+
26
+ Parameters:
27
+ srcdir: Source directory (defaults to current directory).
28
+ version: Show program's version number and exit.
29
+ verbose: Increase verbosity
30
+ sdist: Build a source distribution (disables the default behavior).
31
+ wheel: Build a wheel (disables the default behavior).
32
+ outdir: Output directory (defaults to `{srcdir}/dist`).
33
+ skip_dependency_check: Do not check that build dependencies are installed.
34
+ no_isolation: Disable building the project in an isolated virtual environment.
35
+ Build dependencies must be installed separately when this option is used.
36
+ installer: Python package installer to use (defaults to pip).
37
+ config_setting: Settings to pass to the backend. Multiple settings can be provided.
38
+ """
39
+ from build.__main__ import main as build
40
+
41
+ cli_args = []
42
+
43
+ if srcdir:
44
+ cli_args.append(srcdir)
45
+
46
+ if version:
47
+ cli_args.append("--version")
48
+
49
+ if verbose:
50
+ cli_args.append("--verbose")
51
+
52
+ if sdist:
53
+ cli_args.append("--sdist")
54
+
55
+ if wheel:
56
+ cli_args.append("--wheel")
57
+
58
+ if outdir:
59
+ cli_args.append("--outdir")
60
+ cli_args.append(outdir)
61
+
62
+ if skip_dependency_check:
63
+ cli_args.append("--skip-dependency-check")
64
+
65
+ if no_isolation:
66
+ cli_args.append("--no-isolation")
67
+
68
+ if installer:
69
+ cli_args.append("--installer")
70
+ cli_args.append(installer)
71
+
72
+ if config_setting:
73
+ for setting in config_setting:
74
+ cli_args.append(f"--config-setting={setting}")
75
+
76
+ build(cli_args)
@@ -0,0 +1,178 @@
1
+ """Callable for [git-changelog](https://github.com/pawamoy/git-changelog)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Literal
6
+
7
+ from failprint.lazy import lazy
8
+
9
+
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)
@@ -0,0 +1,227 @@
1
+ """Callable for [Griffe](https://github.com/mkdocstrings/griffe)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Literal
6
+
7
+ from failprint.lazy import lazy
8
+
9
+
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)