A high-level library for Python object inspection
Project description
objinspect
objinspect is a high-level wrapper around Python's built-in inspect
module.
It provides a simple interface for examining Python functions and classes.
Features
- Simplified inspection of Python objects (classes, functions, methods)
- Detailed information about parameters, return types, and docstrings
- prettydir - like dir(), but with more information and prettier output
Installation
From PyPi
pip install objinspect
From source
pip install git+https://github.com/zigai/objinspect
Examples
>>> from objinspect import inspect, pdir
>>> import math
>>> inspect(math.pow)
Function(name='pow', parameters=2, description='Return x**y (x to the power of y).')
>>> inspect(math.pow).dict
[
{
"default":"<class""inspect._empty"">",
"description":"None",
"kind":"<_ParameterKind.POSITIONAL_ONLY":0>,
"name":"x",
"type":"<class""inspect._empty"">"
},
{
"default":"<class""inspect._empty"">",
"description":"None",
"kind":"<_ParameterKind.POSITIONAL_ONLY":0>,
"name":"y",
"type":"<class""inspect._empty"">"
}
]
>>> inspect(inspect)
Function(
name="inspect",
parameters=2,
description="The inspect function takes an object and an optional include_inherited flag (defaults to True) and returns either a Function object or a Class object depending on the type of object.",
)
prettydir
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
objinspect-0.2.10.tar.gz
(15.9 kB
view details)
Built Distribution
File details
Details for the file objinspect-0.2.10.tar.gz
.
File metadata
- Download URL: objinspect-0.2.10.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98b4af545019f2ed418ced8598e0a8ecfdd4064aaf73fcf6287ce9072fc97604 |
|
MD5 | d374108af4d30521bf43df5df18c87fd |
|
BLAKE2b-256 | 7e53b0cbab75ae90194d663e7d07ed1f1247928f25547ef526a4f39206713e0d |
File details
Details for the file objinspect-0.2.10-py3-none-any.whl
.
File metadata
- Download URL: objinspect-0.2.10-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee1d16738a4f8b182c136a360ab70bde3840a21cb6a02beda2dadf27a1afd852 |
|
MD5 | f8b6f54f3601a13d8619d539d63e4eb5 |
|
BLAKE2b-256 | 135ec8cdec1d103da47e4aea234c49fbce904f2dc572ba422cd1871a0fabfa1d |