Skip to main content

Typed engineering quantities with SI-default storage, built on pint

Project description

Engineering Units

Tests Docs MIT License Python 3.10+

Typed engineering quantities with unit-preserving storage, built on pint.

Install

pip install engunits

Quick start

from engunits import Mass, Force, Velocity

# Create quantities -- input units are preserved, SI assumed when omitted
m = Mass(1000, "lb")       # stored as 1000 lb
f = Force(100, "N")

# Convert on demand
print(m("kg"))              # 453.592 kg
print(m.si())               # 453.592 kg
print(m.imperial())         # 1000 lb

# Cross-type arithmetic resolves automatically
a = f / Mass(10, "kg")      # -> Acceleration
print(a.si())                # 10 m / s ** 2

# Arithmetic preserves units
total = Mass(10, "lb") + Mass(5, "lb")   # 15 lb
ratio = Mass(30, "kg") / Mass(10, "kg")  # 3.0

# sum() works
sum([Mass(1, "kg"), Mass(2, "kg"), Mass(3, "kg")])  # Mass(6, 'kg')

Supported quantities (41)

SI Base

Class SI Unit
Mass kg
Length m
Time s
Temperature K
Current A
AmountOfSubstance mol
LuminousIntensity cd

Mechanics

Class SI Unit
Velocity m/s
Acceleration m/s^2
Force N
Moment N*m
Energy J
Power W
Area m^2
Volume m^3
Density kg/m^3
Pressure Pa
Frequency Hz
Momentum kg*m/s
AngularVelocity rad/s
AngularAcceleration rad/s^2
MomentOfInertia kg*m^2
SurfaceTension N/m

Electromagnetism

Class SI Unit
Voltage V
Charge C
Capacity A*h
Resistance ohm
Capacitance F
Inductance H
MagneticFlux Wb
MagneticFluxDensity T
Conductance S
ElectricField V/m

Fluid and Thermal

Class SI Unit
DynamicViscosity Pa*s
KinematicViscosity m^2/s
MassFlowRate kg/s
VolumetricFlowRate m^3/s
ThermalConductivity W/(m*K)
SpecificHeatCapacity J/(kg*K)
HeatFlux W/m^2

Optics

Class SI Unit
Illuminance lx

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

engunits-0.1.1.tar.gz (69.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

engunits-0.1.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file engunits-0.1.1.tar.gz.

File metadata

  • Download URL: engunits-0.1.1.tar.gz
  • Upload date:
  • Size: 69.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for engunits-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e1d3983ac37668330b5e5d42b0d403a74eb51cdd3d8d560b942b7ec24184b263
MD5 4dc12c9d9381016d0341daf43f84693d
BLAKE2b-256 d64ba6b037ddc986ef3e086445469853fbb0a6ac56fa45ea25fe8a484a444402

See more details on using hashes here.

Provenance

The following attestation bundles were made for engunits-0.1.1.tar.gz:

Publisher: release.yml on matuscvengros/engunits

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file engunits-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: engunits-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for engunits-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ceb08bc86e0b698dd48c9ff8faf8221d6448393272d38a6622e4244892a9c083
MD5 4677501cd6440f6026fedd43f5eca7a2
BLAKE2b-256 0dd04ebd69fc1ec2c153b5269d6557e03b9dcdc364dbbcdb7a41f502fa5da00e

See more details on using hashes here.

Provenance

The following attestation bundles were made for engunits-0.1.1-py3-none-any.whl:

Publisher: release.yml on matuscvengros/engunits

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page