pluginkit 0.4.1__tar.gz → 0.4.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.
- pluginkit-0.4.2/LICENSE +21 -0
- {pluginkit-0.4.1 → pluginkit-0.4.2}/PKG-INFO +5 -5
- {pluginkit-0.4.1 → pluginkit-0.4.2}/README.md +1 -1
- {pluginkit-0.4.1 → pluginkit-0.4.2}/pyproject.toml +3 -3
- {pluginkit-0.4.1 → pluginkit-0.4.2}/src/pluginkit/aio.py +2 -2
- {pluginkit-0.4.1 → pluginkit-0.4.2}/src/pluginkit/manager.py +18 -2
- {pluginkit-0.4.1 → pluginkit-0.4.2}/src/pluginkit/__init__.py +0 -0
- {pluginkit-0.4.1 → pluginkit-0.4.2}/src/pluginkit/exceptions.py +0 -0
- {pluginkit-0.4.1 → pluginkit-0.4.2}/src/pluginkit/markers.py +0 -0
- {pluginkit-0.4.1 → pluginkit-0.4.2}/src/pluginkit/py.typed +0 -0
pluginkit-0.4.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Morten Hansen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pluginkit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A strictly-typed, generics-first plugin framework for Python 3.13: hooks with derived return types
|
|
5
5
|
Keywords: plugins,hooks,protocol,entry-points
|
|
6
6
|
Author: Morten Hansen
|
|
7
7
|
Author-email: Morten Hansen <morten@winterop.com>
|
|
8
|
-
License: MIT
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
9
10
|
Classifier: Development Status :: 4 - Beta
|
|
10
11
|
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
13
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
14
|
Classifier: Typing :: Typed
|
|
@@ -38,7 +38,7 @@ hand-annotations and no drift. Zero runtime dependencies, a `py.typed` marker, a
|
|
|
38
38
|
few readable files.
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
41
|
+
uv add pluginkit # or: pip install pluginkit
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
```python
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pluginkit"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.2"
|
|
4
4
|
description = "A strictly-typed, generics-first plugin framework for Python 3.13: hooks with derived return types"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Morten Hansen", email = "morten@winterop.com" }]
|
|
7
|
-
license =
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
8
9
|
requires-python = ">=3.13"
|
|
9
10
|
keywords = ["plugins", "hooks", "protocol", "entry-points"]
|
|
10
11
|
classifiers = [
|
|
11
12
|
"Development Status :: 4 - Beta",
|
|
12
13
|
"Intended Audience :: Developers",
|
|
13
|
-
"License :: OSI Approved :: MIT License",
|
|
14
14
|
"Programming Language :: Python :: 3.13",
|
|
15
15
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
16
16
|
"Typing :: Typed",
|
|
@@ -29,11 +29,11 @@ from pluginkit.markers import (
|
|
|
29
29
|
class AsyncHookCaller(HookCaller):
|
|
30
30
|
"""A HookCaller whose calls are coroutines that await async implementations."""
|
|
31
31
|
|
|
32
|
-
async def __call__(self, **kwargs: Any) -> Any:
|
|
32
|
+
async def __call__(self, *args: Any, **kwargs: Any) -> Any:
|
|
33
33
|
"""Await the hook: a list, a single value (firstresult), or the threaded value (pipeline)."""
|
|
34
34
|
if self.spec.historic:
|
|
35
35
|
raise TypeError(f"historic hook {self.name!r} must be called via call_historic()")
|
|
36
|
-
kwargs = self.check_arguments(kwargs)
|
|
36
|
+
kwargs = self.check_arguments(self._bind(args, kwargs))
|
|
37
37
|
return await self._execute_async(kwargs, self._nonwrappers)
|
|
38
38
|
|
|
39
39
|
async def call_extra(self, functions: list[Callable[..., Any]], kwargs: dict[str, Any]) -> Any:
|
|
@@ -160,11 +160,27 @@ class HookCaller:
|
|
|
160
160
|
extra.append(impl)
|
|
161
161
|
return extra
|
|
162
162
|
|
|
163
|
-
def
|
|
163
|
+
def _bind(self, args: tuple[Any, ...], kwargs: dict[str, Any]) -> dict[str, Any]:
|
|
164
|
+
"""Bind positional args to the spec's params (in order) and merge with kwargs.
|
|
165
|
+
|
|
166
|
+
Lets a typed caller be invoked positionally - `caller(value)` as well as
|
|
167
|
+
`caller(name=value)` - matching what the ParamSpec advertises.
|
|
168
|
+
"""
|
|
169
|
+
if not args:
|
|
170
|
+
return kwargs
|
|
171
|
+
if len(args) > len(self.params):
|
|
172
|
+
raise TypeError(f"hook {self.name!r} takes at most {len(self.params)} positional argument(s)")
|
|
173
|
+
positional = dict(zip(self.params, args, strict=False))
|
|
174
|
+
clash = positional.keys() & kwargs.keys()
|
|
175
|
+
if clash:
|
|
176
|
+
raise TypeError(f"hook {self.name!r} got multiple values for {sorted(clash)}")
|
|
177
|
+
return {**positional, **kwargs}
|
|
178
|
+
|
|
179
|
+
def __call__(self, *args: Any, **kwargs: Any) -> Any:
|
|
164
180
|
"""Call the hook: a list, a single value (firstresult), or the threaded value (pipeline)."""
|
|
165
181
|
if self.spec.historic:
|
|
166
182
|
raise TypeError(f"historic hook {self.name!r} must be called via call_historic()")
|
|
167
|
-
kwargs = self.check_arguments(kwargs)
|
|
183
|
+
kwargs = self.check_arguments(self._bind(args, kwargs))
|
|
168
184
|
return self._execute(kwargs, self._nonwrappers)
|
|
169
185
|
|
|
170
186
|
def call_extra(self, functions: list[Callable[..., Any]], kwargs: dict[str, Any]) -> Any:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|