A simple pip package converting docstrings into clean text (proper paragraphs and indents)
Project description
docstring-to-text
A simple pip package converting docstrings into clean text (proper paragraphs and indents).
For example, here's a class docstring:
class MyClass:
"""
Here's a class.
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:
Here's a class.
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docstring_to_text-1.0.1.tar.gz
.
File metadata
- Download URL: docstring_to_text-1.0.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ec7bbf9f7ec4da5856fb57d8c15b2f8d41ac60444f4bd249ed0d125db7f1b7cc
|
|
MD5 |
0c9e376a4acd95c0196f94e6e7ae58ec
|
|
BLAKE2b-256 |
209e5239905ffcebdc8bf9c1d139344e3b347ab37368f40260b416652530aee5
|
Provenance
The following attestation bundles were made for docstring_to_text-1.0.1.tar.gz
:
Publisher:
publish-release-to-pypi.yml
on Lex-DRL/Py-docstring-to-text
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
docstring_to_text-1.0.1.tar.gz
-
Subject digest:
ec7bbf9f7ec4da5856fb57d8c15b2f8d41ac60444f4bd249ed0d125db7f1b7cc
- Sigstore transparency entry: 543066610
- Sigstore integration time:
-
Permalink:
Lex-DRL/Py-docstring-to-text@d4268cb08007ce3f6bc21f5348a19bc7c2405513
-
Branch / Tag:
refs/heads/main
- Owner: https://github.com/Lex-DRL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish-release-to-pypi.yml@d4268cb08007ce3f6bc21f5348a19bc7c2405513
-
Trigger Event:
push
-
Statement type:
File details
Details for the file docstring_to_text-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: docstring_to_text-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
476cb4c1303c2ab372af7dc121a3b877c281b03c42827a6a579cb9e2108789aa
|
|
MD5 |
327e1725ad14911d42036e14a7d32f56
|
|
BLAKE2b-256 |
9ca43e111cd0925c5defa11337e2852de7a62560bd3dbc8fd7a0c50c3ce08e84
|
Provenance
The following attestation bundles were made for docstring_to_text-1.0.1-py3-none-any.whl
:
Publisher:
publish-release-to-pypi.yml
on Lex-DRL/Py-docstring-to-text
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
docstring_to_text-1.0.1-py3-none-any.whl
-
Subject digest:
476cb4c1303c2ab372af7dc121a3b877c281b03c42827a6a579cb9e2108789aa
- Sigstore transparency entry: 543066613
- Sigstore integration time:
-
Permalink:
Lex-DRL/Py-docstring-to-text@d4268cb08007ce3f6bc21f5348a19bc7c2405513
-
Branch / Tag:
refs/heads/main
- Owner: https://github.com/Lex-DRL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish-release-to-pypi.yml@d4268cb08007ce3f6bc21f5348a19bc7c2405513
-
Trigger Event:
push
-
Statement type: