skillfed

ansys-units

Pythonic interface for units, unit systems, and unit conversions.

ansys-units v0.12.1 94.2K downloads/30d#13,337 on PyPI6
Permissive license MIT Active released

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-units

uv

uv add ansys-units

poetry

poetry add ansys-units

Installing 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

Development Status :: 4 - BetaIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Information Analysis

Tags

unit conversion libraryphysical quantities pythondimensional analysisunit arithmetic operationsSI units and systemsquantity with unitsunit registry
unit-conversiondimensional-analysisscientific-computing

More Information Analysis packages