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

  • Inspect functions, methods, and classes with a consistent API
  • Access signatures, parameters, return annotations, and docstrings
  • prettydir (alias: pdir) for a richer dir()-style view

Installation

From PyPI

pip install objinspect
uv pip install objinspect

From source

pip install git+https://github.com/zigai/objinspect
uv pip install git+https://github.com/zigai/objinspect

Examples

>>> from objinspect import inspect
>>> 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=8, 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.4.1.tar.gz (53.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

objinspect-0.4.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: objinspect-0.4.1.tar.gz
  • Upload date:
  • Size: 53.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for objinspect-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a153f3f3fed231c1eb9811e4f37f052d93cbeb942079f4e66bc1a40bf2e4b5c5
MD5 2dcbd85b53436188dcfef2227ce7e676
BLAKE2b-256 c62ea4aca4661f5af2c04cd51b2e52aaec50ea4d42bd4f7b09365b92801f4608

See more details on using hashes here.

File details

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

File metadata

  • Download URL: objinspect-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for objinspect-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d0b12d2b965bbe740e10f4ac0e886dfcd86888a9d18259941c2ddc2f4e2fafd
MD5 025810eedf43c6646336449e552d0ee0
BLAKE2b-256 e83276565b2f75bb7644bc6497f3a44fbc9e97bb59aa04d8a55a2e40e7de14e3

See more details on using hashes here.

Supported by

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