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
- Inspect functions, methods, and classes with a consistent API
- Access signatures, parameters, return annotations, and docstrings
prettydir(alias:pdir) for a richerdir()-style view
Installation
From PyPI
pip install objinspect
uv add objinspect
From source
pip install git+https://github.com/zigai/objinspect
uv add git+https://github.com/zigai/objinspect
Examples
>>> from objinspect import inspect
>>> import math
>>> inspect(math.pow)
Function(name='pow', parameters=2, description='Return x**y (x to the power of y).')
>>> inspect(math.pow).dict
{
'name': 'pow',
'parameters': [
{'name': 'x', 'kind': <_ParameterKind.POSITIONAL_ONLY: 0>, 'type': <class 'inspect._empty'>, 'default': <class 'inspect._empty'>, 'description': None},
{'name': 'y', 'kind': <_ParameterKind.POSITIONAL_ONLY: 0>, 'type': <class 'inspect._empty'>, 'default': <class 'inspect._empty'>, 'description': None}],
'docstring': 'Return x**y (x to the power of y).'
}
>>> inspect(inspect)
Function(name='inspect', parameters=8, description='Inspects an object and returns a structured representation of its attributes and methods.')
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-1.0.1.tar.gz
(78.4 kB
view details)
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 objinspect-1.0.1.tar.gz.
File metadata
- Download URL: objinspect-1.0.1.tar.gz
- Upload date:
- Size: 78.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54193e9d568233082683e3e07ba30bdb493946493c0df28ddabf630a3aa08d16
|
|
| MD5 |
0901ab29670bbd67e41fa99ed0e4e3ad
|
|
| BLAKE2b-256 |
aa8b39fa0fa62e090b0c6ee9ba322b6d1c88d5a54107eddc97b3d1f6c564425c
|
File details
Details for the file objinspect-1.0.1-py3-none-any.whl.
File metadata
- Download URL: objinspect-1.0.1-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8194dfe4ad32e12441482d99b3d59e64ec495ed212c0619c0428b6d6e1d1c86d
|
|
| MD5 |
e8761d6261b2cc61f571b2c0a547086b
|
|
| BLAKE2b-256 |
9ef20f69025c14e63d27d9f93a895d5da5b24a2c15b8f504a905a0641609a76e
|