frequenz-quantities 1.0.1__tar.gz → 1.0.2__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.1 → frequenz_quantities-1.0.2}/PKG-INFO +77 -30
  2. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/README.md +47 -0
  3. frequenz_quantities-1.0.2/RELEASE_NOTES.md +6 -0
  4. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/pyproject.toml +37 -31
  5. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/__init__.py +14 -17
  6. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_apparent_power.py +23 -23
  7. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_current.py +0 -1
  8. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_energy.py +4 -5
  9. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_frequency.py +0 -1
  10. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_percentage.py +0 -1
  11. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_power.py +1 -2
  12. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_quantity.py +5 -17
  13. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_reactive_power.py +22 -23
  14. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_temperature.py +0 -1
  15. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/_voltage.py +0 -1
  16. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/experimental/marshmallow.py +75 -39
  17. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz_quantities.egg-info/PKG-INFO +77 -30
  18. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz_quantities.egg-info/SOURCES.txt +2 -0
  19. frequenz_quantities-1.0.2/src/frequenz_quantities.egg-info/requires.txt +54 -0
  20. frequenz_quantities-1.0.2/src/frequenz_quantities.egg-info/scm_file_list.json +56 -0
  21. frequenz_quantities-1.0.2/src/frequenz_quantities.egg-info/scm_version.json +8 -0
  22. frequenz_quantities-1.0.1/RELEASE_NOTES.md +0 -17
  23. frequenz_quantities-1.0.1/src/frequenz_quantities.egg-info/requires.txt +0 -53
  24. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/LICENSE +0 -0
  25. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/MANIFEST.in +0 -0
  26. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/setup.cfg +0 -0
  27. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/conftest.py +0 -0
  28. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/experimental/__init__.py +0 -0
  29. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz/quantities/py.typed +0 -0
  30. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz_quantities.egg-info/dependency_links.txt +0 -0
  31. {frequenz_quantities-1.0.1 → frequenz_quantities-1.0.2}/src/frequenz_quantities.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-quantities
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Types for holding quantities with units
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Documentation, https://frequenz-floss.github.io/frequenz-quantities-python/
8
8
  Project-URL: Changelog, https://github.com/frequenz-floss/frequenz-quantities-python/releases
9
9
  Project-URL: Issues, https://github.com/frequenz-floss/frequenz-quantities-python/issues
@@ -12,7 +12,6 @@ Project-URL: Support, https://github.com/frequenz-floss/frequenz-quantities-pyth
12
12
  Keywords: frequenz,python,lib,library,quantities,unit,conversion
13
13
  Classifier: Development Status :: 3 - Alpha
14
14
  Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
15
  Classifier: Programming Language :: Python :: 3
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
18
17
  Classifier: Topic :: Software Development :: Libraries
@@ -20,47 +19,48 @@ Classifier: Typing :: Typed
20
19
  Requires-Python: <4,>=3.11
21
20
  Description-Content-Type: text/markdown
22
21
  License-File: LICENSE
23
- Requires-Dist: typing-extensions<5,>=4.6.0
22
+ Requires-Dist: typing-extensions<5,>=4.12.0
24
23
  Provides-Extra: dev-flake8
25
24
  Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
25
+ Requires-Dist: flake8-datetimez==26.8.1; extra == "dev-flake8"
26
26
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
27
- Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
28
- Requires-Dist: pydoclint==0.7.3; extra == "dev-flake8"
27
+ Requires-Dist: flake8-pyproject==1.2.4; extra == "dev-flake8"
28
+ Requires-Dist: pydoclint==0.9.1; extra == "dev-flake8"
29
29
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
30
30
  Provides-Extra: dev-formatting
31
- Requires-Dist: black==25.1.0; extra == "dev-formatting"
32
- Requires-Dist: isort==6.0.1; extra == "dev-formatting"
31
+ Requires-Dist: black==26.5.1; extra == "dev-formatting"
32
+ Requires-Dist: isort==9.0.1; extra == "dev-formatting"
33
33
  Provides-Extra: dev-mkdocs
