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.0.tar.gz (4.0 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.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: racad-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 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.0.tar.gz
Algorithm Hash digest
SHA256 9207d2377570e96d942d533c033a6604394e60d67dcae8df3546b59b46cb6649
MD5 7038ec3074dc434466c2dd65937d1cb8
BLAKE2b-256 003d8dc70b527587599dd4138b96bedc8dab7db2c5395ca3fbd3805827947a35

See more details on using hashes here.

Provenance

The following attestation bundles were made for racad-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: racad-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 651b3f651228957d6a1082f4eca6af18f3d7e6b644a7b3536a94a966594f0429
MD5 b2c15a53cdd4676bcd37c356cb2cc439
BLAKE2b-256 7d4957fd4888a8f4d47c602101d556919c72d2c33459c0a028703a7834ca520e

See more details on using hashes here.

Provenance

The following attestation bundles were made for racad-0.1.0-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