Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zigai/objinspect
A high-level library for Python object inspection
https://github.com/zigai/objinspect
function-signature inspect-type-hints introspection metaprogramming object-inspection python python-inspect
Last synced: 3 months ago
JSON representation
A high-level library for Python object inspection
- Host: GitHub
- URL: https://github.com/zigai/objinspect
- Owner: zigai
- License: mit
- Created: 2022-09-17T18:11:32.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-02T21:10:06.000Z (3 months ago)
- Last Synced: 2024-10-07T16:48:13.671Z (3 months ago)
- Topics: function-signature, inspect-type-hints, introspection, metaprogramming, object-inspection, python, python-inspect
- Language: Python
- Homepage: https://objinspect.readthedocs.io
- Size: 122 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# objinspect
[![Tests](https://github.com/zigai/objinspect/actions/workflows/tests.yml/badge.svg)](https://github.com/zigai/objinspect/actions/workflows/tests.yml)
[![Documentation Status](https://readthedocs.org/projects/objinspect/badge/?version=latest)](https://objinspect.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/objinspect.svg)](https://badge.fury.io/py/objinspect)
![Supported versions](https://img.shields.io/badge/python-3.10+-blue.svg)
[![Downloads](https://static.pepy.tech/badge/objinspect/month)](https://pepy.tech/project/objinspect)
[![Downloads](https://static.pepy.tech/badge/objinspect)](https://pepy.tech/project/objinspect)
[![license](https://img.shields.io/github/license/zigai/objinspect.svg)](https://github.com/zigai/objinspect/blob/main/LICENSE)`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
``` python
>>> 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': , 'default': , 'description': None},
{'name': 'y', 'kind': <_ParameterKind.POSITIONAL_ONLY: 0>, 'type': , 'default': , '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
![image](https://github.com/zigai/objinspect/assets/69588680/e1adcf90-0ef3-49e4-8804-a662f6388475)## License
[MIT License](https://github.com/zigai/obj-inspect/blob/master/LICENSE)