Metadata-Version: 2.4
Name: python-introspect
Version: 0.1.7
Summary: Pure Python introspection toolkit for function signatures, dataclasses, and type hints
Author-email: Tristan Simas <tristan.simas@mail.mcgill.ca>
License: MIT
Project-URL: Homepage, https://github.com/OpenHCSDev/python-introspect
Project-URL: Repository, https://github.com/OpenHCSDev/python-introspect
Project-URL: Issues, https://github.com/OpenHCSDev/python-introspect/issues
Keywords: introspection,reflection,signature,dataclass,type-hints,docstring
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: annotated-types>=0.7.0
Requires-Dist: metaclass-registry>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=1.24.0; extra == "docs"
Dynamic: license-file

# python-introspect

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

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![PyPI version](https://badge.fury.io/py/python-introspect.svg)](https://badge.fury.io/py/python-introspect)

## Quick start

```python
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

```bash
python -m pip install python-introspect
```

The runtime depends on metaclass-registry. Repository and issues:
[OpenHCSDev/python-introspect](https://github.com/OpenHCSDev/python-introspect).

## Documentation

The maintained sources are in [`docs/source`](docs/source). Documentation
changes are checked by the repository's [documentation
workflow](https://github.com/OpenHCSDev/python-introspect/actions/workflows/docs.yml);
the local warnings-as-errors build command is documented in
[`development.rst`](docs/source/development.rst).
