Skip to main content

python-introspect

Extensible analysis of callable signatures, dataclass fields, type hints, and docstrings.

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.

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.5.tar.gz (28.2 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.5-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_introspect-0.1.5.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for python_introspect-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1b43b2eb5022f42885a9f97b4a92b20e1efda670d72476df8319cdd9039ef43f
MD5 561d388b4066351aeb800d9fbb443643
BLAKE2b-256 e8e90a15d8c6b03b6c0017b8cd77a1cf5e6166b4c2d3c4821a59c6c7c57a1add

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_introspect-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6027f43f1cd9f199f58b7030d97d1bd8395fd6d8f74d510b1cd21841ce455f36
MD5 ba1354dca6fccf1ef12258ede360f59a
BLAKE2b-256 f4b89ac59c8c23c10f62da53ec2facbaedef9ee6c8fb3cd31af797412115246d

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 Sentry Error logging StatusPage Status page