sphinx-argparse-cli 1.24.0__tar.gz → 1.24.2__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.
@@ -9,3 +9,4 @@ __pycache__
9
9
  build
10
10
  dist
11
11
  src/sphinx_argparse_cli/version.py
12
+ /uv.lock
@@ -1,7 +1,9 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sphinx-argparse-cli
3
- Version: 1.24.0
3
+ Version: 1.24.2
4
+ Import-Name: sphinx_argparse_cli
4
5
  Summary: render CLI arguments (sub-commands friendly) defined by argparse module
6
+ Project-URL: Changelog, https://github.com/tox-dev/sphinx-argparse-cli/blob/main/CHANGELOG.md
5
7
  Project-URL: Documentation, https://github.com/tox-dev/sphinx-argparse-cli#sphinx-argparse-cli
6
8
  Project-URL: Homepage, https://github.com/tox-dev/sphinx-argparse-cli
7
9
  Project-URL: Source, https://github.com/tox-dev/sphinx-argparse-cli
@@ -15,7 +17,6 @@ Classifier: Environment :: Console
15
17
  Classifier: Framework :: Sphinx
16
18
  Classifier: Framework :: Sphinx :: Extension
17
19
  Classifier: Intended Audience :: Developers
18
- Classifier: License :: OSI Approved :: MIT License
19
20
  Classifier: Operating System :: OS Independent
20
21
  Classifier: Programming Language :: Python :: 3 :: Only
21
22
  Classifier: Programming Language :: Python :: 3.11
