Define the type. Define the variable. Execute.
Automate physical meaning throughout your pipeline.
Overview
Picounits is a dynamic runtime typing system for numerical dimensional quantities. It provides a consistent type system for expressing dimensional quantities throughout your pipeline.
Features
- Configurable `unit frames` with custom symbols and dimension ordering.
- Parses `UnitValues` language formats: unit types (`.ut`) and unit-informed values (`.uiv`).
- Numerical support for real, complex, and vector quantities with type-specific operations.
- Traces quantity construction and dimensional operations performed on quantities.
- Type checking at functional boundaries, defined by the user.
Why convert at all?
Picounits reduces complexity by reducing the set of units to one canonical set defined by the user.
It does not attempt to answer:
How might one convert between systems at a boundary?
3 feet → 0.9144... metre (1/3.280839895...?)
↺ Each iteration
Picounits follows this principle:
Define unit frame → Define derived units → Work within it, not outside it.
What is a Unit Frame?
A unit frame defines the dimensional system used by an application.
For example:
[symbols]
time: s
length: m
mass: kg
current: A
temperature: K
amount: mol
luminosity: cd
dimensionless: ∅
The dimensional environment is independent of the notation used to represent it. Hence, any semantic representation can be used.
However, PicoUnits operates on a fixed set of fundamental dimensions and prefixes.
See the .picounits file for implementation details.
What are .ut and .uiv?
Both are dimensionally aware formats: .ut defines custom units, while .uiv encodes quantities as:
attribute: value prefix(unit)
.ut defines the custom units for your unit system:
[units]
p: kg*m^-1*s^-2 # Defines the unit for pressure (Pascal)
.uiv defines the quantities within your unit system:
[model]
inlet_pressure: 101 k(p) # 101 kPa using the defined unit p
See UnitValues for overview and language specification.
Quick Start
A step-by-step introduction is available in tutorial/.
from picounits import Q, expects, VOLTAGE, CURRENT, RESISTANCE
@expects(VOLTAGE)
def ohm_law(i: Q, r: Q) -> Q:
return i * r
# Correct Usage
myVar = ohm_law(10 * CURRENT, 5 * RESISTANCE)
# > Output: 50.0 (kg·m²·s⁻³·A⁻¹)
# Incorrect Usage
myVar = ohm_law(10 * CURRENT, 5 * VOLTAGE)
# > DimensionError: 'ohm_law' returned kg·m²·s⁻³, expected kg·m²·s⁻³·A⁻¹
Installation
To install:
pip install PicoUnits
Documentation
Full documentation is available in the docs/ folder including API reference, changelog, and contributors.
Metadata
Release files for PicoUnits 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| picounits-1.1.3.tar.gz | 192.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| picounits-1.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 255.2 kB
Release files / picounits-1.1.3.tar.gz
| Download URL | picounits-1.1.3.tar.gz |
|---|---|
| Size | 192.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97293070d097e83db2307326ac0bef095bb0e518aec63ac56aa29f7b6aa72b15
|
|
BLAKE2b-256 checksum How to use checksums |
340f9bbd408bfae93053a2783693dc1f86c70940d26f91f6bc1c9269e2946aad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logRelease files / picounits-1.1.3-py3-none-any.whl
| Download URL | picounits-1.1.3-py3-none-any.whl |
|---|---|
| Size | 62.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53f698fa71b46fefaa2dcaf8098fc91cb19205a9bae8a90a230740a9e7ae70c2
|
|
BLAKE2b-256 checksum How to use checksums |
7ec81584661d38de375556e8c965ab504413777f34fb7b04f34cdfb376b80721
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency log