Skip to main content

No project description provided

Project description

TUnits - Fast Python Units

GCB CI status:
GCB Build 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

  1. To install the latest version from the main branch

    pip install git+https://github.com/quantumlib/TypedUnits
    
  2. For a local editable copy

    git clone https://github.com/quantumlib/TypedUnits
    cd TypedUnits
    pip install .
    

Development and Testing

  1. Clone the repository.

    git clone https://github.com/quantumlib/TypedUnits
    
    cd TypedUnits
    

    All future steps assume you are in the repository's directory.

  2. Install dev environment dependencies.

    pip install -r dev_tools/dev.env.txt
    
  3. Install TUnits

    pip install .
    
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

typedunits-0.0.1.dev20240911153816-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

typedunits-0.0.1.dev20240911153816-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

typedunits-0.0.1.dev20240911153816-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

File details

Details for the file typedunits-0.0.1.dev20240911153816-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for typedunits-0.0.1.dev20240911153816-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78fa86d6f94b0c381fc7ac8e208268c2f023f720e94901e59c75ab61e5497a3e
MD5 18567e2a4a0ef2ecd96da37e6f496beb
BLAKE2b-256 4b92699a27726e9e7b805f950da16ead30c575ff821fce8b4a5773bc2e6db134

See more details on using hashes here.

File details

Details for the file typedunits-0.0.1.dev20240911153816-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for typedunits-0.0.1.dev20240911153816-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07082f9fbec2a24df504a16bd4b4e1ad80de970afdae7b3284de78520f7a9f78
MD5 5c0f6218a0fb9facf6b524bb5de457e5
BLAKE2b-256 ec1d4b8ba187e7150b853222fc132a72f1499ca2e86ca9904f7efb93b38d2db9

See more details on using hashes here.

File details

Details for the file typedunits-0.0.1.dev20240911153816-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for typedunits-0.0.1.dev20240911153816-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3dd40ab998088aad954b315b29778e881980b0d73660e2fe9636a3a973a8ae4
MD5 3fbe1a248e089701c32d1ac5bd370a6d
BLAKE2b-256 a4f2262d0f6a47ce12ac411ebf193ea995f035b969be5ce6ed1dc988d10d1008

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page