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
{
'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=7, 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.2.13.tar.gz
(19.8 kB
view details)
Built Distribution
File details
Details for the file objinspect-0.2.13.tar.gz
.
File metadata
- Download URL: objinspect-0.2.13.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f0cae81e2bc4200045287544cf266afec0842a529d5d09af36a84d248c979c9 |
|
MD5 | 9ffb72e00f3d2cb427eae5aa88e6cd64 |
|
BLAKE2b-256 | c3206ada7a5775347f14caa1cce79bb3fad2cfd34d07a8dc340e95a15ead927e |
File details
Details for the file objinspect-0.2.13-py3-none-any.whl
.
File metadata
- Download URL: objinspect-0.2.13-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 183cc4ac507abf2ce8c20e3f6a3bdf3b42c893f8f2754ffe32a672692b8d9c0d |
|
MD5 | 5376c70bde628a5f8e058edf2d2a4333 |
|
BLAKE2b-256 | a20951aed0defce623cea25d3d1436466cd519d97282a7ade1149f2673ac58b5 |