msw-plugin-api 0.2.1__py3-none-any.whl

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.
@@ -0,0 +1,61 @@
1
+ """Minimal structural interfaces for MSW plugin packages.
2
+
3
+ Defines runtime-checkable Protocols and a concrete HostSessionInfo dataclass
4
+ so plugins can implement the MSW host-session contract without depending on
5
+ the full murineshiftwork package.
6
+
7
+ Usage in a plugin::
8
+
9
+ from msw_plugin_api import HostSessionInfo, HostSessionProtocol
10
+
11
+ class MyHostSession:
12
+ def attach(self, **kwargs) -> HostSessionInfo: ...
13
+ def start(self) -> None: ...
14
+ def stop(self) -> None: ...
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from dataclasses import dataclass, field
20
+ from typing import Protocol, runtime_checkable
21
+
22
+
23
+ @dataclass
24
+ class HostSessionInfo:
25
+ """Data returned by a host session plugin after attaching.
26
+
27
+ Plugins may return this class directly or return any object whose
28
+ attributes satisfy HostSessionInfoProtocol.
29
+ """
30
+
31
+ backend: str
32
+ acquisition_name: str
33
+ subject: str
34
+ parent_directory: str
35
+ extra: dict[str, object] = field(default_factory=dict)
36
+
37
+
38
+ @runtime_checkable
39
+ class HostSessionInfoProtocol(Protocol):
40
+ """Structural protocol for host session info objects."""
41
+
42
+ backend: str
43
+ acquisition_name: str
44
+ subject: str
45
+ parent_directory: str
46
+ extra: dict[str, object]
47
+
48
+
49
+ @runtime_checkable
50
+ class HostSessionProtocol(Protocol):
51
+ """Structural protocol for MSW host session plugins.
52
+
53
+ Implement this interface (structurally — no import required) and declare::
54
+
55
+ [project.entry-points."msw.host"]
56
+ myplugin = "my_package.session:MyHostSession"
57
+ """
58
+
59
+ def attach(self, **kwargs: object) -> HostSessionInfoProtocol | None: ...
60
+ def start(self) -> None: ...
61
+ def stop(self) -> None: ...
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.2.1'
22
+ __version_tuple__ = version_tuple = (0, 2, 1)
23
+
24
+ __commit_id__ = commit_id = None
File without changes
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: msw-plugin-api
3
+ Version: 0.2.1
4
+ Summary: Minimal structural interfaces for MSW plugin packages
5
+ Project-URL: Homepage, https://github.com/MurineShiftWork/msw-plugin-api
6
+ Project-URL: Issue Tracker, https://github.com/MurineShiftWork/msw-plugin-api/issues
7
+ Author-email: "Lars B. Rollik" <lars@rollik.me>
8
+ License: Copyright (c) 2024-present Lars B. Rollik. All rights reserved.
9
+
10
+ Permission is granted, free of charge, to use, copy, modify, and distribute
11
+ this software and associated documentation files (the "Software") for
12
+ non-commercial research or academic purposes only, subject to the following
13
+ conditions:
14
+
15
+ 1. This copyright notice and permission notice must be included in all copies
16
+ or substantial portions of the Software.
17
+
18
+ 2. Any publication, presentation, or product that uses or builds upon the
19
+ Software must give clear attribution to the original work and its authors.
20
+
21
+ 3. Commercial use is prohibited without a separate written commercial licence
22
+ agreement with the copyright holder. Commercial use means incorporation of
23
+ the Software into anything for which fees or other compensation are charged
24
+ or received, including commercial products and commercial services.
25
+
26
+ 4. No patent licence, express or implied, is granted under these terms. Any
27
+ use that would require a patent licence from the copyright holder requires
28
+ a separate written agreement.
29
+
30
+ 5. Redistribution, in source or binary form, is permitted only for
31
+ non-commercial purposes and must retain this notice unmodified.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ IMPLIED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
35
+ DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE
36
+ SOFTWARE OR THE USE OR DEALINGS IN THE SOFTWARE.
37
+
38
+ For commercial or patent licensing enquiries contact: lars@rollik.me
39
+ License-File: LICENSE
40
+ Classifier: Development Status :: 4 - Beta
41
+ Classifier: Intended Audience :: Developers
42
+ Classifier: Intended Audience :: Science/Research
43
+ Classifier: License :: Free for non-commercial use
44
+ Classifier: Operating System :: OS Independent
45
+ Classifier: Programming Language :: Python :: 3
46
+ Classifier: Typing :: Typed
47
+ Requires-Python: >=3.10
48
+ Provides-Extra: dev
49
+ Requires-Dist: commitizen; extra == 'dev'
50
+ Requires-Dist: mypy; extra == 'dev'
51
+ Requires-Dist: pre-commit; extra == 'dev'
52
+ Requires-Dist: pytest>=8; extra == 'dev'
53
+ Requires-Dist: ruff; extra == 'dev'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # msw-plugin-api
57
+
58
+ Minimal structural interfaces for [MurineShiftWork](https://github.com/MurineShiftWork/murineshiftwork) plugin packages.
59
+
60
+ Zero dependencies (stdlib `typing` and `dataclasses` only). Provides:
61
+
62
+ - `HostSessionInfo` — concrete dataclass plugins return after attaching
63
+ - `HostSessionInfoProtocol` — `runtime_checkable` Protocol for structural typing
64
+ - `HostSessionProtocol` — `runtime_checkable` Protocol for host session plugins
65
+
66
+ ## Usage
67
+
68
+ ```python
69
+ from msw_plugin_api import HostSessionInfo, HostSessionProtocol
70
+
71
+ class MyHostSession:
72
+ def attach(self, **kwargs) -> HostSessionInfo:
73
+ return HostSessionInfo(
74
+ backend="myplugin",
75
+ acquisition_name="subject__20260609_143022__ext",
76
+ subject="subject",
77
+ parent_directory="/data/recordings",
78
+ )
79
+
80
+ def start(self) -> None: ...
81
+ def stop(self) -> None: ...
82
+ ```
83
+
84
+ Declare the plugin entry point in `pyproject.toml`:
85
+
86
+ ```toml
87
+ [project.entry-points."msw.host"]
88
+ myplugin = "my_package.session:MyHostSession"
89
+ ```
90
+
91
+ ## Plugin contract
92
+
93
+ MSW core checks `isinstance(session, HostSessionProtocol)` at dispatch time.
94
+ Plugins may implement the interface structurally (without importing this package)
95
+ or depend on `msw-plugin-api` explicitly for IDE support and test conformance checks.
@@ -0,0 +1,7 @@
1
+ msw_plugin_api/__init__.py,sha256=5T8Udbwmw6p5wauCFwrgmT_SbXdbwetMgzvL1-BZTn4,1680
2
+ msw_plugin_api/_version.py,sha256=CttnnA3dbvHvGG5cEuWfP0DQ5e_0aiOMkUZSe_ertts,520
3
+ msw_plugin_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ msw_plugin_api-0.2.1.dist-info/METADATA,sha256=pWWcSRYSyB9qQPzwGGjzXU3iCPswk5jTDzHO5Tzr3l0,4046
5
+ msw_plugin_api-0.2.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
6
+ msw_plugin_api-0.2.1.dist-info/licenses/LICENSE,sha256=y94meQ0GJdHwzoJDFhr3dwn8YsSVy9TkdM5H-3_DdpQ,1549
7
+ msw_plugin_api-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,31 @@
1
+ Copyright (c) 2024-present Lars B. Rollik. All rights reserved.
2
+
3
+ Permission is granted, free of charge, to use, copy, modify, and distribute
4
+ this software and associated documentation files (the "Software") for
5
+ non-commercial research or academic purposes only, subject to the following
6
+ conditions:
7
+
8
+ 1. This copyright notice and permission notice must be included in all copies
9
+ or substantial portions of the Software.
10
+
11
+ 2. Any publication, presentation, or product that uses or builds upon the
12
+ Software must give clear attribution to the original work and its authors.
13
+
14
+ 3. Commercial use is prohibited without a separate written commercial licence
15
+ agreement with the copyright holder. Commercial use means incorporation of
16
+ the Software into anything for which fees or other compensation are charged
17
+ or received, including commercial products and commercial services.
18
+
19
+ 4. No patent licence, express or implied, is granted under these terms. Any
20
+ use that would require a patent licence from the copyright holder requires
21
+ a separate written agreement.
22
+
23
+ 5. Redistribution, in source or binary form, is permitted only for
24
+ non-commercial purposes and must retain this notice unmodified.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
28
+ DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE
29
+ SOFTWARE OR THE USE OR DEALINGS IN THE SOFTWARE.
30
+
31
+ For commercial or patent licensing enquiries contact: lars@rollik.me