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, get_docdata
@parse_docdata
class MyClass:
"""This is my class.
---
author: Charlie
motto:
- docs
- are
- cool
"""
assert {'author': 'Charlie', 'motto': ['docs', 'are', 'cool']} == get_docdata(MyClass)
If you want to get the data directly, go for MyClass.__docdata__
. If you want to change the way docdata is parsed,
like changing the delimiter, use keyword arguments like in:
from docdata import parse_docdata, get_docdata
@parse_docdata(delimiter='****')
class MyClass:
"""This is my class.
****
author: Charlie
motto:
- docs
- are
- cool
"""
assert {'author': 'Charlie', 'motto': ['docs', 'are', 'cool']} == get_docdata(MyClass)
⬇️ 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.
Source Distribution
Built Distribution
File details
Details for the file docdata-0.0.2.tar.gz
.
File metadata
- Download URL: docdata-0.0.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a58d2a87d43f1782a79c58af9fc1103111cff6a89d3699ddc7c82d1a88b370e7 |
|
MD5 | d9b27066563121417395073fffa2c537 |
|
BLAKE2b-256 | 4c44e5a1bccf3566373a1d6751a8552eea0ef68e56799aa9ce73dd1e7be6ecb3 |
Provenance
File details
Details for the file docdata-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: docdata-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed455c9d7ea32832563d3a023d981ce5331d47ef13bd33263fcec8cd528dbb3b |
|
MD5 | 3f18d849b5f09939b8c9971dcbb57ddb |
|
BLAKE2b-256 | c92e7a971b8d38890b6051f5d16be39994a4468e0fd72f74d8b2ad232d6b9750 |