SI Based Unit System With Minimal Overhead And Maximal Speed
Project description
SI Unit System Designed For Minimal Overhead – Built with speed by William Bowley
Overview
PicoUnits is a low overhead library designed for ensuring dimensional accuracy during runtime. It uses a custom seven fundamental unit system based off the standard SI metric fundamental units.
class SIBase(Enum):
""" SI metric fundamental units expect mass is defined as a gram """
SECOND = auto() # Time
METER = auto() # Length
GRAM = auto() # Mass
AMPERE = auto() # Electric Current
KELVIN = auto() # Temperature
MOLE = auto() # Amount of a substance
CANDELA = auto() # Luminous Intensity
DIMENSIONLESS = auto() # Non-physical quantity
Each unit is made up of a subclass called Dimension which itself is made of two sub-dataclasses SIBase, PrefixScale and one integer value exponent:
@dataclass()
class Dimension:
"""
Defines a SI metric dimension through 'SIBase', 'PrefixScale and 'exponent'
"""
prefix: PrefixScale = PrefixScale.BASE
base: SIBase = SIBase.DIMENSIONLESS
exponent: int = 1
class Unit:
"""
Defines a SI metric unit composed of a singular or multiple 'Dimension'.
"""
def __init__(self, *dimensions: Dimension) -> None:
self.dimensions = list(dimensions)
Each Quantity has both a magnitude and unit, and through the usage of dunder methods dimensional analysis happens in parallel with arithmetic operations.
@dataclass
class Quantity:
"""
Represents a quantity within the framework with both magnitude and unit
"""
magnitude: float | int
unit: Unit
Installation
PicoUnits requires Python 3.10 or newer.
pip install picounits
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 picounits-0.0.1.tar.gz.
File metadata
- Download URL: picounits-0.0.1.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0555aa30a56952c3eae7b92cc45675537f9fe019183e4dc58f3ace46d00895e6
|
|
| MD5 |
2626ed9c606612b86c57487f40e3c5dc
|
|
| BLAKE2b-256 |
97a309450812e5b251b1a40308b48355b9e6dcdee40284f62fc8c93dd687521b
|
Provenance
The following attestation bundles were made for picounits-0.0.1.tar.gz:
Publisher:
publish_picounits.yml on wgbowley/PicoUnits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
picounits-0.0.1.tar.gz -
Subject digest:
0555aa30a56952c3eae7b92cc45675537f9fe019183e4dc58f3ace46d00895e6 - Sigstore transparency entry: 763318884
- Sigstore integration time:
-
Permalink:
wgbowley/PicoUnits@e98ea87f1e813b3fc3214176090760fe6beb79d0 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/wgbowley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_picounits.yml@e98ea87f1e813b3fc3214176090760fe6beb79d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file picounits-0.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: picounits-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1b65f55c4330130b238ff830ce8e40488d85a642c4c4783646d04d9f1e68324
|
|
| MD5 |
15b082751a299dd18e208e8923d9578f
|
|
| BLAKE2b-256 |
8bf05780eed4e58207d4cf7ca6882fd7c634c34d92eee4e29c56fee2377a2c45
|
Provenance
The following attestation bundles were made for picounits-0.0.1-py2.py3-none-any.whl:
Publisher:
publish_picounits.yml on wgbowley/PicoUnits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
picounits-0.0.1-py2.py3-none-any.whl -
Subject digest:
d1b65f55c4330130b238ff830ce8e40488d85a642c4c4783646d04d9f1e68324 - Sigstore transparency entry: 763318885
- Sigstore integration time:
-
Permalink:
wgbowley/PicoUnits@e98ea87f1e813b3fc3214176090760fe6beb79d0 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/wgbowley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_picounits.yml@e98ea87f1e813b3fc3214176090760fe6beb79d0 -
Trigger Event:
push
-
Statement type: