Pint
Physical quantities module
What it is and what it does
Pint is a Python library for working with physical quantities—numbers paired with units of measurement. It lets you perform arithmetic on quantities (adding meters to centimeters, for example), convert between units, and work with a built-in library of physical units, prefixes, and constants. The library is designed to be modular, so you can extend or replace the unit definitions without touching the source code.
The package integrates cleanly with NumPy arrays and supports NumPy mathematical operations without monkey-patching, meaning you can work with arrays of quantities directly. It also integrates with Pandas DataFrames and the uncertainties package when installed. Pint is dependency-free at its core—it runs on Python 3.11+ with only the standard library—making it lightweight and easy to add to any project.
Use it for:
- Scientific calculations where you need to track units automatically and catch dimensional mismatches (e.g., physics simulations, engineering computations).
- Data analysis pipelines that mix different measurement units and need automatic conversion and validation.
- Building command-line tools or applications that accept user input in various units and normalize them internally.
- NumPy-based numerical work where array operations must preserve and transform units correctly.
- Pandas workflows where columns represent measured quantities with different units that need unit-aware operations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pint defines, operates on, and converts between physical quantities—combining numerical values with units of measurement—and supports arithmetic operations and unit conversions across a comprehensive built-in unit library.
Yes. Pint is a mature, actively maintained library with no known vulnerabilities, low install friction, and permissive licensing. It solves a real problem—tracking and converting units in calculations—cleanly and without forcing heavy dependencies. Install it if you work with physical quantities, scientific data, or any calculation where mixing units is a concern.
Install
pint on PyPI
pip
pip install pintuv
uv add pintpoetry
poetry add pintInstalling Pint
Before you install
Low friction: pure Python wheel with only four lightweight runtime dependencies (flexcache, flexparser, platformdirs, typing-extensions). Active maintenance with a recent release 148 days ago and ongoing commits; well-established project since 2012 with 2769 repository stars.
License in practice
BSD permissive license allows free use, modification, and distribution in both open-source and proprietary projects with minimal restrictions.
Quickstart
pip install pint
import pint
ureg = pint.UnitRegistry()
result = 3 * ureg.meter + 4 * ureg.cm
print(result) # <Quantity(3.04, 'meter')>
Requires Python 3.11 or later.
Verify before relying
- Performance characteristics when handling very large arrays or complex unit hierarchies.
- Completeness and accuracy of the default unit definitions relative to domain-specific standards.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — flexcache, flexparser, platformdirs, typing-extensions |
| Maintenance | actively maintained — 148 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,136,479/month — #1,965 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pint-0.25.3-py3-none-any.whl
Keywords: conversion, physical, quantities, science, unit
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
ansys-unitsManages physical quantities with numerical…
permissive · top 15,000 on PyPI
hepunitsProvides units and physical constants in the…
permissive · top 15,000 on PyPI
Pint-PandasPint-Pandas adds physical unit support to…
permissive · top 15,000 on PyPI
pint-xarrayAdds physical units support to xarray datasets…
permissive · top 15,000 on PyPI
quantitiesQuantities handles arithmetic and unit…
unclear · top 15,000 on PyPI
typedunitsImplements unit of measurement arithmetic with…
permissive · top 15,000 on PyPI
ucumvertParses UCUM (Unified Code for Units of Measure)…
permissive · top 15,000 on PyPI
measurementProvides unit-aware measurement objects for…
permissive · top 5,000 on PyPI
isqxisqx provides type-annotation-friendly metadata…
permissive · top 15,000 on PyPI
unytAttaches units to NumPy arrays and provides…
permissive · top 15,000 on PyPI