--- id: unyt version: "3.1.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # unyt — A package for handling numpy arrays with units License: permissive · Maintenance: active · Downloads: 99.2K/mo ## What it is and what it does unyt is a NumPy array subclass that carries unit information alongside numerical data. Instead of writing plain NumPy arrays and relying on documentation or convention to track what units apply, you attach units directly to the array: `distance = [3.4, 5.8, 7.2] * u.mile` then convert or inspect units as needed. The package handles unit arithmetic, conversion between compatible units, and propagation through operations. It's built entirely in Python on top of numpy and sympy, with no compiled dependencies or external tools required. The design keeps units transparent—operations on unitful arrays generally preserve or correctly combine units—so you can write scientific code that's both explicit about dimensions and readable. Use it for: - Track physical quantities in simulations or data analysis without losing dimensional information. - Convert between unit systems (e.g., miles to kilometers) without manual lookup tables. - Catch unit mismatches early by letting NumPy operations fail when incompatible units are combined. - Document and enforce dimensional consistency in scientific workflows and research code. - Build libraries that accept and return quantities with explicit units, reducing API ambiguity. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Attaches units to NumPy arrays and provides unit conversion, so you can track and transform dimensional data without losing track of what units you're working with. Yes. unyt is a mature, actively maintained package with no security issues, low install friction, and a permissive license. It solves a real problem—tracking units in numerical code—that becomes increasingly valuable as data complexity grows. Install it if you work with physical quantities or dimensional data and want to avoid silent unit errors. ## Install pip install unyt uv add unyt poetry add unyt ## Installing unyt Before you install: Low friction install with a pure-Python implementation depending only on numpy, sympy, and packaging. Active maintenance with a recent release and no known vulnerabilities. License in practice: BSD 3-Clause permissive license allows use in commercial and proprietary projects with minimal restrictions; you must include a copy of the license and acknowledge the authors. Quickstart: pip install unyt import unyt as u import numpy as np distance = np.array([3.4, 5.8, 7.2]) * u.mile print(distance.to('km')) Requires Python 3.10 or later. Verify before relying: - Whether unit conversion accuracy and precision meet domain-specific requirements for your application. - Performance characteristics when working with very large arrays or frequent unit conversions. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 99.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags numpy arrays with units, unit conversion python, dimensional analysis, physical quantities, unit handling, quantity arrays, scientific data units, scientific-computing, unit-conversion, data-validation [View on SkillFed](https://skillfed.io/packages/unyt) · [View on PyPI](https://pypi.org/project/unyt/)