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

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.1
File Size Uploaded
picounits-1.1.1.tar.gz 192.3 kB Details

Built distribution (wheel)

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

Total release size: 255.2 kB

Release files / picounits-1.1.1.tar.gz

Download URL picounits-1.1.1.tar.gz
Size 192.3 kB
Tags Source
SHA-256 checksum
How to use checksums
977223ffe4029b6a978cea15b76b5284942fc1e8d212ee76640d868cca936f12
BLAKE2b-256 checksum
How to use checksums
9fc33245f87c10bb3275ce4ce09be49233662773f3c0a0ae2708726b82290c50
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

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

Download URL picounits-1.1.1-py3-none-any.whl
Size 62.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9e24010c7797a0da697306b9e247eacb20a3be2fb27859026b63f593fdfab6d
BLAKE2b-256 checksum
How to use checksums
ed289fecd95efa662d3ea7980352ebd5e8f427c8072ed2af4b8d4d267fba68e9
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

Release history Release notifications | RSS feed

1.1.3

2 release files

This release

1.1.1 This release

2 release files

1.1.0

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