← All packages

Numerics & statistics

star-units 0.1.1

Unit conversion with exact definitions and a dimension check

Public state: Released & Verified. The registry label is RELEASED. What the states mean →

Apache-2.0 Released & Verified single file

Summary

Conversion between 64 units of ten dimensions and four temperature scales from exact definitions held as fractions; identical to SciPy within 4.5e-16 on all 416 ordered pairs and to astropy within 2.3e-16 on 328; a conversion between different dimensions (force and impulse, mass and force) is refused.

Run in your browser

Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).

Runs in the browser: all 49 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026. Open it in the Workspace →

Use it on your computer

No account and no GitHub needed. Download, then install with one command:

python -m pip install star_units-0.1.1-py3-none-any.whl

In Python: import star_units

Get started →

Cite it, and its bill of materials

For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.

@software{cavazzini_star_units_0_1_1,
  author  = {Cavazzini, Andrea},
  title   = {{star-units}: Unit conversion with exact definitions and a dimension check},
  version = {0.1.1},
  year    = {2026},
  url     = {https://andrea07072000.github.io/S.T.A.R.-/software/star_units/},
  note    = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}

For developers

Install directly from the public repository:

python -m pip install "star-units @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_units"

README · tests · evidence (GitHub)

Technical sheet

Package
star-units
Import name
star_units
Version
0.1.1
Licence
Apache-2.0
Python
>=3.9
Dependencies
none (standard library only)
Capability
star.units.conversion
Maturity
Released & Verified (RELEASED)
Published commit
dc09f61d

Requirements

  • R1 convert(value, from_unit, to_unit) for 64 units of ten dimensions (length, mass, time, force, pressure, angle, speed, energy, power, impulse). Every factor is the exact definition (SI Brochure, NIST SP 811, the 1959 yard and pound, standard gravity, IAU 2012 B2 and 2015 B2) held as a fraction; the ratio is exact and rounded once.
  • R2 convert_temperature for K, °C, °F, °R, exact in rational arithmetic; dimension(unit) and units(dimension).
  • R3 Measured on ALL 416 ordered pairs of units of the same dimension: within 4.5e-16 relative of SciPy's table on every pair; within 2.3e-16 of astropy on 328 pairs; 84 temperature conversions within 2e-12 K of both.
  • R4 A conversion between different dimensions raises ValueError naming both; so do unknown or mis-cased unit names, non-finite or non-numeric values (booleans included), an overflowing result, a temperature below absolute zero.

Limits (what is not claimed)

A fixed table, not a unit algebra: no compound units beyond the ones listed, no prefixes generated on the fly, no parsing of expressions. The calorie is the thermochemical one (4.184 J) and the BTU the International Table one; other calories and BTUs exist. On the 68 pairs that involve lbf, slug, psi, hp, ft*lbf, lbf*s or BTU, astropy differs from this module and from SciPy by up to 1.7e-8 relative: it builds the pound-force from a slug rounded to 32.174049 lb and holds the BTU to nine digits; this module follows the exact definitions. That is recorded as a candidate observation about a third-party library, not reported. astropy has no kgf and no atm: 20 pairs are compared with SciPy only.

Release gate

Computed by the registry from the result files, with the same function that decides RELEASED.

Mutation score, latest measure of each module (needs at least 0.850)
  • star_units.py 0.995 (2026-10-06)
Independent implementations written by others (needs 2)
astropy.units with imperial units, scipy.constants (NIST / CODATA factors)
Also compared with, not counted
published values: NIST SP 811, SI Brochure, IAU 2012 B2 (exact definitions)
Result
Released & Verified

Evidence in the registry

CheckStatusRecordedWhat was observed
Clean install from the release tagVERIFIED2026-10-07pytest outside the tree: 49 passed in 0.24s
Clean install from the release tagVERIFIED2026-10-06pytest outside the tree: 49 passed in 0.22s
Unit testsVERIFIED2026-10-0649 passed in 0.46s
ReviewVERIFIED2026-10-06Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed
ReviewVERIFIED2026-10-06Re-running the cross-check gives a byte-identical evidence file
Reference valueVERIFIED2026-10-06convert(1, 'lbf', 'N') = 4.4482216152605, convert(1, 'in', 'm') = 0.0254, convert(1, 'au', 'm') = 149597870700.0: identical (suite: 49 passed in 0.46s)
Cross-check with independent librariesVERIFIED2026-10-06star_units converts between every pair of its units as two independent libraries do, and where they differ it follows the exact definitions
BenchmarkVERIFIED2026-10-06SciPy 4.4e-16 (worst pair ft*lbf -> cal); astropy 2.2e-16 / 1.6e-08

Fingerprints (SHA-256)

star_units-0.1.1-py3-none-any.whlc5e8574730523ffd9d864c247a23e76b52dd197721508ce47c92ca4191fe50f6
star_units.pyaa572fb2306c04bc7ab3feeeb17f228214ff33c60ec90abb8e5fc243a627713f
star_units-0.1.1-source.zip08a346692f0811365d1e9662e1d3c6fd80d7c429af6b7088bfc18b1076053d18

results