typedunits
A fast units and dimensions library with support for static dimensionality checking and protobuffer serialization.
Decision gist · record as of 2026-08-14
Yes, if you work with physical quantities and want compile-time dimensional safety. The active maintenance, permissive license, and precompiled wheels make it low-friction to adopt. No known vulnerabilities. Start with the caveat that protobuffer support is limited to selected units—verify your units are covered before relying on serialization.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; precompiled wheels available for common platforms, but building from source requires Cython.
- Medium install friction due to compiled Cython wheels; precompiled binaries available for Python 3.10–3.13 on macOS, Linux, and Windows.
- Active maintenance with recent commits and a permissive Apache 2 license.
License · maintenance · safety
Apache 2 (permissive) — Apache 2 is permissive; you can use, modify, and distribute typedunits freely in commercial and private projects, provided you include the license notice.
last release 2026-04-13 (123 days) · last repo commit 2026-08-07 · 10 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 93,034 downloads/mo, #13,406 on PyPI
Alternatives
Verify before relying
pip install typedunits
from typedunits.units import meter, km, MHz
print(5 * meter + km)
print(3 * MHz)- Whether protobuffer serialization covers the units you need (documentation notes only selected units are supported).
- Performance characteristics compared to other units libraries in your use case.
- Whether mypy integration works reliably with your type checker configuration.
What it is and what it does
TypedUnits is a Cython-based library that adds dimensional analysis to Python arithmetic. It lets you attach units to numbers and enforces that only compatible units can be combined—adding meters to kilometers works, but adding meters to seconds fails at runtime or, with static type hints, at type-check time. The library ships precompiled wheels for modern Python versions and supports protobuffer serialization for a selected set of units.
The core use case is scientific and engineering code where dimensional consistency matters: you can write functions that accept only specific unit types, and mypy will catch type mismatches. It also provides array support via numpy integration and can convert values to base SI units for inspection or comparison.
Use it for
- Physics simulations where dimensional consistency prevents unit-conversion bugs.
- Type-safe function signatures that reject incompatible unit types at type-check time.
- Serializing and deserializing physical quantities via protobuffer for inter-process communication.
- Scientific data pipelines where unit tracking and validation reduce calculation errors.
- Array-based computations on quantities with consistent dimensionality.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with physical quantities and want compile-time dimensional safety.
The active maintenance, permissive license, and precompiled wheels make it low-friction to adopt. No known vulnerabilities. Start with the caveat that protobuffer support is limited to selected units—verify your units are covered before relying on serialization.
Install
typedunits on PyPI
Before you install
Medium install friction due to compiled Cython wheels; precompiled binaries available for Python 3.10–3.13 on macOS, Linux, and Windows. Active maintenance with recent commits and a permissive Apache 2 license.
Requires Python 3.10 or later; precompiled wheels available for common platforms, but building from source requires Cython.
License in practice
Apache 2 is permissive; you can use, modify, and distribute typedunits freely in commercial and private projects, provided you include the license notice.
Quickstart
pip install typedunits
from typedunits.units import meter, km, MHz
print(5 * meter + km)
print(3 * MHz)
Verify before relying
- Whether protobuffer serialization covers the units you need (documentation notes only selected units are supported).
- Performance characteristics compared to other units libraries in your use case.
- Whether mypy integration works reliably with your type checker configuration.
Package facts
| License | Apache 2 permissive |
| Python support | Supports the current Python release >=3.10.0 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 5 packagesattrscythonnumpyprotobufpyparsing |
| Maintenance | Actively maintained 123 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,034 / month, #13,406 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: typedunits-0.0.2-cp310-cp310-macosx_11_0_arm64.whl; typedunits-0.0.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; typedunits-0.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; typedunits-0.0.2-cp310-cp310-win32.whl; typedunits-0.0.2-cp310-cp310-win_amd64.whl; typedunits-0.0.2-cp311-cp311-macosx_11_0_arm64.whl; typedunits-0.0.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; typedunits-0.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; typedunits-0.0.2-cp311-cp311-win32.whl; typedunits-0.0.2-cp311-cp311-win_amd64.whl; typedunits-0.0.2-cp312-cp312-macosx_11_0_arm64.whl; typedunits-0.0.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; typedunits-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; typedunits-0.0.2-cp312-cp312-win32.whl; typedunits-0.0.2-cp312-cp312-win_amd64.whl; typedunits-0.0.2-cp313-cp313-macosx_11_0_arm64.whl; typedunits-0.0.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; typedunits-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; typedunits-0.0.2-cp313-cp313-win32.whl; typedunits-0.0.2-cp313-cp313-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “static type checking units”
- typedunitsImplements unit of measurement arithmetic with static type checking…
- isqxisqx provides type-annotation-friendly metadata objects for physical…
- basedpyrightBasedpyright is a static type checker for Python that forks and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also Pint · quantities · measurement · unyt · isqx · pint-xarray · Pint-Pandas · ansys-units · hepunits · python-flint