RACAD
RACAD stands for Runtime Access for Class Attribute Docstrings. This is the source code accompanying my blogpost (not online yet).
You can copy this code into your own project or use it as a library.
Usage
Given a class defined as follows:
class MyClass:
a: int = 5
"""This is the docstring of a."""
to get the attribute docstring of one attribute of a class by its name, use:
from racad import get_attribute_docstring
get_attribute_docstring(MyClass, 'a')
# Output: 'This is the docstring of a.'
alternatively, to get all docstrings of all attributes of a class, use:
from racad import get_attribute_docstrings
get_attribute_docstrings(MyClass)
# Output: {'a': 'This is the docstring of a.'}
Limitation
Requires source code access via the inspect module.
E.g. does not work if the class has been defined in a REPL.
Metadata
Release files for racad 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| racad-0.1.2.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| racad-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / racad-0.1.2.tar.gz
| Download URL | racad-0.1.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b3e345e9cb0705e3064cef72c919411146f7d81beb77a42743027d9af831ec0
|
|
BLAKE2b-256 checksum How to use checksums |
4aec7c1d4e374802b63fa78b98784995ae46a573a2fa6dbe44c2ca08186055b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2024.
Transparency logRelease files / racad-0.1.2-py3-none-any.whl
| Download URL | racad-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90f5d1ad8a2ba07873fe99f93e9c976eb51124c7b74eac287fafcfe082d6f924
|
|
BLAKE2b-256 checksum How to use checksums |
8321c56db59340e9032f10bd096d064c4ba039b71a12a5f8c8ee10f59eb9c42f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2024.
Transparency log