Skip to main content

myunits

PyPI - Version PyPI - Python Version

A simple module with a selection of units to simple conversions, using library pint

Installation

pip install myunits

Usage

Import all names from the module and make conversions:

>>> from myunits import *
...
>>> press = 1 * psi
>>> stress = 1 * MPa
>>> compressibility = 100e-6 * cm ** 2 / kgf
...
>>> print(
...     f"Pressure:\n    {press} = {press.to(kPa)}\n"
...     f"Stress:\n    {stress} = {stress.to(kgf / cm **2)}\n"
...     f"Compressibility:\n    {compressibility} = {compressibility.to(1/GPa)}\n"
>>> )
Pressure:
    1 pound_force_per_square_inch = 6.894757293168363 kilopascal
Stress:
    1 megapascal = 10.197162129779283 force_kilogram / centimeter ** 2
Compressibility:
    0.0001 centimeter ** 2 / force_kilogram = 1.0197162129779282 / gigapascal

The defined units are:

  • kg = kilogram
  • g = gram
  • mg = milligram
  • d = day
  • s = second
  • us = microsecond
  • m = meter
  • cm = centimeter
  • mm = millimeter
  • um = micrometer
  • ft = foot
  • bbl = oil_barrel
  • Pa = Pascal
  • kPa = kiloPascal
  • MPa = megaPascal
  • GPa = gigaPascal
  • psi = pound_force_per_square_inch
  • bar = bar
  • sip = 1.0 / pound_force_per_square_inch
  • rab = 1.0 / bar
  • microsip = 1e-06 / pound_force_per_square_inch
  • microrab = 1e-06 / bar
  • usip = 1e-06 / pound_force_per_square_inch
  • urab = 1e-06 / bar
  • K = Kelvin
  • R = degree_Rankine
  • oC = degree_Celsius
  • oF = degree_Fahrenheit
  • kgf = force_kilogram
  • N = Newton
  • daN = decaNewton
  • kN = kiloNewton
  • MN = megaNewton
  • GN = gigaNewton
  • D = Darcy
  • mD = miliDarcy
  • P = Poise
  • cP = centiPoise
  • J = Joule
  • kJ = kiloJoule
  • MJ = megaJoule
  • GJ = gigaJoule
  • W = Watt
  • kW = kiloWatt
  • MW = megaWatt
  • GW = gigaWatt

License

myunits is distributed under the terms of the MIT license.

Metadata

Release files for myunits 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for myunits 0.9.0
File Size Uploaded
myunits-0.9.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for myunits 0.9.0
File Interpreter ABI Platform
myunits-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / myunits-0.9.0.tar.gz

Download URL myunits-0.9.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52270fa96d244367a6edcf57378e67ff7276e16219997d4530f3dab24702b38f
BLAKE2b-256 checksum
How to use checksums
8c6fea1713dfcc04ebb2a7d93d5736521a9ccc1da15ecb4929cd9951967dcd00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / myunits-0.9.0-py3-none-any.whl

Download URL myunits-0.9.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91b173b58be8d74f312e5ec466e4d1e3740b62c76ac1a1f2b57528edcd338d6a
BLAKE2b-256 checksum
How to use checksums
356f96dc5c9591234b1039888faadf0c2990e09b9ed9bfa7654c5a4b79abea47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.10.1

2 release files

0.10.0

2 release files

This release

0.9.0 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page