frequenz-quantities 1.0.2__tar.gz → 1.0.3__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 (31) hide show
  1. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/PKG-INFO +1 -1
  2. frequenz_quantities-1.0.3/RELEASE_NOTES.md +19 -0
  3. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/experimental/marshmallow.py +50 -36
  4. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz_quantities.egg-info/PKG-INFO +1 -1
  5. frequenz_quantities-1.0.3/src/frequenz_quantities.egg-info/scm_version.json +8 -0
  6. frequenz_quantities-1.0.2/RELEASE_NOTES.md +0 -6
  7. frequenz_quantities-1.0.2/src/frequenz_quantities.egg-info/scm_version.json +0 -8
  8. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/LICENSE +0 -0
  9. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/MANIFEST.in +0 -0
  10. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/README.md +0 -0
  11. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/pyproject.toml +0 -0
  12. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/setup.cfg +0 -0
  13. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/__init__.py +0 -0
  14. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_apparent_power.py +0 -0
  15. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_current.py +0 -0
  16. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_energy.py +0 -0
  17. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_frequency.py +0 -0
  18. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_percentage.py +0 -0
  19. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_power.py +0 -0
  20. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_quantity.py +0 -0
  21. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_reactive_power.py +0 -0
  22. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_temperature.py +0 -0
  23. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/_voltage.py +0 -0
  24. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/conftest.py +0 -0
  25. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/experimental/__init__.py +0 -0
  26. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz/quantities/py.typed +0 -0
  27. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz_quantities.egg-info/SOURCES.txt +0 -0
  28. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz_quantities.egg-info/dependency_links.txt +0 -0
  29. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz_quantities.egg-info/requires.txt +0 -0
  30. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz_quantities.egg-info/scm_file_list.json +0 -0
  31. {frequenz_quantities-1.0.2 → frequenz_quantities-1.0.3}/src/frequenz_quantities.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-quantities
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Types for holding quantities with units
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,19 @@
1
+ # Frequenz Quantities Library Release Notes
2
+
3
+ ## Summary
4
+
5
+ <!-- Here goes a general summary of what this release is about -->
6
+
7
+ ## Upgrading
8
+
9
+ <!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10
+
11
+ ## New Features
12
+
13
+ <!-- Here goes the main new features and examples or instructions on how to use them -->
14
+
15
+ ## Bug Fixes
16
+
17
+ <!-- Here goes notable bug fixes that are worth a special mention or explanation -->
18
+
19
+ - Fix a cross-reference that broke downstream strict doc builds.
@@ -4,7 +4,7 @@
4
4
  """Custom marshmallow fields and schema.
5
5
 
6
6
  This module provides custom marshmallow fields for quantities and
7
- a [`QuantitySchema`][.QuantitySchema] class to
7
+ a [`QuantitySchema`][frequenz.quantities.experimental.marshmallow.QuantitySchema] class to
8
8
  be used as base schema for dataclasses containing quantities.
9
9
 
10
10
  Danger:
@@ -43,14 +43,15 @@ attribute.
43
43
 
44
44
 
45
45
  class _QuantityField(Field[Quantity]):
46
- """A custom field for [`Quantity`][....Quantity] objects.
46
+ """A custom field for [`Quantity`][frequenz.quantities.Quantity] objects.
47
47
 
48
48
  Supports per-field serialization configuration.
49
49
 
50
50
  This class handles serialization and deserialization of ALL
51
- [`Quantity`][....Quantity] subclasses.
52
- The specific [`Quantity`][....Quantity] subclass is determined by the
53
- [`.field_type`][.field_type] attribute.
51
+ [`Quantity`][frequenz.quantities.Quantity] subclasses.
52
+ The specific [`Quantity`][frequenz.quantities.Quantity] subclass is determined by the
53
+ [`.field_type`][frequenz.quantities.experimental.marshmallow._QuantityField.field_type]
54
+ attribute.
54
55
 
55
56
  * Deserialization auto-detects the type of deserialization (float or string)
56
57
  based on the input type.
@@ -58,23 +59,29 @@ class _QuantityField(Field[Quantity]):
58
59
  configuration found in the metadata.
59
60
 
60
61
  We need distinct `_QuantityField` subclasses for each
61
- [`Quantity`][....Quantity] subclass, so
62
- they can be used in the [`TYPE_MAPPING`][..QuantitySchema.TYPE_MAPPING] in
63
- [`QuantitySchema`][..QuantitySchema].
62
+ [`Quantity`][frequenz.quantities.Quantity] subclass, so
63
+ they can be used in the
64
+ [`TYPE_MAPPING`][frequenz.quantities.experimental.marshmallow.QuantitySchema.TYPE_MAPPING]
65
+ in
66
+ [`QuantitySchema`][frequenz.quantities.experimental.marshmallow.QuantitySchema].
64
67
  This class is not intended to be used directly.
65
68
 
66
69
  Instead, we use the specific `_QuantityField` subclasses for each
67
- [`Quantity`][....Quantity].
68
- Each field subclass simply sets the [`.field_type`][.field_type]
69
- attribute to the corresponding [`Quantity`][....Quantity] subclass.
70
-
71
- Those subclasses are stored in [`QUANTITY_FIELD_CLASSES`][..QUANTITY_FIELD_CLASSES]
72
- and are used for the [`TYPE_MAPPING`][..QuantitySchema.TYPE_MAPPING] in
73
- [`QuantitySchema`][..QuantitySchema].
70
+ [`Quantity`][frequenz.quantities.Quantity].
71
+ Each field subclass simply sets the
72
+ [`.field_type`][frequenz.quantities.experimental.marshmallow._QuantityField.field_type]
73
+ attribute to the corresponding [`Quantity`][frequenz.quantities.Quantity] subclass.
74
+
75
+ Those subclasses are stored in
76
+ [`QUANTITY_FIELD_CLASSES`][frequenz.quantities.experimental.marshmallow.QUANTITY_FIELD_CLASSES]
77
+ and are used for the
78
+ [`TYPE_MAPPING`][frequenz.quantities.experimental.marshmallow.QuantitySchema.TYPE_MAPPING]
79
+ in
80
+ [`QuantitySchema`][frequenz.quantities.experimental.marshmallow.QuantitySchema].
74
81
  """
