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.

Parameter declarations in 0.2

UnifiedParameterAnalyzer now returns the original ParameterInfo declarations from SignatureAnalyzer. UnifiedParameterInfo, its source_type tag, and analyze_nested were removed. Use analyze and the declared param_type for parameter topology.

ParameterInfo retains its five public fields, constructor and _replace operation, and is now a frozen declaration rather than a tuple. Tuple unpacking and NamedTuple helpers are no longer supported. Dataclass descriptions are derived on first help access; value/default overlays preserve that deferred source, and renaming preserves the original field's help. Callable descriptions still participate eagerly in inferred parameter types. A presentation extraction error yields absent help without discarding valid types/defaults. Factory errors remain uncached and retryable.

Metadata

Release files for python-introspect 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-introspect 0.4.0
File Size Uploaded Provenance Actions
python_introspect-0.4.0.tar.gz 62.9 kB Without provenance Details for python_introspect-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-introspect 0.4.0
File Interpreter ABI Platform Actions
python_introspect-0.4.0-py3-none-any.whl Python 3 none any Details for python_introspect-0.4.0-py3-none-any.whl

Total release size: 109.9 kB

Release files / python_introspect-0.4.0.tar.gz

Download URL python_introspect-0.4.0.tar.gz
Size 62.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11c2a41f980fd69c243d3a96398edf8bb41ee32ef4943517cf7abfcb3502cd81
BLAKE2b-256 checksum
How to use checksums
49a235b32281df876ca3d14a398d4d650c7e728c99c660b2155c2f4de2b1dd78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / python_introspect-0.4.0-py3-none-any.whl

Download URL python_introspect-0.4.0-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c3a1e817ced5c27f16ef229f2ff0b6180b33ba6c7351110351b545a71811bff
BLAKE2b-256 checksum
How to use checksums
6ceda287e9f659518951997534252c6f39af7d976767b4634f093a269dc2a018
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for python-introspect 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page