@@ -38,9 +39,14 @@ Description-Content-Type: text/markdown
38
39
  [![Downloads](https://static.pepy.tech/badge/sphinx-argparse-cli/month)](https://pepy.tech/project/sphinx-argparse-cli)
39
40
  [![PyPI - License](https://img.shields.io/pypi/l/sphinx-argparse-cli?style=flat-square)](https://opensource.org/licenses/MIT)
40
41
  [![check](https://github.com/tox-dev/sphinx-argparse-cli/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/sphinx-argparse-cli/actions/workflows/check.yaml)
42
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/tox-dev/sphinx-argparse-cli/badge)](https://scorecard.dev/viewer/?uri=github.com/tox-dev/sphinx-argparse-cli)
43
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/16261/badge)](https://www.bestpractices.dev/projects/16261)
41
44
 
42
45
  Render CLI arguments (sub-commands friendly) defined by the argparse module.
43
46
 
47
+ See the [changelog](https://github.com/tox-dev/sphinx-argparse-cli/blob/main/CHANGELOG.md) for released changes. The [contribution guide](https://github.com/tox-dev/sphinx-argparse-cli/blob/main/CONTRIBUTING.md) explains which pull
48
+ requests need a fragment, how to name it, and when to use `skip news`.
49
+
44
50
  ## Getting started
45
51
 
46
52
  Install the package:
@@ -1,14 +1,15 @@
1
1
  [build-system]
2
2
  build-backend = "hatchling.build"
3
3
  requires = [
4
+ "hatch-fancy-pypi-readme>=25.1",
4
5
  "hatch-vcs>=0.5",
5
6
  "hatchling>=1.32.4",
6
7
  ]
7
8
 
8
9
  [project]
9
10
  name = "sphinx-argparse-cli"
11
+ import-names = [ "sphinx_argparse_cli" ]
10
12
  description = "render CLI arguments (sub-commands friendly) defined by argparse module"
11
- readme = "README.md"
12
13
  keywords = [
13
14
  "argparse",
14
15
  "sphinx",
@@ -24,7 +25,6 @@ classifiers = [
24
25
  "Framework :: Sphinx",
25
26
  "Framework :: Sphinx :: Extension",
26
27
  "Intended Audience :: Developers",
27
- "License :: OSI Approved :: MIT License",
28
28
  "Operating System :: OS Independent",
29
29
  "Programming Language :: Python :: 3 :: Only",
30
30
  "Programming Language :: Python :: 3.11",
@@ -37,11 +37,13 @@ classifiers = [
37
37
  "Topic :: Documentation :: Sphinx",
38
38
  ]
39
39
  dynamic = [
40
+ "readme",
40
41
  "version",
41
42
  ]
42
43
  dependencies = [
43
44
  "sphinx>=9.0.4",
44
45
  ]
46
+ urls.Changelog = "https://github.com/tox-dev/sphinx-argparse-cli/blob/main/CHANGELOG.md"
45
47
  urls.Documentation = "https://github.com/tox-dev/sphinx-argparse-cli#sphinx-argparse-cli"
46
48
  urls.Homepage = "https://github.com/tox-dev/sphinx-argparse-cli"
47
49
  urls.Source = "https://github.com/tox-dev/sphinx-argparse-cli"
@@ -64,6 +66,13 @@ type = [
64
66
  "ty<0.0.25,>=0.0.24",
65
67
  { include-group = "test" },
66
68
  ]
69
+ build = [
70
+ "cython>=3",
71
+ "hatch-fancy-pypi-readme>=25.1",
72
+ "hatch-vcs>=0.5",
73
+ "hatchling>=1.32.4",
74
+ "setuptools>=80",
75
+ ]
67
76
  lint = [
68
77
  "pre-commit-uv>=4.3",
69
78
  ]
@@ -72,15 +81,41 @@ pkg-meta = [
72
81
  "twine>=7",
73
82
  "uv>=0.12.22",
74
83
  ]
84
+ release-news = [
85
+ "release-creator>=4.4",
86
+ "towncrier>=26.9",
87
+ ]
88
+ release-notes = [
89
+ "release-creator>=4.4",
90
+ ]
91
+ release-prepare = [
92
+ "prek>=0.5",
93
+ "release-creator>=4.4",
94
+ "towncrier>=26.9",
95
+ ]
75
96
 
76
97
  [tool.hatch]
77
98
  version.source = "vcs"
99
+ metadata.hooks.fancy-pypi-readme.content-type = "text/markdown"
100
+ metadata.hooks.fancy-pypi-readme.fragments = [ { path = "README.md" } ]
101
+ metadata.hooks.fancy-pypi-readme.substitutions = [
102
+ { pattern = '''(?x)
103
+ (?<!!)\[(?P<label>[^\]]+)\]\( # Link text, excluding images
104
+ (?P<path>CHANGELOG\.md|CONTRIBUTING\.md) # Repository files linked from the README
105
+ \)
106
+ ''', replacement = '[\g<label>](https://github.com/tox-dev/sphinx-argparse-cli/blob/main/\g<path>)' },
107
+ ]
78
108
  build.hooks.vcs.version-file = "src/sphinx_argparse_cli/version.py"
79
109
  build.targets.sdist.include = [
80
110
  "/src",
81
111
  "/tests",
82
112
  ]
83
113
 
114
+ [tool.uv]
115
+ dependency-groups.release-news = { requires-python = ">=3.15" }
116
+ dependency-groups.release-notes = { requires-python = ">=3.15" }
117
+ dependency-groups.release-prepare = { requires-python = ">=3.15" }
118
+
84
119
  [tool.black]
85
120
  line-length = 120
86
121
 
@@ -147,3 +182,34 @@ paths.source = [
147
182
  report.fail_under = 100
148
183
  html.show_contexts = true
149
184
  html.skip_covered = false
185
+
186
+ [tool.towncrier]
187
+ name = "sphinx-argparse-cli"
188
+ directory = "changelog.d"
189
+ filename = "CHANGELOG.md"
190
+ template = "release_creator.fragments:template.jinja2"
191
+ title_format = false
192
+ type = [
193
+ { directory = "feature", name = "Added", showcontent = true },
194
+ { directory = "change", name = "Changes", showcontent = true },
195
+ { directory = "bugfix", name = "Fixed", showcontent = true },
196
+ { directory = "doc", name = "Documentation", showcontent = true },
197
+ { directory = "breaking", name = "Breaking changes", showcontent = true },
198
+ { directory = "security", name = "Security", showcontent = true },
199
+ { directory = "performance", name = "Performance", showcontent = true },
200
+ { directory = "deprecation", name = "Deprecated", showcontent = true },
201
+ { directory = "removal", name = "Removed", showcontent = true },
202
+ { directory = "packaging", name = "Packaging", showcontent = true },
203
+ ]
204
+
205
+ [tool.nab]
206
+ mode = "universal"
207
+ base-group = "project-runtime"
208
+ default-groups = []
209
+ uploaded-prior-to = "P7D"
210
+ decision-order = "stable"
211
+ matrix.python = ">=3.15,<3.16"
212
+ matrix.platforms = [ "linux_x86_64" ]
213
+ # release-creator 4.4.0 needs a seven-day cutoff exception.
214
+ # expires 2026-11-09
215
+ packages.release-creator.uploaded-prior-to = 2026-11-02T21:45:00Z
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.24.0'
22
- __version_tuple__ = version_tuple = (1, 24, 0)
21
+ __version__ = version = '1.24.2'
22
+ __version_tuple__ = version_tuple = (1, 24, 2)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -1,225 +0,0 @@
1
- # sphinx-argparse-cli
2
-
3
- [![PyPI](https://img.shields.io/pypi/v/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
4
- [![PyPI - Implementation](https://img.shields.io/pypi/implementation/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
5
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
6
- [![Downloads](https://static.pepy.tech/badge/sphinx-argparse-cli/month)](https://pepy.tech/project/sphinx-argparse-cli)
7
- [![PyPI - License](https://img.shields.io/pypi/l/sphinx-argparse-cli?style=flat-square)](https://opensource.org/licenses/MIT)
8
- [![check](https://github.com/tox-dev/sphinx-argparse-cli/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/sphinx-argparse-cli/actions/workflows/check.yaml)
9
-
10
- Render CLI arguments (sub-commands friendly) defined by the argparse module.
11
-
12
- ## Getting started
13
-
14
- Install the package:
15
-
16
- ```bash
17
- python -m pip install sphinx-argparse-cli
18
- ```
19
-
20
- Add the extension to your `conf.py`:
21
-
22
- ```python
23
- extensions = ["sphinx_argparse_cli"]
24
- ```
25
-
26
- Use the directive in any reStructuredText file:
27
-
28
- ```rst
29
- .. sphinx_argparse_cli::
30
- :module: my_project.cli
31
- :func: build_parser
32
- ```
33
-
34
- `:module:` points to the Python module containing the parser, and `:func:` names a zero-argument function that returns
35
- an `ArgumentParser`. Build your docs and the full CLI reference appears.
36
-
37
- ## How-to guides
38
-
39
- ### Override the program name
40
-
41
- By default the program name comes from the parser. Use `:prog:` to replace it:
42
-
43
- ```rst
44
- .. sphinx_argparse_cli::
45
- :module: my_project.cli
46
- :func: build_parser
47
- :prog: my-cli
48
- ```
49
-
50
- ### Hook into a parser that is not returned
51
-
52
- When a function creates and uses a parser internally without returning it, set the `:hook:` flag to intercept
53
- `argparse.ArgumentParser`:
54
-
55
- ```rst
56
- .. sphinx_argparse_cli::
57
- :module: my_project.cli
58
- :func: main
59
- :hook:
60
- :prog: my-cli
61
- ```
62
-
63
- ### Customize section titles
64
-
65
- Control how group and subcommand headings are rendered with `:group_title_prefix:` and `:group_sub_title_prefix:`. Both
66
- accept `{prog}` and the sub-title also accepts `{subcommand}`:
67
-
68
- ```rst
69
- .. sphinx_argparse_cli::
70
- :module: my_project.cli
71
- :func: build_parser
72
- :group_title_prefix: {prog}
73
- :group_sub_title_prefix: {prog} {subcommand}
74
- ```
75
-
76
- ### Suppress default values
77
-
78
- Hide `(default: ...)` annotations from the output:
79
-
80
- ```rst
81
- .. sphinx_argparse_cli::
82
- :module: my_project.cli
83
- :func: build_parser
84
- :no_default_values:
85
- ```
86
-
87
- ### Control usage display
88
-
89
- Set the character width for usage lines and optionally show usage before the description:
90
-
91
- ```rst
92
- .. sphinx_argparse_cli::
93
- :module: my_project.cli
94
- :func: build_parser
95
- :usage_width: 80
96
- :usage_first:
97
- ```
98
-
99
- ### Override title, description, or epilog
100
-
101
- Replace auto-detected values, or pass an empty string to suppress them:
102
-
103
- ```rst
104
- .. sphinx_argparse_cli::
105
- :module: my_project.cli
106
- :func: build_parser
107
- :title: Custom Title
108
- :description: Custom description text.
109
- :epilog:
110
- ```
111
-
112
- ### Cross-reference generated anchors
113
-
114
- The directive registers Sphinx reference labels for every command, group, and flag. Use the `:ref:` role to link to
115
- them.
116
-
117
- With `sphinx_argparse_cli_prefix_document = False` (default):
118
-
119
- ```rst
120
- :ref:`tox-optional-arguments`
121
- :ref:`tox-run`
122
- :ref:`tox-run---magic`
123
- ```
124
-
125
- With `sphinx_argparse_cli_prefix_document = True` (anchors prefixed by document name, avoids clashes across documents):
126
-
127
- ```rst
128
- :ref:`cli:tox-optional-arguments`
129
- :ref:`cli:tox-run`
130
- :ref:`cli:tox-run---magic`
131
- ```
132
-
133
- The anchor text is visible after the `#` in the URL when you click a heading.
134
-
135
- Flags and positional arguments are also registered as Sphinx program options, so the `:option:` role works with the
136
- program (and sub-command) name followed by the argument, or scoped through a `.. program::` directive:
137
-
138
- ```rst
139
- :option:`tox --magic`
140
- :option:`tox run --magic`
141
-
142
- .. program:: tox run
143
-
144
- :option:`--magic`
145
- :option:`--magic=value`
146
- ```
147
-
148
- `:option:` targets keep their original case, so they do not need `:force_refs_lower:`. They ignore
149
- `sphinx_argparse_cli_prefix_document`; when two documents render the same program, the role links to the first one
150
- Sphinx reads.
151
-
152
- ### Handle mixed-case references
153
-
154
- Sphinx `:ref:` only supports lower-case targets. When your program name or flags contain capital letters, set
155
- `:force_refs_lower:` to convert them. Each upper-case letter becomes its lower-case form prefixed with `_` (e.g. `A`
156
- becomes `_a`):
157
-
158
- ```rst
159
- .. sphinx_argparse_cli::
160
- :module: my_project.cli
161
- :func: build_parser
162
- :force_refs_lower:
163
- ```
164
-
165
- For a program named `SampleProgram`:
166
-
167
- ```rst
168
- :ref:`_sample_program--a` .. flag -a
169
- :ref:`_sample_program--_a` .. flag -A
170
- ```
171
-
172
- If you do not need Sphinx `:ref:` cross-references you can leave this off to keep mixed-case anchors in the HTML output,
173
- but enabling it later will change existing anchor URLs.
174
-
175
- ### Write help text as reStructuredText
176
-
177
- The directive parses every argument's `help` string as reStructuredText, so inline markup such as a `:ref:` role or
178
- `**bold**` works. The same applies to characters that carry meaning in reStructuredText: a lone `*` (`match *.py`), a
179
- trailing `_` (`name_`), backticks, or a trailing `::` produce docutils warnings and fail a build run with `-W`. Escape
180
- them with a backslash (`match \*.py`) or wrap them in inline literals. Text between matching single quotes, double
181
- quotes, or braces becomes an inline literal for you, so `pick 'fast' or "slow"` shows `'fast'` and `"slow"` as code.
182
-
183
- ### Add extra content after generated docs
184
-
185
- Any content nested inside the directive is appended after the generated CLI documentation:
186
-
187
- ```rst
188
- .. sphinx_argparse_cli::
189
- :module: my_project.cli
190
- :func: build_parser
191
-
192
- Extra notes or examples rendered after the CLI reference.
193
- ```
194
-
195
- ## Reference
196
-
197
- ### Directive options
198
-
199
- | Option | Type | Default | Description |
200
- | -------------------------- | ------ | ------------------------ | ------------------------------------------------------------------------------ |
201
- | `:module:` | string | **required** | Python module path where the parser is defined |
202
- | `:func:` | string | **required** | Zero-argument function that returns an `ArgumentParser` |
203
- | `:prog:` | string | parser's `prog` | Override the displayed program name |
204
- | `:hook:` | flag | off | Intercept `ArgumentParser` instead of expecting `func` to return it |
205
- | `:title:` | string | `<prog> - CLI interface` | Custom title; empty string suppresses it |
206
- | `:description:` | string | parser's description | Custom description; empty string suppresses it |
207
- | `:epilog:` | string | parser's epilog | Custom epilog; empty string suppresses it |
208
- | `:usage_width:` | int | `100` | Character width for usage lines |
209
- | `:usage_first:` | flag | off | Show usage before the description |
210
- | `:group_title_prefix:` | string | `{prog}` | Heading prefix for groups; `{prog}` is replaced with the program name |
211
- | `:group_sub_title_prefix:` | string | `{prog} {subcommand}` | Heading prefix for subcommand groups; supports `{prog}` and `{subcommand}` |
212
- | `:no_default_values:` | flag | off | Suppress `(default: ...)` annotations |
213
- | `:force_refs_lower:` | flag | off | Lower-case reference anchors with `_` prefix for capitals (for `:ref:` compat) |
214
-
215
- ### Configuration values (`conf.py`)
216
-
217
- | Name | Type | Default | Description |
218
- | ------------------------------------- | ---- | ------- | ---------------------------------------------------------------- |
219
- | `sphinx_argparse_cli_prefix_document` | bool | `False` | Prefix reference anchors with the document name to avoid clashes |
220
-
221
- ## Live examples
222
-
223
- - [tox](https://tox.wiki/en/latest/cli_interface.html)
224
- - [pypa-build](https://pypa-build.readthedocs.io/en/latest/#python-m-build)
225
- - [mdpo](https://mondeja.github.io/mdpo/latest/cli.html)