PyIntrospect
PyIntrospect is a lightweight Python introspection toolkit that provides structured, human-readable analysis of Python modules at runtime.
It builds on top of Python’s inspect module and organizes raw metadata into a consistent, categorized format for easier debugging, exploration, and tooling.
Features
PyIntrospect extracts and structures module information including:
- Submodules
- Variables
- Constants
- Functions (with signatures and return types when available)
- Classes (with base classes and constructor signatures)
- Module source code (when accessible)
- Module file path
- Summary statistics
Installation
pip install pyintrospect
Quick Start
import pyintrospect
import os
r = pyintrospect.Reflect(os)
r.summary()
Core Idea
Python provides powerful introspection tools such as dir() and inspect, but:
dir()is unstructured and noisyinspectis low-level and requires manual processing
PyIntrospect adds a semantic layer on top of inspect, producing structured and categorized output suitable for analysis and tooling.
API
Reflect(module, HideDunder=True, pretty=True)
| Parameter | Type | Description |
|---|---|---|
| module | Module | Target Python module |
| HideDunder | bool | Hide private and dunder members |
| pretty | bool | Print formatted output instead of returning raw data |
Methods
summary()
r.summary()
Returns or prints:
- Module name
- File path
- Version (if available)
- Member counts by type
- Total members
submodules()
r.submodules()
Returns or prints submodules imported in the target module.
variables()
r.variables()
Returns or prints module-level variables.
constants()
r.constants()
Returns or prints module-level constants (uppercase identifiers).
functions()
r.functions()
Returns or prints functions with:
- Name
- Signature
- Return type (if available)
classes()
r.classes()
Returns or prints class definitions with:
- Class name
- Base classes
__init__signature
source()
r.source()
Returns or prints module source code (if available).
path()
r.path()
Returns or prints absolute file path of the module.
all()
r.all()
Returns or prints all available introspection data.
doc(attribute=None)
r.doc()
r.doc("function_name")
Returns documentation for:
- Entire module (default)
- Specific attribute (function/class/variable if applicable)
CLI Usage
pyintrospect <module> [options]
Examples
pyintrospect os
pyintrospect os --functions
pyintrospect requests --classes --raw
CLI Options
Core
-a, --allShow all information (default if no filter is provided)-h, --helpShow help-V, --versionShow version
Inspection
-f, --functionsShow functions-c, --classesShow classes-v, --variablesShow variables-C, --constantsShow constants-m, --submodulesShow submodules
Detail
-s, --sourceShow source code-p, --pathShow module path-d, --docShow documentation
Formatting
-r, --rawDisable pretty print (return raw data)-D, --dunderInclude dunder/private members
Behavior Notes
- Built-in or compiled modules may not expose source code
- Some functions may not provide signature metadata
- Private members are filtered by default unless
HideDunder=False
Design Philosophy
PyIntrospect is designed with three principles:
- Structure over noise
- Readability over raw inspection
- Practical output over raw metadata
The goal is to make Python introspection usable in real tooling workflows, not just debugging sessions.
Version
Current version: 0.2.2
License
MIT License
Copyright (c) 2026 Hoàng Long
Release files for pyintrospect 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyintrospect-0.2.2.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyintrospect-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / pyintrospect-0.2.2.tar.gz
| Download URL | pyintrospect-0.2.2.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85714383e78cfe657015fb800cf6a7bc9160f64a26d1f1c86ef38031146d7027
|
|
BLAKE2b-256 checksum How to use checksums |
db9faa8a529da1f580d4b9c058abe6efb5c0060ec3ef442ad276b06d9dd2f533
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / pyintrospect-0.2.2-py3-none-any.whl
| Download URL | pyintrospect-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e88a4febcce922c7b5ffc06ed51073ff9a691fd73c566a94795ab11132b365c3
|
|
BLAKE2b-256 checksum How to use checksums |
a9be285fdaf5e66a57be26dea49d7a0bf55f00e88839289aff04d8f6828544cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|