reflex-google-auth 0.0.8__tar.gz → 0.0.9a1__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.
Files changed (22) hide show
  1. reflex_google_auth-0.0.9a1/.github/workflows/publish.yml +41 -0
  2. reflex_google_auth-0.0.9a1/.gitignore +6 -0
  3. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/PKG-INFO +2 -2
  4. reflex_google_auth-0.0.9a1/custom_components/reflex_google_auth/google_auth.pyi +24 -0
  5. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth.egg-info/PKG-INFO +2 -2
  6. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth.egg-info/SOURCES.txt +10 -1
  7. reflex_google_auth-0.0.9a1/google_auth_demo/.gitignore +5 -0
  8. reflex_google_auth-0.0.9a1/google_auth_demo/assets/favicon.ico +0 -0
  9. reflex_google_auth-0.0.9a1/google_auth_demo/google_auth_demo/__init__.py +0 -0
  10. reflex_google_auth-0.0.9a1/google_auth_demo/google_auth_demo/google_auth_demo.py +84 -0
  11. reflex_google_auth-0.0.9a1/google_auth_demo/requirements.txt +2 -0
  12. reflex_google_auth-0.0.9a1/google_auth_demo/rxconfig.py +5 -0
  13. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/pyproject.toml +5 -2
  14. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/README.md +0 -0
  15. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth/__init__.py +0 -0
  16. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth/decorator.py +0 -0
  17. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth/google_auth.py +0 -0
  18. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth/state.py +0 -0
  19. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth.egg-info/dependency_links.txt +0 -0
  20. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth.egg-info/requires.txt +0 -0
  21. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/custom_components/reflex_google_auth.egg-info/top_level.txt +0 -0
  22. {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a1}/setup.cfg +0 -0
@@ -0,0 +1,41 @@
1
+ name: Publish Component to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "*"
7
+
8
+ jobs:
9
+ publish:
10
+ name: Publish Component to PyPI
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@master
14
+ - name: Set up Python 3.12
15
+ uses: actions/setup-python@v3
16
+ with:
17
+ python-version: "3.12"
18
+ - name: Install package
19
+ run: pip install .
20
+ - name: Publish to PyPI
21
+ run: reflex component publish -t ${{ secrets.PYPI_TOKEN }} --no-share --no-validate-project-info
22
+ deploy:
23
+ name: Deploy Demo App to Reflex Cloud
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@master
27
+ - name: Set up Python 3.12
28
+ uses: actions/setup-python@v3
29
+ with:
30
+ python-version: "3.12"
31
+ - name: Set reflex version for deploy
32
+ run: sed -e "s/^reflex-google-auth[ >=].*$/reflex-google-auth==${{ github.event.release.tag_name }}/" -i google_auth_demo/requirements.txt
33
+ - name: Deploy to ReflexCloud
34
+ uses: reflex-dev/reflex-deploy-action@v2
35
+ with:
36
+ auth_token: ${{ secrets.REFLEX_AUTH_TOKEN }}
37
+ project_id: ${{ secrets.REFLEX_PROJECT_ID }}
38
+ app_directory: google_auth_demo
39
+ extra_args: ${{ env.EXTRA_ARGS }}
40
+ dry_run: ${{ vars.DRY_RUN }}
41
+ skip_checkout: "true"
@@ -0,0 +1,6 @@
1
+ *.db
2
+ *.egg-info/
3
+ *.py[cod]
4
+ .web
5
+ __pycache__/
6
+ dist/
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: reflex-google-auth
3
- Version: 0.0.8
3
+ Version: 0.0.9a1
4
4
  Summary: Sign in with Google
5
5
  Author-email: Masen Furer <m_github@0x26.net>
6
6
  License: Apache-2.0
