unxts.api#

Abstract dispatch API for unxt.

Note

unxts.api is the canonical package. The legacy unxt-api distribution remains available as a thin backward-compatible shim that re-exports this package, so existing import unxt_api code keeps working unchanged.

unxts.api declares the abstract dispatch interfaces that unxt and other packages implement. It depends only on plum — not on jax, numpy or astropy — so a package can speak unxt’s API without pulling in its implementation.

Install#

uv add unxts.api
pip install unxts.api

At a glance#

unxts.api declares the function; unxt registers the implementation that runs.

import unxt as u

q = u.Q(5, "m")
u.uconvert("km", q)

u.uconvert here is unxt’s registered implementation of the abstract unxts.api.uconvert. To make your own type work with the same call, you register an implementation of your own — see Extending.

Pages#

Tutorial

Discussion

How-to

Reference

  • API — every abstract function, its signature and its registered implementations in unxt.

Public API#

The abstract functions, by domain:

Every one is a plum dispatch function, so f.methods lists what is currently registered:

import unxts.api as uapi

uapi.dimension.methods
uapi.unit_of.methods
uapi.uconvert.methods
uapi.uconvert_value.methods

See also#