ucon 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl
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.
- tests/ucon/__init__.py +3 -0
- tests/ucon/test_algebra.py +3 -1
- tests/ucon/test_core.py +202 -48
- tests/ucon/test_quantity.py +26 -19
- tests/ucon/test_units.py +3 -1
- ucon/__init__.py +7 -1
- ucon/algebra.py +4 -0
- ucon/core.py +167 -155
- ucon/quantity.py +24 -77
- ucon/units.py +4 -0
- {ucon-0.3.4.dist-info → ucon-0.3.5.dist-info}/METADATA +45 -34
- ucon-0.3.5.dist-info/RECORD +16 -0
- {ucon-0.3.4.dist-info → ucon-0.3.5.dist-info}/WHEEL +1 -1
- ucon-0.3.5.dist-info/licenses/LICENSE +202 -0
- ucon-0.3.5.dist-info/licenses/NOTICE +28 -0
- ucon-0.3.4.dist-info/RECORD +0 -15
- ucon-0.3.4.dist-info/licenses/LICENSE +0 -21
- {ucon-0.3.4.dist-info → ucon-0.3.5.dist-info}/top_level.txt +0 -0
ucon/quantity.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# © 2025 The Radiativity Company
|
|
2
|
+
# Licensed under the Apache License, Version 2.0
|
|
3
|
+
# See the LICENSE file for details.
|
|
4
|
+
|
|
1
5
|
"""
|
|
2
6
|
ucon.quantity
|
|
3
7
|
==========
|
|
@@ -18,7 +22,7 @@ from dataclasses import dataclass
|
|
|
18
22
|
from typing import Union
|
|
19
23
|
|
|
20
24
|
from ucon import units
|
|
21
|
-
from ucon.core import
|
|
25
|
+
from ucon.core import Unit, UnitProduct, Scale
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
Quantifiable = Union['Number', 'Ratio']
|
|
@@ -39,12 +43,24 @@ class Number:
|
|
|
39
43
|
<2.5 (m/s)>
|
|
40
44
|
"""
|
|
41
45
|
quantity: Union[float, int] = 1.0
|
|
42
|
-
unit: Unit = units.none
|
|
46
|
+
unit: Union[Unit, UnitProduct] = units.none
|
|
43
47
|
|
|
44
48
|
@property
|
|
45
49
|
def value(self) -> float:
|
|
46
|
-
"""Return numeric magnitude as
|
|
47
|
-
|
|
50
|
+
"""Return the numeric magnitude as-expressed (no scale folding).
|
|
51
|
+
|
|
52
|
+
Scale lives in the unit expression (e.g. kJ, mL) and is NOT
|
|
53
|
+
folded into the returned value. Use ``unit.fold_scale()`` on a
|
|
54
|
+
UnitProduct when you need the base-unit-equivalent magnitude.
|
|
55
|
+
"""
|
|
56
|
+
return round(self.quantity, 15)
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def _canonical_magnitude(self) -> float:
|
|
60
|
+
"""Quantity folded to base-unit scale (internal use for eq/div)."""
|
|
61
|
+
if isinstance(self.unit, UnitProduct):
|
|
62
|
+
return self.quantity * self.unit.fold_scale()
|
|
63
|
+
return self.quantity
|
|
48
64
|
|
|
49
65
|
def simplify(self):
|
|
50
66
|
"""Return a new Number expressed in base scale (Scale.one)."""
|
|
@@ -56,38 +72,6 @@ class Number:
|
|
|
56
72
|
def as_ratio(self):
|
|
57
73
|
return Ratio(self)
|
|
58
74
|
|
|
59
|
-
def _inherit_symbolic_identity(self, new_unit: Unit, lhs: Unit, rhs: Unit) -> Unit:
|
|
60
|
-
"""
|
|
61
|
-
If new_unit has no name/aliases but is dimension-compatible
|
|
62
|
-
with either lhs or rhs, inherit symbolic identity.
|
|
63
|
-
"""
|
|
64
|
-
if isinstance(new_unit, CompositeUnit):
|
|
65
|
-
return new_unit # composite units have their own structure
|
|
66
|
-
|
|
67
|
-
if new_unit.aliases or new_unit.name:
|
|
68
|
-
return new_unit # already has a symbol
|
|
69
|
-
|
|
70
|
-
if new_unit.scale is not Scale.one:
|
|
71
|
-
return new_unit # keep scaled units intact
|
|
72
|
-
|
|
73
|
-
# inheritance priority: lhs → rhs
|
|
74
|
-
if lhs.dimension == new_unit.dimension:
|
|
75
|
-
return Unit(
|
|
76
|
-
*lhs.aliases,
|
|
77
|
-
name=lhs.name,
|
|
78
|
-
dimension=new_unit.dimension,
|
|
79
|
-
scale=Scale.one,
|
|
80
|
-
)
|
|
81
|
-
if rhs.dimension == new_unit.dimension:
|
|
82
|
-
return Unit(
|
|
83
|
-
*rhs.aliases,
|
|
84
|
-
name=rhs.name,
|
|
85
|
-
dimension=new_unit.dimension,
|
|
86
|
-
scale=Scale.one,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
return new_unit
|
|
90
|
-
|
|
91
75
|
def __mul__(self, other: Quantifiable) -> 'Number':
|
|
92
76
|
if isinstance(other, Ratio):
|
|
93
77
|
other = other.evaluate()
|
|
@@ -115,8 +99,8 @@ class Number:
|
|
|
115
99
|
# If the net dimension is none, we want a pure scalar:
|
|
116
100
|
# fold *all* scale factors into the numeric magnitude.
|
|
117
101
|
if not unit_quot.dimension:
|
|
118
|
-
num = self.
|
|
119
|
-
den = other.
|
|
102
|
+
num = self._canonical_magnitude # quantity × scale
|
|
103
|
+
den = other._canonical_magnitude
|
|
120
104
|
return Number(quantity=num / den, unit=units.none)
|
|
121
105
|
|
|
122
106
|
# --- Case 2: Dimensionful result -----------------------------------
|
|
@@ -140,7 +124,7 @@ class Number:
|
|
|
140
124
|
return False
|
|
141
125
|
|
|
142
126
|
# Compare magnitudes, scale-adjusted
|
|
143
|
-
if abs(self.
|
|
127
|
+
if abs(self._canonical_magnitude - other._canonical_magnitude) >= 1e-12:
|
|
144
128
|
return False
|
|
145
129
|
|
|
146
130
|
return True
|
|
@@ -174,49 +158,12 @@ class Ratio:
|
|
|
174
158
|
# Pure arithmetic, no scale normalization.
|
|
175
159
|
numeric = self.numerator.quantity / self.denominator.quantity
|
|
176
160
|
|
|
177
|
-
# Pure unit division, with
|
|
161
|
+
# Pure unit division, with UnitFactor preservation.
|
|
178
162
|
unit = self.numerator.unit / self.denominator.unit
|
|
179
163
|
|
|
180
164
|
# DO NOT normalize, DO NOT fold scale.
|
|
181
165
|
return Number(quantity=numeric, unit=unit)
|
|
182
166
|
|
|
183
|
-
def _fold_scales(self, unit: Union[Unit, CompositeUnit]):
|
|
184
|
-
"""
|
|
185
|
-
Extracts numeric scaling from unit prefixes while preserving exponent structure.
|
|
186
|
-
Returns: (numeric_factor: float, stripped_unit: Unit|CompositeUnit)
|
|
187
|
-
"""
|
|
188
|
-
# --- UNIT CASE ----------------------------------------------------
|
|
189
|
-
if isinstance(unit, Unit) and not isinstance(unit, CompositeUnit):
|
|
190
|
-
return self._fold_scales_from_unit(unit)
|
|
191
|
-
|
|
192
|
-
# --- COMPOSITE CASE -----------------------------------------------
|
|
193
|
-
total = 1.0
|
|
194
|
-
normalized: dict[Unit, float] = {}
|
|
195
|
-
|
|
196
|
-
for u, exp in unit.components.items():
|
|
197
|
-
factor, base_unit = self._fold_scales_from_unit(u, exp)
|
|
198
|
-
total *= factor
|
|
199
|
-
if abs(exp) >= 1e-12: # drop zero powers
|
|
200
|
-
normalized[base_unit] = normalized.get(base_unit, 0) + exp
|
|
201
|
-
|
|
202
|
-
return total, CompositeUnit(normalized) if normalized else units.none
|
|
203
|
-
|
|
204
|
-
def _fold_scales_from_unit(self, u: Unit, power: float = 1):
|
|
205
|
-
"""Extract numeric scale^power and return (factor, scale-free Unit)."""
|
|
206
|
-
if u.scale is Scale.one:
|
|
207
|
-
return 1.0, Unit(*u.aliases, name=u.name, dimension=u.dimension, scale=Scale.one)
|
|
208
|
-
|
|
209
|
-
factor = u.scale.value.evaluated ** power
|
|
210
|
-
return factor, Unit(*u.aliases, name=u.name, dimension=u.dimension, scale=Scale.one)
|
|
211
|
-
|
|
212
|
-
def normalize(self, number: Number) -> Number:
|
|
213
|
-
scale_factor, base_unit = self._fold_scales(number.unit)
|
|
214
|
-
|
|
215
|
-
return Number(
|
|
216
|
-
quantity = number.quantity * scale_factor,
|
|
217
|
-
unit = base_unit
|
|
218
|
-
)
|
|
219
|
-
|
|
220
167
|
def __mul__(self, another_ratio: 'Ratio') -> 'Ratio':
|
|
221
168
|
if self.numerator.unit == another_ratio.denominator.unit:
|
|
222
169
|
factor = self.numerator / another_ratio.denominator
|
ucon/units.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ucon
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: a tool for dimensional analysis: a "Unit CONverter"
|
|
5
5
|
Home-page: https://github.com/withtwoemms/ucon
|
|
6
6
|
Author: Emmanuel I. Obi
|
|
7
7
|
Maintainer: Emmanuel I. Obi
|
|
8
8
|
Maintainer-email: withtwoemms@gmail.com
|
|
9
|
-
License:
|
|
9
|
+
License: Apache-2.0
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Intended Audience :: Education
|
|
13
13
|
Classifier: Intended Audience :: Science/Research
|
|
14
14
|
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
-
Classifier: License :: OSI Approved ::
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.7
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.8
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -23,6 +23,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.14
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
License-File: LICENSE
|
|
26
|
+
License-File: NOTICE
|
|
26
27
|
Dynamic: author
|
|
27
28
|
Dynamic: classifier
|
|
28
29
|
Dynamic: description
|
|
@@ -54,8 +55,8 @@ Dynamic: summary
|
|
|
54
55
|
It combines **units**, **scales**, and **dimensions** into a composable algebra that supports:
|
|
55
56
|
|
|
56
57
|
- Dimensional analysis through `Number` and `Ratio`
|
|
57
|
-
- Scale-aware arithmetic and
|
|
58
|
-
- Metric and binary prefixes (`kilo`, `kibi`, `micro`, `mebi`,
|
|
58
|
+
- Scale-aware arithmetic via `UnitFactor` and `UnitProduct`
|
|
59
|
+
- Metric and binary prefixes (`kilo`, `kibi`, `micro`, `mebi`, etc.)
|
|
59
60
|
- A clean foundation for physics, chemistry, data modeling, and beyond
|
|
60
61
|
|
|
61
62
|
Think of it as **`decimal.Decimal` for the physical world** — precise, predictable, and type-safe.
|
|
@@ -69,20 +70,22 @@ The crux of this tiny library is to provide abstractions that simplify the answe
|
|
|
69
70
|
To best answer this question, we turn to an age-old technique ([dimensional analysis](https://en.wikipedia.org/wiki/Dimensional_analysis)) which essentially allows for the solution to be written as a product of ratios. `ucon` comes equipped with some useful primitives:
|
|
70
71
|
| Type | Defined In | Purpose | Typical Use Cases |
|
|
71
72
|
| ----------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
-
| **`Vector`** | `ucon.
|
|
73
|
-
| **`
|
|
74
|
-
| **`
|
|
73
|
+
| **`Vector`** | `ucon.algebra` | Represents the exponent tuple of a physical quantity's base dimensions (e.g., T, L, M, I, Θ, J, N). | Internal representation of dimensional algebra; building derived quantities (e.g., area, velocity, force). |
|
|
74
|
+
| **`Exponent`** | `ucon.algebra` | Represents base-power pairs (e.g., 10³, 2¹⁰) used by `Scale`. | Performing arithmetic on powers and bases; normalizing scales across conversions. |
|
|
75
|
+
| **`Dimension`** | `ucon.core` | Encapsulates physical dimensions (e.g., length, time, mass) as algebraic combinations of vectors. | Enforcing dimensional consistency; defining relationships between quantities (e.g., length / time = velocity). |
|
|
75
76
|
| **`Scale`** | `ucon.core` | Encodes powers of base magnitudes (binary or decimal prefixes like kilo-, milli-, mebi-). | Adjusting numeric scale without changing dimension (e.g., kilometer ↔ meter, byte ↔ kibibyte). |
|
|
76
|
-
| **`
|
|
77
|
-
| **`
|
|
78
|
-
| **`
|
|
79
|
-
| **`
|
|
77
|
+
| **`Unit`** | `ucon.core` | An atomic, scale-free measurement symbol (e.g., meter, second, joule) with a `Dimension`. | Defining base units; serving as graph nodes for future conversions. |
|
|
78
|
+
| **`UnitFactor`** | `ucon.core` | Pairs a `Unit` with a `Scale` (e.g., kilo + gram = kg). Used as keys inside `UnitProduct`. | Preserving user-provided scale prefixes through algebraic operations. |
|
|
79
|
+
| **`UnitProduct`** | `ucon.core` | A product/quotient of `UnitFactor`s with exponent tracking and simplification. | Representing composite units like m/s, kg·m/s², kJ·h. |
|
|
80
|
+
| **`Number`** | `ucon.quantity` | Combines a numeric quantity with a unit; the primary measurable type. | Performing arithmetic with units; representing physical quantities like 5 m/s. |
|
|
81
|
+
| **`Ratio`** | `ucon.quantity` | Represents the division of two `Number` objects; captures relationships between quantities. | Expressing rates, densities, efficiencies (e.g., energy / time = power, length / time = velocity). |
|
|
82
|
+
| **`units` module** | `ucon.units` | Defines canonical unit instances (SI and common derived units). | Quick access to standard physical units (`units.meter`, `units.second`, `units.newton`, etc.). |
|
|
80
83
|
|
|
81
84
|
### Under the Hood
|
|
82
85
|
|
|
83
86
|
`ucon` models unit math through a hierarchy where each layer builds on the last:
|
|
84
87
|
|
|
85
|
-
<img src=https://gist.githubusercontent.com/withtwoemms/429d2ca1f979865aa80a2658bf9efa32/raw/
|
|
88
|
+
<img src=https://gist.githubusercontent.com/withtwoemms/429d2ca1f979865aa80a2658bf9efa32/raw/f24134c362829dc72e7dff18bfcaa24b9be01b54/ucon.data-model_v035.png align="center" alt="ucon Data Model" width=600/>
|
|
86
89
|
|
|
87
90
|
## Why `ucon`?
|
|
88
91
|
|
|
@@ -90,24 +93,22 @@ Python already has mature libraries for handling units and physical quantities
|
|
|
90
93
|
|
|
91
94
|
| Library | Focus | Limitation |
|
|
92
95
|
| --------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
-
| **Pint** | Runtime unit conversion and compatibility checking | Treats quantities as decorated numbers — conversions work, but the algebra behind them isn
|
|
96
|
+
| **Pint** | Runtime unit conversion and compatibility checking | Treats quantities as decorated numbers — conversions work, but the algebra behind them isn't inspectable or type-safe. |
|
|
94
97
|
| **SymPy** | Symbolic algebra and simplification of unit expressions | Excellent for symbolic reasoning, but not designed for runtime validation, conversion, or serialization. |
|
|
95
98
|
| **Unum** | Unit-aware arithmetic and unit propagation | Tracks units through arithmetic but lacks explicit dimensional algebra, conversion taxonomy, or runtime introspection. |
|
|
96
99
|
|
|
97
100
|
Together, these tools can _use_ units, but none can explicitly represent and verify the relationships between units and dimensions.
|
|
98
101
|
|
|
99
|
-
That
|
|
102
|
+
That's the gap `ucon` fills.
|
|
100
103
|
|
|
101
104
|
It treats units, dimensions, and scales as first-class objects and builds a composable algebra around them.
|
|
102
105
|
This allows you to:
|
|
103
106
|
- Represent dimensional meaning explicitly (`Dimension`, `Vector`);
|
|
104
107
|
- Compose and compute with type-safe, introspectable quantities (`Unit`, `Number`);
|
|
105
|
-
- Perform reversible, declarative conversions (standard, linear, affine, nonlinear);
|
|
106
|
-
- Serialize and validate measurements with Pydantic integration;
|
|
107
108
|
- Extend the system with custom unit registries and conversion families.
|
|
108
109
|
|
|
109
110
|
Where Pint, Unum, and SymPy focus on _how_ to compute with units,
|
|
110
|
-
`ucon` focuses on why those computations make sense. Every operation checks the dimensional structure, _not just the unit labels_. This means ucon doesn
|
|
111
|
+
`ucon` focuses on why those computations make sense. Every operation checks the dimensional structure, _not just the unit labels_. This means ucon doesn't just track names: it enforces physics:
|
|
111
112
|
```python
|
|
112
113
|
from ucon import Number, units
|
|
113
114
|
|
|
@@ -135,7 +136,8 @@ This sort of dimensional analysis:
|
|
|
135
136
|
```
|
|
136
137
|
becomes straightforward when you define a measurement:
|
|
137
138
|
```python
|
|
138
|
-
from ucon import Number, Scale,
|
|
139
|
+
from ucon import Number, Scale, units
|
|
140
|
+
from ucon.quantity import Ratio
|
|
139
141
|
|
|
140
142
|
# Two milliliters of bromine
|
|
141
143
|
mL = Scale.milli * units.liter
|
|
@@ -148,27 +150,36 @@ bromine_density = Ratio(
|
|
|
148
150
|
)
|
|
149
151
|
|
|
150
152
|
# Multiply to find mass
|
|
151
|
-
grams_bromine =
|
|
152
|
-
print(grams_bromine) # <6.238
|
|
153
|
+
grams_bromine = bromine_density.evaluate() * two_mL_bromine
|
|
154
|
+
print(grams_bromine) # <6.238 g>
|
|
153
155
|
```
|
|
154
156
|
|
|
155
|
-
Scale
|
|
156
|
-
|
|
157
|
+
Scale prefixes compose naturally:
|
|
157
158
|
```python
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
km = Scale.kilo * units.meter # UnitProduct with kilo-scaled meter
|
|
160
|
+
mg = Scale.milli * units.gram # UnitProduct with milli-scaled gram
|
|
161
|
+
|
|
162
|
+
print(km.shorthand) # 'km'
|
|
163
|
+
print(mg.shorthand) # 'mg'
|
|
164
|
+
|
|
165
|
+
# Scale arithmetic
|
|
166
|
+
print(km.fold_scale()) # 1000.0
|
|
167
|
+
print(mg.fold_scale()) # 0.001
|
|
160
168
|
```
|
|
161
169
|
|
|
170
|
+
> **Note:** Unit _conversions_ (e.g., `number.to(units.inch)`) are planned for v0.4.x
|
|
171
|
+
> via the `ConversionGraph` abstraction. See [ROADMAP.md](./ROADMAP.md).
|
|
172
|
+
|
|
162
173
|
---
|
|
163
174
|
|
|
164
175
|
## Roadmap Highlights
|
|
165
176
|
|
|
166
|
-
| Version | Theme | Focus |
|
|
167
|
-
|
|
168
|
-
|
|
|
169
|
-
| [**0.4.x**](https://github.com/withtwoemms/ucon/milestone/2) | Conversion System |
|
|
170
|
-
| [**0.6.x**](https://github.com/withtwoemms/ucon/milestone/4) | Nonlinear / Specialized Units | Decibel, Percent, pH |
|
|
171
|
-
| [**0.8.x**](https://github.com/withtwoemms/ucon/milestone/6) | Pydantic Integration | Type-safe quantity validation |
|
|
177
|
+
| Version | Theme | Focus | Status |
|
|
178
|
+
|----------|-------|--------|--------|
|
|
179
|
+
| **0.3.5** | Dimensional Algebra | Unit/Scale separation, `UnitFactor`, `UnitProduct` | ✅ Complete |
|
|
180
|
+
| [**0.4.x**](https://github.com/withtwoemms/ucon/milestone/2) | Conversion System | `ConversionGraph`, `Number.to()` | 🚧 Up Next |
|
|
181
|
+
| [**0.6.x**](https://github.com/withtwoemms/ucon/milestone/4) | Nonlinear / Specialized Units | Decibel, Percent, pH | ⏳ Planned |
|
|
182
|
+
| [**0.8.x**](https://github.com/withtwoemms/ucon/milestone/6) | Pydantic Integration | Type-safe quantity validation | ⏳ Planned |
|
|
172
183
|
|
|
173
184
|
See full roadmap: [ROADMAP.md](./ROADMAP.md)
|
|
174
185
|
|
|
@@ -181,13 +192,13 @@ Ensure `nox` is installed.
|
|
|
181
192
|
```
|
|
182
193
|
pip install -r requirements.txt
|
|
183
194
|
```
|
|
184
|
-
Then run the full test suite (
|
|
195
|
+
Then run the full test suite (against all supported python versions) before committing:
|
|
185
196
|
|
|
186
197
|
```bash
|
|
187
198
|
nox -s test
|
|
188
199
|
```
|
|
189
200
|
---
|
|
190
201
|
|
|
191
|
-
>
|
|
202
|
+
> "If it can be measured, it can be represented.
|
|
192
203
|
If it can be represented, it can be validated.
|
|
193
|
-
If it can be validated, it can be trusted
|
|
204
|
+
If it can be validated, it can be trusted."
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
tests/ucon/__init__.py,sha256=9BAHYTs27Ed3VgqiMUH4XtVttAmOPgK0Zvj-dUNo7D8,119
|
|
2
|
+
tests/ucon/test_algebra.py,sha256=0mxkiXibZfnzYtbscgVXPDcX1JelrVpcqNBcQe3cn3g,8330
|
|
3
|
+
tests/ucon/test_core.py,sha256=x5JLJAKuaTBkxQzYqTFnDaStVcIlnCviJNiN2OJ7KGQ,32435
|
|
4
|
+
tests/ucon/test_quantity.py,sha256=YLV78_t4AkZcJeEGu-lBvIXNLhTV_MLkTbIKV67rs4Y,14955
|
|
5
|
+
tests/ucon/test_units.py,sha256=SILymDtDNDyxEhkYQubrfkakKCMexwEwjyHfhrkDrMI,869
|
|
6
|
+
ucon/__init__.py,sha256=Va7KJ5ImQCkf06TWPKs0r6kfziURsvGh5I63ipiYiLo,1927
|
|
7
|
+
ucon/algebra.py,sha256=ZVF8B2kUOeSN20R-lTHJNJDxe_Zv7s8kJ70F2JOSYxk,7262
|
|
8
|
+
ucon/core.py,sha256=Dx8HNwjGpF-RFlO_2Cz1BZikRFeLcYlMy7hscw106vo,29825
|
|
9
|
+
ucon/quantity.py,sha256=skXge9RU-5dW1ULCV6kiE4jk-rMVzXpBa4hV4mVr_Eo,7310
|
|
10
|
+
ucon/units.py,sha256=-CShNMLr9t7f3pyYsfmZv3wMCZU4lEnoe8r_9YQWjxA,3783
|
|
11
|
+
ucon-0.3.5.dist-info/licenses/LICENSE,sha256=LtimSYBSw1L_X6n1-VEdZRdwuROzPumrMUNX21asFuI,11356
|
|
12
|
+
ucon-0.3.5.dist-info/licenses/NOTICE,sha256=bh4fBOItio3kM4hSNYhqfFpcaAvOoixjD7Du8im-sYA,1079
|
|
13
|
+
ucon-0.3.5.dist-info/METADATA,sha256=unyLeaX8cl9Uf-EaX1NnylgaW5yUBLf_k22-cfCzaq0,11429
|
|
14
|
+
ucon-0.3.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
+
ucon-0.3.5.dist-info/top_level.txt,sha256=zZYRJiQrVUtN32ziJD2YEq7ClSvDmVYHYy5ArRAZGxI,11
|
|
16
|
+
ucon-0.3.5.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright © 2025 The Radiativity Company
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
ucon — A dimensional analysis and unit algebra library
|
|
2
|
+
© 2025 The Radiativity Company
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0.
|
|
5
|
+
You may not use this project except in compliance with the License.
|
|
6
|
+
A copy of the License is included in the LICENSE file or at:
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
This NOTICE file is part of the ucon distribution.
|
|
11
|
+
|
|
12
|
+
ucon implements:
|
|
13
|
+
• A compositional unit algebra (UnitFactor, UnitProduct, UnitForm)
|
|
14
|
+
• A dimension algebra based on vector-space operations
|
|
15
|
+
• Expression-level scale separation for unit provenance
|
|
16
|
+
• A foundation for ConversionGraph-based unit transformations
|
|
17
|
+
|
|
18
|
+
Portions of this software may incorporate or depend upon
|
|
19
|
+
third-party libraries. Attribution notices for those components,
|
|
20
|
+
if required, are included here or in the accompanying documentation.
|
|
21
|
+
|
|
22
|
+
The Radiativity Company retains all trademark rights to the names:
|
|
23
|
+
• "ucon"
|
|
24
|
+
• "The Radiativity Company"
|
|
25
|
+
• "Project Calico"
|
|
26
|
+
|
|
27
|
+
This file is for attribution purposes only and does not modify
|
|
28
|
+
the terms of the Apache License, Version 2.0.
|
ucon-0.3.4.dist-info/RECORD
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
tests/ucon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
tests/ucon/test_algebra.py,sha256=seQ5qfvtqc7uojzldQIk4jRr5O9FCNqpagox1Q53lMU,8212
|
|
3
|
-
tests/ucon/test_core.py,sha256=CMbToQiFJ_2MW26qV2RGKFWo-tLwz_3XN7O7dRDaoBg,26605
|
|
4
|
-
tests/ucon/test_quantity.py,sha256=XacQHxinlwoABR6tHPrw27ct5b_4le36c0e7d2h0JIw,14486
|
|
5
|
-
tests/ucon/test_units.py,sha256=NUEbcKgvj5nn9xIe3D-5NoaOpQry5Dkg_OmIAxY7QpU,777
|
|
6
|
-
ucon/__init__.py,sha256=B_yFxd47zl4toP4v5M6ODfJNnssoSzQz3VTM2md1rfg,1745
|
|
7
|
-
ucon/algebra.py,sha256=qe7Hfvo_P4YiBjSahBQu6rcH0ZfjBuO1cGtqG-ip_x8,7142
|
|
8
|
-
ucon/core.py,sha256=54zJpnutgK-RwrqajS81p8uiR_26ADSSzfI6co7fOFo,28797
|
|
9
|
-
ucon/quantity.py,sha256=wbgzc48Qs1ncgtU0Dz0F8x6q88eKe8jK2Ii5lVJKJ4E,9344
|
|
10
|
-
ucon/units.py,sha256=HqpATy3QPISLRfenWFaNnc-w6QhF1_Mm6_XIb93imOk,3663
|
|
11
|
-
ucon-0.3.4.dist-info/licenses/LICENSE,sha256=-Djjiq2wM8Cc6fzTsdMbr_T2_uaX6Yorxcemr3GGkqc,1072
|
|
12
|
-
ucon-0.3.4.dist-info/METADATA,sha256=qXIkp1XhZmjpDdKoY_mqk8LrA8b0h2av0WezAuCQZwE,10583
|
|
13
|
-
ucon-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
ucon-0.3.4.dist-info/top_level.txt,sha256=zZYRJiQrVUtN32ziJD2YEq7ClSvDmVYHYy5ArRAZGxI,11
|
|
15
|
-
ucon-0.3.4.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Emmanuel I. Obi
|
|
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.
|
|
File without changes
|