UnitForge for Python
UnitForge combines physical quantities and unit conversion with a Rust numeric engine. Python 3.10 or newer is required. Install with pip install unitforge; NumPy and typing_extensions are dependencies.
from unitforge import Force, ForceUnit, Distance, DistanceUnit, Energy
force = Force(12., ForceUnit.N)
distance = Distance(2., DistanceUnit.m)
intermediate = force * distance
work = intermediate.into_semantic(Energy)
assert work.as_f64() == 24.
assert (force / force).as_f64() == 1.
Every multiplication or division with valid dimensions is available, including unnamed intermediates. Operations which are ambiguous in physical meaning produce a generic quantity; into_energy(), into_moment(), or into_semantic(NamedClass) provide explicit interpretation. into_generic() erases meaning before reinterpretation.
Named constructors accept the corresponding unit enum. quantity.to(UnitEnum.variant) extracts a value in the chosen compatible unit. as_f64() explicitly extracts a base-unit float; only Dimensionless accepts float(quantity).
Fixed-shape containers include Vector2/3 and Matrix2/3/2x3/3x2. They support arithmetic, dot/cross products, transposition, norms, determinants, inverses, solving, and rectangular pseudoinverses as appropriate to shape. QR and symmetric eigen decomposition on raw-float Matrix3 use the same Rust algorithms and iteration limits. Quantity vector normalization returns Dimensionless components. NumPy conversion explicitly selects units or extracts raw numeric values.
Static stubs preserve named scalar scaling and explicit interpretation. Products with quantities conservatively return Quantity, since arbitrary dimensional expressions cannot be fully represented by finite Python overload tables. Runtime checks enforce dimensions and semantic compatibility.
Downstream Rust extensions exchange versioned data using unitforge::python_api; no shared PyO3 class identity is required. Custom quantities are registered using namespaced identities and unit descriptors. See the API guide for registration, serialization, and the exchange protocol.
Metadata
Release files for unitforge 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unitforge-0.6.0.tar.gz | 152.5 kB | Without provenance | Details for unitforge-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unitforge-0.6.0-cp312-cp312-manylinux_2_35_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.35+ x86-64 | Details for unitforge-0.6.0-cp312-cp312-manylinux_2_35_x86_64.whl |
Total release size: 506.6 kB
Release files / unitforge-0.6.0.tar.gz
| Download URL | unitforge-0.6.0.tar.gz |
|---|---|
| Size | 152.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b996de5a1e3b1ca844832ed409f40cbda03227b2a77169635c221010853a6b60
|
|
BLAKE2b-256 checksum How to use checksums |
9cb07301af2bfbde0b74a1e23ac5c5570697c591c09114419ba1e86967a99537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Release files / unitforge-0.6.0-cp312-cp312-manylinux_2_35_x86_64.whl
| Download URL | unitforge-0.6.0-cp312-cp312-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 354.1 kB |
| Tags | CPython 3.12 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
ec5c249f54008b35244253ae70efc21e079377f9a2cec0adc449234d81caa8d9
|
|
BLAKE2b-256 checksum How to use checksums |
e7b5aa2bcdd60f5f8258784e096d1048b9b4d32856b0b3384f9f238442b6d587
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Security for unitforge 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.