Simple Python introspection tool
Project description
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
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 pyintrospect-0.2.2.tar.gz.
File metadata
- Download URL: pyintrospect-0.2.2.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85714383e78cfe657015fb800cf6a7bc9160f64a26d1f1c86ef38031146d7027
|
|
| MD5 |
9c68cdbb952c3a0f068eebba9d8b017f
|
|
| BLAKE2b-256 |
db9faa8a529da1f580d4b9c058abe6efb5c0060ec3ef442ad276b06d9dd2f533
|
File details
Details for the file pyintrospect-0.2.2-py3-none-any.whl.
File metadata
- Download URL: pyintrospect-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e88a4febcce922c7b5ffc06ed51073ff9a691fd73c566a94795ab11132b365c3
|
|
| MD5 |
a387f939cbd1c09252e60485480021ec
|
|
| BLAKE2b-256 |
a9be285fdaf5e66a57be26dea49d7a0bf55f00e88839289aff04d8f6828544cb
|