Skip to main content

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

Project description

Engineering Units

Tests Docs Python 3.10+ PyPI MIT License

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.2.tar.gz (71.3 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.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: engunits-0.1.2.tar.gz
  • Upload date:
  • Size: 71.3 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.2.tar.gz
Algorithm Hash digest
SHA256 21e0d1f2338e7b374a0aaba7e4780325ff8f5fb14bc5c0265c2b04d2606c4ff3
MD5 f3a11bb268bc3658c0dbfb1b0b15492e
BLAKE2b-256 18f4245e88f19df08b6cde772d38add53062bf0a5e699957abc2343339705551

See more details on using hashes here.

Provenance

The following attestation bundles were made for engunits-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: engunits-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cbf4017a8905a345ce0944864a1b15eb89dceaf9de19ffc4eecdc70643f21e5
MD5 1d04ae1f08c358e0ef7c57f12907935f
BLAKE2b-256 864a2a9b4d054aedf1174a8e0f0b2a1b7ecbc074ff815c1d066d584d30ec1015

See more details on using hashes here.

Provenance

The following attestation bundles were made for engunits-0.1.2-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