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.11.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

objinspect-0.2.11-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: objinspect-0.2.11.tar.gz
  • Upload date:
  • Size: 16.5 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.11.tar.gz
Algorithm Hash digest
SHA256 8e9e4cf32afbf690a7f9e47480c0070b262c62cf0eedc6b18457a710e1ad9094
MD5 7b596931d8ab8380b209f3e9ef7aeef5
BLAKE2b-256 6d890affc6cf6ef3ee3e46a978458e6b44dcc3eb834530a00497ac67454d27dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: objinspect-0.2.11-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8030591e9c19b204043a17ce5f678785f1c461fa1ee68ae2efbea016aee08a03
MD5 cd23232f866e8b4acfeab3257764ed3a
BLAKE2b-256 197ea33712b46551ec348a1c4697afcf6f14d636e224a1aed84531dec56533be

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