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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file objinspect-0.2.12.tar.gz.

File metadata

  • Download URL: objinspect-0.2.12.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for objinspect-0.2.12.tar.gz
Algorithm Hash digest
SHA256 779a9749f51b13848b08f81bc06ab6d642e1d7246bf7bd3bc344c55587e7c5d8
MD5 c2476b41e30cd681ae919fcade48aa99
BLAKE2b-256 4c9494d8d3321253c76a541cce60166912381a1fabe31ceacd6c5661dadf63df

See more details on using hashes here.

File details

Details for the file objinspect-0.2.12-py3-none-any.whl.

File metadata

  • Download URL: objinspect-0.2.12-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for objinspect-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 30c970a21ae89b7c1e324c4e96197bc115929cb44fd59e7d4006025f530b1cee
MD5 2c1a3aaf5d518015ac4be55939eb5b37
BLAKE2b-256 01f9615cf14f51327d08e8f48f8161a0a6fcbdff002fd0f7018ea80ae036a4b9

See more details on using hashes here.

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