si-units
Representation of quantities with SI units.
The package is written with flexibility in mind and is able to represent arbitrarily complex units. In addition to simple scalar quantities, it can be used to decorate any complex data type (numpy arrays, PyTorch tensors) to provide unit checks.
Installation and Usage
You can install the package from PyPI
pip install si-units
For the documentation, see here.
To build the wheel or documentation locally, see below.
Examples
Calculate the pressure of an ideal gas.
from si_units import *
temperature = 25.0 * CELSIUS
volume = 1.5 * METER**3
moles = 75.0 * MOL
pressure = moles * RGAS * temperature / volume
print(pressure) # 123.94785148011941 kPa
numpy functions can be used with SI units:
from si_units import *
import numpy as np
ms = np.linspace(2.0, 4.0, 3) * METER
sqms = ms**2
print(sqms) # [4, 9, 16] m²
Building from Source
You need a rust compiler to build the wheel locally. To build the bindings to python, we use maturin.
Use
# in si-units
maturin develop --release
to build the package locally.
To build the python wheels, use
maturin build --release
Building the Documentation
To build the documentation you need mkdocs-material and mkdocstrings-python. Installing these packages (e.g. using uv or pip) will also install the needed dependencies.
During development, use
# in si-units
mkdocs serve
to run a local development server.
To build the documentation for deployment, use
# in si-units
mkdocs build
Metadata
Release files for si-units 0.11.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| si_units-0.11.5-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| si_units-0.11.5-cp310-abi3-win32.whl | CPython 3.10 | abi3 | Windows x86-32 | Details |
| si_units-0.11.5-cp310-abi3-pyemscripten_2026_0_wasm32.whl | CPython 3.10 | abi3 | PyEmscripten 2026.0+ WebAssembly | Details |
| si_units-0.11.5-cp310-abi3-manylinux_2_34_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| si_units-0.11.5-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| si_units-0.11.5-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 4.9 MB
Release files / si_units-0.11.5-cp310-abi3-win_amd64.whl
| Download URL | si_units-0.11.5-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 804.4 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b6fb63c2db0afe7dfbe7464b007ee687ffcbc58bbc3c7aeed807d8921f622e7d
|
|
BLAKE2b-256 checksum How to use checksums |
a02bc7850acecb32a4275ee6ffc413054aeb8bbd7730cbf9de3739ab1fa49070
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / si_units-0.11.5-cp310-abi3-win32.whl
| Download URL | si_units-0.11.5-cp310-abi3-win32.whl |
|---|---|
| Size | 716.6 kB |
| Tags | CPython 3.10 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
30400261ec180d825d845a92cc9d902740f64baeb79a3bc116c8dd32b2c4872d
|
|
BLAKE2b-256 checksum How to use checksums |
5b331efc41cc248c56aaa9852d4188b9ff706367935daa0fd349da88019cdea2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / si_units-0.11.5-cp310-abi3-pyemscripten_2026_0_wasm32.whl
| Download URL | si_units-0.11.5-cp310-abi3-pyemscripten_2026_0_wasm32.whl |
|---|---|
| Size | 522.3 kB |
| Tags | CPython 3.10 PyEmscripten 2026.0+ WebAssembly abi3 |
|
SHA-256 checksum How to use checksums |
b29b622f30e80e3c1838e0875b7773dbae3393fe8fc003d815f5adabfcfbade5
|
|
BLAKE2b-256 checksum How to use checksums |
a33a015d1a8117bd36857819dc365fe9c542e9d82975bb14ee544f62eb95b51f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / si_units-0.11.5-cp310-abi3-manylinux_2_34_x86_64.whl
| Download URL | si_units-0.11.5-cp310-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d98729f9ac232e09fc907d86394e535ad1ecdeec283e505900b9eb75e78b9863
|
|
BLAKE2b-256 checksum How to use checksums |
08b3ba18b171d1e69e37e6d289eff5cc2c94af5405d3b891a06fa6dde2efd6fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / si_units-0.11.5-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | si_units-0.11.5-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 915.9 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1a91ed83dd58d9b8404ed231c1b5657b9092d32ca4ba1ef72228fe8dbabdec8e
|
|
BLAKE2b-256 checksum How to use checksums |
fa448e442a52b8ab0553ff772cf7f901d64502a37a93ef9f8ec0cfc3a597e399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / si_units-0.11.5-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | si_units-0.11.5-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 949.4 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
23025468daef90e3c80562617d9bc886960796e66fc3a0149f68011f82ded886
|
|
BLAKE2b-256 checksum How to use checksums |
5c07265e6ca91124a7ce55471f7a17fb04d3c60e10a1ae63637f2caa60913cd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|