kuchka 0.1.0__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.
Files changed (37) hide show
  1. kuchka-0.1.0/PKG-INFO +385 -0
  2. kuchka-0.1.0/README.md +368 -0
  3. kuchka-0.1.0/pyproject.toml +123 -0
  4. kuchka-0.1.0/pyproject.toml.orig +141 -0
  5. kuchka-0.1.0/src/kuchka/__init__.py +259 -0
  6. kuchka-0.1.0/src/kuchka/constants.py +72 -0
  7. kuchka-0.1.0/src/kuchka/dimensions.py +96 -0
  8. kuchka-0.1.0/src/kuchka/errors.py +90 -0
  9. kuchka-0.1.0/src/kuchka/numeric.py +72 -0
  10. kuchka-0.1.0/src/kuchka/py.typed +0 -0
  11. kuchka-0.1.0/src/kuchka/quantities/__init__.py +61 -0
  12. kuchka-0.1.0/src/kuchka/quantities/amount.py +22 -0
  13. kuchka-0.1.0/src/kuchka/quantities/base.py +380 -0
  14. kuchka-0.1.0/src/kuchka/quantities/charge.py +44 -0
  15. kuchka-0.1.0/src/kuchka/quantities/electrical.py +137 -0
  16. kuchka-0.1.0/src/kuchka/quantities/energy.py +43 -0
  17. kuchka-0.1.0/src/kuchka/quantities/kinematics.py +52 -0
  18. kuchka-0.1.0/src/kuchka/quantities/length.py +38 -0
  19. kuchka-0.1.0/src/kuchka/quantities/luminous_intensity.py +22 -0
  20. kuchka-0.1.0/src/kuchka/quantities/mass.py +22 -0
  21. kuchka-0.1.0/src/kuchka/quantities/proportion.py +28 -0
  22. kuchka-0.1.0/src/kuchka/quantities/temporal.py +292 -0
  23. kuchka-0.1.0/src/kuchka/quantities/thermal.py +275 -0
  24. kuchka-0.1.0/src/kuchka/units/__init__.py +313 -0
  25. kuchka-0.1.0/src/kuchka/units/amount.py +60 -0
  26. kuchka-0.1.0/src/kuchka/units/charge.py +58 -0
  27. kuchka-0.1.0/src/kuchka/units/current.py +65 -0
  28. kuchka-0.1.0/src/kuchka/units/energy.py +86 -0
  29. kuchka-0.1.0/src/kuchka/units/kinematics.py +52 -0
  30. kuchka-0.1.0/src/kuchka/units/length.py +111 -0
  31. kuchka-0.1.0/src/kuchka/units/luminous_intensity.py +47 -0
  32. kuchka-0.1.0/src/kuchka/units/mass.py +103 -0
  33. kuchka-0.1.0/src/kuchka/units/power.py +58 -0
  34. kuchka-0.1.0/src/kuchka/units/proportion.py +51 -0
  35. kuchka-0.1.0/src/kuchka/units/resistance.py +65 -0
  36. kuchka-0.1.0/src/kuchka/units/temporal.py +232 -0
  37. kuchka-0.1.0/src/kuchka/units/voltage.py +71 -0
