Learn to Code ยท zero-dependency ยท MIT

larzunit

Unit conversion that shows its working.

Convert between units and see how - the factor used and the arithmetic - so conversion stops being a black box. Covers length, mass, temperature, data and time, and is honest that temperature uses formulas, not a single factor.

larzscript pkg install unit
View on GitHub →Learn the stack

What you get

Try it

import "unit" as unit
print(round(unit.convert(5, "km", "mi"), 4))
print(unit.convert(1, "gb", "mb"))
print(unit.convert(0, "celsius", "fahrenheit"))
print(unit.explain(5, "km", "mi"))
Output
3.1069
1024
32
5 km * 0.621371 = 3.10686 mi

Why it's in the Larz Stack

larzunit is a real Larzscript package (larzscript pkg install unit) - 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.