Skip to main content

Add your description here

Project description

Wrap Docstrings

Currently limited to only wrapping the argument descriptions in Google-style docstrings.

# Install the tool globally.
git clone https://github.com/btjanaka/wrap-docstrings
uv tool install .

# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wrap_docstrings-0.1.0a1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wrap_docstrings-0.1.0a1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file wrap_docstrings-0.1.0a1.tar.gz.

File metadata

  • Download URL: wrap_docstrings-0.1.0a1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wrap_docstrings-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 5eb88cf0eda29e738b6749a0043027c5c1730db9113b305be1ced3089b66b2d5
MD5 773a10fe9fb7f24d3f09fbeb40684c48
BLAKE2b-256 e9df8f54d98742b7dd0b8f46307c1be41c1dc0da31ab30e9044fb40f6bc1dcf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for wrap_docstrings-0.1.0a1.tar.gz:

Publisher: ci.yml on btjanaka/wrap-docstrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wrap_docstrings-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for wrap_docstrings-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 77eeccd0e4c7380a70293f553e838c7323c6d90187938dd7956aa94eadf0adbd
MD5 d580ee7498021bc2dfd0b28b23654574
BLAKE2b-256 df249dbf7d650b3217ad24f9e19c749735b5a8bc874c360e26dc9f0029ed36c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for wrap_docstrings-0.1.0a1-py3-none-any.whl:

Publisher: ci.yml on btjanaka/wrap-docstrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page