Skip to content

Commit 7a0523a

Browse files
authored
chore(deps): bump mloda to 0.10.0 (#83)
* chore(deps): bump mloda to 0.10.0 Raise the mloda floor from 0.9.0 to 0.10.0 and refresh the lock. Improvements surfaced by the bump: - MyComputeFramework used `uuid: UUID = uuid4()` as a default. Python evaluates a default once at import, so every instance shared a single uuid. mloda keys compute-framework instances by uuid, so any plugin generated from this template inherited the collision. Default to None and mint a fresh uuid per instance instead. - Modernize the signature to `X | None` per the repo type-hint rule. - Bump the stale mloda version example in the issue template. 0.10.0 needs no migration here: the breaking changes (PROPERTY_MAPPING flattened form, input-feature option forwarding, allow_empty_result) do not touch the template's surface. Full tox gate and pip-audit are green. * test: isolate the plugin registry, modernize the extender hints Adopt the isolated_plugin_registry fixture that mloda 0.10 ships as a pytest plugin (auto-registered, no conftest wiring). The entry-point test called PluginLoader.all(force_reload=True) and mutated the process-global registry with no teardown, leaking into every later test. Also drop the last typing.Set from the example extender, and remove the now-stale "mloda 0.9" version strings from the pyproject comment and README so they cannot drift from the declared floor.
1 parent af663fb commit 7a0523a

8 files changed

Lines changed: 34 additions & 16 deletions

File tree

.github/ISSUE_TEMPLATE/issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ body:
4545
attributes:
4646
label: Environment (optional, bugs only)
4747
description: Python version, OS, mloda version.
48-
placeholder: Python 3.12, Linux, mloda 0.9.0
48+
placeholder: Python 3.12, Linux, mloda 0.10.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ placeholder/
4747

4848
### Plugin discovery
4949

50-
mloda 0.9+ auto-discovers installed plugins via `PluginLoader.all()`, no manual import needed. Each
50+
mloda auto-discovers installed plugins via `PluginLoader.all()`, no manual import needed. Each
5151
`manifest.py` lists its concrete classes (`FEATURE_GROUPS`, `COMPUTE_FRAMEWORKS`, `EXTENDERS`) and
5252
`pyproject.toml` wires them up under `[project.entry-points."mloda.*"]`. Add a plugin by appending
5353
it to the relevant list.

placeholder/compute_frameworks/my_plugin/my_compute_framework.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Example ComputeFramework implementation."""
22

3-
from typing import Optional, Set
43
from uuid import UUID, uuid4
54

65
from mloda.core.abstract_plugins.components.parallelization_modes import ParallelizationMode
@@ -15,8 +14,10 @@ def __init__(
1514
self,
1615
mode: ParallelizationMode = ParallelizationMode.SYNC,
1716
children_if_root: frozenset[UUID] = frozenset(),
18-
uuid: UUID = uuid4(),
19-
function_extender: Optional[Set[Extender]] = None,
17+
uuid: UUID | None = None,
18+
function_extender: set[Extender] | None = None,
2019
) -> None:
2120
"""Initialize with default values for minimal instantiation."""
22-
super().__init__(mode, children_if_root, uuid, function_extender)
21+
# uuid defaults to None, not uuid4(): a default is evaluated once, so every
22+
# instance would otherwise share one id.
23+
super().__init__(mode, children_if_root, uuid or uuid4(), function_extender)

placeholder/compute_frameworks/my_plugin/tests/test_my_compute_framework.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Tests for MyComputeFramework."""
22

3+
from uuid import uuid4
4+
35
from placeholder.compute_frameworks.my_plugin import MyComputeFramework
46
from mloda.provider import ComputeFramework
57

@@ -13,3 +15,14 @@ def test_instantiation() -> None:
1315
"""MyComputeFramework should instantiate with no arguments."""
1416
instance = MyComputeFramework()
1517
assert instance is not None
18+
19+
20+
def test_default_uuid_is_per_instance() -> None:
21+
"""Each instance gets its own uuid; a uuid4() default would be shared by all."""
22+
assert MyComputeFramework().uuid != MyComputeFramework().uuid
23+
24+
25+
def test_explicit_uuid_is_respected() -> None:
26+
"""An explicitly passed uuid is not overwritten."""
27+
given = uuid4()
28+
assert MyComputeFramework(uuid=given).uuid == given

placeholder/extenders/my_plugin/my_extender.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""Example Extender implementation."""
22

3-
from typing import Any, Set
3+
from typing import Any
44

55
from mloda.core.abstract_plugins.function_extender import Extender, ExtenderHook
66

77

88
class MyExtender(Extender):
99
"""Example Extender - rename and customize for your use case."""
1010

11-
def wraps(self) -> Set[ExtenderHook]:
11+
def wraps(self) -> set[ExtenderHook]:
1212
"""Return the set of hooks this extender wraps."""
1313
return set()
1414

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ version = "0.4.0"
1010
description = "TEMPLATE PLACEHOLDER - Do not install directly. This package reserves the name for mloda-plugin-template. See https://github.com/mloda-ai/mloda-plugin-template"
1111
license = "Apache-2.0"
1212
authors = [{ name = "Your Name placeholder", email = "placeholder@placeholder.com" }]
13-
dependencies = ["mloda>=0.9.0", "mloda-testing>=0.3.2"]
13+
dependencies = ["mloda>=0.10.0", "mloda-testing>=0.3.2"]
1414
requires-python = ">=3.10"
1515

16-
# mloda 0.9 discovers installed plugins through these entry points: each resolves to a
16+
# mloda discovers installed plugins through these entry points: each resolves to a
1717
# manifest list of concrete classes. customize.sh rewrites the dotted paths on rename.
1818
[project.entry-points."mloda.feature_groups"]
1919
placeholder = "placeholder.feature_groups.manifest:FEATURE_GROUPS"

tests/test_entry_points.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ def test_entry_points_declared() -> None:
2424
assert any(v.endswith(suffix) for v in values), f"{group}: no entry point ending in {suffix}; got {values}"
2525

2626

27-
def test_plugin_loader_discovers_example_classes() -> None:
28-
"""PluginLoader.all() registers the example classes via entry points, without importing the package."""
27+
def test_plugin_loader_discovers_example_classes(isolated_plugin_registry: PluginRegistry) -> None:
28+
"""PluginLoader.all() registers the example classes via entry points, without importing the package.
29+
30+
isolated_plugin_registry (shipped by mloda as a pytest plugin) restores the process-global
31+
registry on teardown, so this force_reload does not leak into later tests.
32+
"""
2933
PluginLoader.all(force_reload=True)
30-
registered = {cls.__name__ for cls in PluginRegistry.default().registered_classes()}
34+
registered = {cls.__name__ for cls in isolated_plugin_registry.registered_classes()}
3135
assert {"MyFeatureGroup", "MyComputeFramework", "MyExtender"} <= registered

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)