docstrings2pep727
Move documentation from docstrings to PEP 727 type annotations.
Installation
pip install docstrings2pep727
With uv:
uv tool install docstrings2pep727
Usage
Add typing-extensions>=4.8 to the project that runs the transformed code. The output imports Doc from typing_extensions.
Preview changes before editing files:
docstrings2pep727 diff src/
Rewrite one or more Python files or directories:
docstrings2pep727 format src/ tests/
Use check in CI. It leaves files unchanged and exits with status 1 if changes are needed.
docstrings2pep727 check src/
Each subcommand detects Google, NumPy, and Sphinx docstrings. To choose a style, add --style google, --style numpy, or --style sphinx after the subcommand.
docstrings2pep727 format --style google src/
The transformation moves descriptions for annotated parameters, returns, yields, receives, and attributes into Annotated[..., Doc(...)].
It keeps prose and unsupported sections, such as Raises, in docstrings. It keeps a section if any item cannot be moved.
Sponsors
Metadata
Release files for docstrings2pep727 0.3.0
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 |
|---|---|---|---|---|
| docstrings2pep727-0.3.0.tar.gz | 35.7 kB | Without provenance | Details for docstrings2pep727-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docstrings2pep727-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for docstrings2pep727-0.3.0-py3-none-any.whl |
Total release size: 51.1 kB
Release files / docstrings2pep727-0.3.0.tar.gz
| Download URL | docstrings2pep727-0.3.0.tar.gz |
|---|---|
| Size | 35.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab5634ca2e33df988a1f89efc2f7170b61e807056ffec919783b50e212234a25
|
|
BLAKE2b-256 checksum How to use checksums |
9629a2fcd2b80fe904f8a38db038fdbd7f2730844c86188910380aca6aea92b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / docstrings2pep727-0.3.0-py3-none-any.whl
| Download URL | docstrings2pep727-0.3.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7eeaabaf6000631f52d8ca30107fcbd2b553866f8a5c27687783ef34328f3cc0
|
|
BLAKE2b-256 checksum How to use checksums |
7c9d70cef3b1616b46749b71ed72a96c7bbf9eba316f993bc818bfba743ac28d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for docstrings2pep727 0.3.0
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.