@@ -0,0 +1,24 @@
1
+ from typing import Any, Dict, Literal, Optional, Union, overload
2
+ from reflex.vars import Var, BaseVar, ComputedVar
3
+ from reflex.event import EventChain, EventHandler, EventSpec
4
+ from reflex.style import Style
5
+ import reflex as rx
6
+ from .state import GoogleAuthState
7
+
8
+ class GoogleOAuthProvider(rx.Component):
9
+
10
+ @overload
11
+ @classmethod
12
+ def create(cls, *children, client_id: Optional[Union[Var[str], str]]=None, style: Optional[Style]=None, key: Optional[Any]=None, id: Optional[Any]=None, class_name: Optional[Any]=None, autofocus: Optional[bool]=None, custom_attrs: Optional[Dict[str, Union[Var, str]]]=None, on_blur: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_click: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_context_menu: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_double_click: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_focus: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mount: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_down: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_move: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_out: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_over: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_up: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_scroll: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_unmount: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, **props) -> 'GoogleOAuthProvider':
13
+ """"""
14
+ ...
15
+ google_oauth_provider = GoogleOAuthProvider.create
16
+
17
+ class GoogleLogin(rx.Component):
18
+
19
+ @overload
20
+ @classmethod
21
+ def create(cls, *children, on_success: Optional[EventHandler[Any]]=None, style: Optional[Style]=None, key: Optional[Any]=None, id: Optional[Any]=None, class_name: Optional[Any]=None, autofocus: Optional[bool]=None, custom_attrs: Optional[Dict[str, Union[Var, str]]]=None, on_blur: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_click: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_context_menu: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_double_click: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_focus: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mount: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_down: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_move: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_out: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_over: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_mouse_up: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_scroll: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_success: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, on_unmount: Optional[Union[EventHandler, EventSpec, list, function, BaseVar]]=None, **props) -> 'GoogleLogin':
22
+ """"""
23
+ ...
24
+ google_login = GoogleLogin.create
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: reflex-google-auth
3
- Version: 0.0.8
3
+ Version: 0.0.9a1
4
4
  Summary: Sign in with Google
5
5
  Author-email: Masen Furer <m_github@0x26.net>
6
6
  License: Apache-2.0
@@ -1,11 +1,20 @@
1
+ .gitignore
1
2
  README.md
2
3
  pyproject.toml
4
+ .github/workflows/publish.yml
3
5
  custom_components/reflex_google_auth/__init__.py
4
6
  custom_components/reflex_google_auth/decorator.py
5
7
  custom_components/reflex_google_auth/google_auth.py
8
+ custom_components/reflex_google_auth/google_auth.pyi
6
9
  custom_components/reflex_google_auth/state.py
7
10
  custom_components/reflex_google_auth.egg-info/PKG-INFO
8
11
  custom_components/reflex_google_auth.egg-info/SOURCES.txt
9
12
  custom_components/reflex_google_auth.egg-info/dependency_links.txt
10
13
  custom_components/reflex_google_auth.egg-info/requires.txt
