pyview-web 0.0.8a0__py3-none-any.whl → 0.0.9a0__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.

Potentially problematic release.


This version of pyview-web might be problematic. Click here for more details.

pyview/auth/required.py CHANGED
@@ -4,8 +4,14 @@ from starlette.websockets import WebSocket
4
4
  from starlette.authentication import requires as starlette_requires, has_required_scope
5
5
  from .provider import AuthProvider, AuthProviderFactory
6
6
  from pyview import LiveView
7
+ import sys
7
8
 
8
- _CallableType = typing.TypeVar("_CallableType", bound=typing.Callable)
9
+ if sys.version_info >= (3, 10): # pragma: no cover
10
+ from typing import ParamSpec
11
+ else: # pragma: no cover
12
+ from typing_extensions import ParamSpec
13
+
14
+ _P = ParamSpec("_P")
9
15
 
10
16
 
11
17
  @dataclass
@@ -14,10 +20,12 @@ class RequiredScopeAuthProvider(AuthProvider):
14
20
  status_code: int = 403
15
21
  redirect: typing.Optional[str] = None
16
22
 
17
- def wrap(self, func: _CallableType) -> _CallableType:
23
+ def wrap(
24
+ self, func: typing.Callable[_P, typing.Any]
25
+ ) -> typing.Callable[_P, typing.Any]:
18
26
  return starlette_requires(self.scopes, self.status_code, self.redirect)(func)
19
27
 
20
- def has_required_auth(self, websocket: WebSocket) -> bool:
28
+ async def has_required_auth(self, websocket: WebSocket) -> bool:
21
29
  return has_required_scope(websocket, self.scopes)
22
30
 
23
31
 
@@ -28,6 +36,8 @@ def requires(
28
36
  ) -> typing.Callable[[type[LiveView]], type[LiveView]]:
29
37
  def decorator(cls: type[LiveView]) -> type[LiveView]:
30
38
  scopes_list = [scopes] if isinstance(scopes, str) else list(scopes)
31
- return AuthProviderFactory.set(cls, RequiredScopeAuthProvider(scopes_list, status_code, redirect))
39
+ return AuthProviderFactory.set(
40
+ cls, RequiredScopeAuthProvider(scopes_list, status_code, redirect)
41
+ )
32
42
 
33
43
  return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyview-web
3
- Version: 0.0.8a0
3
+ Version: 0.0.9a0
4
4
  Summary: LiveView in Python
5
5
  Home-page: https://pyview.rocks
6
6
  License: MIT
@@ -34,7 +34,7 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
34
34
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
35
35
  Classifier: Typing :: Typed
36
36
  Requires-Dist: APScheduler (==3.9.1.post1)
37
- Requires-Dist: fastapi (==0.89.1)
37
+ Requires-Dist: fastapi (==0.111.0)
38
38
  Requires-Dist: itsdangerous (>=2.1.2,<3.0.0)
39
39
  Requires-Dist: markupsafe (>=2.1.2,<3.0.0)
40
40
  Requires-Dist: psutil (>=5.9.4,<6.0.0)
@@ -57,10 +57,22 @@ PyView enables dynamic, real-time web apps, using server-rendered HTML.
57
57
 
58
58
  `pip install pyview-web`
59
59
 
60
+ ## Quickstart
61
+
62
+ There's a [cookiecutter](https://github.com/cookiecutter/cookiecutter) template available
63
+
64
+ ```
65
+ cookiecutter gh:ogrodnek/pyview-cookiecutter
66
+ ```
67
+
60
68
  # Live Examples
61
69
 
62
70
  [https://examples.pyview.rocks/](https://examples.pyview.rocks/)
63
71
 
72
+ ## Other Examples
73
+
74
+ - [pyview AI chat](https://github.com/pyview/pyview-example-ai-chat)
75
+
64
76
  ## Simple Counter
65
77
 
66
78
  [See it live!](https://examples.pyview.rocks/count)
@@ -4,7 +4,7 @@ pyview/assets/package-lock.json,sha256=kFCrEUJc3G7VD7EsBQf6__EKQhaKAok-I5rrwiAoX
4
4
  pyview/assets/package.json,sha256=E6xaX8KMUAektIIedLmI55jGnmlNMSeD2tgKYXWk1vg,151
5
5
  pyview/auth/__init__.py,sha256=vMlirETRhD4va61NOzwg8VY8ep9wVOF96GznJGBmzD0,109
6
6
  pyview/auth/provider.py,sha256=fwriy2JZcOStutVXD-8VlMPAFXjILCM0l08lhTgmuyE,935
7
- pyview/auth/required.py,sha256=4Xat6-LePwm82NhBABnp4KFznxj9rRYU1yevW9u7DRs,1223
7
+ pyview/auth/required.py,sha256=ZtNmLFth9nK39RxDiJkSzArXwS5Cvr55MUAzfJ1F2e0,1418
8
8
  pyview/changesets/__init__.py,sha256=55CLari2JHZtwy4hapHe7CqUyKjcP4dkM_t5d3CY2gU,46
9
9
  pyview/changesets/changesets.py,sha256=B1q1nXwI2iuZZQpE3P2T0PpwI21PHjqcsuIQmkKPCvI,1747
10
10
  pyview/csrf.py,sha256=VIURva9EJqXXYGC7engweh3SwDQCnHlhV2zWdcdnFqc,789
@@ -36,7 +36,7 @@ pyview/vendor/ibis/template.py,sha256=IX9z-Ig13yJyRnMqtB52eiRLe002qdIxnfa7fYEXLq
36
36
  pyview/vendor/ibis/tree.py,sha256=5LAjl3q9iPMZBb6QbKurWj9-QGKLVf11K2_bQotWlUc,2293
37
37
  pyview/vendor/ibis/utils.py,sha256=nLSaxPR9vMphzV9qinlz_Iurv9c49Ps6Knv8vyNlewU,2768
38
38
  pyview/ws_handler.py,sha256=tokN9gtC_Gn1tlPTxfhYGSFfquiSUvD3sHigzjh1gYM,4738
39
- pyview_web-0.0.8a0.dist-info/LICENSE,sha256=M_bADaBm9_MV9llX3lCicksLhwk3eZUjA2srE0uUWr0,1071
40
- pyview_web-0.0.8a0.dist-info/METADATA,sha256=xURzdj61BS-VXiF-eDfi1wO330RonBEhPOb9rThSbR4,4970
41
- pyview_web-0.0.8a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
- pyview_web-0.0.8a0.dist-info/RECORD,,
39
+ pyview_web-0.0.9a0.dist-info/LICENSE,sha256=M_bADaBm9_MV9llX3lCicksLhwk3eZUjA2srE0uUWr0,1071
40
+ pyview_web-0.0.9a0.dist-info/METADATA,sha256=A5xUGWuuj2y8FvzoqsSynuwkD3osTc2ZO1HWzYzUm2U,5220
41
+ pyview_web-0.0.9a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
+ pyview_web-0.0.9a0.dist-info/RECORD,,