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 hashes)
Built Distribution
Close
Hashes for objinspect-0.2.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 183cc4ac507abf2ce8c20e3f6a3bdf3b42c893f8f2754ffe32a672692b8d9c0d |
|
MD5 | 5376c70bde628a5f8e058edf2d2a4333 |
|
BLAKE2b-256 | a20951aed0defce623cea25d3d1436466cd519d97282a7ade1149f2673ac58b5 |