Utilities · zero-dependency · MIT

larzunits

Unit conversion + dimensional checks.

Convert between units with dimensional-consistency checking (including affine temperatures) — catch 'meters plus seconds' bugs before they happen.

larzscript pkg install units
View on GitHub →Learn the stack

What you get

Try it

import "units" as units
print(round(units.convert(5, "km", "mi"), 4))
print(units.convert(100, "C", "F"))
let a = units.qty(5, "m")
let b = units.qty(30, "cm")
print(units.qty_str(units.qty_add(a, b)))
print(units.compatible("mi", "kg"))
Output
3.1069
212
5.3 m
false

Why it's in the Larz Stack

larzunits is a real Larzscript package (larzscript pkg install units) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.