Add structured information to the end of your python docstrings.
Project description
Docdata
Add structured information to the end of your python docstrings.
💪 Getting Started
Use this package to add structured data to your docstrings in YAML. Just
add a ---
delimiter at the bottom, and the rest is parsed as YAML.
from docdata import parse_docdata, docdata
@parse_docdata
class MyClass:
"""This is my class.
---
author: Charlie
motto:
- docs
- are
- cool
"""
assert {'author': 'Charlie', 'motto': ['docs', 'are', 'cool']} == docdata(MyClass)
If you want to get the data directly, go for MyClass.__docdata__
.
⬇️ Installation
The most recent release can be installed from PyPI with:
$ pip install docdata
The most recent code and data can be installed directly from GitHub with:
$ pip install git+https://github.com/cthoyt/docdata.git
To install in development mode, use the following:
$ git clone git+https://github.com/cthoyt/docdata.git
$ cd docdata
$ pip install -e .
⚖️ License
The code in this package is licensed under the MIT License.
🙏 Contributing
Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See CONTRIBUTING.rst for more information on getting involved.
🍪 Cookiecutter Acknowledgement
This package was created with @audreyr's cookiecutter package using @cthoyt's cookiecutter-python-package template.
🛠️ Development
The final section of the README is for if you want to get involved by making a code contribution.
❓ Testing
After cloning the repository and installing tox
with pip install tox
, the unit tests in the tests/
folder can be
run reproducibly with:
$ tox
Additionally, these tests are automatically re-run with each commit in a GitHub Action.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.