No project description provided
Project description
TUnits - Fast Python Units
GCB CI status: |
---|
Implements unit of measurement arithmetic, where a number is associated with a product of powers of base units and values with compatible units can be added.
Defines SI units, SI prefixes, and some derived units.
Example
import tunits
from tunits.units import meter, km, N
print(5*meter + km)
# 1005.0 meter
print(N/meter)
# N/meter
print((N/meter).inBaseUnits())
# kg/s^2
print(2*km / tunits.Value(3, 's'))
# 0.666666666667 km/s
Installation
-
To install the latest version from the main branch
pip install git+https://github.com/quantumlib/TypedUnits
-
For a local editable copy
git clone https://github.com/quantumlib/TypedUnits cd TypedUnits pip install .
Development and Testing
-
Clone the repository.
git clone https://github.com/quantumlib/TypedUnits cd TypedUnits
All future steps assume you are in the repository's directory.
-
Install dev environment dependencies.
pip install -r dev_tools/dev.env.txt
-
Install TUnits
pip install .
-
Test.
pytest
Formatting
dev_tools/format.sh # to format
dev_tools/format.sh --check # to verify format
Note: This is not an officially supported Google product
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 Distributions
Built Distributions
File details
Details for the file typedunits-0.0.1.dev20240911153237-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: typedunits-0.0.1.dev20240911153237-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84037bc7de3bc189f8ca449761b61d8df043a60cd5418563f819552469d717f5 |
|
MD5 | a2555de6063786399722a47194754e2d |
|
BLAKE2b-256 | 82265c6eeda00a68cda3edd4ed1545cebf50cf1c05aec57fbf9d2112d71a4c6c |
File details
Details for the file typedunits-0.0.1.dev20240911153237-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: typedunits-0.0.1.dev20240911153237-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d74b9df6e04fcdb51fdd77cd0c1ce870e9c7d24f490fc1c2df244fa7cc421213 |
|
MD5 | 9c2397425162ea0be67091b80ec0bf2d |
|
BLAKE2b-256 | 1d12757e0c4a85329b1598f6620e6eb68eb290af3654d645a8af5c3d39a46adb |
File details
Details for the file typedunits-0.0.1.dev20240911153237-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: typedunits-0.0.1.dev20240911153237-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 392a91168a99bc2729f308a0a7550f09d105f36a0599355ff60ba31fa95c5378 |
|
MD5 | 554e5e5bfd2a37adf816f634a7b9a622 |
|
BLAKE2b-256 | 2cb723aa12b963f643040d565e6b81b57a5768e63f64dd48ace59a7cf7e309ef |