Skip to main content

docstring-to-text

PyPI GitHub Release Test status

A simple pip package converting docstrings into clean text (proper paragraphs and indents).

For example, here's a class docstring:

class MyClass:
  """
  This is a class docstring.
  
  
  It has sphinx-like paragraphs, which can
  span multiple lines. Any modern IDE would
  display them as a single line, that wraps
  the given width.
  
  You can't just remove all the new lines
  in the entire string, because you want
  to preserve paragraphs themselves.
  
  Also, when it comes to lists:
    - You probably want to separate items
    with new lines.
    - However, you don't want to preserve
    lines inside each item.
  
  And...
  * ... you might need various bullet
  characters.
  • Including unicode ones.
  
  And don't forget that the list still needs
  to be separated from the following text.
  """
  ...

With this package, you could do:

from docstring_to_text import *

clean_text = format_docstring(cleandoc(MyClass.__doc__))
clean_text = format_object_docstring(MyClass)

Then, the resulting string would be:

This is a class docstring.

It has sphinx-like paragraphs, which can span multiple lines. Any modern IDE would display them as a single line, that wraps the given width.
You can't just remove all the new lines in the entire string, because you want to preserve paragraphs themselves.
Also, when it comes to lists:
- You probably want to separate items with new lines.
- However, you don't want to preserve lines inside each item.
And...
* ... you might need various bullet characters.
• Including unicode ones.
And don't forget that the list still needs to be separated from the following text.

Metadata

Release files for docstring-to-text 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docstring-to-text 1.0.3
File Size Uploaded Provenance
docstring_to_text-1.0.3.tar.gz 17.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for docstring-to-text 1.0.3
File Interpreter ABI Platform
docstring_to_text-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / docstring_to_text-1.0.3.tar.gz

Download URL docstring_to_text-1.0.3.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
99d9346a7c3d9f02a140c6503ce2d0ef5eb2671ce2bd7ebfbdc457f486dec6f7
BLAKE2b-256 checksum
How to use checksums
b33b6432115bd8e05698fe5ca1351ab41cfe4eb9fdec1ed936605631af915dae
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 Oct 12, 2025.

Transparency log

Release files / docstring_to_text-1.0.3-py3-none-any.whl

Download URL docstring_to_text-1.0.3-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
256df10ea647dbe48c2ae84948c5f2196bd6a9e442458540f968ea539c802ce7
BLAKE2b-256 checksum
How to use checksums
7069fc20b4d00d0420ffe78d2379a43c309131130db2be30e28e0c84d5a93a76
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 Oct 12, 2025.

Transparency log

Security for docstring-to-text 1.0.3

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for docstring_to_text-1.0.3.tar.gz

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 Oct 12, 2025.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page