htmy 0.8.0__tar.gz → 0.8.1__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.

Potentially problematic release.


This version of htmy might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: htmy
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: Async, pure-Python server-side rendering engine.
5
5
  License: MIT
6
6
  Author: Peter Volf
@@ -30,6 +30,7 @@ from .typing import HTMYComponentType as HTMYComponentType
30
30
  from .typing import MutableContext as MutableContext
31
31
  from .typing import Properties as Properties
32
32
  from .typing import PropertyValue as PropertyValue
33
+ from .typing import RendererType as RendererType
33
34
  from .typing import SyncComponent as SyncComponent
34
35
  from .typing import SyncContextProvider as SyncContextProvider
35
36
  from .utils import as_component_sequence as as_component_sequence
@@ -44,6 +44,8 @@ class Renderer:
44
44
  """
45
45
  Renders the given component.
46
46
 
47
+ Implements `htmy.typing.RendererType`.
48
+
47
49
  Arguments:
48
50
  component: The component to render.
49
51
  context: An optional rendering context.
@@ -270,6 +270,8 @@ class Renderer:
270
270
  """
271
271
  Renders the given component.
272
272
 
273
+ Implements `htmy.typing.RendererType`.
274
+
273
275
  Arguments:
274
276
  component: The component to render.
275
277
  context: An optional rendering context.
@@ -65,6 +65,27 @@ ComponentSequence: TypeAlias = list[ComponentType] | tuple[ComponentType, ...]
65
65
  Component: TypeAlias = ComponentType | ComponentSequence
66
66
  """Component type: a single component or a sequence of components."""
67
67
 
68
+
69
+ # -- Renderer
70
+
71
+
72
+ class RendererType(Protocol):
73
+ """Protocol definition for `htmy` renderers."""
74
+
75
+ async def render(self, component: Component, context: Context | None = None) -> str:
76
+ """
77
+ Renders the given component.
78
+
79
+ Arguments:
80
+ component: The component to render.
81
+ context: An optional rendering context.
82
+
83
+ Returns:
84
+ The rendered string.
85
+ """
86
+ ...
87
+
88
+
68
89
  # -- Context providers
69
90
 
70
91
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "htmy"
3
- version = "0.8.0"
3
+ version = "0.8.1"
4
4
  description = "Async, pure-Python server-side rendering engine."
5
5
  authors = ["Peter Volf <do.volfp@gmail.com>"]
6
6
  license = "MIT"
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
File without changes