jaxtyping
Type annotations and runtime checking for shape and dtype of JAX/NumPy/PyTorch/etc. arrays.
What it is and what it does
jaxtyping is a type-annotation library that lets you specify the shape and data type of arrays and tensors directly in function signatures. Instead of writing generic array or tensor type hints, you can declare that a function expects a floating-point array with specific axis names—and optionally enforce those constraints at runtime. The library works with JAX, PyTorch, NumPy, MLX, and TensorFlow, despite its historical name.
The annotations themselves are static (compatible with standard Python type checkers), but jaxtyping is designed to pair with runtime type-checking libraries, which can then validate that actual arguments match the declared shapes and dtypes. This catches shape mismatches and dtype errors early, which is especially valuable in numerical and deep-learning code where silent broadcasting or type coercion can hide bugs.
Use it for:
- Annotate neural network layer inputs and outputs with expected tensor shapes to catch dimension mismatches early
- Document and enforce dtype constraints in scientific computing functions
- Pair with runtime type-checking tools to add validation to model code
- Improve IDE autocomplete and static type-checker support for array-heavy codebases
- Validate matrix operation arguments for compatible dimensions
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type annotations and runtime type-checking for array shape and dtype across JAX, PyTorch, NumPy, MLX, and TensorFlow, with no JAX dependency required.
Yes. Active maintenance, permissive MIT license, low install friction, and no known vulnerabilities. Valuable for any codebase mixing arrays or tensors with type hints. Install it for annotations alone; add a runtime type-checking package separately if runtime validation is needed.
Install
jaxtyping on PyPI
pip
pip install jaxtypinguv
uv add jaxtypingpoetry
poetry add jaxtypingInstalling jaxtyping
Before you install
Low friction install with a single runtime dependency (wadler-lindig). Active maintenance with recent releases; last commit 2026-07-08. Requires Python 3.11+.
License in practice
MIT License (permissive). Code includes sections modified from typeguard under MIT terms. Allows commercial and private use with attribution.
Quickstart
pip install jaxtyping
from jaxtyping import Float
def matrix_multiply(x: Float["dim1 dim2"],
y: Float["dim2 dim3"]
) -> Float["dim1 dim3"]:
pass
Requires Python 3.11+. Runtime type-checking typically requires installing a separate type-checking package.
Verify before relying
- Performance overhead of runtime type-checking on large arrays or frequent function calls
- Compatibility with type-checking tools beyond those mentioned in documentation
- Support for custom array types or frameworks beyond those listed
Package facts
| License | MIT License Copyright (c) 2022 Google LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — wadler-lindig |
| Maintenance | actively maintained — 62 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,153,117/month — #1,779 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jaxtyping-0.3.11-py3-none-any.whl
Keywords: deep-learning, equinox, jax, neural-networks, typing
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
torchtypingAdds type annotations for PyTorch tensor shape,…
permissive · top 15,000 on PyPI
einshapeEinshape provides a DSL-based interface for…
permissive · top 15,000 on PyPI
chexChex provides utilities for writing reliable…
permissive · top 5,000 on PyPI
equinoxEquinox provides neural network and model…
permissive · top 5,000 on PyPI
numeraryProvides runtime-checkable protocols and type…
permissive · top 15,000 on PyPI
orbax-exportOrbax Export serializes JAX models to…
permissive · top 15,000 on PyPI
autorayAutoray provides automatic dispatch of array…
permissive · top 15,000 on PyPI
nptypingProvides type hints and runtime type checking…
permissive · top 15,000 on PyPI
lineaxLineax solves linear systems and least-squares…
permissive · top 15,000 on PyPI
numpydanticNumpydantic adds type annotations and…
permissive · top 15,000 on PyPI