34
- Requires-Dist: Markdown==3.8.2; extra == "dev-mkdocs"
35
- Requires-Dist: black==25.1.0; extra == "dev-mkdocs"
36
- Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
37
- Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
38
- Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
39
- Requires-Dist: mkdocs-macros-plugin==1.3.9; extra == "dev-mkdocs"
40
- Requires-Dist: mkdocs-material==9.6.18; extra == "dev-mkdocs"
41
- Requires-Dist: mkdocstrings[python]==0.30.0; extra == "dev-mkdocs"
42
- Requires-Dist: mkdocstrings-python==1.18.2; extra == "dev-mkdocs"
43
- Requires-Dist: frequenz-repo-config[lib]==0.13.5; extra == "dev-mkdocs"
34
+ Requires-Dist: Markdown==3.10.3; extra == "dev-mkdocs"
35
+ Requires-Dist: black==26.5.1; extra == "dev-mkdocs"
36
+ Requires-Dist: mike==2.2.0; extra == "dev-mkdocs"
37
+ Requires-Dist: mkdocs-gen-files==0.6.1; extra == "dev-mkdocs"
38
+ Requires-Dist: mkdocs-literate-nav==0.6.3; extra == "dev-mkdocs"
39
+ Requires-Dist: mkdocs-macros-plugin==1.5.0; extra == "dev-mkdocs"
40
+ Requires-Dist: mkdocs-material==9.7.7; extra == "dev-mkdocs"
41
+ Requires-Dist: mkdocstrings[python]==1.0.6; extra == "dev-mkdocs"
42
+ Requires-Dist: mkdocstrings-python==2.0.7; extra == "dev-mkdocs"
43
+ Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-mkdocs"
44
44
  Provides-Extra: dev-mypy
45
- Requires-Dist: mypy==1.17.1; extra == "dev-mypy"
46
- Requires-Dist: types-Markdown==3.8.0.20250809; extra == "dev-mypy"
45
+ Requires-Dist: mypy==2.3.1; extra == "dev-mypy"
46
+ Requires-Dist: types-Markdown==3.10.2.20260712; extra == "dev-mypy"
47
47
  Requires-Dist: frequenz-quantities[dev-mkdocs,dev-noxfile,dev-pytest,marshmallow]; extra == "dev-mypy"
48
48
  Provides-Extra: dev-noxfile
49
- Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
50
- Requires-Dist: frequenz-repo-config[lib]==0.13.5; extra == "dev-noxfile"
49
+ Requires-Dist: nox==2026.8.17; extra == "dev-noxfile"
50
+ Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-noxfile"
51
51
  Provides-Extra: dev-pylint
52
52
  Requires-Dist: frequenz-quantities[dev-mkdocs,dev-noxfile,dev-pytest,marshmallow]; extra == "dev-pylint"
53
53
  Provides-Extra: dev-pytest
54
- Requires-Dist: pytest==8.4.1; extra == "dev-pytest"
55
- Requires-Dist: pylint==3.3.8; extra == "dev-pytest"
56
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.5; extra == "dev-pytest"
57
- Requires-Dist: pytest-mock==3.14.1; extra == "dev-pytest"
58
- Requires-Dist: pytest-asyncio==1.1.0; extra == "dev-pytest"
59
- Requires-Dist: async-solipsism==0.8; extra == "dev-pytest"
60
- Requires-Dist: hypothesis==6.138.13; extra == "dev-pytest"
54
+ Requires-Dist: pytest==9.1.1; extra == "dev-pytest"
55
+ Requires-Dist: pylint==4.0.8; extra == "dev-pytest"
56
+ Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.19.0; extra == "dev-pytest"
57
+ Requires-Dist: pytest-mock==3.15.1; extra == "dev-pytest"
58
+ Requires-Dist: pytest-asyncio==1.4.0; extra == "dev-pytest"
59
+ Requires-Dist: async-solipsism==0.9; extra == "dev-pytest"
60
+ Requires-Dist: hypothesis==6.165.10; extra == "dev-pytest"
61
61
  Requires-Dist: frequenz-quantities[marshmallow]; extra == "dev-pytest"
62
62
  Provides-Extra: marshmallow
63
- Requires-Dist: marshmallow<5,>=3.0.0; extra == "marshmallow"
63
+ Requires-Dist: marshmallow<5,>=4; extra == "marshmallow"
64
64
  Requires-Dist: marshmallow-dataclass<9,>=8.0.0; extra == "marshmallow"
65
65
  Provides-Extra: dev
66
66
  Requires-Dist: frequenz-quantities[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest,marshmallow]; extra == "dev"
@@ -85,6 +85,53 @@ converting one of them.
85
85
  Quantities store the value in a base unit, and then provide methods to get that
