frequenz-core 1.0.0__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.
- {frequenz_core-1.0.0/src/frequenz_core.egg-info → frequenz_core-1.0.2}/PKG-INFO +1 -1
- frequenz_core-1.0.2/RELEASE_NOTES.md +17 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/id.py +8 -5
- {frequenz_core-1.0.0 → frequenz_core-1.0.2/src/frequenz_core.egg-info}/PKG-INFO +1 -1
- frequenz_core-1.0.0/RELEASE_NOTES.md +0 -14
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/LICENSE +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/MANIFEST.in +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/README.md +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/pyproject.toml +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/setup.cfg +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/__init__.py +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/conftest.py +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/datetime.py +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/math.py +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/module.py +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/py.typed +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz/core/typing.py +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz_core.egg-info/SOURCES.txt +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz_core.egg-info/dependency_links.txt +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz_core.egg-info/requires.txt +0 -0
- {frequenz_core-1.0.0 → frequenz_core-1.0.2}/src/frequenz_core.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Frequenz Core 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
|
+
* `BaseId` will now log instead of raising a warning when a duplicate prefix is detected. This is to fix [a problem with code examples](https://github.com/frequenz-floss/frequenz-repo-config-python/issues/421) being tested using sybil and the class being imported multiple times, which caused the exception to be raised. We first tried to use `warn()` but that complicated the building process for all downstream projects, requiring them to add an exception for exactly this warning.
|
|
@@ -62,8 +62,11 @@ Example: Creating an ID type with a non-standard name
|
|
|
62
62
|
'''
|
|
63
63
|
|
|
64
64
|
|
|
65
|
+
import logging
|
|
65
66
|
from typing import Any, ClassVar, Self, cast
|
|
66
67
|
|
|
68
|
+
_logger = logging.getLogger(__name__)
|
|
69
|
+
|
|
67
70
|
|
|
68
71
|
class BaseId:
|
|
69
72
|
"""A base class for unique identifiers.
|
|
@@ -105,17 +108,17 @@ class BaseId:
|
|
|
105
108
|
**kwargs: Forwarded to the parent's __init_subclass__.
|
|
106
109
|
|
|
107
110
|
Raises:
|
|
108
|
-
ValueError: If the `str_prefix` is already registered by another
|
|
109
|
-
ID type.
|
|
110
111
|
TypeError: If `allow_custom_name` is False and the class name
|
|
111
112
|
does not end with "Id".
|
|
112
113
|
"""
|
|
113
114
|
super().__init_subclass__(**kwargs)
|
|
114
115
|
|
|
115
116
|
if str_prefix in BaseId._registered_prefixes:
|
|
116
|
-
raise
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
# We want to raise an exception here, but currently can't due to
|
|
118
|
+
# https://github.com/frequenz-floss/frequenz-repo-config-python/issues/421
|
|
119
|
+
_logger.warning(
|
|
120
|
+
"Prefix '%s' is already registered. ID prefixes must be unique.",
|
|
121
|
+
str_prefix,
|
|
119
122
|
)
|
|
120
123
|
BaseId._registered_prefixes.add(str_prefix)
|
|
121
124
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Frequenz Core Library Release Notes
|
|
2
|
-
|
|
3
|
-
## Summary
|
|
4
|
-
|
|
5
|
-
This is the initial release of the Frequenz Core Library, which provides a set of fundamental tools and utilities for Python.
|
|
6
|
-
|
|
7
|
-
The library currently includes:
|
|
8
|
-
|
|
9
|
-
- `datetime`: For utilities related to dates and times.
|
|
10
|
-
* `id`: For creating unique system-wide ID types.
|
|
11
|
-
* `math`: For utilities related to math.
|
|
12
|
-
* `typing`: For type annotations and type-checking utilities.
|
|
13
|
-
|
|
14
|
-
But more tools will be added in the future.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|