Skip to main content

Supports runtime key-path recording/accessing for Python.

Project description

Python Key-path

Supports runtime key-path recording/accessing for Python.

from __future__ import annotations

from runtime_keypath import KeyPath, KeyPathSupporting

class A(KeyPathSupporting):
    def __init__(self) -> None:
        self.__b = B()

    @property
    def b(self) -> B:
        return self.__b

class B(KeyPathSupporting):
    def __init__(self) -> None:
        self.__c = C()

    @property
    def c(self) -> C:
        return self.__c

class C:
    pass

a = A()
key_path = KeyPath.of(a.b.c)
assert key_path.target is a and key_path.keys == ("b", "c")
assert key_path() is a.b.c

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

runtime_keypath-0.2.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

runtime_keypath-0.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file runtime_keypath-0.2.0.tar.gz.

File metadata

  • Download URL: runtime_keypath-0.2.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for runtime_keypath-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a6945caa12a977728f2a92973b33bda27575cc341b3aea914c6c67ce7b79d2c3
MD5 01a6753675d2359853c029aa8174d167
BLAKE2b-256 5165e325f6acf738b7e156c5184774e3bdda50b564ff13c5f5f64fe715db437e

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtime_keypath-0.2.0.tar.gz:

Publisher: python-publish.yml on Azureblade3808/py-runtime-keypath

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

File details

Details for the file runtime_keypath-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for runtime_keypath-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b33672a967a0261477536d153c5725955884ecaebce92013cc9e25d158e4694c
MD5 8f2e71ddeb0d680b969d9ddab6ef9c31
BLAKE2b-256 7fcbfecc399fde90aed13cfa0211d240337dee00e1ec94c2a5949e05442b9c58

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtime_keypath-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on Azureblade3808/py-runtime-keypath

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