ansys-units
Pythonic interface for units, unit systems, and unit conversions.
What it is and what it does
PyAnsys Units is a Python library for working with physical quantities—combinations of numerical values and units of measurement. It provides a Quantity class that wraps values with their units, enabling arithmetic operations (addition, subtraction, multiplication, division, exponentiation) while automatically tracking and validating dimensional consistency. The package includes a UnitRegistry for accessing predefined units, a UnitSystem abstraction for switching between measurement systems (SI, imperial, custom), and direct conversion between compatible units.
The library is designed for scientific and engineering workflows where dimensional analysis matters. It works with scalar values, lists, and NumPy arrays, and integrates with standard Python math functions. Its modular design allows extending the unit and constant definitions without modifying source code. With complete test coverage and support for Python 3.10 through 3.14, it targets researchers and engineers who need reliable unit handling in calculations.
Use it for:
- Perform physics calculations with automatic dimensional checking to catch unit mismatches early.
- Convert between unit systems (e.g., SI to imperial) in scientific simulations or data pipelines.
- Work with NumPy arrays of measurements while preserving and validating their units throughout operations.
- Define custom unit systems for domain-specific engineering problems without modifying the library.
- Integrate unit-aware quantities into data analysis workflows that mix different measurement standards.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Manages physical quantities with numerical values and units, supporting arithmetic operations, unit conversions, and integration with NumPy arrays.
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive MIT license. It solves a real problem—dimensional consistency in numerical code—with a clean API. Install it if you work with physical quantities and want automatic unit tracking; skip it if your calculations never mix units or if you need a heavier symbolic math system.
Install
ansys-units on PyPI
pip
pip install ansys-unitsuv
uv add ansys-unitspoetry
poetry add ansys-unitsInstalling ansys-units
Before you install
Low install friction with only two lightweight runtime dependencies (pyyaml and typing-extensions). Active maintenance with a recent release 59 days ago and current commit activity.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal attribution requirements.
Quickstart
pip install ansys-units
import ansys.units as ansunits
from ansys.units.common import m, s
volume = 1 * m**3
print(volume.value, volume.units.name)
velocity = 10 * m / s
print(velocity.to(ansunits.UnitRegistry().km / ansunits.UnitRegistry().hour))
Requires Python 3.10 or later (supports up to 3.14). NumPy is optional but needed for array-based quantities.
Verify before relying
- Whether NumPy integration is automatic or requires explicit installation beyond the listed runtime dependencies.
- Performance characteristics when working with large arrays or complex unit systems.
- Completeness of the bundled physical units and constants relative to domain-specific needs.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pyyaml, typing-extensions |
| Maintenance | actively maintained — 59 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 94,246/month — #13,337 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ansys_units-0.12.1-py3-none-any.whl
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
measurementProvides unit-aware measurement objects for…
permissive · top 5,000 on PyPI
PintPint defines, operates on, and converts between…
permissive · top 5,000 on PyPI
isqxisqx provides type-annotation-friendly metadata…
permissive · top 15,000 on PyPI
quantitiesQuantities handles arithmetic and unit…
unclear · 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
unytAttaches units to NumPy arrays and provides…
permissive · top 15,000 on PyPI
ansys-tools-commonProvides shared utilities and tools for the…
permissive · top 15,000 on PyPI
binaryConverts between binary (IEC) and decimal (SI)…
permissive · top 15,000 on PyPI
ucumvertParses UCUM (Unified Code for Units of Measure)…
permissive · top 15,000 on PyPI