Skip to main content

Test Coverage Stable Version Pre-release Version PyPI - Python Version PyPI Downloads

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

Go to documentation

Metadata

Release files for runtime-reflection-lite 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runtime-reflection-lite 0.2.1
File Size Uploaded
runtime_reflection_lite-0.2.1.tar.gz 26.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runtime-reflection-lite 0.2.1
File Interpreter ABI Platform
runtime_reflection_lite-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 57.7 kB

Release files / runtime_reflection_lite-0.2.1.tar.gz

Download URL runtime_reflection_lite-0.2.1.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8d23a71e1c0aab1eb600808d39827cce30d287ea4cf9238b0e3db397def9cc66
BLAKE2b-256 checksum
How to use checksums
0491b2128f579c244ca5c5118ceaf2f6f1965a256d5d9796837b141e48c38896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / runtime_reflection_lite-0.2.1-py3-none-any.whl

Download URL runtime_reflection_lite-0.2.1-py3-none-any.whl
Size 30.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc8d6184207b87689092a75f4f8616e312f98148c174e846411e1f6c333851e9
BLAKE2b-256 checksum
How to use checksums
0bc87ee8bd7ddce7930ea4ecc11678eb52df43630edf0bf85a9cb488b8c6023d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page