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.2.tar.gz (54.7 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.2-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: objinspect-0.4.2.tar.gz
  • Upload date:
  • Size: 54.7 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.2.tar.gz
Algorithm Hash digest
SHA256 123c237ed6b89d0eec8cc8b394db071ff9fd5f2642558e3e95af0bcd630ae344
MD5 b3b1b8b4cdc1b13cb0f817b61044e879
BLAKE2b-256 da6421f287b7cbadcf61e85947554292e56d74e7877133b0e274f9faad27c222

See more details on using hashes here.

File details

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

File metadata

  • Download URL: objinspect-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 19.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 83e1166952cec32ced045e3f1017b6e28e3e286891487357bf1121ca71b7b1bc
MD5 e922f4af0a97d1b482e72024e595dc6f
BLAKE2b-256 ab8b03357f48dc88771a57c9ed5cd3a3b255d0c21c88be09039bd157b9475ee2

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