myunits
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= kilogramg= grammg= milligramd= days= secondus= microsecondm= metercm= centimetermm= millimeterum= micrometerft= footbbl= oil_barrelPa= PascalkPa= kiloPascalMPa= megaPascalGPa= gigaPascalpsi= pound_force_per_square_inchbar= barsip= 1.0 / pound_force_per_square_inchrab= 1.0 / barmicrosip= 1e-06 / pound_force_per_square_inchmicrorab= 1e-06 / barusip= 1e-06 / pound_force_per_square_inchurab= 1e-06 / barK= KelvinR= degree_RankineoC= degree_CelsiusoF= degree_Fahrenheitkgf= force_kilogramN= NewtondaN= decaNewtonkN= kiloNewtonMN= megaNewtonGN= gigaNewtonD= DarcymD= miliDarcyP= PoisecP= centiPoiseJ= JoulekJ= kiloJouleMJ= megaJouleGJ= gigaJouleW= WattkW= kiloWattMW= megaWattGW= gigaWatt
License
myunits is distributed under the terms of the
MIT license.
Metadata
Release files for myunits 0.4.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 | |
|---|---|---|---|
| myunits-0.4.0.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myunits-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / myunits-0.4.0.tar.gz
| Download URL | myunits-0.4.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c8ae4fe2700c6330dea78fefe0362c1873a99ba7acd64e2642e248d3ef43414
|
|
BLAKE2b-256 checksum How to use checksums |
7122c7161ac74578ddc73b1bfda72473870ad98bbabfa73594aa19decb1828e0
|
| 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.4.0-py3-none-any.whl
| Download URL | myunits-0.4.0-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c72608887995ca05a338d2e68a20f71dc0eff7b7a14570fd937f355bd63c470
|
|
BLAKE2b-256 checksum How to use checksums |
e3b5f1c87a09012163c87df6ad02f15d0658d7c41fad62f314ea3e07ea0764db
|
| 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}
|