75
82
 
76
83
  field_type: Type[Quantity] | None = None
77
- """The specific [`Quantity`][.....Quantity] subclass."""
84
+ """The specific [`Quantity`][frequenz.quantities.Quantity] subclass."""
78
85
 
79
86
  def __init__(self, *args: Any, **kwargs: Any) -> None:
80
87
  """Initialize the field."""
@@ -84,7 +91,7 @@ class _QuantityField(Field[Quantity]):
84
91
  def _serialize(
85
92
  self, value: Quantity | None, attr: str | None, obj: Any, **kwargs: Any
86
93
  ) -> Any:
87
- """Serialize a [`Quantity`][.....Quantity] based on per-field configuration.
94
+ """Serialize a [`Quantity`][frequenz.quantities.Quantity] based on per-field configuration.
88
95
 
89
96
  Args:
90
97
  value: The quantity to serialize, or `None`.
@@ -97,9 +104,11 @@ class _QuantityField(Field[Quantity]):
97
104
  the raw base float value otherwise. `None` if `value` is `None`.
98
105
 
99
106
  Raises:
100
- TypeError: If [`..field_type`][..field_type] is not set to a
101
- [`Quantity`][.....Quantity] subclass, or if
102
- `value` is not a [`Quantity`][.....Quantity]
107
+ TypeError: If
108
+ [`.field_type`][frequenz.quantities.experimental.marshmallow._QuantityField.field_type]
109
+ is not set to a
110
+ [`Quantity`][frequenz.quantities.Quantity] subclass, or if
111
+ `value` is not a [`Quantity`][frequenz.quantities.Quantity]
103
112
  instance.
104
113
  """
105
114
  if self.field_type is None or not issubclass(self.field_type, Quantity):
@@ -132,7 +141,7 @@ class _QuantityField(Field[Quantity]):
132
141
  def _deserialize(
133
142
  self, value: Any, attr: str | None, data: Any, **kwargs: Any
134
143
  ) -> Quantity:
135
- """Deserialize a [`Quantity`][.....Quantity] from a float, int, or string.
144
+ """Deserialize a [`Quantity`][frequenz.quantities.Quantity] from a float, int, or string.
136
145
 
137
146
  Args:
138
147
  value: The raw value to deserialize (float, int, or string).
@@ -144,8 +153,10 @@ class _QuantityField(Field[Quantity]):
144
153
  The deserialized quantity instance.
145
154
 
146
155
  Raises:
147
- TypeError: If [`..field_type`][..field_type] is not set to a
148
- [`Quantity`][.....Quantity] subclass.
156
+ TypeError: If
157
+ [`.field_type`][frequenz.quantities.experimental.marshmallow._QuantityField.field_type]
158
+ is not set to a
159
+ [`Quantity`][frequenz.quantities.Quantity] subclass.
149
160
  ValidationError: If the input type is invalid or parsing fails
150
161
  (see [`marshmallow.ValidationError`][marshmallow.ValidationError]).
151
162
  """
