plugantic 0.2.0__tar.gz → 0.2.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.
- {plugantic-0.2.0/src/plugantic.egg-info → plugantic-0.2.2}/PKG-INFO +2 -2
- {plugantic-0.2.0 → plugantic-0.2.2}/README.md +1 -1
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic/_consts.py +1 -1
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic/plugin.py +11 -10
- {plugantic-0.2.0 → plugantic-0.2.2/src/plugantic.egg-info}/PKG-INFO +2 -2
- {plugantic-0.2.0 → plugantic-0.2.2}/LICENSE +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/pyproject.toml +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/setup.cfg +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic/__init__.py +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic/_helpers.py +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic/_types.py +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic.egg-info/SOURCES.txt +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic.egg-info/dependency_links.txt +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic.egg-info/requires.txt +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/src/plugantic.egg-info/top_level.txt +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/test/test_auto_downcast.py +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/test/test_basic_usage.py +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/test/test_combined_usage.py +0 -0
- {plugantic-0.2.0 → plugantic-0.2.2}/test/test_schema_error.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plugantic
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Simplified extendable composition with pydantic
|
|
5
5
|
Author-email: Martin Kunze <martin@martinkunze.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/martinkunze/plugantic
|
|
@@ -316,7 +316,7 @@ uv build
|
|
|
316
316
|
> 💡 This section is primarily relevant for the maintainers of this package (me), as it requires permission to push a package to the `plugantic` repository on PyPI.
|
|
317
317
|
|
|
318
318
|
```bash
|
|
319
|
-
uv
|
|
319
|
+
uv publish --token <token>
|
|
320
320
|
```
|
|
321
321
|
|
|
322
322
|
</details>
|
|
@@ -300,7 +300,7 @@ uv build
|
|
|
300
300
|
> 💡 This section is primarily relevant for the maintainers of this package (me), as it requires permission to push a package to the `plugantic` repository on PyPI.
|
|
301
301
|
|
|
302
302
|
```bash
|
|
303
|
-
uv
|
|
303
|
+
uv publish --token <token>
|
|
304
304
|
```
|
|
305
305
|
|
|
306
306
|
</details>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# Single source of truth for information needed at runtime and build-time (i.e. version)
|
|
2
|
-
version = "0.2.
|
|
2
|
+
version = "0.2.2"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing_extensions import ClassVar, Type, Self, Literal, Any, TypeVar, Set, Self, get_type_hints, get_origin, get_args
|
|
1
|
+
from typing_extensions import ClassVar, Type, Self, Literal, Any, TypeVar, Set, Self, get_type_hints, get_origin, get_args, TYPE_CHECKING
|
|
2
2
|
from pydantic import BaseModel, GetCoreSchemaHandler, Field, ConfigDict, model_validator
|
|
3
3
|
from pydantic.fields import FieldInfo
|
|
4
4
|
from pydantic_core.core_schema import tagged_union_schema, union_schema
|
|
@@ -47,14 +47,15 @@ class PluginModel(BaseModel, metaclass=PluganticModelMeta):
|
|
|
47
47
|
|
|
48
48
|
model_config: ClassVar[PluganticConfigDict] = PluganticConfigDict()
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
if not TYPE_CHECKING:
|
|
51
|
+
def __init__(self, *args, **kwargs):
|
|
52
|
+
declared_type = self._get_declared_type() # inject the default discriminator value if not provided
|
|
53
|
+
if declared_type:
|
|
54
|
+
kwargs = {
|
|
55
|
+
self.__plugantic_varname_type__: declared_type,
|
|
56
|
+
**kwargs
|
|
57
|
+
}
|
|
58
|
+
super().__init__(*args, **kwargs)
|
|
58
59
|
|
|
59
60
|
def __init_subclass__(cls, *,
|
|
60
61
|
varname_type: str|None=None,
|
|
@@ -138,7 +139,7 @@ class PluginModel(BaseModel, metaclass=PluganticModelMeta):
|
|
|
138
139
|
annotation = None
|
|
139
140
|
try:
|
|
140
141
|
annotation = get_type_hints(cls).get(name, None)
|
|
141
|
-
except NameError:
|
|
142
|
+
except (NameError, TypeError):
|
|
142
143
|
pass
|
|
143
144
|
if not annotation:
|
|
144
145
|
field = cls.model_fields.get(name, None)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plugantic
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Simplified extendable composition with pydantic
|
|
5
5
|
Author-email: Martin Kunze <martin@martinkunze.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/martinkunze/plugantic
|
|
@@ -316,7 +316,7 @@ uv build
|
|
|
316
316
|
> 💡 This section is primarily relevant for the maintainers of this package (me), as it requires permission to push a package to the `plugantic` repository on PyPI.
|
|
317
317
|
|
|
318
318
|
```bash
|
|
319
|
-
uv
|
|
319
|
+
uv publish --token <token>
|
|
320
320
|
```
|
|
321
321
|
|
|
322
322
|
</details>
|
|
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
|