Runtime reflection (lite)
Project description
Runtime Reflection Lite
Lightweight runtime reflection for Python — with proper type awareness.
🚀 Why this exists
Python has powerful introspection capabilities, but working with them in practice can be messy:
- Type hints are not always resolved
- Metadata is scattered across different APIs
- Understanding structure at runtime requires a lot of boilerplate
This library provides a clean and consistent abstraction layer for inspecting Python code at runtime.
👉 The goal is simple: Make runtime structure easy to access, understand, and use
✨ Features
- 🔍 Inspect modules, classes, and functions
- 🧠 Resolve type hints (including forward references)
- 🔐 Understand encapsulation and structure
- ⚡ Lightweight implementation (no source code parsing)
- 🧩 Clean API for building higher-level tooling
📦 Use cases
This library is especially useful when building:
- Frameworks
- Dependency injection systems
- Code analysis tools
- Runtime validation systems
- Developer tooling
👉 If you're working with dynamic architectures, this removes a lot of friction.
🏗 Design philosophy
Unlike heavier reflection systems, this project deliberately avoids:
- ❌ Parsing source code
- ❌ Full AST inspection
This keeps it:
✅ Fast ✅ Predictable ✅ Easy to integrate
⚙️ Example
from runtime.reflection.lite import MemberFilter, MemberInfo, Class, Method, reflect, get_signature, get_members
class Class1:
def __init__(self, value: str):
self.__value = value
def do_something(self, suffix: str | None = None) -> str:
return self.__value + (suffix or "")
reflection: Class = reflect(Class1)
reflection.constructor.signature # -> (value: str)
member_info, method = reflection.members.subset_methods()["do_something"] # -> tuple[MemberInfo, Method]
signature1 = get_signature(Class1.do_something) # -> (suffix: str | None) -> str
signature2 = get_signature(Class1.__init__) # -> (value: str)
members = get_members(Class1, filter = MemberFilter.FUNCTIONS_AND_METHODS)
member_info, member = members["do_something"] # -> MemberInfo, Member
Full documentation
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runtime_reflection_lite-0.2.1.tar.gz.
File metadata
- Download URL: runtime_reflection_lite-0.2.1.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d23a71e1c0aab1eb600808d39827cce30d287ea4cf9238b0e3db397def9cc66
|
|
| MD5 |
6568128bddbd62e1767b6dee553443a5
|
|
| BLAKE2b-256 |
0491b2128f579c244ca5c5118ceaf2f6f1965a256d5d9796837b141e48c38896
|
Provenance
The following attestation bundles were made for runtime_reflection_lite-0.2.1.tar.gz:
Publisher:
python-publish.yml on apmadsen/runtime-reflection-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
runtime_reflection_lite-0.2.1.tar.gz -
Subject digest:
8d23a71e1c0aab1eb600808d39827cce30d287ea4cf9238b0e3db397def9cc66 - Sigstore transparency entry: 1731104797
- Sigstore integration time:
-
Permalink:
apmadsen/runtime-reflection-lite@79ac12599a9638ff2a4ed5a69ba550aab2720ab2 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/apmadsen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@79ac12599a9638ff2a4ed5a69ba550aab2720ab2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file runtime_reflection_lite-0.2.1-py3-none-any.whl.
File metadata
- Download URL: runtime_reflection_lite-0.2.1-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc8d6184207b87689092a75f4f8616e312f98148c174e846411e1f6c333851e9
|
|
| MD5 |
a9dfca76d25f2088d78a306a35aff940
|
|
| BLAKE2b-256 |
0bc87ee8bd7ddce7930ea4ecc11678eb52df43630edf0bf85a9cb488b8c6023d
|
Provenance
The following attestation bundles were made for runtime_reflection_lite-0.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on apmadsen/runtime-reflection-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
runtime_reflection_lite-0.2.1-py3-none-any.whl -
Subject digest:
dc8d6184207b87689092a75f4f8616e312f98148c174e846411e1f6c333851e9 - Sigstore transparency entry: 1731104831
- Sigstore integration time:
-
Permalink:
apmadsen/runtime-reflection-lite@79ac12599a9638ff2a4ed5a69ba550aab2720ab2 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/apmadsen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@79ac12599a9638ff2a4ed5a69ba550aab2720ab2 -
Trigger Event:
release
-
Statement type: