Skip to main content

si-units

documentation PyPI version

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

si_units-0.11.5-cp310-abi3-win_amd64.whl (804.4 kB view details)

Uploaded CPython 3.10+Windows x86-64

si_units-0.11.5-cp310-abi3-win32.whl (716.6 kB view details)

Uploaded CPython 3.10+Windows x86

si_units-0.11.5-cp310-abi3-pyemscripten_2026_0_wasm32.whl (522.3 kB view details)

Uploaded CPython 3.10+PyEmscripten 2026.0 wasm32

si_units-0.11.5-cp310-abi3-manylinux_2_34_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

si_units-0.11.5-cp310-abi3-macosx_11_0_arm64.whl (915.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

si_units-0.11.5-cp310-abi3-macosx_10_12_x86_64.whl (949.4 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file si_units-0.11.5-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: si_units-0.11.5-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 804.4 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for si_units-0.11.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b6fb63c2db0afe7dfbe7464b007ee687ffcbc58bbc3c7aeed807d8921f622e7d
MD5 3f7cf61976b51ba3295e11314edb7d79
BLAKE2b-256 a02bc7850acecb32a4275ee6ffc413054aeb8bbd7730cbf9de3739ab1fa49070

See more details on using hashes here.

File details

Details for the file si_units-0.11.5-cp310-abi3-win32.whl.

File metadata

  • Download URL: si_units-0.11.5-cp310-abi3-win32.whl
  • Upload date:
  • Size: 716.6 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for si_units-0.11.5-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 30400261ec180d825d845a92cc9d902740f64baeb79a3bc116c8dd32b2c4872d
MD5 447178885a5f162502199276b7a9efa2
BLAKE2b-256 5b331efc41cc248c56aaa9852d4188b9ff706367935daa0fd349da88019cdea2

See more details on using hashes here.

File details

Details for the file si_units-0.11.5-cp310-abi3-pyemscripten_2026_0_wasm32.whl.

File metadata

File hashes

Hashes for si_units-0.11.5-cp310-abi3-pyemscripten_2026_0_wasm32.whl
Algorithm Hash digest
SHA256 b29b622f30e80e3c1838e0875b7773dbae3393fe8fc003d815f5adabfcfbade5
MD5 1a2352d22fb9db7c060e57359690348f
BLAKE2b-256 a33a015d1a8117bd36857819dc365fe9c542e9d82975bb14ee544f62eb95b51f

See more details on using hashes here.

File details

Details for the file si_units-0.11.5-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for si_units-0.11.5-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d98729f9ac232e09fc907d86394e535ad1ecdeec283e505900b9eb75e78b9863
MD5 5880c72aed6ea1236309de5691d6b8a0
BLAKE2b-256 08b3ba18b171d1e69e37e6d289eff5cc2c94af5405d3b891a06fa6dde2efd6fd

See more details on using hashes here.

File details

Details for the file si_units-0.11.5-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for si_units-0.11.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a91ed83dd58d9b8404ed231c1b5657b9092d32ca4ba1ef72228fe8dbabdec8e
MD5 adf0176fbed1763fa47721be485dc454
BLAKE2b-256 fa448e442a52b8ab0553ff772cf7f901d64502a37a93ef9f8ec0cfc3a597e399

See more details on using hashes here.

File details

Details for the file si_units-0.11.5-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for si_units-0.11.5-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 23025468daef90e3c80562617d9bc886960796e66fc3a0149f68011f82ded886
MD5 2ae3b4928dc2035e5a138c6594bcbfde
BLAKE2b-256 5c07265e6ca91124a7ce55471f7a17fb04d3c60e10a1ae63637f2caa60913cd5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page