scruby-plugin 0.7.2__py3-none-any.whl → 0.8.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.
- scruby_plugin/plugin.py +4 -0
- {scruby_plugin-0.7.2.dist-info → scruby_plugin-0.8.1.dist-info}/METADATA +11 -3
- scruby_plugin-0.8.1.dist-info/RECORD +7 -0
- scruby_plugin-0.7.2.dist-info/RECORD +0 -7
- {scruby_plugin-0.7.2.dist-info → scruby_plugin-0.8.1.dist-info}/WHEEL +0 -0
- {scruby_plugin-0.7.2.dist-info → scruby_plugin-0.8.1.dist-info}/licenses/LICENSE +0 -0
scruby_plugin/plugin.py
CHANGED
|
@@ -8,6 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
__all__ = ("ScrubyPlugin",)
|
|
9
9
|
|
|
10
10
|
import weakref
|
|
11
|
+
from typing import ClassVar
|
|
11
12
|
|
|
12
13
|
from scruby import Scruby
|
|
13
14
|
|
|
@@ -15,5 +16,8 @@ from scruby import Scruby
|
|
|
15
16
|
class ScrubyPlugin:
|
|
16
17
|
"""Base class for creating Scruby plugins."""
|
|
17
18
|
|
|
19
|
+
# What version of Scruby is the plugin for?
|
|
20
|
+
scruby_version: ClassVar[int] = 0
|
|
21
|
+
|
|
18
22
|
def __init__(self, scruby_self: Scruby) -> None: # noqa: D107
|
|
19
23
|
self.scruby_self = weakref.ref(scruby_self)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scruby-plugin
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Library for creating Scruby plugins.
|
|
5
5
|
Project-URL: Bug Tracker, https://github.com/kebasyaty/scruby-plugin/issues
|
|
6
6
|
Project-URL: Changelog, https://github.com/kebasyaty/scruby-plugin/blob/v0/CHANGELOG.md
|
|
@@ -57,7 +57,12 @@ Library for creating plugins for <a href="https://pypi.org/project/scruby/" alt=
|
|
|
57
57
|
## Installation
|
|
58
58
|
|
|
59
59
|
```shell
|
|
60
|
-
|
|
60
|
+
# For Scruby version 0
|
|
61
|
+
uv add "scruby-plugin>=0.8.1,<1.0.0"
|
|
62
|
+
# For Scruby version 1
|
|
63
|
+
uv add "scruby-plugin>=1.0.0,<2.0.0"
|
|
64
|
+
# For Scruby version 2
|
|
65
|
+
uv add "scruby-plugin>=2.0.0,<3.0.0"
|
|
61
66
|
```
|
|
62
67
|
|
|
63
68
|
## Usage
|
|
@@ -102,7 +107,6 @@ ScrubyConfig.plugins = [
|
|
|
102
107
|
|
|
103
108
|
class Car(ScrubyModel):
|
|
104
109
|
"""Car model."""
|
|
105
|
-
|
|
106
110
|
brand: str = Field(strict=True, frozen=True)
|
|
107
111
|
model: str = Field(strict=True, frozen=True)
|
|
108
112
|
year: int = Field(strict=True)
|
|
@@ -116,6 +120,10 @@ class Car(ScrubyModel):
|
|
|
116
120
|
|
|
117
121
|
|
|
118
122
|
async def main() -> None:
|
|
123
|
+
"""Example."""
|
|
124
|
+
# Activate database.
|
|
125
|
+
Scruby.run(plugins=[CollectionMeta])
|
|
126
|
+
|
|
119
127
|
# Get collection `Car`.
|
|
120
128
|
car_coll = await Scruby.collection(Car)
|
|
121
129
|
# Get metadata of collection
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
scruby_plugin/__init__.py,sha256=kWaqpz4RYNT9Kc9FF6jj0GX1Mppm1uhFfArPY6EYneI,241
|
|
2
|
+
scruby_plugin/plugin.py,sha256=9VsNylr4lLn4IX7WGQMdej56iuMdx9lnQS5kBtfbxQQ,599
|
|
3
|
+
scruby_plugin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
scruby_plugin-0.8.1.dist-info/METADATA,sha256=_bvA8D6CLFQ5mMWy8fUfsFk6s-dFL-fjFJauPYqfI4M,5559
|
|
5
|
+
scruby_plugin-0.8.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
6
|
+
scruby_plugin-0.8.1.dist-info/licenses/LICENSE,sha256=mvh5qv1YJGyuVCkRxonDDNOzxlwXszKvwxXfOeXKrqw,1074
|
|
7
|
+
scruby_plugin-0.8.1.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
scruby_plugin/__init__.py,sha256=kWaqpz4RYNT9Kc9FF6jj0GX1Mppm1uhFfArPY6EYneI,241
|
|
2
|
-
scruby_plugin/plugin.py,sha256=oGhbFBPZ4LaPLsDJO316vV0zJCrUPZ7KTCPAUAV0Rj4,484
|
|
3
|
-
scruby_plugin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
scruby_plugin-0.7.2.dist-info/METADATA,sha256=R8mkWwb58RAhnLcialUsNb2xwQFC7PZAYbIsz796J5Q,5315
|
|
5
|
-
scruby_plugin-0.7.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
6
|
-
scruby_plugin-0.7.2.dist-info/licenses/LICENSE,sha256=mvh5qv1YJGyuVCkRxonDDNOzxlwXszKvwxXfOeXKrqw,1074
|
|
7
|
-
scruby_plugin-0.7.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|