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-0.4.3.tar.gz
(80.5 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-0.4.3.tar.gz.
File metadata
- Download URL: objinspect-0.4.3.tar.gz
- Upload date:
- Size: 80.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29bad637e1a4a035260c50f8fabd0390bab6346fd0c19fd07c73fdec816bbce9
|
|
| MD5 |
91575332ff8d2bb0c436a7f2bf97779b
|
|
| BLAKE2b-256 |
b116d543a6e8523327bfbb80808b862c698520d21c639977625d18c48fbd33ea
|
File details
Details for the file objinspect-0.4.3-py3-none-any.whl.
File metadata
- Download URL: objinspect-0.4.3-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.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7286862665319d179f42584e76dce1c8aaf9268f20053c6590e47b848baf5b2
|
|
| MD5 |
78a58449bcafa68ecdc64b0b63c87fef
|
|
| BLAKE2b-256 |
3cf98cbc0e59248085d457e4a45f6b50e4712a4550d3c49582d173cb5c1d70bc
|