skillfed

quantities

Support for physical quantities with units, based on numpy

quantities v0.16.4 263.6K downloads/30d#8,354 on PyPI219
License unclear Active released

What it is and what it does

Quantities is a Python library for working with physical quantities—numbers paired with units and dimensionality. It extends numpy to let you perform arithmetic on quantities while automatically tracking and enforcing dimensional consistency; dividing distance by time yields a velocity with the correct units, and attempting to add incompatible units raises an error. The library is built on numpy and integrates with many numpy ufuncs, making it suitable for scientific and engineering calculations where unit safety matters.

The package is actively maintained and has a stable API, but the authors explicitly note that test coverage is incomplete and recommend against mission-critical applications. It depends only on numpy and installs as a pure Python wheel with low friction.

Use it for:

  • Perform dimensional analysis in physics or engineering simulations where unit mismatches should be caught automatically.
  • Convert between unit systems (e.g., metres to feet, seconds to hours) while preserving quantity semantics.
  • Build scientific data pipelines where quantities carry both magnitude and dimensionality through calculations.
  • Validate physical calculations by ensuring operations respect dimensional consistency rules.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Quantities handles arithmetic and unit conversions for physical quantities with magnitude, dimensionality, and optional uncertainty, built on numpy.

Yes, if you need unit-aware arithmetic in scientific code and can tolerate incomplete test coverage. The low install friction, active maintenance, and numpy integration make it straightforward to adopt. No, if your work is mission-critical or requires bulletproof test coverage—the package's own documentation discourages such use. Verify the license terms before committing.

Install

quantities on PyPI

pip

pip install quantities

uv

uv add quantities

poetry

poetry add quantities

Installing quantities

Before you install

Low install friction; pure Python wheel. Maintenance is active with recent commits, though the package notes test coverage remains incomplete and is not recommended for mission-critical applications.

License in practice

License treatment is unclear—the package states it uses only BSD-compatible code but provides no explicit SPDX identifier or raw license field in metadata, so you should verify the actual license terms before use.

Quickstart

pip install quantities

import quantities as pq
distance = 42 * pq.metre
time = 17 * pq.second
velocity = distance / time
print(f"{velocity.magnitude:.3f} {velocity.dimensionality}")

Requires Python >= 3.10 and numpy as a runtime dependency.

Verify before relying

  • Whether test coverage has improved since the description was written and whether the package is now suitable for mission-critical use.
  • Exact BSD license variant(s) used, given the unclear license_treatment in metadata.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 210 days since the last release
Last repo commit
First released
Downloads 263,593/month — #8,354 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: quantities-0.16.4-py3-none-any.whl

Keywords: quantities, units, physical, constants

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: End Users/DesktopIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonTopic :: EducationTopic :: Scientific/Engineering

Tags

physical units and quantitiesunit conversion arithmeticdimensional analysis pythonnumpy quantities with unitsscientific unit handling
units-and-quantitiesdimensional-analysis

More Scientific/Engineering packages