@@ -186,55 +197,55 @@ _QUANTITY_SUBCLASSES = [
186
197
 
187
198
 
188
199
  class ApparentPowerField(_QuantityField):
189
- """A custom field for [`ApparentPower`][....ApparentPower] objects."""
200
+ """A custom field for [`ApparentPower`][frequenz.quantities.ApparentPower] objects."""
190
201
 
191
202
  field_type = ApparentPower
192
203
 
193
204
 
194
205
  class CurrentField(_QuantityField):
195
- """A custom field for [`Current`][....Current] objects."""
206
+ """A custom field for [`Current`][frequenz.quantities.Current] objects."""
196
207
 
197
208
  field_type = Current
198
209
 
199
210
 
200
211
  class EnergyField(_QuantityField):
201
- """A custom field for [`Energy`][....Energy] objects."""
212
+ """A custom field for [`Energy`][frequenz.quantities.Energy] objects."""
202
213
 
203
214
  field_type = Energy
204
215
 
205
216
 
206
217
  class FrequencyField(_QuantityField):
207
- """A custom field for [`Frequency`][....Frequency] objects."""
218
+ """A custom field for [`Frequency`][frequenz.quantities.Frequency] objects."""
208
219
 
209
220
  field_type = Frequency
210
221
 
211
222
 
212
223
  class PercentageField(_QuantityField):
213
- """A custom field for [`Percentage`][....Percentage] objects."""
224
+ """A custom field for [`Percentage`][frequenz.quantities.Percentage] objects."""
214
225
 
215
226
  field_type = Percentage
216
227
 
217
228
 
218
229
  class PowerField(_QuantityField):
219
- """A custom field for [`Power`][....Power] objects."""
230
+ """A custom field for [`Power`][frequenz.quantities.Power] objects."""
220
231
 
221
232
  field_type = Power
222
233
 
223
234
 
224
235
  class ReactivePowerField(_QuantityField):
225
- """A custom field for [`ReactivePower`][....ReactivePower] objects."""
236
+ """A custom field for [`ReactivePower`][frequenz.quantities.ReactivePower] objects."""
226
237
 
227
238
  field_type = ReactivePower
228
239
 
229
240
 
230
241
  class TemperatureField(_QuantityField):
231
- """A custom field for [`Temperature`][....Temperature] objects."""
242
+ """A custom field for [`Temperature`][frequenz.quantities.Temperature] objects."""
232
243
 
233
244
  field_type = Temperature
234
245
 
235
246
 
236
247
  class VoltageField(_QuantityField):
237
- """A custom field for [`Voltage`][....Voltage] objects."""
248
+ """A custom field for [`Voltage`][frequenz.quantities.Voltage] objects."""
238
249
 
239
250
  field_type = Voltage
240
251
 
@@ -250,10 +261,13 @@ QUANTITY_FIELD_CLASSES: dict[type[Quantity], type[Field[Any]]] = {
250
261
  Temperature: TemperatureField,
251
262
  Voltage: VoltageField,
252
263
  }
253
- """The mapping from [`Quantity`][....Quantity] subclasses to their corresponding field subclasses.
264
+ """The mapping from [`Quantity`][frequenz.quantities.Quantity] subclasses
265
+ to their corresponding field subclasses.
254
266
 
255
- This mapping is used in [`QuantitySchema.TYPE_MAPPING`][..QuantitySchema.TYPE_MAPPING] to
256
- determine the correct field class for each [`Quantity`][....Quantity]
267
+ This mapping is used in
268
+ [`QuantitySchema.TYPE_MAPPING`][frequenz.quantities.experimental.marshmallow.QuantitySchema.TYPE_MAPPING]
269
+ to
270
+ determine the correct field class for each [`Quantity`][frequenz.quantities.Quantity]
257
271
  subclass.
258
272
  """
259
273
 
@@ -327,4 +341,4 @@ class QuantitySchema(Schema):
327
341
  """
328
342
 
329
343
  TYPE_MAPPING: dict[type, type[Field[Any]]] = QUANTITY_FIELD_CLASSES
330
- """The field class to use for each [`Quantity`][.....Quantity] subclass."""
344
+ """The field class to use for each [`Quantity`][frequenz.quantities.Quantity] subclass."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-quantities
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Types for holding quantities with units
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.0.3",
3
+ "distance": 0,
4
+ "node": "g04548b0ea6a67998d666c025dd04675bdbd27c76",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-09-08"
8
+ }
@@ -1,6 +0,0 @@
1
- # Frequenz Quantities Library Release Notes
2
-
3
- ## Upgrading
4
-
5
- - The minimum `typing-extensions` version was bumped to 4.12.0. Consumers may need to upgrade it too.
6
- - The `marshmallow` optional dependency now requires version 4 or later. Consumers pinned to marshmallow 3.x must upgrade.
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "1.0.2",
3
- "distance": 0,
4
- "node": "g7757a92227985b972470a047d0a56d7712a5f938",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-09-07"
8
- }