docstring-to-text


Namedocstring-to-text JSON
Version 1.0.3 PyPI version JSON
download
home_pageNone
SummaryA simple pip package converting docstrings into clean text (proper paragraphs and indents)
upload_time2025-10-12 01:51:32
maintainerNone
docs_urlNone
authorLex Darlog (Lex-DRL)
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  
# docstring-to-text

[![PyPI][pypi-shield]][pypi-url]
[![GitHub Release][github-release-shield]][github-release-url]
[![Test status][github-tests-shield]][github-tests-url]

[pypi-shield]: https://img.shields.io/pypi/v/docstring-to-text?logo=pypi
[pypi-url]: https://pypi.org/p/docstring-to-text
[github-tests-shield]: https://github.com/Lex-DRL/Py-docstring-to-text/actions/workflows/test.yml/badge.svg?branch=main
[github-tests-url]: https://github.com/Lex-DRL/Py-docstring-to-text/actions/workflows/test.yml?query=branch%3Amain
[github-release-shield]: https://img.shields.io/github/v/release/Lex-DRL/Py-docstring-to-text?logo=github
[github-release-url]: https://github.com/Lex-DRL/Py-docstring-to-text/releases/latest
</div>

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

For example, here's a class docstring:
```python
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:
```python
from docstring_to_text import *

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

Then, the resulting string would be:
```text
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.
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "docstring-to-text",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Lex Darlog (Lex-DRL)",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b3/3b/6432115bd8e05698fe5ca1351ab41cfe4eb9fdec1ed936605631af915dae/docstring_to_text-1.0.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  \n# docstring-to-text\n\n[![PyPI][pypi-shield]][pypi-url]\n[![GitHub Release][github-release-shield]][github-release-url]\n[![Test status][github-tests-shield]][github-tests-url]\n\n[pypi-shield]: https://img.shields.io/pypi/v/docstring-to-text?logo=pypi\n[pypi-url]: https://pypi.org/p/docstring-to-text\n[github-tests-shield]: https://github.com/Lex-DRL/Py-docstring-to-text/actions/workflows/test.yml/badge.svg?branch=main\n[github-tests-url]: https://github.com/Lex-DRL/Py-docstring-to-text/actions/workflows/test.yml?query=branch%3Amain\n[github-release-shield]: https://img.shields.io/github/v/release/Lex-DRL/Py-docstring-to-text?logo=github\n[github-release-url]: https://github.com/Lex-DRL/Py-docstring-to-text/releases/latest\n</div>\n\nA simple pip package converting docstrings into clean text (proper paragraphs and indents).\n\nFor example, here's a class docstring:\n```python\nclass MyClass:\n  \"\"\"\n  This is a class docstring.\n  \n  \n  It has sphinx-like paragraphs, which can\n  span multiple lines. Any modern IDE would\n  display them as a single line, that wraps\n  the given width.\n  \n  You can't just remove all the new lines\n  in the entire string, because you want\n  to preserve paragraphs themselves.\n  \n  Also, when it comes to lists:\n    - You probably want to separate items\n    with new lines.\n    - However, you don't want to preserve\n    lines inside each item.\n  \n  And...\n  * ... you might need various bullet\n  characters.\n  \u2022 Including unicode ones.\n  \n  And don't forget that the list still needs\n  to be separated from the following text.\n  \"\"\"\n  ...\n```\n\nWith this package, you could do:\n```python\nfrom docstring_to_text import *\n\nclean_text = format_docstring(cleandoc(MyClass.__doc__))\nclean_text = format_object_docstring(MyClass)\n```\n\nThen, the resulting string would be:\n```text\nThis is a class docstring.\n\nIt has sphinx-like paragraphs, which can span multiple lines. Any modern IDE would display them as a single line, that wraps the given width.\nYou can't just remove all the new lines in the entire string, because you want to preserve paragraphs themselves.\nAlso, when it comes to lists:\n- You probably want to separate items with new lines.\n- However, you don't want to preserve lines inside each item.\nAnd...\n* ... you might need various bullet characters.\n\u2022 Including unicode ones.\nAnd don't forget that the list still needs to be separated from the following text.\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple pip package converting docstrings into clean text (proper paragraphs and indents)",
    "version": "1.0.3",
    "project_urls": {
        "Issues": "https://github.com/Lex-DRL/Py-docstring-to-text/issues",
        "Source Code": "https://github.com/Lex-DRL/Py-docstring-to-text"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7069fc20b4d00d0420ffe78d2379a43c309131130db2be30e28e0c84d5a93a76",
                "md5": "77a57932f13e41d27e0a5921fc7c8616",
                "sha256": "256df10ea647dbe48c2ae84948c5f2196bd6a9e442458540f968ea539c802ce7"
            },
            "downloads": -1,
            "filename": "docstring_to_text-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77a57932f13e41d27e0a5921fc7c8616",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11030,
            "upload_time": "2025-10-12T01:51:31",
            "upload_time_iso_8601": "2025-10-12T01:51:31.281382Z",
            "url": "https://files.pythonhosted.org/packages/70/69/fc20b4d00d0420ffe78d2379a43c309131130db2be30e28e0c84d5a93a76/docstring_to_text-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b33b6432115bd8e05698fe5ca1351ab41cfe4eb9fdec1ed936605631af915dae",
                "md5": "1001b20a822a2a7d34676668725b1348",
                "sha256": "99d9346a7c3d9f02a140c6503ce2d0ef5eb2671ce2bd7ebfbdc457f486dec6f7"
            },
            "downloads": -1,
            "filename": "docstring_to_text-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "1001b20a822a2a7d34676668725b1348",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 17682,
            "upload_time": "2025-10-12T01:51:32",
            "upload_time_iso_8601": "2025-10-12T01:51:32.662759Z",
            "url": "https://files.pythonhosted.org/packages/b3/3b/6432115bd8e05698fe5ca1351ab41cfe4eb9fdec1ed936605631af915dae/docstring_to_text-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-12 01:51:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Lex-DRL",
    "github_project": "Py-docstring-to-text",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "docstring-to-text"
}
        
Elapsed time: 2.20525s