11
- custom_components/reflex_google_auth.egg-info/top_level.txt
14
+ custom_components/reflex_google_auth.egg-info/top_level.txt
15
+ google_auth_demo/.gitignore
16
+ google_auth_demo/requirements.txt
17
+ google_auth_demo/rxconfig.py
18
+ google_auth_demo/assets/favicon.ico
19
+ google_auth_demo/google_auth_demo/__init__.py
20
+ google_auth_demo/google_auth_demo/google_auth_demo.py
@@ -0,0 +1,5 @@
1
+ *.db
2
+ *.py[cod]
3
+ .web
4
+ __pycache__/
5
+ assets/external/
@@ -0,0 +1,84 @@
1
+ import reflex as rx
2
+
3
+ from reflex_google_auth import (
4
+ GoogleAuthState,
5
+ handle_google_login,
6
+ require_google_login,
7
+ )
8
+
9
+
10
+ class State(GoogleAuthState):
11
+ @rx.var(cache=True)
12
+ def protected_content(self) -> str:
13
+ if self.token_is_valid:
14
+ return f"This content can only be viewed by a logged in User. Nice to see you {self.tokeninfo['name']}"
15
+ return "Not logged in."
16
+
17
+
18
+ def user_info(tokeninfo: rx.vars.ObjectVar) -> rx.Component:
19
+ return rx.hstack(
20
+ rx.avatar(
21
+ src=tokeninfo["picture"],
22
+ fallback=tokeninfo["name"],
23
+ size="5",
24
+ ),
25
+ rx.vstack(
26
+ rx.heading(tokeninfo["name"], size="6"),
27
+ rx.text(tokeninfo["email"]),
28
+ align_items="flex-start",
29
+ ),
30
+ rx.button("Logout", on_click=GoogleAuthState.logout),
31
+ padding="10px",
32
+ )
33
+
34
+
35
+ def index():
36
+ return rx.vstack(
37
+ rx.heading("Google OAuth", size="8"),
38
+ rx.link("Protected Page", href="/protected"),
39
+ rx.link("Partially Protected Page", href="/partially-protected"),
40
+ rx.link("Custom Login Button", href="/custom-button"),
41
+ align="center",
42
+ )
43
+
44
+
45
+ @rx.page(route="/protected")
46
+ @require_google_login
47
+ def protected() -> rx.Component:
48
+ return rx.vstack(
49
+ user_info(GoogleAuthState.tokeninfo),
50
+ rx.text(State.protected_content),
51
+ rx.link("Home", href="/"),
52
+ )
53
+
54
+
55
+ @require_google_login
56
+ def user_name_or_sign_in() -> rx.Component:
57
+ return rx.heading(GoogleAuthState.tokeninfo["name"], size="6")
58
+
59
+
60
+ @rx.page(route="/partially-protected")
61
+ def partially_protected() -> rx.Component:
62
+ return rx.vstack(
63
+ rx.heading("This page is partially protected."),
64
+ rx.text(
65
+ "If you are signed in with google, you should see your name below, otherwise "
66
+ "you will see a sign in button",
67
+ ),
68
+ user_name_or_sign_in(),
69
+ )
70
+
71
+
72
+ @rx.page(route="/custom-button")
73
+ @require_google_login(
74
+ button=rx.button("Google Login 🚀", on_click=handle_google_login())
75
+ )
76
+ def custom_button() -> rx.Component:
77
+ return rx.vstack(
78
+ user_info(GoogleAuthState.tokeninfo),
79
+ "You clicked a custom button to login, nice",
80
+ )
81
+
82
+
83
+ app = rx.App()
84
+ app.add_page(index)
@@ -0,0 +1,2 @@
1
+ reflex>=0.6.6
2
+ reflex-google-auth
@@ -0,0 +1,5 @@
1
+ import reflex as rx
2
+
3
+ config = rx.Config(
4
+ app_name="google_auth_demo",
5
+ )
@@ -1,13 +1,13 @@
1
1
  [build-system]
2
2
  requires = [
3
- "setuptools",
3
+ "setuptools>=64",
4
+ "setuptools_scm>=8",
4
5
  "wheel",
5
6
  ]
6
7
  build-backend = "setuptools.build_meta"
7
8
 
8
9
  [project]
9
10
  name = "reflex-google-auth"
10
- version = "0.0.8"
11
11
  description = "Sign in with Google"
12
12
  readme = "README.md"
13
13
  license = { text = "Apache-2.0" }
@@ -23,6 +23,7 @@ dependencies = [
23
23
  classifiers = [
24
24
  "Development Status :: 4 - Beta",
25
25
  ]
26
+ dynamic = ["version"]
26
27
 
27
28
  [project.urls]
28
29
  homepage = "https://github.com/masenf/reflex-google-auth"
@@ -32,3 +33,5 @@ dev = ["build", "twine"]
32
33
 
33
34
  [tool.setuptools.packages.find]
34
35
  where = ["custom_components"]
36
+
37
+ [tool.setuptools_scm]