kuchka-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,385 @@
1
+ Metadata-Version: 2.4
2
+ Name: kuchka
3
+ Version: 0.1.0
4
+ Summary: A small pile of physically-typed engineering units for Python.
5
+ Author: dimonade
6
+ Author-email: dimonade <dimonade@protonmail.com>
7
+ License-Expression: Apache-2.0
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Requires-Python: >=3.11
13
+ Project-URL: Homepage, https://codeberg.org/dimonade/kuchka
14
+ Project-URL: Repository, https://codeberg.org/dimonade/kuchka
15
+ Project-URL: Bug Tracker, https://codeberg.org/dimonade/kuchka/issues
16
+ Description-Content-Type: text/markdown
17
+
18
+ # kuchka
19
+
20
+ A small pile of physically-typed engineering units for Python.
21
+
22
+ ```python
23
+ from kuchka import Volt, Milliampere
24
+
25
+ voltage = Volt(4.2)
26
+ current = Milliampere(150)
27
+ power = voltage * current # -> Power(0.63 W), typed and computed automatically.
28
+ ```
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ uv add kuchka
34
+ ```
35
+
36
+ or, with pip:
37
+
38
+ ```bash
39
+ pip install kuchka
40
+ ```
41
+
42
+ That's the only install step needed to use kuchka in application code.
43
+ The `Development` section below covers the separate, larger set of tools (ruff, mypy, ty, pytest, hypothesis, ...) needed to work on `kuchka`.
44
+
45
+ ## Stability
46
+
47
+ `kuchka` is `0.1.0`: pre-1.0, and versioned accordingly.
48
+ Breaking changes are expected between `0.1.x` releases while the API settles.
49
+ From `0.2.0` onward, `kuchka` follows ordinary semantic versioning:
50
+ a minor version bump won't break existing code, and a breaking change always comes with a major version bump.
51
+
52
+ ## Why
53
+
54
+ A raw `float` doesn't remember what it means.
55
+ Passing floats through an engineering pipeline makes unit mistakes easy to write and hard to catch:
56
+ the code stays syntactically valid even when it's semantically wrong.
57
+
58
+ `kuchka` makes the physically-typed version of the code no harder to write than the untyped one.
59
+ There's no reason left to reach for a naked `float`.
60
+
61
+ ```python
62
+ def analyse_voltage(voltage: Voltage) -> Report: ...
63
+
64
+
65
+ analyse_voltage(4.2) # rejected by mypy/ty, and again at runtime.
66
+ analyse_voltage(Ampere(2)) # rejected by mypy/ty, and again at runtime.
67
+ analyse_voltage(Volt(4.2)) # one example of a valid type check.
68
+ analyse_voltage(Millivolt(4200)) # another example of a valid type check.
69
+ ```
70
+
71
+ ## What's in v0.1
72
+
73
+ | Quantity | Constructors |
74
+ | ------------------- | -------------------------------------------------------------------------------- |
75
+ | `Voltage` | `Volt`, `Millivolt`, `Microvolt`, `Kilovolt` |
76
+ | `Current` | `Ampere`, `Milliampere`, `Microampere`, `Kiloampere` |
77
+ | `Power` | `Watt`, `Milliwatt`, `Kilowatt` |
78
+ | `Resistance` | `Ohm`, `Milliohm`, `Kiloohm`, `Megaohm` |
79
+ | `Temperature` | `Celsius`, `Kelvin` |
80
+ | `TemperatureDelta` | `DeltaCelsius`, `DeltaKelvin` |
81
+ | `Time` | `Second`, `Millisecond`, `Microsecond` |
82
+ | `Frequency` | `Hertz`, `Kilohertz`, `Megahertz` |
83
+ | `SamplingPeriod` | `SecondSamplingPeriod`, `MillisecondSamplingPeriod`, `MicrosecondSamplingPeriod` |
84
+ | `SampleRate` | `SamplesPerSecond`, `KilosamplesPerSecond`, `MegasamplesPerSecond` |
85
+ | `BaudRate` | `Baud`, `Kilobaud` |
86
+ | `Length` | `Nanometer`, `Micrometer`, `Millimeter`, `Meter`, `Kilometer`, `Inch` |
87
+ | `Mass` | `Nanogram`, `Microgram`, `Milligram`, `Gram`, `Kilogram`, `Megagram`, `Tonne` |
88
+ | `AmountOfSubstance` | `Micromole`, `Millimole`, `Mole` |
89
+ | `LuminousIntensity` | `Candela` |
90
+ | `Proportion` | `Ratio`, `Percent` |
91
+
92
+ Deliberately nothing else yet.
93
+ See "What this is not (yet)" below.
94
+
95
+ ## Design choices, and why
96
+
97
+ - **`Decimal`, not `float`.**
98
+ SI prefixes are powers of ten, and those are exact in `Decimal` but usually not in binary `float`.
99
+ `Volt(1) + Millivolt(500) == Volt(1.5)` is true by construction, and not by lucky rounding.
100
+ - **Unit constructors are plain functions, not classes.**
101
+ `Volt(4.2)` returns a `Voltage`.
102
+ There's no `Volt` type to accidentally `isinstance()`-check against, and no subclass/`__new__` surprise where `isinstance(Volt(5), Volt)` is `False`.
103
+ - **`.to(Unit)` uses Python names, never unit strings.**
104
+ There's no `voltage.to("mV")` anywhere in this library.
105
+ - **Boundary code that must resolve a unit from a string has a maintained table to use.**
106
+ `kuchka.units` exports a `*_UNITS` mapping per dimension (`VOLTAGE_UNITS`, `CURRENT_UNITS`, `FREQUENCY_UNITS`, and so on), closed to that dimension's own constructors and immutable.
107
+ This is not a second construction path: `Volt(5)` is still how application code builds a `Voltage`.
108
+ It exists for the one place a unit is expected to arrive as a string -- a config file, a CSV header, a hardware descriptor.
109
+ The intention is so that place doesn't have to hand-roll the same table every other application resolving `kuchka` units already needed.
110
+ See `docs/examples/config_migration` for it in use, and `docs/review_notes.md` for why this doesn't reintroduce the registry the "Comparison to existing tools" section below argues against.
111
+ - **Cross-type arithmetic is rejected statically, not just at runtime.**
112
+ `Volt(5) + Ampere(2)` and `Volt(5) + 4.2` are both mypy errors, not only runtime ones.
113
+ This falls out of typing the base arithmetic methods against `Self` instead of `object`, so every quantity type only ever type-checks arithmetic against its own kind.
114
+ See "Known limitations" for where `ty` doesn't (yet) enforce this the same way.
115
+ - **A hand-written overload table.**
116
+ The runtime arithmetic derives any product or quotient from general exponent-vector algebra.
117
+ Type checkers can't infer "Voltage times Current is Power" from that algebra on their own, so each pairing is spelled out as an explicit `@overload`.
118
+ - **`Temperature` is a separate, smaller type from everything else.**
119
+ Absolute temperature is affine, not linear:
120
+ `20 degC + 5 degC` isn't meaningful the way `5V + 3V` is.
121
+ It supports `Temperature +/- TemperatureDelta` and `Temperature - Temperature`, but not `Temperature - Temperature`, and no scalar multiplication at all.
122
+ See the module docstring next to `Temperature` for the full reasoning.
123
+ - **Scope gaps are curated, not generic, where the gap has a name.**
124
+ `Resistance * Resistance` raises `UnrepresentableDimensionError`: dimensionally valid, no registered type, and no plan to add one.
125
+ Planned to be implemented dimensions raise a `PlannedDimensionError` instead, a subclass of the same error, because some calculations are planned to be implemented soon.
126
+ The error message is explicitly different, and not leaving the reader to reverse-engineer the physics from an exponent vector.
127
+
128
+ ### Same dimension, different concepts
129
+
130
+ `Frequency`, `SampleRate`, and `BaudRate` all share the same physical dimension (T^-1), but they are not the same thing, and `kuchka` keeps them as separate types on purpose:
131
+
132
+ ```python
133
+ # IncompatibleDimensionError, even though both are dimensionally T^-1.
134
+ Hertz(50) + SamplesPerSecond(50)
135
+ ```
136
+
137
+ Only one type per dimension is ever the _canonical_ one -- the type generic arithmetic produces automatically.
138
+ That's always the plain SI name (`Frequency` for T^-1, `Time` for T^1), never a domain-specific type like `SampleRate` or `BaudRate`.
139
+ Those stay reachable only by explicit construction, the same way `Temperature` already works.
140
+
141
+ Genuine reciprocal pairs convert into each other directly:
142
+
143
+ ```python
144
+ rate = 1 / SecondSamplingPeriod(2) # -> SampleRate, not Frequency.
145
+ period = 1 / rate # -> SamplingPeriod again.
146
+ ```
147
+
148
+ `BaudRate` gets no reciprocal at all: baud counts symbols per second, not bits or cycles, so a default equivalence with `Frequency` would be wrong for any encoding other than exactly one bit per symbol.
149
+ Silently guessing here is worse than refusing.
150
+
151
+ For code that wants to accept "a Frequency or a SampleRate, interchangeably", there's a `ConvertibleToFrequency` protocol:
152
+
153
+ ```python
154
+ from kuchka import ConvertibleToFrequency, Frequency
155
+
156
+
157
+ def nyquist_ok(signal: ConvertibleToFrequency, sample_rate: Frequency) -> bool:
158
+ return signal.as_frequency() * 2 <= sample_rate
159
+ ```
160
+
161
+ `BaudRate` deliberately does not satisfy this protocol, since it has no `as_frequency()`.
162
+
163
+ ### Percent and Ratio are the same quantity, not different concepts
164
+
165
+ `Proportion` is the dimensionless quantity: `Ratio` is its coherent, unscaled unit (a bare fraction), and `Percent` is a hundredth of that.
166
+ Unlike `Frequency`/`SampleRate`/`BaudRate`, these are not different concepts sharing a dimension -- `5%` and `0.05` are the same quantity at different scale, the same relationship `Volt`/`Millivolt` has:
167
+
168
+ ```python
169
+ Percent(5) == Ratio(Decimal("0.05")) # True
170
+ Percent(5) + Ratio(Decimal("0.05")) == Percent(10) # True
171
+ ```
172
+
173
+ `Proportion` is never registered for `DIMENSIONLESS`, and could not usefully be even if it wanted to: `Ohm(5) / Ohm(2)` already returns a bare `Decimal` for any dimensionless result, before the registry is even consulted, and that does not change.
174
+ `Percent`/`Ratio` stay reachable only by explicit construction, the same way `SampleRate`/`BaudRate` do.
175
+
176
+ What does change: multiplying or dividing any existing quantity by a `Proportion` already produces the correctly-typed result, with no new arithmetic added anywhere.
177
+
178
+ ```python
179
+ Volt(5) * Ratio(Decimal("0.1")) == Volt(Decimal("0.5")) # True, a tolerance band.
180
+ ```
181
+
182
+ This falls out of the same general dimension algebra that already derives `Power` from `Voltage * Current`: multiplying by the dimensionless identity leaves the other operand's dimension, and therefore its type, unchanged.
183
+
184
+ ## Physical constants
185
+
186
+ `kuchka.constants` provides a small set of physical constants as ordinary `kuchka` quantities.
187
+
188
+ ```python
189
+ from kuchka import Hertz
190
+ from kuchka.constants import SPEED_OF_LIGHT
191
+
192
+ wifi_wavelength = SPEED_OF_LIGHT / Hertz(2_400_000_000) # -> Length, ~0.1249 m
193
+ ```
194
+
195
+ `SPEED_OF_LIGHT` and `ELEMENTARY_CHARGE` are exact by SI definition.
196
+ `ELECTRON_MASS`, `PROTON_MASS`, and `NEUTRON_MASS` are CODATA 2022 recommended values, carrying exactly as many significant digits as CODATA publishes for each.
197
+ The module docstring states which category each constant belongs to.
198
+
199
+ The set grows as concrete needs come up, the same way the unit vocabulary itself does.
200
+
201
+ ## Errors
202
+
203
+ Every error kuchka raises for a mistake in application code is a `MeasurementError`; catch that to handle the whole family at once.
204
+
205
+ | Error | Raised when |
206
+ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
207
+ | `InvalidMeasurementError` | a unit constructor got a non-numeric value, a `bool`, or an incompatible measurement |
208
+ | `IncompatibleDimensionError` | an operation was attempted between two incompatible dimensions or types |
209
+ | `InvalidConversionError` | `.to(...)` was given something that isn't a valid unit for that dimension |
210
+ | `UnrepresentableDimensionError` | arithmetic produced a dimension with no registered engineering type |
211
+ | `PlannedDimensionError` | same as above, but for a dimension already named and intended for a future release (subclass of `UnrepresentableDimensionError`) |
212
+
213
+ ## Formatting
214
+
215
+ Every quantity supports Python's format mini-language through `__format__`, applied to the magnitude in its current display unit.
216
+
217
+ ```python
218
+ from kuchka import Volt
219
+
220
+ voltage = Volt(1234.5)
221
+
222
+ f"{voltage}" # "1234.5 V" -- matches repr()
223
+ f"{voltage:.2f}" # "1234.50 V"
224
+ f"{voltage:.2e}" # "1.23e+3 V"
225
+ f"{voltage:,.2f}" # "1,234.50 V"
226
+ ```
227
+
228
+ An empty format spec matches `repr()`.
229
+ A non-empty spec applies to the underlying `Decimal`, and the unit symbol is appended after.
230
+
231
+ ## Examples
232
+
233
+ - **[Migrating a config from unit-suffixed keys to kuchka](docs/examples/config_migration/README.md)** --
234
+ a worked example: an old `.ini` file where units live in the key name (`accepted_voltage_min_mv`), migrated to a `.toml` file where units are data, parsed through a boundary layer into typed dataclasses.
235
+ Covers closed per-dimension unit resolution, `Decimal`-exact parsing, and three concrete failure modes the boundary layer catches at load time.
236
+
237
+ ## Package layout
238
+
239
+ _subject to change as the design and architecture bounces around and settles down._
240
+
241
+ ```text
242
+ src/kuchka/
243
+ constants.py a handful of physical constants
244
+ dimensions.py exponent-vector dimensional algebra
245
+ numeric.py strict coercion of int/float/Decimal/Fraction into Decimal
246
+ errors.py the exception hierarchy
247
+ quantities/
248
+ base.py the quantity engine: LinearQuantity, UnitDef, the dimension registry
249
+ electrical.py Voltage, Current, Power, Resistance and their overload tables
250
+ temporal.py Time, Frequency, SamplingPeriod, SampleRate, BaudRate
251
+ thermal.py TemperatureDelta, and the affine Temperature type
252
+ length.py Length
253
+ mass.py Mass
254
+ amount.py AmountOfSubstance
255
+ luminous_intensity.py LuminousIntensity
256
+ proportion.py Proportion
257
+ units/
258
+ voltage.py, current.py, resistance.py, power.py, temporal.py, length.py,
259
+ mass.py, amount.py, luminous_intensity.py, proportion.py, ...
260
+ one module per dimension's prefix constructors
261
+ tests/ All tests in the module.
262
+ ```
263
+
264
+ Application code should only ever need the top-level `kuchka` package.
265
+ Everything under `quantities/`, `units/`, and the internals of `temperature.py` is implementation detail, re-exported for convenience but not meant to be imported piecemeal.
266
+
267
+ ## Development
268
+
269
+ `uv sync` installs the `dev` dependency group (ruff, mypy, ty, pytest, hypothesis, coverage, and editor tooling) alongside `kuchka` itself.
270
+
271
+ ```bash
272
+ uv sync
273
+
274
+ uv run pytest
275
+ uv run mypy --strict src/kuchka
276
+ uv run ty check src/kuchka tests
277
+ uv run coverage run -m pytest && uv run coverage report
278
+ ```
279
+
280
+ Alternatively, one can leverage the `justfile`'s `just ct` or `just covtest` to execute the whole testbench and additional statistics.
281
+
282
+ `tests/test_typing.py` runs mypy against `tests/typing_fixtures/should_fail.py`, a file that mixes lines that must type-check with lines marked `# type: ignore[...]` that must not.
283
+ Under `--strict`, an _unused_ `type: ignore` is itself an error.
284
+ A clean run of that test is only possible if mypy's static verdict matches the fixture's claim on every single line -- that's the thing that actually proves the type story works, not just that it looks plausible.
285
+
286
+ Ruff runs with `select = ["ALL"]`.
287
+ Every disabled rule in `pyproject.toml` carries an inline comment explaining why it doesn't fit this codebase.
288
+ This mostly includes dunder-per-dunder docstrings, the deliberately capitalized unit-constructor names, and the exception hierarchy's inline-message style.
289
+ Worth reading before adding a new blanket ignore.
290
+
291
+ ## Performance
292
+
293
+ `kuchka` deliberately uses `Decimal` under the hood for correctness.
294
+ The design philosophy is to utilize `kuchka` for unit correctness as values come from configuration files, through permutations and checks flow into reports.
295
+ Running `kuchka` in a hot loop transforming values in a vector of mega-samples-per-second live is not really the intended use case of it.
296
+
297
+ For more see [`benchmarks`](benchmarks/README.md).
298
+
299
+ ## Comparison to existing tools
300
+
301
+ `kuchka` isn't the first attempt at physical quantities in Python.
302
+ A non-exhaustive list of prior art: `Pint`, `astropy.units`, `physipy`, `unyt`, `forallpeople`, `numericalunits`, `Unum`, `quantities`, `units`, `unitpy`, and `impunity`.
303
+
304
+ **The uncomfortable starting point.** Pint has existed since roughly 2012.
305
+ Despite that, more than a decade of engineering work across healthcare, finance, and secure embedded devices has produced (for me) essentially zero sightings of any of these libraries in Python code.
306
+ What actually gets written instead is `voltage_mv`, `temperature_c`, `time_ms`, or a small home-grown newtype.
307
+
308
+ I assume that's not because engineers don't know these libraries exist.
309
+ None of them seem to have made the safe path more comfortable than the naming-convention path.
310
+ That's the problem `kuchka` is trying to solve -- and it's worth being honest that `kuchka` hasn't proven it solves it either.
311
+ It has no adoption history of its own to point to.
312
+ The claim here is about mechanism, not a guarantee.
313
+
314
+ **Where the existing libraries put the friction:**
315
+
316
+ ```python
317
+ # Pint / physipy: a registry, and a unit looked up on or from it.
318
+ ureg = pint.UnitRegistry()
319
+ voltage = 3 * ureg.volt + 40 * ureg.millivolt
320
+
321
+ # kuchka: the unit is the constructor.
322
+ voltage = Volt(3) + Millivolt(40)
323
+ ```
324
+
325
+ | Library | Unit is... | Result type |
326
+ | -------------- | --------------------------------------------------------- | ------------------------------------- |
327
+ | Pint | looked up on a registry (`ureg.meter`, `"3 m"`) | one generic `Quantity` for everything |
328
+ | physipy | looked up in a dict (`units["nm"]`) | one generic `Quantity` for everything |
329
+ | units / unitpy | a string (`unit("m")`, `U("km")`) | -- |
330
+ | impunity | a string in a function annotation, checked at import time | none at runtime -- rewritten away |
331
+ | kuchka | an ordinary Python name (`Meter`) | a distinct Python type per quantity |
332
+
333
+ Pint is the mature, general-purpose default: a huge unit vocabulary, NumPy/Pandas integration, unit parsing from strings.
334
+ That generality is the whole point of Pint, and `kuchka` isn't trying to replicate it.
335
+
336
+ impunity is the closest in spirit to `kuchka`'s static-first goal, and worth knowing about specifically for that reason.
337
+ It's a genuinely different, and in some ways more efficient, trade-off:
338
+ zero runtime cost once the check has run, at the cost of the "unit" being a string inside an annotation rather than an ordinary object you can construct, return, and pass around.
339
+
340
+ `kuchka`'s bet: `isinstance(Volt(5), Voltage)` should work with no registry, no plugin, and no decorator rewriting your function body.
341
+ `mypy`/`ty` should understand the arithmetic because it's ordinary overloads on an ordinary class, not a new annotation vocabulary.
342
+ The trade-off: a deliberately small, hand-maintained unit vocabulary, and no array/NumPy support yet.
343
+
344
+ **The gap this is aimed at.** Not "Python has no unit libraries" -- it obviously does.
345
+ The narrower claim: physical quantities should be ordinary, boring Python types that a type checker already understands, without an engineer ever carrying a registry or spelling a unit as a string.
346
+ Whether that's _also_ the missing ingredient for adoption, versus adoption needing something else entirely (habit, deadlines, nobody
347
+ asking), is genuinely open.
348
+ `kuchka` is a bet on the first explanation, not proof of it.
349
+
350
+ ## What this is not (yet)
351
+
352
+ - `Length` was added, `Foot`/`Yard`/`Mile` were not.
353
+ - No NumPy/Pandas integration.
354
+ `Decimal` doesn't vectorize into `ndarray` cleanly, and per-sample scalar wrapping is the wrong shape for high-rate acquisition.
355
+ Intended pattern for now: buffer raw floats at the acquisition boundary, convert once there is a value worth reasoning about.
356
+ - No JSON/DB persistence layer. When it's added:
357
+ - the _storage_ format may use a unit string (`{"value": 4.2, "unit": "V"}`), since that's not the application-facing API.
358
+ Loading it back must reconstruct a typed measurement, never hand back a bare number.
359
+ - No point-in-time type.
360
+ `Time` is a span (a duration, a timeout, a sample period), not a timestamp.
361
+ A timestamp would need the same affine treatment `Temperature` gets, and isn't modelled yet.
362
+
363
+ ## Known limitations
364
+
365
+ - **`ty` doesn't yet enforce `Self`-narrowed arithmetic across sibling quantity types the way `mypy --strict` does.**
366
+ `Volt(5) + Ampere(2)` is a `mypy --strict` error but is currently accepted by `ty`.
367
+ Both tools agree on naked-number arithmetic (`Volt(5) + 4.2`) and on the `Temperature` cases.
368
+ Search the test suite for "not (yet) flagged by ty" for the exact cases.
369
+ - **The dimension vocabulary is small on purpose.**
370
+ `Resistance * Resistance` and similar mathematically-valid-but-unregistered products raise `UnrepresentableDimensionError` at runtime rather than returning a typed result.
371
+ Neither mypy nor ty catch this ahead of time, since the fallback overload on each quantity type has to accept `object` to stay compatible with the base class.
372
+ - No special array, NumPy/Pandas support.
373
+
374
+ ## Open questions for the upcoming iterations / next versions
375
+
376
+ - Whether Kelvin should get a distinct, scalar-multipliable type (see the design note next to `Temperature`).
377
+ - Whether a point-in-time type (`Instant`, most likely) is ever worth adding, and what its "you can't add two timestamps" rule should look like.
378
+ - NumPy/Pandas integration strategy, once vectorized acquisition is actually needed, not just anticipated.
379
+ - Better `AffineQuantity` representation.
380
+ - `Modular` or `Cyclic` - for angles, compass values, etc.
381
+ - `dB` family.
382
+
383
+ ## History
384
+
385
+ The original pre-implementation design proposal lives at [`docs/introduction/design_proposal.md`](docs/introduction/design_proposal.md), kept as a record of the initial thinking.