Skip to main content

PicoUnits logo

Define the type. Define the variable. Execute.
Automate physical meaning throughout your pipeline.

Overview

Version License Python  Version Coverage PyPI Downloads

PicoUnits is a dynamic runtime typing system for numerical quantities. It provides a consistent type system for expressing dimensional quantities throughout your pipeline.

- 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.
- Type checking at functional boundaries, defined by the user.

Why convert at all?

PicoUnits removes uncertainty 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

Because for computation, this is quite flawed. It destroys certainty for implementation convenience.

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

from picounits import Q, expects, VOLTAGE, CURRENT, RESISTANCE
 
@expects(VOLTAGE)
def ohm_law(i: Q, r: Q) -> Q:
  return i * r
 
# Correct Usage
ohm_law(10 * CURRENT, 5 * RESISTANCE) 
# > Output: 50.0 (kg·m²·s⁻³·A⁻¹)

# Incorrect Usage
ohm_law(10 * CURRENT, 5 * VOLTAGE)
# > DimensionError: 'ohm_law' returned kg·m²·s⁻³, expected kg·m²·s⁻³·A⁻¹

An introduction example is available in example/.


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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PicoUnits 1.1.0
File Size Uploaded
picounits-1.1.0.tar.gz 186.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PicoUnits 1.1.0
File Interpreter ABI Platform
picounits-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 248.3 kB

Release files / picounits-1.1.0.tar.gz

Download URL picounits-1.1.0.tar.gz
Size 186.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9537d6ce8053afb9e490d5a7ca2b048a24ae9aa8a4437de6331bee68cd4a2d44
BLAKE2b-256 checksum
How to use checksums
f61353f487e275ab61d371c0aa203a5a76b93e109512c47cb459edf51162ebc7
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 6, 2026.

Transparency log

Release files / picounits-1.1.0-py3-none-any.whl

Download URL picounits-1.1.0-py3-none-any.whl
Size 61.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de8c2392472ef7eb1ec0ceb0dbf672ca80df8fd4864b255f9674610852d1b109
BLAKE2b-256 checksum
How to use checksums
d28fbedb4ab8ce362b82b79e3d5697d462e63a74f2a3148a78456f1ba3598471
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 6, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.3

2 release files

1.1.1

2 release files

This release

1.1.0 This release

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page