Metadata-Version: 2.4
Name: unxt-api
Version: 1.8.0
Summary: Abstract dispatch API definitions for unxt
Project-URL: Bug Tracker, https://github.com/GalacticDynamics/unxt/issues
Project-URL: Homepage, https://github.com/GalacticDynamics/unxt
Author-email: GalacticDynamics <nstarman@users.noreply.github.com>, Nathaniel Starkman <nstarman@users.noreply.github.com>
License: BSD-3-Clause
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: astropy>=7.0.0
Requires-Dist: plum-dispatch>=2.5.7
Description-Content-Type: text/markdown

# unxt-api

Abstract dispatch API definitions for unxt.

This package defines the abstract dispatch interfaces that unxt and other
packages can implement. It provides a minimal dependency set for packages that
want to define or use unxt's dispatch-based API without pulling in the full unxt
implementation.

## Installation

```bash
pip install unxt-api
```

## Usage

This package is typically used as a dependency by unxt and related packages. It
defines abstract dispatch signatures using plum-dispatch that concrete
implementations register against.

For comprehensive documentation, examples, and extension guides, see:

- [unxt-api API Reference](https://unxt.readthedocs.io/en/latest/api/unxt-api.html)
- [Extending unxt Guide](https://unxt.readthedocs.io/en/latest/guides/extending.html)
- [Main unxt Documentation](https://unxt.readthedocs.io/)

## Quick Example

```python
from plum import dispatch
import unxt as u


class Temperature:
    def __init__(self, value, unit="K"):
        self.value = value
        self.unit_str = unit


@dispatch
def unit_of(obj: Temperature, /):
    return u.unit(obj.unit_str)


@dispatch
def dimension_of(obj: Temperature, /):
    return u.dimension("temperature")


# Now Temperature works with unxt!
temp = Temperature(300, "K")
u.unit_of(temp)  # Unit("K")
u.dimension_of(temp)  # PhysicalType('temperature')
```
