Class doc
Small set of helpers aimed to extract class attributes documentation from the class definition. This stuff tries to mimic sphinx-autodoc behaviour as closely as possible (except instance attributes defined inside __init__ function).
The main advantage of this project over sphinx-autodoc is that it is lightweight single-purpose dependency, while autodoc just a small part of really heavy project.
Installation
This package is available on PyPI
pip install class-doc
Examples
Shamely stolen from sphinx-autodoc docs
class Foo:
"""Docstring for class Foo."""
#: Doc comment for class attribute Foo.bar.
#: It can have multiple lines.
bar = 1
flox = 1.5 #: Doc comment for Foo.flox. One line only.
baz = 2
"""Docstring for class attribute Foo.baz."""
baf = 3
"""
Even
multiline
docstrings
handled
properly
"""
import class_doc
assert class_doc.extract_docs_from_cls_obj(Foo) == {
"bar": ["Doc comment for class attribute Foo.bar.", "It can have multiple lines."],
"flox": ["Doc comment for Foo.flox. One line only."],
"baz": ["Docstring for class attribute Foo.baz."],
"baf": ["Even", "multiline", "docstrings", "handled", "properly"]
}
Development setup
Project requires Poetry for development setup.
- If you aren't have it already
pip install poetry
- Install project dependencies
poetry install
- Run tests
poetry run pytest .
- Great, all works!
Metadata
Release files for class-doc 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| class-doc-0.2.6.tar.gz | 5.0 kB | Without provenance | Details for class-doc-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| class_doc-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for class_doc-0.2.6-py3-none-any.whl |
Total release size: 9.7 kB
Release files / class-doc-0.2.6.tar.gz
| Download URL | class-doc-0.2.6.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5e036ed9b7f6de528affdd9f038851910b342d4c1c1252983a55ff080b530e0
|
|
BLAKE2b-256 checksum How to use checksums |
891e4378f484ba489255a8f523feb381f792eb195745a709b56efc46a22a333d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Linux/5.4.0-62-generic
|
Release files / class_doc-0.2.6-py3-none-any.whl
| Download URL | class_doc-0.2.6-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6f2cea2dfbe93f76dee25de13d70dc0d2269698e8b849f751d98dc894c52ea5
|
|
BLAKE2b-256 checksum How to use checksums |
a6336b4051860e772581f59f671e878178cab4c115b5a6e3df1921d5a2384518
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Linux/5.4.0-62-generic
|
Security for class-doc 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.