Metadata-Version: 2.4
Name: flextype
Version: 0.1.0
Summary: Lazy and structural helpers for Python dispatch and type checks
Author-email: Clemens Damke <clemens@cortys.de>
License-Expression: MIT
Project-URL: source, https://github.com/Cortys/flextype
Project-URL: tracker, https://github.com/Cortys/flextype/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.13.0
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# flextype

Lazy and structural helpers for Python dispatch and type checks.

`flextype` provides lazy alternatives to `functools.singledispatch`, `isinstance`,
and `issubclass`. It supports delayed imports, string-based type references,
runtime registries, and dispatch against dynamically registered structural types.

## Install

`flextype` requires Python 3.13 or newer.

```sh
pip install flextype
```

```sh
uv add flextype
```

## Quickstart

```python
from flextype import flexdispatch


@flexdispatch
def describe(value: object) -> str:
    return "object"


@describe.register("pathlib.Path")
def describe_path(value: object) -> str:
    return f"path-like: {value}"
```

String registrations are resolved lazily, so optional imports can stay optional
until a matching value is dispatched.

## Development

```sh
uv run --group lint ruff check src/flextype tests/flextype
uv run --group lint ty check
uv run --group test pytest tests/flextype
```

Pre-commit hooks are managed with `prek`:

```sh
uvx prek install
uvx prek run --all-files
```

## License

This project is licensed under the MIT License.
