Skip to main content

Runtime Access for Class Attribute Docstrings

Project description

RACAD

GitHub Actions Workflow Status pypi versions license

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.

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

racad-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

racad-0.1.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file racad-0.1.2.tar.gz.

File metadata

  • Download URL: racad-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for racad-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0b3e345e9cb0705e3064cef72c919411146f7d81beb77a42743027d9af831ec0
MD5 5bd14d1e8627b6ae61acf93c779d52c7
BLAKE2b-256 4aec7c1d4e374802b63fa78b98784995ae46a573a2fa6dbe44c2ca08186055b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for racad-0.1.2.tar.gz:

Publisher: pypi-publish.yml on Lucas-Steinmann/racad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file racad-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: racad-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for racad-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 90f5d1ad8a2ba07873fe99f93e9c976eb51124c7b74eac287fafcfe082d6f924
MD5 a16211672b72cf44a098bd244a2327f1
BLAKE2b-256 8321c56db59340e9032f10bd096d064c4ba039b71a12a5f8c8ee10f59eb9c42f

See more details on using hashes here.

Provenance

The following attestation bundles were made for racad-0.1.2-py3-none-any.whl:

Publisher: pypi-publish.yml on Lucas-Steinmann/racad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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