86
86
  quantity as a particular unit.
87
87
 
88
+ ## Installation
89
+
90
+ ### Using `pip`
91
+
92
+ ```bash
93
+ python3 -m pip install frequenz-quantities
94
+ ```
95
+
96
+ ### Using `pyproject.toml`
97
+
98
+ Add this to your `pyproject.toml` file:
99
+
100
+ ```toml
101
+ [project]
102
+ dependencies = [
103
+ "frequenz-quantities >= 1.0.0, < 2"
104
+ ]
105
+ ```
106
+
107
+ > [!NOTE]
108
+ > We recommend pinning the dependency to the latest version for programs,
109
+ > like `"frequenz-quantities == 1.0.0"`, and specifying a version range
110
+ > spanning one major version for libraries, like `"frequenz-quantities >= 1.0.0, < 2"`.
111
+ > We follow [semver](https://semver.org/).
112
+
113
+ ## Quick Start
114
+
115
+ ```python
116
+ from frequenz.quantities import Power, Current, Voltage
117
+
118
+ # Create quantities using unit-specific constructors
119
+ power = Power.from_watts(1500.0)
120
+ current = Current.from_amperes(10.0)
121
+ voltage = Voltage.from_volts(230.0)
122
+
123
+ # Perform operations between quantities
124
+ total_power = power + Power.from_kilowatts(2.0)
125
+ print(f"Total power: {total_power}") # Total power: 3500 W
126
+
127
+ # Convert to different units
128
+ print(f"Power in kW: {total_power.as_kilowatts()}") # Power in kW: 3.5
129
+
130
+ # Type safety prevents invalid operations
131
+ # This would raise a TypeError:
132
+ # invalid = power + current # Can't add power and current!
133
+ ```
134
+
88
135
  ## Documentation
89
136
 
90
137
  For more information on how to use this library and examples, please check the
@@ -17,6 +17,53 @@ converting one of them.
17
17
  Quantities store the value in a base unit, and then provide methods to get that
18
18
  quantity as a particular unit.
19
19
 
20
+ ## Installation
21
+
22
+ ### Using `pip`
23
+
24
+ ```bash
25
+ python3 -m pip install frequenz-quantities
26
+ ```
27
+
28
+ ### Using `pyproject.toml`
29
+
30
+ Add this to your `pyproject.toml` file:
31
+
32
+ ```toml
33
+ [project]
34
+ dependencies = [
35
+ "frequenz-quantities >= 1.0.0, < 2"
36
+ ]
37
+ ```
38
+
39
+ > [!NOTE]
40
+ > We recommend pinning the dependency to the latest version for programs,
41
+ > like `"frequenz-quantities == 1.0.0"`, and specifying a version range
42
+ > spanning one major version for libraries, like `"frequenz-quantities >= 1.0.0, < 2"`.
43
+ > We follow [semver](https://semver.org/).
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ from frequenz.quantities import Power, Current, Voltage
49
+
50
+ # Create quantities using unit-specific constructors
51
+ power = Power.from_watts(1500.0)
52
+ current = Current.from_amperes(10.0)
53
+ voltage = Voltage.from_volts(230.0)
54
+
55
+ # Perform operations between quantities
56
+ total_power = power + Power.from_kilowatts(2.0)
57
+ print(f"Total power: {total_power}") # Total power: 3500 W
58
+
59
+ # Convert to different units
60
+ print(f"Power in kW: {total_power.as_kilowatts()}") # Power in kW: 3.5
61
+
62
+ # Type safety prevents invalid operations
63
+ # This would raise a TypeError:
64
+ # invalid = power + current # Can't add power and current!
65
+ ```
66
+
20
67
  ## Documentation
21
68
 
22
69
  For more information on how to use this library and examples, please check the
@@ -0,0 +1,6 @@
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.
@@ -3,9 +3,9 @@
3
3
 
4
4
  [build-system]
5
5
  requires = [
6
- "setuptools == 80.9.0",
7
- "setuptools_scm[toml] == 9.2.0",
8
- "frequenz-repo-config[lib] == 0.13.5",
6
+ "setuptools == 84.0.0",
7
+ "setuptools_scm[toml] == 10.2.1",
8
+ "frequenz-repo-config[lib] == 0.19.0",
9
9
  ]
10
10
  build-backend = "setuptools.build_meta"
11
11
 
@@ -13,7 +13,8 @@ build-backend = "setuptools.build_meta"
13
13
  name = "frequenz-quantities"
14
14
  description = "Types for holding quantities with units"
15
15
  readme = "README.md"
16
- license = { text = "MIT" }
16
+ license = "MIT"
17
+ license-files = ["LICENSE"]
17
18
  keywords = [
18
19
  "frequenz",
19
20
  "python",
@@ -26,14 +27,13 @@ keywords = [
26
27
  classifiers = [
27
28
  "Development Status :: 3 - Alpha",
28
29
  "Intended Audience :: Developers",
29
- "License :: OSI Approved :: MIT License",
30
30
  "Programming Language :: Python :: 3",
31
31
  "Programming Language :: Python :: 3 :: Only",
32
32
  "Topic :: Software Development :: Libraries",
33
33
  "Typing :: Typed",
34
34
  ]
35
35
  requires-python = ">= 3.11, < 4"
36
- dependencies = ["typing-extensions >= 4.6.0, < 5"]
36
+ dependencies = ["typing-extensions >= 4.12.0, < 5"]
37
37
  dynamic = ["version"]
38
38
 
39
39
  [[project.authors]]
@@ -43,49 +43,50 @@ email = "floss@frequenz.com"
43
43
  [project.optional-dependencies]
44
44
  dev-flake8 = [
45
45
  "flake8 == 7.3.0",
46
+ "flake8-datetimez == 26.8.1",
46
47
  "flake8-docstrings == 1.7.0",
47
- "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
48
- "pydoclint == 0.7.3",
48
+ "flake8-pyproject == 1.2.4", # For reading the flake8 config from pyproject.toml
49
+ "pydoclint == 0.9.1",
49
50
  "pydocstyle == 6.3.0",
50
51
  ]
51
- dev-formatting = ["black == 25.1.0", "isort == 6.0.1"]
52
+ dev-formatting = ["black == 26.5.1", "isort == 9.0.1"]
52
53
  dev-mkdocs = [
53
- "Markdown == 3.8.2",
54
- "black == 25.1.0",
55
- "mike == 2.1.3",
56
- "mkdocs-gen-files == 0.5.0",
57
- "mkdocs-literate-nav == 0.6.2",
58
- "mkdocs-macros-plugin == 1.3.9",
59
- "mkdocs-material == 9.6.18",
60
- "mkdocstrings[python] == 0.30.0",
61
- "mkdocstrings-python == 1.18.2",
62
- "frequenz-repo-config[lib] == 0.13.5",
54
+ "Markdown == 3.10.3",
55
+ "black == 26.5.1",
56
+ "mike == 2.2.0",
57
+ "mkdocs-gen-files == 0.6.1",
58
+ "mkdocs-literate-nav == 0.6.3",
59
+ "mkdocs-macros-plugin == 1.5.0",
60
+ "mkdocs-material == 9.7.7",
61
+ "mkdocstrings[python] == 1.0.6",
62
+ "mkdocstrings-python == 2.0.7",
63
+ "frequenz-repo-config[lib] == 0.19.0",
63
64
  ]
64
65
  dev-mypy = [
65
- "mypy == 1.17.1",
66
- "types-Markdown == 3.8.0.20250809",
66
+ "mypy == 2.3.1",
67
+ "types-Markdown == 3.10.2.20260712",
67
68
  # For checking the noxfile, docs/ script, and tests
68
69
  "frequenz-quantities[dev-mkdocs,dev-noxfile,dev-pytest,marshmallow]",
69
70
  ]
70
- dev-noxfile = ["nox == 2025.5.1", "frequenz-repo-config[lib] == 0.13.5"]
71
+ dev-noxfile = ["nox == 2026.8.17", "frequenz-repo-config[lib] == 0.19.0"]
71
72
  dev-pylint = [
72
73
  # dev-pytest already defines a dependency to pylint because of the examples
73
74
  # For checking the noxfile, docs/ script, and tests
74
75
  "frequenz-quantities[dev-mkdocs,dev-noxfile,dev-pytest,marshmallow]",
75
76
  ]
76
77
  dev-pytest = [
77
- "pytest == 8.4.1",
78
- "pylint == 3.3.8", # We need this to check for the examples
79
- "frequenz-repo-config[extra-lint-examples] == 0.13.5",
80
- "pytest-mock == 3.14.1",
81
- "pytest-asyncio == 1.1.0",
82
- "async-solipsism == 0.8",
83
- "hypothesis == 6.138.13",
78
+ "pytest == 9.1.1",
79
+ "pylint == 4.0.8", # We need this to check for the examples
80
+ "frequenz-repo-config[extra-lint-examples] == 0.19.0",
81
+ "pytest-mock == 3.15.1",
82
+ "pytest-asyncio == 1.4.0",
83
+ "async-solipsism == 0.9",
84
+ "hypothesis == 6.165.10",
84
85
  "frequenz-quantities[marshmallow]",
85
86
  ]
86
87
 
87
88
  marshmallow = [
88
- "marshmallow >= 3.0.0, < 5",
89
+ "marshmallow >= 4, < 5",
89
90
  "marshmallow-dataclass >= 8.0.0, < 9",
90
91
  ]
91
92
 
@@ -126,6 +127,9 @@ check-yield-types = false
126
127
  arg-type-hints-in-docstring = false
127
128
  arg-type-hints-in-signature = true
128
129
  allow-init-docstring = true
130
+ check-class-attributes = true
131
+ check-style-mismatch = true
132
+ require-inline-class-var-docs = true
129
133
 
130
134
  [tool.pylint.similarities]
131
135
  ignore-comments = ['yes']
@@ -158,13 +162,15 @@ disable = [
158
162
  ]
159
163
 
160
164
  [tool.pytest.ini_options]
161
- addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv"
165
+ addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning"
162
166
  testpaths = ["tests", "src"]
167
+ asyncio_debug = true
163
168
  asyncio_mode = "auto"
164
169
  asyncio_default_fixture_loop_scope = "function"
165
170
  required_plugins = ["pytest-asyncio", "pytest-mock"]
166
171
 
167
172
  [tool.mypy]
173
+ enable_error_code = ["exhaustive-match"]
168
174
  explicit_package_bases = true
169
175
  namespace_packages = true
170
176
  # This option disables mypy cache, and it is sometimes useful to enable it if
@@ -3,7 +3,7 @@
3
3
 
4
4
  """Types for holding quantities with units.
5
5
 
6
- This library provide types for holding quantities with units. The main goal is to avoid
6
+ This library provides types for holding quantities with units. The main goal is to avoid
7
7
  mistakes while working with different types of quantities, for example avoiding adding
8
8
  a length to a time.
9
9
 
@@ -13,7 +13,7 @@ units, like adding a power in Joules to a power in Watts without converting one
13
13
  Quantities store the value in a base unit, and then provide methods to get that quantity
14
14
  as a particular unit. They can only be constructed using special constructors with the
15
15
  form `Quantity.from_<unit>`, for example
16
- [`Power.from_watts(10.0)`][frequenz.quantities.Power.from_watts].
16
+ [`Power.from_watts(10.0)`][.Power.from_watts].
17
17
 
18
18
  Internally quantities store values as `float`s, so regular [float issues and limitations
19
19
  apply](https://docs.python.org/3/tutorial/floatingpoint.html), although some of them are
@@ -24,19 +24,17 @@ the quantity.
24
24
 
25
25
  This library provides the following types:
26
26
 
27
- - [ApparentPower][frequenz.quantities.ApparentPower]: A quantity representing apparent
28
- power.
29
- - [Current][frequenz.quantities.Current]: A quantity representing an electric current.
30
- - [Energy][frequenz.quantities.Energy]: A quantity representing energy.
31
- - [Frequency][frequenz.quantities.Frequency]: A quantity representing frequency.
32
- - [Percentage][frequenz.quantities.Percentage]: A quantity representing a percentage.
33
- - [Power][frequenz.quantities.Power]: A quantity representing power.
34
- - [ReactivePower][frequenz.quantities.ReactivePower]: A quantity representing reactive
35
- power.
36
- - [Temperature][frequenz.quantities.Temperature]: A quantity representing temperature.
37
- - [Voltage][frequenz.quantities.Voltage]: A quantity representing electric voltage.
38
-
39
- There is also the unitless [Quantity][frequenz.quantities.Quantity] class. All
27
+ - [`ApparentPower`][.ApparentPower]: A quantity representing apparent power.
28
+ - [`Current`][.Current]: A quantity representing an electric current.
29
+ - [`Energy`][.Energy]: A quantity representing energy.
30
+ - [`Frequency`][.Frequency]: A quantity representing frequency.
31
+ - [`Percentage`][.Percentage]: A quantity representing a percentage.
32
+ - [`Power`][.Power]: A quantity representing power.
33
+ - [`ReactivePower`][.ReactivePower]: A quantity representing reactive power.
34
+ - [`Temperature`][.Temperature]: A quantity representing temperature.
35
+ - [`Voltage`][.Voltage]: A quantity representing electric voltage.
36
+
37
+ There is also the unitless [`Quantity`][.Quantity] class. All
40
38
  quantities are subclasses of this class and it can be used as a base to create new
41
39
  quantities. Using the `Quantity` class directly is discouraged, as it doesn't provide
42
40
  any unit conversion methods.
@@ -80,13 +78,12 @@ Example:
80
78
  ```
81
79
 
82
80
  This library also provides an [**experimental** module with marshmallow fields and
83
- a base schema][frequenz.quantities.experimental.marshmallow] to serialize and
81
+ a base schema][.experimental.marshmallow] to serialize and
84
82
  deserialize quantities using the marshmallow library. To use it, you need to make sure
85
83
  to install this package with the `marshmallow` optional dependencies (e.g.
86
84
  `pip install frequenz-quantities[marshmallow]`).
87
85
  """
88
86
 
89
-
90
87
  from ._apparent_power import ApparentPower
91
88
  from ._current import Current
92
89
  from ._energy import Energy
@@ -25,7 +25,7 @@ class ApparentPower(
25
25
  6: "MVA",
26
26
  },
27
27
  ):
28
- """A apparent power quantity.
28
+ """An apparent power quantity.
29
29
 
30
30
  Objects of this type are wrappers around `float` values and are immutable.
31
31
 
@@ -118,34 +118,34 @@ class ApparentPower(
118
118
 
119
119
  @overload
120
120
  def __mul__(self, scalar: float, /) -> Self:
121
- """Scale this power by a scalar.
121
+ """Scale this apparent power by a scalar.
122
122
 
123
123
  Args:
124
- scalar: The scalar by which to scale this power.
124
+ scalar: The scalar by which to scale this apparent power.
125
125
 
126
126
  Returns:
127
- The scaled power.
127
+ The scaled apparent power.
128
128
  """
129
129
 
130
130
  @overload
131
131
  def __mul__(self, percent: Percentage, /) -> Self:
132
- """Scale this power by a percentage.
132
+ """Scale this apparent power by a percentage.
133
133
 
134
134
  Args:
135
- percent: The percentage by which to scale this power.
135
+ percent: The percentage by which to scale this apparent power.
136
136
 
137
137
  Returns:
138
- The scaled power.
138
+ The scaled apparent power.
139
139
  """
140
140
 
141
141
  def __mul__(self, other: float | Percentage, /) -> Self:
142
- """Return a power or energy from multiplying this power by the given value.
142
+ """Scale this apparent power by a scalar or percentage.
143
143
 
144
144
  Args:
145
- other: The scalar, percentage or duration to multiply by.
145
+ other: The scalar or percentage by which to scale this apparent power.
146
146
 
147
147
  Returns:
148
- A power or energy.
148
+ The scaled apparent power.
149
149
  """
150
150
  from ._percentage import Percentage # pylint: disable=import-outside-toplevel
151
151
 
@@ -165,58 +165,58 @@ class ApparentPower(
165
165
  # https://github.com/python/mypy/issues/4985#issuecomment-389692396
166
166
  @overload # type: ignore[override]
167
167
  def __truediv__(self, other: float, /) -> Self:
168
- """Divide this power by a scalar.
168
+ """Divide this apparent power by a scalar.
169
169
 
170
170
  Args:
171
- other: The scalar to divide this power by.
171
+ other: The scalar to divide this apparent power by.
172
172
 
173
173
  Returns:
174
- The divided power.
174
+ The divided apparent power.
175
175
  """
176
176
 
177
177
  @overload
178
178
  def __truediv__(self, other: Self, /) -> float:
179
- """Return the ratio of this power to another.
179
+ """Return the ratio of this apparent power to another.
180
180
 
181
181
  Args:
182
- other: The other power.
182
+ other: The other apparent power.
183
183
 
184
184
  Returns:
185
- The ratio of this power to another.
185
+ The ratio of this apparent power to another.
186
186
  """
187
187
 
188
188
  @overload
189
189
  def __truediv__(self, current: Current, /) -> Voltage:
190
- """Return a voltage from dividing this power by the given current.
190
+ """Return a voltage from dividing this apparent power by the given current.
191
191
 
192
192
  Args:
193
193
  current: The current to divide by.
194
194
 
195
195
  Returns:
196
- A voltage from dividing this power by the a current.
196
+ A voltage from dividing this apparent power by a current.
197
197
  """
198
198
 
199
199
  @overload
200
200
  def __truediv__(self, voltage: Voltage, /) -> Current:
201
- """Return a current from dividing this power by the given voltage.
201
+ """Return a current from dividing this apparent power by the given voltage.
202
202
 
203
203
  Args:
204
204
  voltage: The voltage to divide by.
205
205
 
206
206
  Returns:
207
- A current from dividing this power by a voltage.
207
+ A current from dividing this apparent power by a voltage.
208
208
  """
209
209
 
210
210
  def __truediv__(
211
211
  self, other: float | Self | Current | Voltage, /
212
212
  ) -> Self | float | Voltage | Current:
213
- """Return a current or voltage from dividing this power by the given value.
213
+ """Return a scaled apparent power, ratio, voltage, or current.
214
214
 
215
215
  Args:
216
- other: The scalar, power, current or voltage to divide by.
216
+ other: The scalar, apparent power, current or voltage to divide by.
217
217
 
218
218
  Returns:
219
- A current or voltage from dividing this power by the given value.
219
+ A scaled apparent power, a ratio, a voltage, or a current.
220
220
  """
221
221
  from ._current import Current # pylint: disable=import-outside-toplevel
222
222
  from ._voltage import Voltage # pylint: disable=import-outside-toplevel
@@ -3,7 +3,6 @@
3
3
 
4
4
  """Types for holding quantities with units."""
5
5
 
6
-
7
6
  from __future__ import annotations
8
7
 
9
8
  from typing import TYPE_CHECKING, Self, overload
@@ -3,7 +3,6 @@
3
3
 
4
4
  """Types for holding quantities with units."""
5
5
 
6
-
7
6
  from __future__ import annotations
8
7
 
9
8
  from datetime import timedelta
@@ -97,10 +96,10 @@ class Energy(
97
96
  return self._base_value / 1e6
98
97
 
99
98
  def __mul__(self, other: float | Percentage) -> Self:
100
- """Scale this energy by a percentage.
99
+ """Scale this energy by a scalar or percentage.
101
100
 
102
101
  Args:
103
- other: The percentage by which to scale this energy.
102
+ other: The scalar or percentage by which to scale this energy.
104
103
 
105
104
  Returns:
106
105
  The scaled energy.
@@ -163,13 +162,13 @@ class Energy(
163
162
  def __truediv__(
164
163
  self, other: float | Self | timedelta | Power, /
165
164
  ) -> Self | float | Power | timedelta:
166
- """Return a power or duration from dividing this energy by the given value.
165
+ """Return a scaled energy, ratio, power, or duration.
167
166
 
168
167
  Args:
169
168
  other: The scalar, energy, power or duration to divide by.
170
169
 
171
170
  Returns:
172
- A power or duration from dividing this energy by the given value.
171
+ A scaled energy, a ratio, a power, or a duration.
173
172
  """
174
173
  from ._power import Power # pylint: disable=import-outside-toplevel
175
174
 
@@ -3,7 +3,6 @@
3
3
 
4
4
  """Types for holding quantities with units."""
5
5
 
6
-
7
6
  from datetime import timedelta
8
7
  from typing import Self
9
8
 
@@ -3,7 +3,6 @@
3
3
 
4
4
  """Types for holding quantities with units."""
5
5
 
6
-
7
6
  from typing import Self
8
7
 
9
8
  from ._quantity import NoDefaultConstructible, Quantity
@@ -3,7 +3,6 @@
3
3
 
4
4
  """Types for holding quantities with units."""
5
5
 
6
-
7
6
  from __future__ import annotations
8
7
 
9
8
  from datetime import timedelta
@@ -203,7 +202,7 @@ class Power(
203
202
  current: The current to divide by.
204
203
 
205
204
  Returns:
206
- A voltage from dividing this power by the a current.
205
+ A voltage from dividing this power by a current.
207
206
  """
208
207
 
209
208
  @overload