A simple module with a selection of units to simple conversions, using library Pint.
Project description
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= gramd= days= secondus= microsecondm= metercm= centimetermm= millimeterum= micrometerft= footbbl= oil_barrelPa= PascalkPa= kiloPascalMPa= megaPascalGPa= gigaPascalpsi= pound_force_per_square_inchbar= barK= KelvinR= degree_RankineoC= degree_CelsiusoF= degree_Fahrenheitkgf= force_kilogramN= NewtondaN= decaNewtonkN= kiloNewtonMN= megaNewtonGN= gigaNewtonD= DarcymD= miliDarcyP= PoisecP= centiPoiseJ= JouleW= Watt
License
myunits is distributed under the terms of the
MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
myunits-0.2.0.tar.gz
(2.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file myunits-0.2.0.tar.gz.
File metadata
- Download URL: myunits-0.2.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea0335454e406dde2c4f1719d49f29d4abecfa27f44009d9520aee0dda4a2b84
|
|
| MD5 |
f84da16fde22de951511fee807529b30
|
|
| BLAKE2b-256 |
94ab78e8508e2da01b42d648a1902baec45ecd0b26edf52fddc49625e75951ce
|
File details
Details for the file myunits-0.2.0-py3-none-any.whl.
File metadata
- Download URL: myunits-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07194539f4065e609693bf22491092be45802e135f1f4e90e4b16a82d21215a
|
|
| MD5 |
4301a4656ff20f8472c21ba94571dab9
|
|
| BLAKE2b-256 |
c11efda46f3f507c67315542f5b60bd0f2f8f101fcc385c16cfee2f1e5e733c8
|