--- id: hepunits version: "2.4.6" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # hepunits — Units and constants in the HEP system of units License: permissive · Maintenance: active · Downloads: 119.2K/mo ## What it is and what it does hepunits is a Python library that defines the standard units and physical constants used in high-energy physics, based on the CLHEP system rather than SI units. The core difference is that HEP uses millimeters for length, nanoseconds for time, and MeV for energy as its base units, reflecting conventions used in major physics software like GEANT4 and Gaudi. The package provides two main modules: constants (physical constants and commonly used values) and units (length, time, energy, and other dimensional quantities). You use it by multiplying numerical values by unit objects to create dimensioned quantities, then dividing by units to extract values in a desired unit system. For example, defining a 1 GeV mass window as `1 * GeV` and retrieving an energy resolution in GeV as `energy_resolution() / GeV`. The package also optionally integrates with Pint for interoperability with a more general-purpose units library, though this is not required for basic use. Use it for: - Define and work with particle lifetimes and decay distances in particle physics simulations and analysis code - Perform energy and momentum calculations in high-energy physics experiments using standard HEP conventions - Convert between HEP units and SI or other unit systems when interfacing with external libraries or publishing results - Store dimensioned quantities consistently in data structures while keeping internal representation in HEP units ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides units and physical constants in the HEP (High Energy Physics) system of units, derived from CLHEP, for use in particle physics calculations and simulations. Yes. The package has zero security vulnerabilities, low install friction, active maintenance, and is designed for a specific and well-defined use case in particle physics. If you work in HEP or use software that follows CLHEP conventions, this is the standard way to handle units and constants in Python. Even if you only occasionally need HEP unit conversions, the permissive license and lack of dependencies make it a safe, lightweight addition. ## Install pip install hepunits uv add hepunits poetry add hepunits ## Installing hepunits Before you install: Low install friction with no runtime dependencies. Active maintenance with a release within the last 59 days. Supports Python 3.9 through 3.14, indicating current compatibility. License in practice: BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions, making this package safe to incorporate into most projects. Quickstart: pip install hepunits from hepunits.constants import c_light from hepunits.units import picosecond, micrometer tau = 1.5 * picosecond distance = c_light * tau print(distance / micrometer) # converts to micrometers Verify before relying: - Whether Pint integration is required for typical use or remains optional for most workflows - Performance characteristics when working with large datasets or frequent unit conversions ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 119.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags HEP units constants, particle physics units, CLHEP units python, high energy physics units, MeV GeV keV units, physics unit conversion, scientific constants HEP, physics-units, particle-physics, scientific-computing [View on SkillFed](https://skillfed.io/packages/hepunits) · [View on PyPI](https://pypi.org/project/hepunits/)