This release is a pre-release and may not be stable for production use.
Wrap Docstrings
Currently limited to only wrapping the argument descriptions in Google-style docstrings.
Installation
# Install from PyPI.
uv tool install wrap-docstrings
# Install from source.
git clone https://github.com/btjanaka/wrap-docstrings
cd wrap-docstrings
uv tool install .
Usage
# This command should now work:
wrap-docstrings --help
# To format a file (must have .py extension):
wrap-docstrings file.py
# To format a directory:
wrap-docstrings DIRECTORY
# To read from stdin and write to stdout:
wrap-docstrings -
# To change width and indentation (the default values are shown below):
wrap-docstrings file.py --width 88 --indent 4
Example
This text:
def f(x, y):
"""Does stuff.
Args:
x: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure do
y: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure do
Returns:
Returns are not formatted (for now, at least).
"""
return x
Becomes:
def f(x, y):
"""Does stuff.
Args:
x: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure do
y: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure do
Returns:
Returns are not formatted (for now, at least).
"""
return x
Integration with Neoformat
If you are using Neoformat in vim, you can configure this program as a formatter with:
let g:neoformat_python_wrap_docstrings = {
\ 'exe': 'wrap-docstrings',
\ 'args': ['-'],
\ 'stdin': 1,
\ }
let g:neoformat_enabled_python = ['wrap_docstrings'] " Or append wrap_docstrings to your current list of formatters.
Suppression
To skip a file, add this comment somewhere in the file:
# wrap-docstrings: disable
Development
To get set up:
uv sync --locked --all-extras --dev
uv run pre-commit install
For publishing, this project uses the "trusted publishers" setup between GitHub
Actions and PyPI; see
here
and
here
for more info. To publish a release, bump the version with uv version and
commit the repo with the bumped version. Then, push a tag with the version
number; the tag will trigger publishing.
Release files for wrap-docstrings 0.1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wrap_docstrings-0.1.0a3.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wrap_docstrings-0.1.0a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / wrap_docstrings-0.1.0a3.tar.gz
| Download URL | wrap_docstrings-0.1.0a3.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07b204bea08abcb11c90b7d9b75d522e76409af8a2e6ff3344438a36a9856997
|
|
BLAKE2b-256 checksum How to use checksums |
ef1ea8b39563eb1391327ff996b47dc5be80ab5ae7144e1b14a78d99a435c6b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2025.
Transparency logRelease files / wrap_docstrings-0.1.0a3-py3-none-any.whl
| Download URL | wrap_docstrings-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2647f0906356990cbcd0e97629c533edf065775316d4bc8c1157d9af53053d4
|
|
BLAKE2b-256 checksum How to use checksums |
7b98bb6c6d669164b9341583c37d5a6f57ce42c1c3bfe7b7ba2d12efc4ef7b1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 4, 2025.
Transparency log