Skip to content

Commit ec908c4

Browse files
authored
Merge pull request #165 from uhd-urz/dev
Apply hotfix for bill-teams
2 parents 267bf9d + 32cc1e7 commit ec908c4

File tree

4 files changed

+45
-24
lines changed

4 files changed

+45
-24
lines changed

CHANGELOG.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.4.3] - 2025-09-22
9+
10+
This is a hotfix release. See the **version 2.4.2 changelog below** for the new changes.
11+
12+
### Fixed
13+
14+
- Fix how type for `ConfigurationValidation` argument is validated that affects `bill-teams` plugin
15+
816
## [2.4.2] - 2025-09-22
917

1018
This release brings some minor bug fixes and improvements.
1119

1220
### Added
1321

14-
- elAPI `whoami` that shows information about the eLab user (see [documentation](https://github.com/uhd-urz/elAPI/tree/main?tab=readme-ov-file#elapi-whoami))
15-
- New configuration field `async_capacity` that lets you the maximum number of in-flight requests (see [documentation](https://github.com/uhd-urz/elAPI/tree/dev?tab=readme-ov-file#configuration))
22+
- elAPI `whoami` that shows information about the eLab user (
23+
see [documentation](https://github.com/uhd-urz/elAPI/tree/main?tab=readme-ov-file#elapi-whoami))
24+
- New configuration field `async_capacity` that lets you the maximum number of in-flight requests (
25+
see [documentation](https://github.com/uhd-urz/elAPI/tree/dev?tab=readme-ov-file#configuration))
1626
- Improved `bill-teams` retry strategy that uses `async_capacity`
1727

1828
### Fixed
@@ -21,19 +31,20 @@ This release brings some minor bug fixes and improvements.
2131

2232
### Changes
2333

24-
- Replace HTTPX's back-end with `aiohttp`. This fixes #162.
34+
- Replace HTTPX's back-end with `aiohttp`. This fixes #162.
2535

2636
## [2.4.1] - 2025-08-26
2737

2838
> [!NOTE]
2939
> This release deprecates support for Python versions 3.9 and 3.10.
3040
31-
This is a hotfix release. See the [version 2.4.0 changelog](https://github.com/uhd-urz/elAPI/releases/tag/v2.4.0) for the new changes.
41+
This is a hotfix release. See the [version 2.4.0 changelog](https://github.com/uhd-urz/elAPI/releases/tag/v2.4.0) for
42+
the new changes.
3243

3344
### Fixed
3445

35-
- Rollback [httpx-limiter](https://midnighter.github.io/httpx-limiter/) to version 0.3.0. The version 0.4.0 would break elAPI support on Pyodide (see GH #160)
36-
46+
- Rollback [httpx-limiter](https://midnighter.github.io/httpx-limiter/) to version 0.3.0. The version 0.4.0 would break
47+
elAPI support on Pyodide (see GH #160)
3748

3849
## [2.4.0] - 2025-08-25
3950

@@ -44,10 +55,13 @@ This release brings general bug fixes and a few major improvements.
4455

4556
### Added
4657

47-
- The `mail` built-in plugin that is able to scan logs and send emails based on pre-configured trigger conditions (see [documentation](https://github.com/uhd-urz/elAPI/tree/main?tab=readme-ov-file#mail-built-in-plugin))
48-
- New configuration field `async_rate_limit` that lets you control requests per second (see [documentation](https://github.com/uhd-urz/elAPI/tree/dev?tab=readme-ov-file#configuration))
58+
- The `mail` built-in plugin that is able to scan logs and send emails based on pre-configured trigger conditions (
59+
see [documentation](https://github.com/uhd-urz/elAPI/tree/main?tab=readme-ov-file#mail-built-in-plugin))
60+
- New configuration field `async_rate_limit` that lets you control requests per second (
61+
see [documentation](https://github.com/uhd-urz/elAPI/tree/dev?tab=readme-ov-file#configuration))
4962
- Global callback mechanisms (GH https://github.com/uhd-urz/elAPI/pull/156/; see "Callback classes")
50-
- `add_logging_level` to add new logging levels (see [documentation](https://haggis.readthedocs.io/en/stable/api.html#haggis.logs.add_logging_level))
63+
- `add_logging_level` to add new logging levels (
64+
see [documentation](https://haggis.readthedocs.io/en/stable/api.html#haggis.logs.add_logging_level))
5165

5266
### Fixed
5367

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "elapi"
3-
version = "2.4.2"
3+
version = "2.4.3"
44
description = "elAPI is a powerful, extensible API client for eLabFTW."
55
authors = [{ name = "Alexander Haller, Mahadi Xion", email = "elabftw@uni-heidelberg.de" }]
66
requires-python = ">=3.11.0,<4"

src/elapi/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.2
1+
2.4.3

src/elapi/configuration/validators.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from dynaconf.utils.boxing import DynaBox
77

8+
from .._names import APP_NAME
89
from ..configuration.config import CANON_YAML_EXTENSION, CONFIG_FILE_NAME
910
from ..core_validators import (
1011
CriticalValidationError,
@@ -15,15 +16,18 @@
1516
Validator,
1617
)
1718
from ..loggers import DefaultLogLevels, Logger
19+
from ..path import ProperPath
1820
from ..styles import Missing, stdout_console
1921
from ..styles.highlight import NoteText
2022
from ..utils import add_message
2123
from ._config_history import FieldValueWithKey, MinimalActiveConfiguration
2224
from .config import (
25+
_XDG_DOWNLOAD_DIR,
2326
ASYNC_CAPACITY_DEFAULT_VAL,
2427
ASYNC_RATE_LIMIT_DEFAULT_VAL,
2528
DEVELOPMENT_MODE_DEFAULT_VAL,
2629
ENABLE_HTTP2_DEFAULT_VAL,
30+
FALLBACK_EXPORT_DIR,
2731
KEY_ASYNC_CAPACITY,
2832
KEY_ASYNC_RATE_LIMIT,
2933
KEY_DEVELOPMENT_MODE,
@@ -48,14 +52,14 @@ def __init__(self, minimal_active_config_obj: MinimalActiveConfiguration, /):
4852
self.active_configuration = minimal_active_config_obj
4953

5054
@property
51-
def active_configuration(self) -> MinimalActiveConfiguration:
55+
def active_configuration(self) -> MinimalActiveConfiguration | dict:
5256
return self._active_configuration
5357

5458
@active_configuration.setter
55-
def active_configuration(self, value: MinimalActiveConfiguration):
56-
if not isinstance(value, MinimalActiveConfiguration):
59+
def active_configuration(self, value: MinimalActiveConfiguration | dict):
60+
if not isinstance(value, (MinimalActiveConfiguration, dict)):
5761
raise TypeError(
58-
f"Value must be an instance of {MinimalActiveConfiguration.__name__}."
62+
f"Value must be an instance of dict or {MinimalActiveConfiguration.__name__}."
5963
)
6064
self._active_configuration = value
6165

@@ -68,6 +72,7 @@ def __init__(self, *args):
6872
super().__init__(*args)
6973

7074
def validate(self) -> str:
75+
self.active_configuration: MinimalActiveConfiguration
7176
_HOST_EXAMPLE: str = f"{KEY_HOST.lower()}: 'https://demo.elabftw.net/api/v2'"
7277

7378
if isinstance(self.active_configuration.get_value(KEY_HOST), Missing):
@@ -126,10 +131,9 @@ def __init__(self, *args):
126131
super().__init__(*args)
127132

128133
def validate(self) -> str:
129-
from ..loggers import Logger
130134
from .config import KEY_API_TOKEN
131135

132-
logger = Logger()
136+
self.active_configuration: MinimalActiveConfiguration
133137
if isinstance(self.active_configuration.get_value(KEY_API_TOKEN), Missing):
134138
logger.critical(
135139
f"'{KEY_API_TOKEN.lower()}' is missing from configuration file."
@@ -197,10 +201,10 @@ def __init__(self, *args):
197201
super().__init__(*args)
198202

199203
def validate(self) -> Path:
204+
self.active_configuration: MinimalActiveConfiguration
205+
200206
def get_validated_fallback():
201-
from .._names import APP_NAME
202-
from ..path import ProperPath
203-
from .config import _XDG_DOWNLOAD_DIR, FALLBACK_EXPORT_DIR
207+
global FALLBACK_EXPORT_DIR, _XDG_DOWNLOAD_DIR, ProperPath
204208

205209
ACTUAL_FALLBACK_EXPORT_DIR = FALLBACK_EXPORT_DIR
206210
if _XDG_DOWNLOAD_DIR is not None:
@@ -274,9 +278,6 @@ def __init__(self, *args, key_name: str, fallback_value: bool):
274278
self.fallback_value = fallback_value
275279

276280
def validate(self) -> bool:
277-
from ..loggers import Logger
278-
279-
logger = Logger()
280281
if isinstance(
281282
value := self.active_configuration.get_value(self.key_name), Missing
282283
):
@@ -312,7 +313,9 @@ def __init__(
312313
self.fallback_value = fallback_value
313314
self.allow_none = allow_none
314315

315-
def validate(self) -> float:
316+
def validate(self) -> Optional[float]:
317+
self.active_configuration: MinimalActiveConfiguration
318+
316319
if isinstance(
317320
value := self.active_configuration.get_value(self.key_name), Missing
318321
):
@@ -349,6 +352,8 @@ def __init__(
349352
self.allow_none = allow_none
350353

351354
def validate(self) -> Optional[int]:
355+
self.active_configuration: MinimalActiveConfiguration
356+
352357
if isinstance(
353358
value := self.active_configuration.get_value(self.key_name), Missing
354359
):
@@ -380,7 +385,9 @@ def __init__(self, *args, key_name: str, fallback_value: dict):
380385
self.fallback_value = fallback_value
381386

382387
def validate(self) -> dict:
388+
self.active_configuration: MinimalActiveConfiguration
383389
value: DynaBox = self.active_configuration.get_value(self.key_name)
390+
384391
if isinstance(value, Missing):
385392
return self.fallback_value
386393
if value is None:

0 commit comments

Comments
 (0)