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.1.6.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

runtime_keypath-0.1.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runtime_keypath-0.1.6.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for runtime_keypath-0.1.6.tar.gz
Algorithm Hash digest
SHA256 337b4b2ca4acb7a11335a06ba92cf629e7fc48b74abbf5d8cdbdb158101236cc
MD5 9c94ba85b168af7106ce2ea4adfef33e
BLAKE2b-256 e5cbaca81a07883eae396f0e1bec35b2bd87be413ff2afb8345fc0d2f7f48db3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runtime_keypath-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c3369dae6d0e38b45b5e826ed7f640a2daacf7f33327bab7dd0251a7ca32d03c
MD5 697468ad20d77e6c86a8b89cf7531083
BLAKE2b-256 ee9ed85862a356ae9bad78f25fe6e20ab94a9df856adb8b8c9adbfb6739c0b73

See more details on using hashes here.

Supported by

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