Docstripy - Convert any docstring to any format docstring
Transform your python docstrings to the format you want :sparkles:
Support Nympydoc, Google and ReStructuredText as output styles. The input style should be either Numpy, Google, ReST or even a mix of both.
Python notebook are supported as well!
Documentation
The documentation :memo: is available at docstripy.readthedocs.io.
How to use
Install the library via pip:
pip install docstripy
Use it like that to write the files in place. Set a directory path to transform all python files in it.
docstripy <dir-or-file_path> -s=<style> -o=<output_path>
Available styles (style) are:
- "numpy": Numpy doc style (default)
- "google": Google style
- "rest": ReST style
See examples in the documentation.
Cool features
See examples of the features in the documentation.
Overwrite the files directly
You can use the -w (or --overwrite) option to write the files in place.
docstripy <dir-or-file_path> -s=<style> -w
You can find an end-to-end example in the documentation.
Notes:
- The module takes into account the fonction definitions. If the definition of the function bring new information, this will be added to the docstring. In case of a conflict, the information in the function definition will be prioritized. It means that docstripy will automatically update your docstring if you update your functions!
- If the old docstring not already contains information on parameters and/or return elements, the output docstring will not specify those elements either. However, if the function definition contains more information, the docstring will be updated with all the corresponding information available in the signature.
Max line length
You can control the max line length of the docstring with the --len option.
By default, there is no limit. The line lenght take into account the indentation
found in the file. It does not applied on wild sections such as "Examples" or "Notes".
2 spaces indentation
If your files are indented with 2 spaces, you can use the --n_indent=2 option to
the command line.
docstripy <dir-or-file_path> -s=<style> -w --n_indent=2
Note that the default value is 4 spaces but you can set any value you want.
Create a short docstring when missing
When a function has no docstring, a short one will be created based on
the function name. You can disable this feature with the --noadd option
in command line.
docstripy <dir-or-file_path> -s=<style> -w --noadd
Prevent type hinting
You can disable the type hinting in the docstring with the --notype option.
docstripy <dir-or-file_path> -s=<style> -w --notype
Class docstring
The class docstring is updated based on the class definition with the signature
of __init__ method.
Metadata
Release files for docstripy 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docstripy-0.7.2.tar.gz | 53.9 kB | Without provenance | Details for docstripy-0.7.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docstripy-0.7.2-py3-none-any.whl | Python 3 | none | any | Details for docstripy-0.7.2-py3-none-any.whl |
Total release size: 84.5 kB
Release files / docstripy-0.7.2.tar.gz
| Download URL | docstripy-0.7.2.tar.gz |
|---|---|
| Size | 53.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f572afe1c501c03c3c27ddaab7e7fab5708d49b6146582979559b4a182c20693
|
|
BLAKE2b-256 checksum How to use checksums |
cfe6d71167cb3d2669cfa85fe9e407a7fe3dfed1792798a897b45e608ace33a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / docstripy-0.7.2-py3-none-any.whl
| Download URL | docstripy-0.7.2-py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4ba35de6c1b1c51f7afad4a46d8953aad55dce1a490d198f7e98c8c63efefda
|
|
BLAKE2b-256 checksum How to use checksums |
85d79b6ac05350ab7f7d3a730ff143ff3e2cada54514117c37be37e26dc91242
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for docstripy 0.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.