scruby-plugin 0.8.0__py3-none-any.whl → 0.8.2__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 CHANGED
@@ -8,7 +8,7 @@ from __future__ import annotations
8
8
  __all__ = ("ScrubyPlugin",)
9
9
 
10
10
  import weakref
11
- from typing import ClassVar
11
+ from typing import ClassVar, Literal
12
12
 
13
13
  from scruby import Scruby
14
14
 
@@ -17,7 +17,7 @@ class ScrubyPlugin:
17
17
  """Base class for creating Scruby plugins."""
18
18
 
19
19
  # What version of Scruby is the plugin for?
20
- scruby_version: ClassVar[int] = 0
20
+ SCRUBY_VERSION: ClassVar[Literal[0]] = 0
21
21
 
22
22
  def __init__(self, scruby_self: Scruby) -> None: # noqa: D107
23
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.8.0
3
+ Version: 0.8.2
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
- uv add scruby-plugin
60
+ # For Scruby version 0
61
+ uv add "scruby-plugin>=0.8.2,<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
@@ -79,7 +84,7 @@ class PluginName(ScrubyPlugin):
79
84
  import anyio
80
85
  from typing import Any
81
86
  from pydantic import Field
82
- from scruby import Scruby, ScrubyModel
87
+ from scruby import Scruby, ScrubyModel, ScrubyConfig
83
88
  from scruby_plugin import ScrubyPlugin
84
89
  from pprint import pprint as pp
85
90
 
@@ -94,6 +99,12 @@ class CollectionMeta(ScrubyPlugin):
94
99
  return await scruby_self.get_meta()
95
100
 
96
101
 
102
+ # Plugins connection.
103
+ ScrubyConfig.plugins = [
104
+ CollectionMeta,
105
+ ]
106
+
107
+
97
108
  class Car(ScrubyModel):
98
109
  """Car model."""
99
110
  brand: str = Field(strict=True, frozen=True)
@@ -0,0 +1,7 @@
1
+ scruby_plugin/__init__.py,sha256=kWaqpz4RYNT9Kc9FF6jj0GX1Mppm1uhFfArPY6EYneI,241
2
+ scruby_plugin/plugin.py,sha256=CppRJLFDYl6M97gqQL8_0jtaG_6JVftdk6J76PCc03w,615
3
+ scruby_plugin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ scruby_plugin-0.8.2.dist-info/METADATA,sha256=UvO9XatRoZIhq18c9ynRMiiFAe0YjXfYWBKsFipmVoc,5559
5
+ scruby_plugin-0.8.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
6
+ scruby_plugin-0.8.2.dist-info/licenses/LICENSE,sha256=mvh5qv1YJGyuVCkRxonDDNOzxlwXszKvwxXfOeXKrqw,1074
7
+ scruby_plugin-0.8.2.dist-info/RECORD,,
@@ -1,7 +0,0 @@
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.0.dist-info/METADATA,sha256=aFsvvxB1twM3Y0wVelcyjp9nd8fJcZeWuxETSzVe37I,5315
5
- scruby_plugin-0.8.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
6
- scruby_plugin-0.8.0.dist-info/licenses/LICENSE,sha256=mvh5qv1YJGyuVCkRxonDDNOzxlwXszKvwxXfOeXKrqw,1074
7
- scruby_plugin-0.8.0.dist-info/RECORD,,