From 8d5187432f16bb4f613d0f160335f551ad46ee94 Mon Sep 17 00:00:00 2001 From: Simon Young <40179067+Kastier1@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:30:43 -0800 Subject: [PATCH 1/3] add codeowners (#4312) Co-authored-by: simon --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..05cc10ff78 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +@reflex-dev/reflex-team From 54b081c1043c5be5798af97d2cc9d66f49e2cd2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Wed, 6 Nov 2024 09:31:13 -0800 Subject: [PATCH 2/3] allow custom bunfig.toml file (#4280) * allow custom bunfig.toml file * always copy custom bunfig * split tests into half * forgot a space * use different syntax * also split node latest check * turn off failfast for app harness --------- Co-authored-by: Khaleel Al-Adhami --- .github/workflows/check_node_latest.yml | 7 ++++-- .github/workflows/integration_app_harness.yml | 18 +++++++------- reflex/constants/installer.py | 5 ++++ reflex/utils/prerequisites.py | 24 ++++++++++++------- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.github/workflows/check_node_latest.yml b/.github/workflows/check_node_latest.yml index 5910fa9edf..1cf9f6fdf2 100644 --- a/.github/workflows/check_node_latest.yml +++ b/.github/workflows/check_node_latest.yml @@ -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 @@ -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}} diff --git a/.github/workflows/integration_app_harness.yml b/.github/workflows/integration_app_harness.yml index c868935568..ee9394b7ea 100644 --- a/.github/workflows/integration_app_harness.yml +++ b/.github/workflows/integration_app_harness.yml @@ -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 @@ -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 @@ -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() diff --git a/reflex/constants/installer.py b/reflex/constants/installer.py index 26a53f2d8a..42084bb4d0 100644 --- a/reflex/constants/installer.py +++ b/reflex/constants/installer.py @@ -75,6 +75,11 @@ def DEFAULT_PATH(cls): """ return cls.ROOT_PATH / "bin" / ("bun" if not IS_WINDOWS else "bun.exe") + DEFAULT_CONFIG = """ +[install] +registry = {registry} +""" + # FNM config. class Fnm(SimpleNamespace): diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index 063c2f5943..a712e9a38b 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -598,6 +598,8 @@ def initialize_web_directory(): initialize_package_json() + initialize_bun_config() + path_ops.mkdir(get_web_dir() / constants.Dirs.PUBLIC) update_next_config() @@ -622,17 +624,21 @@ def _compile_package_json(): def initialize_package_json(): """Render and write in .web the package.json file.""" output_path = get_web_dir() / constants.PackageJson.PATH - code = _compile_package_json() - output_path.write_text(code) + output_path.write_text(_compile_package_json()) + - best_registry = _get_npm_registry() +def initialize_bun_config(): + """Initialize the bun config file.""" bun_config_path = get_web_dir() / constants.Bun.CONFIG_PATH - bun_config_path.write_text( - f""" -[install] -registry = "{best_registry}" -""" - ) + + if (custom_bunfig := Path(constants.Bun.CONFIG_PATH)).exists(): + bunfig_content = custom_bunfig.read_text() + console.info(f"Copying custom bunfig.toml inside {get_web_dir()} folder") + else: + best_registry = _get_npm_registry() + bunfig_content = constants.Bun.DEFAULT_CONFIG.format(registry=best_registry) + + bun_config_path.write_text(bunfig_content) def init_reflex_json(project_hash: int | None): From 8a4701143ea29afa7d9523bf992f48790875c3ec Mon Sep 17 00:00:00 2001 From: Carlos <36110765+carlosabadia@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:49:09 +0100 Subject: [PATCH 3/3] add toast classname prop (#4310) --- reflex/components/sonner/toast.py | 3 +++ reflex/components/sonner/toast.pyi | 1 + 2 files changed, 4 insertions(+) diff --git a/reflex/components/sonner/toast.py b/reflex/components/sonner/toast.py index c226c7bd03..c7db55a407 100644 --- a/reflex/components/sonner/toast.py +++ b/reflex/components/sonner/toast.py @@ -114,6 +114,9 @@ class ToastProps(PropsBase, NoExtrasAllowedProps): # Custom style for the toast. style: Optional[Style] + # Class name for the toast. + class_name: Optional[str] + # XXX: These still do not seem to work # Custom style for the toast primary button. action_button_styles: Optional[Style] diff --git a/reflex/components/sonner/toast.pyi b/reflex/components/sonner/toast.pyi index b2ef3fc55d..aa6a5b7802 100644 --- a/reflex/components/sonner/toast.pyi +++ b/reflex/components/sonner/toast.pyi @@ -45,6 +45,7 @@ class ToastProps(PropsBase, NoExtrasAllowedProps): id: Optional[Union[str, Var]] unstyled: Optional[bool] style: Optional[Style] + class_name: Optional[str] action_button_styles: Optional[Style] cancel_button_styles: Optional[Style] on_dismiss: Optional[Any]