Skip to main content

python-introspect

Extensible analysis of callable signatures, dataclass fields, type hints, and docstrings, plus signature-derived callable declaration projection.

Python 3.10+ PyPI version

Quick start

from python_introspect import SignatureAnalyzer

def resize(image, factor: float = 0.5, *, preserve_range: bool = True):
    """Resize an image.

    Args:
        image: Input image.
        factor: Scale factor.
        preserve_range: Preserve the input intensity range.
    """

parameters = SignatureAnalyzer().analyze(resize)

for name, info in parameters.items():
    print(name, info.param_type, info.default_value, info.is_required)

analyze is the unified entry point for functions, methods, classes, dataclass types, and instances. It returns a mapping of names to ParameterInfo records.

Use callable_declaration_kwargs when declaration identity should omit keyword arguments equal to their signature defaults. The caller supplies value equality so array, lazy, or other framework-specific values keep their owning semantics.

Extension points

Use register_namespace_provider to contribute names used while resolving forward references and register_type_resolver to unwrap application proxy types. Wrappers can declare their user-facing inspection target through the signature-target helpers in python_introspect.signature_analyzer.

Installation

python -m pip install python-introspect

The runtime depends on metaclass-registry. Repository and issues: OpenHCSDev/python-introspect.

Documentation

The maintained sources are in docs/source. Documentation changes are checked by the repository's documentation workflow; the local warnings-as-errors build command is documented in development.rst.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_introspect-0.1.11.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

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

python_introspect-0.1.11-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file python_introspect-0.1.11.tar.gz.

File metadata

  • Download URL: python_introspect-0.1.11.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for python_introspect-0.1.11.tar.gz
Algorithm Hash digest
SHA256 58200b6f8f81097af710c2a8923a73b12ec6ee1ae10303ebdd2b4ee0c620f20c
MD5 8a9f16fcf3da9a5c554ef860875b9734
BLAKE2b-256 0af6ffc161835f398730888313dfea1ad8fc22237a74e12a76df81ce74be1b58

See more details on using hashes here.

File details

Details for the file python_introspect-0.1.11-py3-none-any.whl.

File metadata

File hashes

Hashes for python_introspect-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e4816008627be42c40190b26894b1f47146ecc6966e29d0b56495ae39faf10
MD5 0626d3e6682169316f23c260de7d8f11
BLAKE2b-256 2935cb0eb6ca364b95c69be3d107e71865c033f57c1ec786d9117c053b673ffe

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.0

2 files

Supported by

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