Skip to main content

Get Python docstrings from files

Project description

docstring-extractor

Get Python docstrings from files or Python source code.

Example usage:

>>> from docstring_extractor import get_docstrings
>>>
>>> with open("example.py") as file:
...     get_docstrings(file)
...

{
    'module': 'example',
    'content': [{
        'type': 'Function',
        'name': 'my_fuction',
        'line': 4,
        'docstring': 'Long description spanning multiple lines\n- First line\n- Second line\n- Third line\n\n:param name: description 1\n:param int priority: description 2\n:param str sender: description 3\n:raises ValueError: if name is invalid'
    }]
}

Contributing

This project uses Black.

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

docstring-extractor-0.4.0.tar.gz (14.7 kB view hashes)

Uploaded Source

Built Distribution

docstring_extractor-0.4.0-py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 3

Supported by

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