Skip to main content

A high-level library for Python object inspection

Project description

objinspect

Tests Documentation Status PyPI version Supported versions Downloads Downloads 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

>>> 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

image

License

MIT License

Project details


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.12.tar.gz (19.6 kB view hashes)

Uploaded Source

Built Distribution

objinspect-0.2.12-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page