docstring-tailor 0.1.0__tar.gz → 0.2.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.
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/.gitignore +3 -0
- docstring_tailor-0.2.0/PKG-INFO +407 -0
- docstring_tailor-0.2.0/README.md +374 -0
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/makefile +2 -3
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/pyproject.toml +4 -2
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/src/docstring_tailor/cli_config.py +6 -3
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/src/docstring_tailor/constants.py +21 -11
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/src/docstring_tailor/docstring_visitor.py +4 -1
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/src/docstring_tailor/main.py +23 -9
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/src/docstring_tailor/multi_line_docstring_formatter.py +117 -109
- docstring_tailor-0.2.0/src/docstring_tailor/utils/__init__.py +1 -0
- docstring_tailor-0.2.0/src/docstring_tailor/utils/utils_formatting.py +171 -0
- docstring_tailor-0.2.0/tests/cases/__init__.py +1 -0
- docstring_tailor-0.2.0/tests/cases/config_model.py +89 -0
- docstring_tailor-0.2.0/tests/cases/formatting_cases.py +90 -0
- docstring_tailor-0.1.0/tests/fixtures/formatted/all_docstring_types_100.py → docstring_tailor-0.2.0/tests/fixtures/all_docstrings/all_docstrings_100.py +10 -2
- docstring_tailor-0.2.0/tests/fixtures/all_docstrings/all_docstrings_60.py +107 -0
- docstring_tailor-0.2.0/tests/fixtures/all_docstrings/all_docstrings_80.py +85 -0
- docstring_tailor-0.1.0/tests/fixtures/raw/all_docstring_types_too_long.py → docstring_tailor-0.2.0/tests/fixtures/all_docstrings/all_docstrings_too_long.py +9 -7
- docstring_tailor-0.2.0/tests/fixtures/all_docstrings/all_docstrings_too_short.py +167 -0
- docstring_tailor-0.1.0/tests/fixtures/raw/function_docstring_complex.py → docstring_tailor-0.2.0/tests/fixtures/function_docstring_complex/function_docstring_complex_100.py +10 -11
- docstring_tailor-0.2.0/tests/fixtures/function_docstring_complex/function_docstring_complex_60.py +100 -0
- docstring_tailor-0.2.0/tests/fixtures/function_docstring_complex/function_docstring_complex_80.py +88 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_blank_lines/module_docstring_blank_lines.py +8 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_blank_lines/module_docstring_blank_lines_100.py +6 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_empty/module_docstring_empty.py +1 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_empty/module_docstring_empty_blank_lines.py +9 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_example_backticks/module_docstring_example_backticks.py +13 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_example_backticks/module_docstring_example_backticks_60.py +14 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_example_tildes/module_docstring_example_tildes.py +13 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_example_tildes/module_docstring_example_tildes_60.py +14 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_ordered_list/module_docstring_ordered_list_100.py +14 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_ordered_list/module_docstring_ordered_list_60.py +20 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_ordered_list/module_docstring_ordered_list_80.py +16 -0
- docstring_tailor-0.2.0/tests/fixtures/module_docstring_ordered_list/module_docstring_ordered_list_too_long.py +7 -0
- docstring_tailor-0.2.0/tests/fixtures/readme_examples/readme_examples.py +164 -0
- docstring_tailor-0.2.0/tests/test_formatting.py +24 -0
- docstring_tailor-0.2.0/tests/utils_test.py +43 -0
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/uv.lock +1 -9
- docstring_tailor-0.1.0/PKG-INFO +0 -153
- docstring_tailor-0.1.0/README.md +0 -120
- docstring_tailor-0.1.0/tests/fixtures/formatted/__init__.py +0 -1
- docstring_tailor-0.1.0/tests/fixtures/raw/__init__.py +0 -1
- docstring_tailor-0.1.0/tests/fixtures/raw/all_docstring_types_too_short.py +0 -97
- docstring_tailor-0.1.0/tests/test_docstring_visitor.py +0 -37
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/LICENSE +0 -0
- {docstring_tailor-0.1.0 → docstring_tailor-0.2.0}/src/docstring_tailor/__init__.py +0 -0
- /docstring_tailor-0.1.0/src/docstring_tailor/utils.py → /docstring_tailor-0.2.0/src/docstring_tailor/utils/utils_file_system.py +0 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docstring-tailor
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Automatic formatting of Python docstrings according to PEP 257
|
|
5
|
+
Author-email: Auke Bruinsma <afbruinsma@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Auke Bruinsma
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
29
|
+
Requires-Python: >=3.11
|
|
30
|
+
Requires-Dist: libcst>=1.8.6
|
|
31
|
+
Requires-Dist: typer>=0.26.4
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Docstring Tailor 🪡
|
|
35
|
+
|
|
36
|
+
Automatic formatting of Python docstrings according to PEP 257 and a predefined maximum number of chacacters per line.
|
|
37
|
+
|
|
38
|
+
[](https://pypi.org/project/docstring-tailor/)
|
|
39
|
+
[](https://pypi.org/project/docstring-tailor/)
|
|
40
|
+
[](https://pypi.org/project/docstring-tailor/)
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
1. [Installation](#Installation)
|
|
44
|
+
2. [Quick start](#quick_start)
|
|
45
|
+
3. [API Overview](#api-overview)
|
|
46
|
+
- [Command](#command)
|
|
47
|
+
- [Options](#options)
|
|
48
|
+
- [Examples](#examples)
|
|
49
|
+
4. [Example docstrings](#example-docstrings)
|
|
50
|
+
5. [Release Notes](#release_notes)
|
|
51
|
+
6. [Roadmap](#roadmap)
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
Installation with [UV](https://docs.astral.sh/uv/) (recommended)
|
|
56
|
+
```bash
|
|
57
|
+
uv add --dev docstring-tailor
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or with pip:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install docstring-tailor
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Quick start
|
|
67
|
+
|
|
68
|
+
Run on a single file or directory:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uv run docstring_tailor my_file.py
|
|
72
|
+
uv run docstring_tailor my_folder
|
|
73
|
+
```
|
|
74
|
+
Multiple files and/or folders are also accepted. Without a file path or folder path, it will try to locate the `src` folder.
|
|
75
|
+
|
|
76
|
+
The default line length is 100. To customise it:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv run docstring_tailor --line-length 88
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Configure it permanently in `pyproject.toml` or in `docstring_tailor.toml`:
|
|
83
|
+
|
|
84
|
+
```toml
|
|
85
|
+
# pyproject.toml
|
|
86
|
+
[tool.docstring_tailor]
|
|
87
|
+
line-length = 88
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```toml
|
|
91
|
+
# docstring_tailor.toml
|
|
92
|
+
line-length = 88
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Define a docstring style, however the only style that is currently supported is [Google](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html). This is also the default style. Explicit configuration:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uv run docstring_tailor --style google
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
or in `pyproject.toml`
|
|
102
|
+
|
|
103
|
+
```toml
|
|
104
|
+
[tool.docstring_tailor]
|
|
105
|
+
style = "google"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## API Overview
|
|
109
|
+
|
|
110
|
+
### Command
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uv run docstring_tailor [PATHS ...] [OPTIONS]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`PATHS` may contain one or more files and/or directories.
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv run docstring_tailor my_file.py
|
|
122
|
+
uv run docstring_tailor src/
|
|
123
|
+
uv run docstring_tailor src/ tests/test_file.py
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If no paths are provided, `docstring_tailor` will attempt to locate and format files inside the `src` directory.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### Options
|
|
131
|
+
|
|
132
|
+
| <div style="width:140px">Option</div> | <div style="width:50px">Type</div> | <div style="width:80px">Default</div> | Description |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| `--line-length` | `int` | 100 | Maximum number of characters allowed per line after formatting. |
|
|
135
|
+
| `--style` | `str` | google | Docstring style to enforce. Currently only the Google docstring style is supported. |
|
|
136
|
+
| `--detect-lists` | `bool` | true | Detect unordered and ordered/numbered lists anywhere in a docstring and preserve each list element on its own line during formatting. |
|
|
137
|
+
|
|
138
|
+
### Examples
|
|
139
|
+
|
|
140
|
+
`CLI`
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
uv run docstring_tailor src/ --line-length 88
|
|
144
|
+
uv run docstring_tailor my_file.py --style google
|
|
145
|
+
uv run docstring_tailor --detect-lists
|
|
146
|
+
uv run docstring_tailor --no-detect-lists
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`pyproject.toml`
|
|
150
|
+
|
|
151
|
+
```toml
|
|
152
|
+
[tool.docstring_tailor]
|
|
153
|
+
line-length = 88
|
|
154
|
+
style = "google"
|
|
155
|
+
detect-lists = true
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`docstring_tailor.toml`
|
|
159
|
+
|
|
160
|
+
```toml
|
|
161
|
+
line-length = 88
|
|
162
|
+
style = "google"
|
|
163
|
+
detect-lists = true
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Example docstrings
|
|
167
|
+
|
|
168
|
+
1. [Google](#google)
|
|
169
|
+
- [Module docstring](#module-docstring)
|
|
170
|
+
- [Class docstring](#class-docstring)
|
|
171
|
+
- [Function docstring](#function-docstring)
|
|
172
|
+
- [Codeblocks](#codeblocks)
|
|
173
|
+
- [Other sections](#other-sections)
|
|
174
|
+
- [Unordered and numbered lists](#unordered-and-numbered-lists)
|
|
175
|
+
|
|
176
|
+
### Google
|
|
177
|
+
|
|
178
|
+
#### Module docstring
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
"""Demonstrates a minimal Google-style module docstring.
|
|
182
|
+
|
|
183
|
+
This module exists as a formatting example and illustrates the typical
|
|
184
|
+
structure of a Google-style docstring, including a concise summary
|
|
185
|
+
line followed by an additional descriptive paragraph.
|
|
186
|
+
"""
|
|
187
|
+
```
|
|
188
|
+
- Make sure to you use a **blank line** in between the summary line and the more elaborate description.
|
|
189
|
+
|
|
190
|
+
#### Class docstring
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
class ExampleConfiguration:
|
|
194
|
+
"""Represents a configuration object used to demonstrate Google-
|
|
195
|
+
style class docstrings.
|
|
196
|
+
|
|
197
|
+
This class is provided as a formatting example and illustrates how
|
|
198
|
+
attributes are documented consistently in the Google docstring
|
|
199
|
+
style.
|
|
200
|
+
|
|
201
|
+
Attributes:
|
|
202
|
+
example_argument_1 (str): Stores the first configuration value
|
|
203
|
+
provided at initialization.
|
|
204
|
+
example_argument_2 (int): Stores the second configuration
|
|
205
|
+
value provided at initialization.
|
|
206
|
+
"""
|
|
207
|
+
```
|
|
208
|
+
- The `Attributes` section is recognized by the formatter and triggers special indentation rules for attribute entries.
|
|
209
|
+
- If the description of an attribute extends to the next line, **it must be indented one additional level beyond the attribute name**. This indentation level is important: it is used by the formatter to distinguish between a new attribute entry and a continuation of the previous attribute’s description.
|
|
210
|
+
|
|
211
|
+
#### Function docstring
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
def example_function(example_argument_1: str, example_argument_2: int) -> str:
|
|
215
|
+
"""Demonstrates a Google-style function docstring with multiple
|
|
216
|
+
sections.
|
|
217
|
+
|
|
218
|
+
This function exists purely as a formatting example and
|
|
219
|
+
illustrates how Args, Returns, Examples, and Raises sections are
|
|
220
|
+
structured in a Google-style docstring.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
example_argument_1 (str): First example input value used to
|
|
224
|
+
construct a formatted result string.
|
|
225
|
+
example_argument_2 (int): Second example input value used to
|
|
226
|
+
influence the transformation logic.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
str: A formatted string combining both input arguments into a
|
|
230
|
+
single human-readable representation.
|
|
231
|
+
|
|
232
|
+
Examples:
|
|
233
|
+
Basic usage with typical inputs produces a simple combined
|
|
234
|
+
string:
|
|
235
|
+
|
|
236
|
+
>>> example_function("alpha", 3)
|
|
237
|
+
'alpha-3'
|
|
238
|
+
|
|
239
|
+
You can also write text in between two Python REPL sections,
|
|
240
|
+
and this part will be formatted, while the two small code
|
|
241
|
+
sections won't be formatted.
|
|
242
|
+
|
|
243
|
+
>>> example_function(
|
|
244
|
+
... "beta",
|
|
245
|
+
... 7,
|
|
246
|
+
... )
|
|
247
|
+
'beta-7'
|
|
248
|
+
|
|
249
|
+
Raises:
|
|
250
|
+
ValueError: Raised when example_argument_2 is negative or
|
|
251
|
+
zero, as only positive integers are considered valid in
|
|
252
|
+
this demonstration.
|
|
253
|
+
"""
|
|
254
|
+
if example_argument_2 <= 0:
|
|
255
|
+
raise ValueError("example_argument_2 must be positive")
|
|
256
|
+
|
|
257
|
+
return f"{example_argument_1}-{example_argument_2}"
|
|
258
|
+
```
|
|
259
|
+
- The `Args`, `Returns`, `Examples` and `Raises` section are all keywords recognized by the formatter.
|
|
260
|
+
- You can either use `Args` or `Arguments` for the argument section, and `Example` or `Examples` for the example section.
|
|
261
|
+
- Similar to the `Attributes` section for the class docstring above, make sure to **introduce another level of indentation** for the description of a function argument, return variable or error description, if it extends to the next line.
|
|
262
|
+
- In the `Example` section, make sure to use `>>>` for the start of the Python REPL, and use `...` for continuation lines. In this way it is consistent with Pydoc.
|
|
263
|
+
- You can also use these keywords in module or class docstrings. For example, an `Args` section in a class docstring, or an `Example(s)` section in a module docstring.
|
|
264
|
+
|
|
265
|
+
#### Codeblocks
|
|
266
|
+
|
|
267
|
+
```python
|
|
268
|
+
"""Demonstrates a Google-style module docstring containing a code
|
|
269
|
+
block.
|
|
270
|
+
|
|
271
|
+
This module-level docstring is used as a formatting example and shows
|
|
272
|
+
how code blocks can be embedded inside docstrings using fenced
|
|
273
|
+
delimiters.
|
|
274
|
+
|
|
275
|
+
Example:
|
|
276
|
+
```
|
|
277
|
+
def example_function(x, y):
|
|
278
|
+
return x + y
|
|
279
|
+
```
|
|
280
|
+
"""
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
"""Demonstrates a Google-style module docstring containing a code
|
|
285
|
+
block.
|
|
286
|
+
|
|
287
|
+
This module-level docstring is used as a formatting example and shows
|
|
288
|
+
how code blocks can be embedded inside docstrings using fenced
|
|
289
|
+
delimiters.
|
|
290
|
+
|
|
291
|
+
Example:
|
|
292
|
+
~~~
|
|
293
|
+
def example_function(x, y):
|
|
294
|
+
return x + y
|
|
295
|
+
~~~
|
|
296
|
+
"""
|
|
297
|
+
```
|
|
298
|
+
- Codeblocks should be under the `Example(s)` section.
|
|
299
|
+
- You can either use backticks ` ``` ` or tildes `~~~`, similar to how code sections work in markdown files.
|
|
300
|
+
|
|
301
|
+
#### Other sections
|
|
302
|
+
|
|
303
|
+
```python
|
|
304
|
+
def example_generator(n):
|
|
305
|
+
"""Generators have a ``Yields`` section instead of a ``Returns``
|
|
306
|
+
section.
|
|
307
|
+
|
|
308
|
+
Args:
|
|
309
|
+
n (int): The upper limit of the range to generate, from 0 to
|
|
310
|
+
`n` - 1.
|
|
311
|
+
|
|
312
|
+
Yields:
|
|
313
|
+
int: The next number in the range of 0 to `n` - 1.
|
|
314
|
+
"""
|
|
315
|
+
```
|
|
316
|
+
- Similar to `Returns`, `Yields` is also supported.
|
|
317
|
+
|
|
318
|
+
```pythonUnordered and numbered lists
|
|
319
|
+
|
|
320
|
+
"""Demonstrates a Google-style module docstring containing a Note
|
|
321
|
+
section.
|
|
322
|
+
|
|
323
|
+
This module-level docstring is used as a formatting example and
|
|
324
|
+
illustrates how additional informational sections can be included
|
|
325
|
+
alongside the main description in a Google-style docstring.
|
|
326
|
+
|
|
327
|
+
Note:
|
|
328
|
+
The formatting of this docstring is intentionally designed to test
|
|
329
|
+
how note sections are detected and preserved during docstring
|
|
330
|
+
transformation.
|
|
331
|
+
"""
|
|
332
|
+
```
|
|
333
|
+
- `Note` is a keyword that is also supported.
|
|
334
|
+
- You can use either `Note` or `Notes`.
|
|
335
|
+
|
|
336
|
+
#### Unordered and numbered lists
|
|
337
|
+
|
|
338
|
+
```python
|
|
339
|
+
"""Demonstrates that Google-style docstrings can include structured
|
|
340
|
+
lists.
|
|
341
|
+
|
|
342
|
+
This module-level docstring is used as a formatting example and shows
|
|
343
|
+
how unordered lists can be represented inside a docstring. Each list
|
|
344
|
+
item is recognized by the formatter and rendered on a separate line.
|
|
345
|
+
|
|
346
|
+
Items:
|
|
347
|
+
- Demonstrates that docstrings may contain structured unordered lists
|
|
348
|
+
that are parsed and formatted consistently by the docstring
|
|
349
|
+
formatter.
|
|
350
|
+
- Shows that each list item is treated as an independent element and
|
|
351
|
+
is wrapped separately when exceeding the configured line length.
|
|
352
|
+
- Illustrates that long list items may span multiple lines while
|
|
353
|
+
preserving indentation and list structure integrity across
|
|
354
|
+
formatting operations.
|
|
355
|
+
"""
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
"""Demonstrates that Google-style docstrings can include structured
|
|
360
|
+
lists.
|
|
361
|
+
|
|
362
|
+
This module-level docstring is used as a formatting example and shows
|
|
363
|
+
how numbered lists can be represented inside a docstring. Each list
|
|
364
|
+
item is recognized by the formatter and rendered on a separate line.
|
|
365
|
+
|
|
366
|
+
Steps:
|
|
367
|
+
1. Demonstrates that docstrings may contain structured numbered lists
|
|
368
|
+
that are parsed and formatted consistently by the docstring
|
|
369
|
+
formatter.
|
|
370
|
+
2. Shows that each list item is treated as a separate logical element
|
|
371
|
+
and is wrapped independently when exceeding the configured line
|
|
372
|
+
length.
|
|
373
|
+
3. Illustrates that long list items may span multiple lines while
|
|
374
|
+
preserving indentation and list structure integrity across
|
|
375
|
+
formatting operations.
|
|
376
|
+
"""
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
- Personally, I like to use unordered and numbered lists sometimes in a docstring. Similar to what has been described before, **indentation** is used to detect new list elements.
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## Release Notes
|
|
383
|
+
|
|
384
|
+
| <div style="width:70px">Version</div> | <div style="width:100px">Release date</div> | <div style="width:130px">Type</div> | Details |
|
|
385
|
+
|---|---|---|---|
|
|
386
|
+
| `0.1.0` | 2026-05-31 | Initial release | First public release of `docstring-tailor`. Includes <ul><li>Automatic docstring wrapping for module, class and function docstring, for both one line and multi line docstrings, with a configurable `line-length` parameter.</li><li>Paragraph-aware formatting, differentiating between 'Args', 'Examples' or normal text sections.</li> <li> Docstring support for the Google `style` (Numpy, Sphinx, Epydoc not yet supported). </li><li>TOML-based configuration support.</li><li> Test coverage: 52% </ul> |
|
|
387
|
+
| `0.1.1` | 2026-05-31 | Documentation update | Updated the `README.md` file with the 'Installation' and 'Quick Start' section. |
|
|
388
|
+
| `0.2.0` | 2026-06-07 | Feature update | <ul><li>Implemented the `detect-lists` parameter, adding support for unordered and ordered (numbered) lists in docstrings. When enabled, list structures are detected automatically and each list item is formatted onto its own line.</li><li>Introduced a declarative golden-file test framework for formatter validation. Test cases are now generated from parametrized templates using Cartesian-product expansion, significantly reducing boilerplate and improving scalability for configuration coverage.</li><li>Expanded this `README.md` with the 'API Overview', 'Release Notes', 'Example docstrings' and 'Roadmap' sections.</li><li>Test coverage: 75%</li></ul> |
|
|
389
|
+
|
|
390
|
+
## Roadmap
|
|
391
|
+
|
|
392
|
+
### Must have
|
|
393
|
+
|
|
394
|
+
- Support for all major docstrings styles (Google, Numpy, Sphinx, Epydoc).
|
|
395
|
+
- Add `diff` functionality that will show you the formatting changes before actually changing the file(s).
|
|
396
|
+
- Make sure the package can be used as a pre-commit hook.
|
|
397
|
+
- Add `exclude` parameters that allows the user to ignore specific files.
|
|
398
|
+
- Add `v`/`version` parameter that shows the version of the package.
|
|
399
|
+
|
|
400
|
+
### Nice to have
|
|
401
|
+
|
|
402
|
+
- Add docstring linting functionality by converting the docstring into an AST (Abstract Syntax Tree).
|
|
403
|
+
- Add docstring conversion functionality that allows you to change your docstring style. For example, conversion from the 'Google' docstring style to 'Numpy'. Passing the linting phase successfully would be a requirement for conversion.
|
|
404
|
+
|
|
405
|
+
### Maybe later
|
|
406
|
+
|
|
407
|
+
- Parameter that allows the user to format module, class and function docstrings independently.
|