Skip to content

Commit

Permalink
Merge branch 'main' into lendemor/stop_ignoring_some_lint_rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor committed Nov 6, 2024
2 parents 3acb55a + 6ea797d commit e5fce22
Show file tree
Hide file tree
Showing 128 changed files with 6,799 additions and 6,731 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@reflex-dev/reflex-team
7 changes: 5 additions & 2 deletions .github/workflows/check_node_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ jobs:
strategy:
matrix:
python-version: ['3.12']
split_index: [1, 2]
node-version: ['node']
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
Expand All @@ -30,11 +33,11 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: |
poetry run uv pip install pyvirtualdisplay pillow
poetry run uv pip install pyvirtualdisplay pillow pytest-split
poetry run playwright install --with-deps
- run: |
poetry run pytest tests/test_node_version.py
poetry run pytest tests/integration
poetry run pytest tests/integration --splits 2 --group ${{matrix.split_index}}


18 changes: 10 additions & 8 deletions .github/workflows/integration_app_harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ concurrency:

on:
push:
branches: ['main']
branches: ["main"]
paths-ignore:
- '**/*.md'
- "**/*.md"
pull_request:
branches: ['main']
branches: ["main"]
paths-ignore:
- '**/*.md'
- "**/*.md"

permissions:
contents: read
Expand All @@ -22,8 +22,10 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
state_manager: ['redis', 'memory']
python-version: ['3.11.5', '3.12.0']
state_manager: ["redis", "memory"]
split_index: [1, 2]
python-version: ["3.11.5", "3.12.0"]
fail-fast: false
runs-on: ubuntu-22.04
services:
# Label used to access the service container
Expand All @@ -45,14 +47,14 @@ jobs:
python-version: ${{ matrix.python-version }}
run-poetry-install: true
create-venv-at-path: .venv
- run: poetry run uv pip install pyvirtualdisplay pillow
- run: poetry run uv pip install pyvirtualdisplay pillow pytest-split
- name: Run app harness tests
env:
SCREENSHOT_DIR: /tmp/screenshots
REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }}
run: |
poetry run playwright install --with-deps
poetry run pytest tests/integration
poetry run pytest tests/integration --splits 2 --group ${{matrix.split_index}}
- uses: actions/upload-artifact@v4
name: Upload failed test screenshots
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:

