PicoUnits 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ name: Publish Picounits (Lowercase)
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ - '*.*.*'
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ id-token: write
15
+ environment:
16
+ name: pypi
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.x"
24
+
25
+ - name: Install build tools
26
+ run: python -m pip install --upgrade pip build
27
+
28
+ - name: Build package
29
+ run: python -m build
30
+
31
+ - name: Publish package to PyPI (picounits)
32
+ uses: pypa/gh-action-pypi-publish@release/v1
33
+ with:
34
+ targets: picounits
@@ -0,0 +1,38 @@
1
+ name: Publish PicoUnits (Capitalized)
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ - '*.*.*'
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ id-token: write
15
+ environment:
16
+ name: pypi
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.x"
24
+
25
+ - name: Install build tools
26
+ run: python -m pip install --upgrade pip build
27
+
28
+ - name: Temporarily set name to PicoUnits
29
+ run: |
30
+ sed -i 's/name = "picounits"/name = "PicoUnits"/g' pyproject.toml
31
+
32
+ - name: Build package
33
+ run: python -m build
34
+
35
+ - name: Publish package to PyPI (PicoUnits)
36
+ uses: pypa/gh-action-pypi-publish@release/v1
37
+ with:
38
+ targets: PicoUnits
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 William Bowley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: PicoUnits
3
+ Version: 0.0.1
4
+ Summary: SI Based Unit System With Minimal Overhead And Maximal Speed
5
+ Project-URL: Homepage, https://github.com/wgbowley/picounits
6
+ Project-URL: Bug Tracker, https://github.com/wgbowley/picounits/issues
7
+ Author-email: William Bowley <wgrantbowley@gmail.com>
8
+ Maintainer-email: William Bowley <wgrantbowley@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2025 William Bowley
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: high-performance,minimal,physics,si,units
32
+ Description-Content-Type: text/markdown
33
+
34
+ <p align="center">
35
+ <img src="media/banner.png" alt="PicoUnits" style="max-width:600px;">
36
+ <br>
37
+ <em>SI Unit System Designed For Minimal Overhead – Built with speed by <a href="https://github.com/wgbowley">William Bowley</a></em>
38
+ </p>
39
+
40
+ ## Overview
41
+
42
+ ![Work in Progress](https://img.shields.io/badge/status-wip-orange)
43
+ ![Python Version](https://img.shields.io/badge/python-3.10+-blue)
44
+ ![License](https://img.shields.io/badge/license-MIT-green)
45
+
46
+ **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.
47
+
48
+ ```py
49
+ class SIBase(Enum):
50
+ """ SI metric fundamental units expect mass is defined as a gram """
51
+ SECOND = auto() # Time
52
+ METER = auto() # Length
53
+ GRAM = auto() # Mass
54
+ AMPERE = auto() # Electric Current
55
+ KELVIN = auto() # Temperature
56
+ MOLE = auto() # Amount of a substance
57
+ CANDELA = auto() # Luminous Intensity
58
+ DIMENSIONLESS = auto() # Non-physical quantity
59
+ ```
60
+
61
+ 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`:
62
+
63
+ ```py
64
+ @dataclass()
65
+ class Dimension:
66
+ """
67
+ Defines a SI metric dimension through 'SIBase', 'PrefixScale and 'exponent'
68
+ """
69
+ prefix: PrefixScale = PrefixScale.BASE
70
+ base: SIBase = SIBase.DIMENSIONLESS
71
+ exponent: int = 1
72
+
73
+ class Unit:
74
+ """
75
+ Defines a SI metric unit composed of a singular or multiple 'Dimension'.
76
+ """
77
+ def __init__(self, *dimensions: Dimension) -> None:
78
+ self.dimensions = list(dimensions)
79
+ ```
80
+
81
+
82
+
83
+ Each `Quantity` has both a magnitude and unit, and through the usage of dunder methods dimensional analysis happens in parallel with arithmetic operations.
84
+
85
+ ```py
86
+ @dataclass
87
+ class Quantity:
88
+ """
89
+ Represents a quantity within the framework with both magnitude and unit
90
+ """
91
+ magnitude: float | int
92
+ unit: Unit
93
+ ```
94
+
95
+ ## Installation
96
+
97
+ PicoUnits requires Python 3.10 or newer.
98
+
99
+ ```bash
100
+ pip install picounits
101
+ ```
@@ -0,0 +1,68 @@
1
+ <p align="center">
2
+ <img src="media/banner.png" alt="PicoUnits" style="max-width:600px;">
3
+ <br>
4
+ <em>SI Unit System Designed For Minimal Overhead – Built with speed by <a href="https://github.com/wgbowley">William Bowley</a></em>
5
+ </p>
6
+
7
+ ## Overview
8
+
9
+ ![Work in Progress](https://img.shields.io/badge/status-wip-orange)
10
+ ![Python Version](https://img.shields.io/badge/python-3.10+-blue)
11
+ ![License](https://img.shields.io/badge/license-MIT-green)
12
+
13
+ **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.
14
+
15
+ ```py
16
+ class SIBase(Enum):
17
+ """ SI metric fundamental units expect mass is defined as a gram """
18
+ SECOND = auto() # Time
19
+ METER = auto() # Length
20
+ GRAM = auto() # Mass
21
+ AMPERE = auto() # Electric Current
22
+ KELVIN = auto() # Temperature
23
+ MOLE = auto() # Amount of a substance
24
+ CANDELA = auto() # Luminous Intensity
25
+ DIMENSIONLESS = auto() # Non-physical quantity
26
+ ```
27
+
28
+ 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`:
29
+
30
+ ```py
31
+ @dataclass()
32
+ class Dimension:
33
+ """
34
+ Defines a SI metric dimension through 'SIBase', 'PrefixScale and 'exponent'
35
+ """
36
+ prefix: PrefixScale = PrefixScale.BASE
37
+ base: SIBase = SIBase.DIMENSIONLESS
38
+ exponent: int = 1
39
+
40
+ class Unit:
41
+ """
42
+ Defines a SI metric unit composed of a singular or multiple 'Dimension'.
43
+ """
44
+ def __init__(self, *dimensions: Dimension) -> None:
45
+ self.dimensions = list(dimensions)
46
+ ```
47
+
48
+
49
+
50
+ Each `Quantity` has both a magnitude and unit, and through the usage of dunder methods dimensional analysis happens in parallel with arithmetic operations.
51
+
52
+ ```py
53
+ @dataclass
54
+ class Quantity:
55
+ """
56
+ Represents a quantity within the framework with both magnitude and unit
57
+ """
58
+ magnitude: float | int
59
+ unit: Unit
60
+ ```
61
+
62
+ ## Installation
63
+
64
+ PicoUnits requires Python 3.10 or newer.
65
+
66
+ ```bash
67
+ pip install picounits
68
+ ```
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "0.2",
3
+ "language": "en-US",
4
+ "words": [
5
+ "picounits",
6
+ "bowley",
7
+ "femm",
8
+ "giga",
9
+ "hecto",
10
+ "deka",
11
+ "deci",
12
+ "centi",
13
+ "milli",
14
+ "pico",
15
+ "pyfemm",
16
+ "Dunder",
17
+ "dataclasses",
18
+ "dataclass"
19
+ ]
20
+ }
Binary file
@@ -0,0 +1 @@
1
+ # PicoUnits/__init__.py
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "PicoUnits"
7
+ version = "0.0.1"
8
+ description = "SI Based Unit System With Minimal Overhead And Maximal Speed"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "William Bowley", email = "wgrantbowley@gmail.com" },
12
+ ]
13
+ maintainers = [
14
+ { name = "William Bowley", email = "wgrantbowley@gmail.com" },
15
+ ]
16
+ license = { file = "LICENSE" }
17
+ keywords = ["units", "si", "high-performance", "minimal", "physics"]
18
+
19
+ [project.urls]
20
+ "Homepage" = "https://github.com/wgbowley/picounits"
21
+ "Bug Tracker" = "https://github.com/wgbowley/picounits/issues"