- name: Install Requirements for reflex-web
working-directory: ./reflex-web
run: poetry run uv pip install -r requirements.txt
run: poetry run uv pip install $(grep -ivE "reflex " requirements.txt)
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
- name: Init Website for reflex-web
Expand Down
14 changes: 8 additions & 6 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Callable,
Coroutine,
Dict,
Generic,
List,
Optional,
Set,
Expand Down Expand Up @@ -69,6 +70,7 @@
from reflex.components.radix import themes
from reflex.config import environment, get_config
from reflex.event import (
BASE_STATE,
Event,
EventHandler,
EventSpec,
Expand Down Expand Up @@ -186,15 +188,15 @@ class OverlayFragment(Fragment):
@dataclasses.dataclass(
frozen=True,
)
class UnevaluatedPage:
class UnevaluatedPage(Generic[BASE_STATE]):
"""An uncompiled page."""

component: Union[Component, ComponentCallable]
route: str
title: Union[Var, str, None]
description: Union[Var, str, None]
image: str
on_load: Union[EventType[[]], None]
on_load: Union[EventType[[], BASE_STATE], None]
meta: List[Dict[str, str]]


Expand Down Expand Up @@ -269,7 +271,7 @@ class App(MiddlewareMixin, LifespanMixin):
_state_manager: Optional[StateManager] = None

# Mapping from a route to event handlers to trigger when the page loads. PRIVATE.
load_events: Dict[str, List[IndividualEventType[[]]]] = dataclasses.field(
load_events: Dict[str, List[IndividualEventType[[], Any]]] = dataclasses.field(
default_factory=dict
)

Expand Down Expand Up @@ -474,7 +476,7 @@ def add_page(
title: str | Var | None = None,
description: str | Var | None = None,
image: str = constants.DefaultPage.IMAGE,
on_load: EventType[[]] | None = None,
on_load: EventType[[], BASE_STATE] | None = None,
meta: list[dict[str, str]] = constants.DefaultPage.META_LIST,
):
"""Add a page to the app.
Expand Down Expand Up @@ -560,7 +562,7 @@ def _compile_page(self, route: str):
self._check_routes_conflict(route)
self.pages[route] = component

def get_load_events(self, route: str) -> list[IndividualEventType[[]]]:
def get_load_events(self, route: str) -> list[IndividualEventType[[], Any]]:
"""Get the load events for a route.
Args:
Expand Down Expand Up @@ -619,7 +621,7 @@ def add_custom_404_page(
title: str = constants.Page404.TITLE,
image: str = constants.Page404.IMAGE,
description: str = constants.Page404.DESCRIPTION,
on_load: EventType[[]] | None = None,
on_load: EventType[[], BASE_STATE] | None = None,
meta: list[dict[str, str]] = constants.DefaultPage.META_LIST,
):
"""Define a custom 404 page for any url having no match.
Expand Down
32 changes: 16 additions & 16 deletions reflex/components/base/app_wrap.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload

from reflex.components.base.fragment import Fragment
from reflex.event import EventType
from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var

Expand All @@ -22,21 +22,21 @@ class AppWrap(Fragment):
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[EventType[[]]] = None,
on_click: Optional[EventType[[]]] = None,
on_context_menu: Optional[EventType[[]]] = None,
on_double_click: Optional[EventType[[]]] = None,
on_focus: Optional[EventType[[]]] = None,
on_mount: Optional[EventType[[]]] = None,
on_mouse_down: Optional[EventType[[]]] = None,
on_mouse_enter: Optional[EventType[[]]] = None,
on_mouse_leave: Optional[EventType[[]]] = None,
on_mouse_move: Optional[EventType[[]]] = None,
on_mouse_out: Optional[EventType[[]]] = None,
on_mouse_over: Optional[EventType[[]]] = None,
on_mouse_up: Optional[EventType[[]]] = None,
on_scroll: Optional[EventType[[]]] = None,
on_unmount: Optional[EventType[[]]] = None,
on_blur: Optional[EventType[[], BASE_STATE]] = None,
on_click: Optional[EventType[[], BASE_STATE]] = None,
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
on_focus: Optional[EventType[[], BASE_STATE]] = None,
on_mount: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AppWrap":
"""Create a new AppWrap component.
Expand Down
32 changes: 16 additions & 16 deletions reflex/components/base/body.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload

from reflex.components.component import Component
from reflex.event import EventType
from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var

Expand All @@ -22,21 +22,21 @@ class Body(Component):
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[EventType[[]]] = None,
on_click: Optional[EventType[[]]] = None,
on_context_menu: Optional[EventType[[]]] = None,
on_double_click: Optional[EventType[[]]] = None,
on_focus: Optional[EventType[[]]] = None,
on_mount: Optional[EventType[[]]] = None,
on_mouse_down: Optional[EventType[[]]] = None,
on_mouse_enter: Optional[EventType[[]]] = None,
on_mouse_leave: Optional[EventType[[]]] = None,
on_mouse_move: Optional[EventType[[]]] = None,
on_mouse_out: Optional[EventType[[]]] = None,
on_mouse_over: Optional[EventType[[]]] = None,
on_mouse_up: Optional[EventType[[]]] = None,
on_scroll: Optional[EventType[[]]] = None,
on_unmount: Optional[EventType[[]]] = None,
on_blur: Optional[EventType[[], BASE_STATE]] = None,
on_click: Optional[EventType[[], BASE_STATE]] = None,
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
on_focus: Optional[EventType[[], BASE_STATE]] = None,
on_mount: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Body":
"""Create the component.
Expand Down
Loading

0 comments on commit e5fce22

Please sign in to comment.