From a320d062fb739235642c95fc4907f7d5f9531e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Mon, 2 Dec 2024 09:20:33 -0800 Subject: [PATCH 01/12] enable css props via wrapperStyle for recharts components (#4447) --- reflex/components/recharts/recharts.py | 16 ++-------------- reflex/components/recharts/recharts.pyi | 1 - 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/reflex/components/recharts/recharts.py b/reflex/components/recharts/recharts.py index a0d683f72..b5a4ed113 100644 --- a/reflex/components/recharts/recharts.py +++ b/reflex/components/recharts/recharts.py @@ -3,7 +3,6 @@ from typing import Dict, Literal from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent -from reflex.utils import console class Recharts(Component): @@ -11,19 +10,8 @@ class Recharts(Component): library = "recharts@2.13.0" - def render(self) -> Dict: - """Render the tag. - - Returns: - The rendered tag. - """ - tag = super().render() - if any(p.startswith("css") for p in tag["props"]): - console.warn( - f"CSS props do not work for {self.__class__.__name__}. Consult docs to style it with its own prop." - ) - tag["props"] = [p for p in tag["props"] if not p.startswith("css")] - return tag + def _get_style(self) -> Dict: + return {"wrapperStyle": self.style} class RechartsCharts(NoSSRComponent, MemoizationLeaf): diff --git a/reflex/components/recharts/recharts.pyi b/reflex/components/recharts/recharts.pyi index 10e1b96c1..65e65bce1 100644 --- a/reflex/components/recharts/recharts.pyi +++ b/reflex/components/recharts/recharts.pyi @@ -11,7 +11,6 @@ from reflex.style import Style from reflex.vars.base import Var class Recharts(Component): - def render(self) -> Dict: ... @overload @classmethod def create( # type: ignore From 99d1b5fbdfaa05cfac3f61fdc4f4c991178567d4 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Mon, 2 Dec 2024 16:29:06 -0800 Subject: [PATCH 02/12] rx.upload must include _var_data from props (#4463) * rx.upload must include _var_data from props str-casting the dropzone arguments removed any VarData they depended on, like the state context. update test_upload to include passing a prop from a state var * Handle large payload delta from upload event handler Fix update chunk chaining logic; try/catch wasn't catching errors from the async inner function. --- reflex/.templates/web/utils/state.js | 39 ++++++++++++++++------------ reflex/components/core/upload.py | 13 ++++++---- tests/integration/test_upload.py | 10 ++++++- 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js index f6541c7ae..622f171ad 100644 --- a/reflex/.templates/web/utils/state.js +++ b/reflex/.templates/web/utils/state.js @@ -457,7 +457,7 @@ export const connect = async ( socket.current.on("reload", async (event) => { event_processing = false; queueEvents([...initialEvents(), JSON5.parse(event)], socket); - }) + }); document.addEventListener("visibilitychange", checkVisibility); }; @@ -490,23 +490,30 @@ export const uploadFiles = async ( return false; } + // Track how many partial updates have been processed for this upload. let resp_idx = 0; const eventHandler = (progressEvent) => { - // handle any delta / event streamed from the upload event handler + const event_callbacks = socket._callbacks.$event; + // Whenever called, responseText will contain the entire response so far. const chunks = progressEvent.event.target.responseText.trim().split("\n"); + // So only process _new_ chunks beyond resp_idx. chunks.slice(resp_idx).map((chunk) => { - try { - socket._callbacks.$event.map((f) => { - f(chunk); - }); - resp_idx += 1; - } catch (e) { - if (progressEvent.progress === 1) { - // Chunk may be incomplete, so only report errors when full response is available. - console.log("Error parsing chunk", chunk, e); - } - return; - } + event_callbacks.map((f, ix) => { + f(chunk) + .then(() => { + if (ix === event_callbacks.length - 1) { + // Mark this chunk as processed. + resp_idx += 1; + } + }) + .catch((e) => { + if (progressEvent.progress === 1) { + // Chunk may be incomplete, so only report errors when full response is available. + console.log("Error parsing chunk", chunk, e); + } + return; + }); + }); }); }; @@ -711,7 +718,7 @@ export const useEventLoop = ( const combined_name = events.map((e) => e.name).join("+++"); if (event_actions?.temporal) { if (!socket.current || !socket.current.connected) { - return; // don't queue when the backend is not connected + return; // don't queue when the backend is not connected } } if (event_actions?.throttle) { @@ -852,7 +859,7 @@ export const useEventLoop = ( if (router.components[router.pathname].error) { delete router.components[router.pathname].error; } - } + }; router.events.on("routeChangeStart", change_start); router.events.on("routeChangeComplete", change_complete); router.events.on("routeChangeError", change_error); diff --git a/reflex/components/core/upload.py b/reflex/components/core/upload.py index 33dfae40f..87488d98a 100644 --- a/reflex/components/core/upload.py +++ b/reflex/components/core/upload.py @@ -293,13 +293,15 @@ class Upload(MemoizationLeaf): format.to_camel_case(key): value for key, value in upload_props.items() } - use_dropzone_arguments = { - "onDrop": event_var, - **upload_props, - } + use_dropzone_arguments = Var.create( + { + "onDrop": event_var, + **upload_props, + } + ) left_side = f"const {{getRootProps: {root_props_unique_name}, getInputProps: {input_props_unique_name}}} " - right_side = f"useDropzone({str(Var.create(use_dropzone_arguments))})" + right_side = f"useDropzone({str(use_dropzone_arguments)})" var_data = VarData.merge( VarData( @@ -307,6 +309,7 @@ class Upload(MemoizationLeaf): hooks={Hooks.EVENTS: None}, ), event_var._get_all_var_data(), + use_dropzone_arguments._get_all_var_data(), VarData( hooks={ callback_str: None, diff --git a/tests/integration/test_upload.py b/tests/integration/test_upload.py index fe8ebb4d7..b7f14b03d 100644 --- a/tests/integration/test_upload.py +++ b/tests/integration/test_upload.py @@ -19,10 +19,14 @@ def UploadFile(): import reflex as rx + LARGE_DATA = "DUMMY" * 1024 * 512 + class UploadState(rx.State): _file_data: Dict[str, str] = {} event_order: List[str] = [] progress_dicts: List[dict] = [] + disabled: bool = False + large_data: str = "" async def handle_upload(self, files: List[rx.UploadFile]): for file in files: @@ -33,6 +37,7 @@ def UploadFile(): for file in files: upload_data = await file.read() self._file_data[file.filename or ""] = upload_data.decode("utf-8") + self.large_data = LARGE_DATA yield UploadState.chain_event def upload_progress(self, progress): @@ -41,13 +46,15 @@ def UploadFile(): self.progress_dicts.append(progress) def chain_event(self): + assert self.large_data == LARGE_DATA + self.large_data = "" self.event_order.append("chain_event") def index(): return rx.vstack( rx.input( value=UploadState.router.session.client_token, - is_read_only=True, + read_only=True, id="token", ), rx.heading("Default Upload"), @@ -56,6 +63,7 @@ def UploadFile(): rx.button("Select File"), rx.text("Drag and drop files here or click to select files"), ), + disabled=UploadState.disabled, ), rx.button( "Upload", From c721227a062ed6f977477e435d37b3fa5b0be509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Mon, 2 Dec 2024 16:31:32 -0800 Subject: [PATCH 03/12] add default value for text area (#4462) * add default_value prop in text_area * also support it for el.textarea --- reflex/components/el/elements/forms.py | 3 +++ reflex/components/el/elements/forms.pyi | 2 ++ reflex/components/radix/themes/components/text_area.py | 3 +++ reflex/components/radix/themes/components/text_area.pyi | 2 ++ 4 files changed, 10 insertions(+) diff --git a/reflex/components/el/elements/forms.py b/reflex/components/el/elements/forms.py index 7a94a9c2d..56dab5c7f 100644 --- a/reflex/components/el/elements/forms.py +++ b/reflex/components/el/elements/forms.py @@ -570,6 +570,9 @@ class Textarea(BaseHTML): # Visible width of the text control, in average character widths cols: Var[Union[str, int, bool]] + # The default value of the textarea when initially rendered + default_value: Var[str] + # Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted dirname: Var[Union[str, int, bool]] diff --git a/reflex/components/el/elements/forms.pyi b/reflex/components/el/elements/forms.pyi index a32eb8c5d..e2d659338 100644 --- a/reflex/components/el/elements/forms.pyi +++ b/reflex/components/el/elements/forms.pyi @@ -1350,6 +1350,7 @@ class Textarea(BaseHTML): auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_height: Optional[Union[Var[bool], bool]] = None, cols: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + default_value: Optional[Union[Var[str], str]] = None, dirname: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_submit: Optional[Union[Var[bool], bool]] = None, @@ -1439,6 +1440,7 @@ class Textarea(BaseHTML): auto_focus: Automatically focuses the textarea when the page loads auto_height: Automatically fit the content height to the text (use min-height with this prop) cols: Visible width of the text control, in average character widths + default_value: The default value of the textarea when initially rendered dirname: Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted disabled: Disables the textarea enter_key_submit: Enter key submits form (shift-enter adds new line) diff --git a/reflex/components/radix/themes/components/text_area.py b/reflex/components/radix/themes/components/text_area.py index 87f56e911..83fa8a593 100644 --- a/reflex/components/radix/themes/components/text_area.py +++ b/reflex/components/radix/themes/components/text_area.py @@ -41,6 +41,9 @@ class TextArea(RadixThemesComponent, elements.Textarea): # Automatically focuses the textarea when the page loads auto_focus: Var[bool] + # The default value of the textarea when initially rendered + default_value: Var[str] + # Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted dirname: Var[str] diff --git a/reflex/components/radix/themes/components/text_area.pyi b/reflex/components/radix/themes/components/text_area.pyi index 196346cf9..63d474842 100644 --- a/reflex/components/radix/themes/components/text_area.pyi +++ b/reflex/components/radix/themes/components/text_area.pyi @@ -123,6 +123,7 @@ class TextArea(RadixThemesComponent, elements.Textarea): ] = None, auto_complete: Optional[Union[Var[bool], bool]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, + default_value: Optional[Union[Var[str], str]] = None, dirname: Optional[Union[Var[str], str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, @@ -217,6 +218,7 @@ class TextArea(RadixThemesComponent, elements.Textarea): radius: The radius of the text area: "none" | "small" | "medium" | "large" | "full" auto_complete: Whether the form control should have autocomplete enabled auto_focus: Automatically focuses the textarea when the page loads + default_value: The default value of the textarea when initially rendered dirname: Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted disabled: Disables the textarea form: Associates the textarea with a form (by id) From a894f21ce50eb661feb9db349830770b7f67b1dd Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Wed, 4 Dec 2024 18:15:31 -0800 Subject: [PATCH 04/12] [ENG-4149] require login to deploy named templates (#4450) * integration_tests.yml: init masenf/rx_shout as a template fix test * [ENG-4149] require login to deploy template * Send loginv2 telemetry event --- .github/workflows/integration_tests.yml | 29 +++++++++++++++++++ reflex/reflex.py | 4 ++- reflex/utils/prerequisites.py | 38 ++++++++++++------------- reflex/utils/telemetry.py | 2 +- 4 files changed, 52 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index fc5935c2a..3e22234b8 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -162,7 +162,36 @@ jobs: --python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}" --pr-id "${{ github.event.pull_request.id }}" --branch-name "${{ github.head_ref || github.ref_name }}" --app-name "reflex-web" --path ./reflex-web/.web + + rx-shout-from-template: + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup_build_env + with: + python-version: '3.11.4' + run-poetry-install: true + create-venv-at-path: .venv + - name: Create app directory + run: mkdir rx-shout-from-template + - name: Init reflex-web from template + run: poetry run reflex init --template https://github.com/masenf/rx_shout + working-directory: ./rx-shout-from-template + - name: ignore reflex pin in requirements + run: sed -i -e '/reflex==/d' requirements.txt + working-directory: ./rx-shout-from-template + - name: Install additional dependencies + run: poetry run uv pip install -r requirements.txt + working-directory: ./rx-shout-from-template + - name: Run Website and Check for errors + run: | + # Check that npm is home + npm -v + poetry run bash scripts/integration.sh ./rx-shout-from-template prod + reflex-web-macos: if: github.event_name == 'push' && github.ref == 'refs/heads/main' strategy: diff --git a/reflex/reflex.py b/reflex/reflex.py index f71fc5f86..f228f43d4 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -370,7 +370,9 @@ def loginv2(loglevel: constants.LogLevel = typer.Option(config.loglevel)): check_version() - hosting_cli.login() + validated_info = hosting_cli.login() + if validated_info is not None: + telemetry.send("loginv2", user_uuid=validated_info.get("user_id")) @cli.command() diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index ec79b3297..559f668a1 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -1408,13 +1408,22 @@ def validate_and_create_app_using_remote_template(app_name, template, templates) """ # If user selects a template, it needs to exist. if template in templates: + from reflex_cli.v2.utils import hosting + + authenticated_token = hosting.authenticated_token() + if not authenticated_token or not authenticated_token[0]: + console.print( + f"Please use `reflex loginv2` to access the '{template}' template." + ) + raise typer.Exit(3) + template_url = templates[template].code_url else: # Check if the template is a github repo. if template.startswith("https://github.com"): template_url = f"{template.strip('/').replace('.git', '')}/archive/main.zip" else: - console.error(f"Template `{template}` not found.") + console.error(f"Template `{template}` not found or invalid.") raise typer.Exit(1) if template_url is None: @@ -1451,7 +1460,7 @@ def generate_template_using_ai(template: str | None = None) -> str: def fetch_remote_templates( - template: Optional[str] = None, + template: str, ) -> tuple[str, dict[str, Template]]: """Fetch the available remote templates. @@ -1460,9 +1469,6 @@ def fetch_remote_templates( Returns: The selected template and the available templates. - - Raises: - Exit: If the template is not valid or if the template is not specified. """ available_templates = {} @@ -1474,19 +1480,7 @@ def fetch_remote_templates( console.debug(f"Error while fetching templates: {e}") template = constants.Templates.DEFAULT - if template == constants.Templates.DEFAULT: - return template, available_templates - - if template in available_templates: - return template, available_templates - - else: - if template is not None: - console.error(f"{template!r} is not a valid template name.") - console.print( - f"Go to the templates page ({constants.Templates.REFLEX_TEMPLATES_URL}) and copy the command to init with a template." - ) - raise typer.Exit(0) + return template, available_templates def initialize_app( @@ -1501,6 +1495,9 @@ def initialize_app( Returns: The name of the template. + + Raises: + Exit: If the template is not valid or unspecified. """ # Local imports to avoid circular imports. from reflex.utils import telemetry @@ -1528,7 +1525,10 @@ def initialize_app( # change to the default to allow creation of default app template = constants.Templates.DEFAULT elif template == constants.Templates.CHOOSE_TEMPLATES: - template, templates = fetch_remote_templates() + console.print( + f"Go to the templates page ({constants.Templates.REFLEX_TEMPLATES_URL}) and copy the command to init with a template." + ) + raise typer.Exit(0) # If the blank template is selected, create a blank app. if template in (constants.Templates.DEFAULT,): diff --git a/reflex/utils/telemetry.py b/reflex/utils/telemetry.py index 815d37a1b..b24b4d3bf 100644 --- a/reflex/utils/telemetry.py +++ b/reflex/utils/telemetry.py @@ -129,7 +129,7 @@ def _prepare_event(event: str, **kwargs) -> dict: cpuinfo = get_cpu_info() - additional_keys = ["template", "context", "detail"] + additional_keys = ["template", "context", "detail", "user_uuid"] additional_fields = { key: value for key in additional_keys if (value := kwargs.get(key)) is not None } From e23d9397810d8c14f058ea1ede3c57b401a6cd8e Mon Sep 17 00:00:00 2001 From: Elijah Ahianyo Date: Thu, 5 Dec 2024 02:17:22 +0000 Subject: [PATCH 05/12] [HOS-373][HOS-372]Logout should not open the browser (#4475) * Logout should not open the browser * check user login first before deploy --- reflex/reflex.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/reflex/reflex.py b/reflex/reflex.py index f228f43d4..0e2b54fcb 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -398,15 +398,10 @@ def logoutv2( ), ): """Log out of access to Reflex hosting service.""" - from reflex_cli.v2.utils import hosting + from reflex_cli.v2 import cli check_version() - - console.set_log_level(loglevel) - - hosting.log_out_on_browser() - console.debug("Deleting access token from config locally") - hosting.delete_token_from_config() + cli.logout() db_cli = typer.Typer() @@ -672,6 +667,8 @@ def deployv2( # Set the log level. console.set_log_level(loglevel) + # make sure user is logged in. + hosting_cli.login() # Only check requirements if interactive. # There is user interaction for requirements update. From 12771004cb5f53d3c3e5a5889a45711aab90b010 Mon Sep 17 00:00:00 2001 From: Simon Young <40179067+Kastier1@users.noreply.github.com> Date: Wed, 4 Dec 2024 23:21:18 -0800 Subject: [PATCH 06/12] remove v2 commands (#4478) * remove v2 commands * format * remove v2 * remove v2 * little fixes friend * add cloud * relock poetry deps * bump reflex-hosting-cli dep * test_dynamic_routes: wait for token attempt to avoid test flakiness * relock deps * test_dynamic_routes: increase polling timeout --------- Co-authored-by: simon Co-authored-by: Masen Furer --- poetry.lock | 16 +- pyproject.toml | 2 +- reflex/config.py | 4 +- reflex/custom_components/custom_components.py | 4 +- reflex/reflex.py | 191 +----------------- tests/integration/test_dynamic_routes.py | 10 +- 6 files changed, 30 insertions(+), 197 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3310f106a..74e5755a3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2206,13 +2206,13 @@ reflex = ">=0.6.0a" [[package]] name = "reflex-hosting-cli" -version = "0.1.17" +version = "0.1.28" description = "Reflex Hosting CLI" optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "reflex_hosting_cli-0.1.17-py3-none-any.whl", hash = "sha256:cf1accec70745557a40125ffa2a8929e6ef9834808afe78e4f4a01933ac0cb67"}, - {file = "reflex_hosting_cli-0.1.17.tar.gz", hash = "sha256:263d8dc217eb24d4198ac0bcfd710980bd7795d9818a5e522027657f94752710"}, + {file = "reflex_hosting_cli-0.1.28-py3-none-any.whl", hash = "sha256:68c60e8b2cb8856d0b8eac1f06410d8fe192944884f54bfad47adf5db62bd395"}, + {file = "reflex_hosting_cli-0.1.28.tar.gz", hash = "sha256:9b4fb771396ffeba857ada0207fdfd78e2e40b8e35a5486b89cb07f1aa416867"}, ] [package.dependencies] @@ -2224,7 +2224,7 @@ pydantic = ">=1.10.2,<3.0" python-dateutil = ">=2.8.1" rich = ">=13.0.0,<14.0" tabulate = ">=0.9.0,<0.10.0" -typer = ">=0.4.2,<1" +typer = ">=0.15.0,<1" websockets = ">=10.4" [[package]] @@ -2722,13 +2722,13 @@ urllib3 = ">=1.26.0" [[package]] name = "typer" -version = "0.13.1" +version = "0.15.1" description = "Typer, build great CLIs. Easy to code. Based on Python type hints." optional = false python-versions = ">=3.7" files = [ - {file = "typer-0.13.1-py3-none-any.whl", hash = "sha256:5b59580fd925e89463a29d363e0a43245ec02765bde9fb77d39e5d0f29dd7157"}, - {file = "typer-0.13.1.tar.gz", hash = "sha256:9d444cb96cc268ce6f8b94e13b4335084cef4c079998a9f4851a90229a3bd25c"}, + {file = "typer-0.15.1-py3-none-any.whl", hash = "sha256:7994fb7b8155b64d3402518560648446072864beefd44aa2dc36972a5972e847"}, + {file = "typer-0.15.1.tar.gz", hash = "sha256:a0588c0a7fa68a1978a069818657778f86abe6ff5ea6abf472f940a08bfe4f0a"}, ] [package.dependencies] @@ -3041,4 +3041,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "8000601d48cfc1b10d0ae18c6046cc59a50cb6c45e6d3ef4775a3203769f2154" +content-hash = "8d908859a32731cfe8ec4d0d855f5643a2d8150f4a2a27b3dd8d4485877862ea" diff --git a/pyproject.toml b/pyproject.toml index 619c4ff47..7c2297a68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ wrapt = [ {version = ">=1.11.0,<2.0", python = "<3.11"}, ] packaging = ">=23.1,<25.0" -reflex-hosting-cli = ">=0.1.17,<2.0" +reflex-hosting-cli = ">=0.1.28,<2.0" charset-normalizer = ">=3.3.2,<4.0" wheel = ">=0.42.0,<1.0" build = ">=1.0.3,<2.0" diff --git a/reflex/config.py b/reflex/config.py index 88230cefe..1d952f4f0 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -652,9 +652,9 @@ class Config(Base): frontend_packages: List[str] = [] # The hosting service backend URL. - cp_backend_url: str = Hosting.CP_BACKEND_URL + cp_backend_url: str = Hosting.HOSTING_SERVICE # The hosting service frontend URL. - cp_web_url: str = Hosting.CP_WEB_URL + cp_web_url: str = Hosting.HOSTING_SERVICE_UI # The worker class used in production mode gunicorn_worker_class: str = "uvicorn.workers.UvicornH11Worker" diff --git a/reflex/custom_components/custom_components.py b/reflex/custom_components/custom_components.py index 6be64ae2d..41808d60a 100644 --- a/reflex/custom_components/custom_components.py +++ b/reflex/custom_components/custom_components.py @@ -827,11 +827,11 @@ def _collect_details_for_gallery(): Raises: Exit: If pyproject.toml file is ill-formed or the request to the backend services fails. """ - from reflex.reflex import _login + from reflex_cli.utils import hosting console.rule("[bold]Authentication with Reflex Services") console.print("First let's log in to Reflex backend services.") - access_token = _login() + access_token, _ = hosting.authenticated_token() console.rule("[bold]Custom Component Information") params = {} diff --git a/reflex/reflex.py b/reflex/reflex.py index 0e2b54fcb..26937e763 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -9,8 +9,6 @@ from typing import List, Optional import typer import typer.core -from reflex_cli.deployments import deployments_cli -from reflex_cli.utils import dependency from reflex_cli.v2.deployments import check_version, hosting_cli from reflex import constants @@ -330,41 +328,8 @@ def export( ) -def _login() -> str: - """Helper function to authenticate with Reflex hosting service.""" - from reflex_cli.utils import hosting - - access_token, invitation_code = hosting.authenticated_token() - if access_token: - console.print("You already logged in.") - return access_token - - # If not already logged in, open a browser window/tab to the login page. - access_token = hosting.authenticate_on_browser(invitation_code) - - if not access_token: - console.error("Unable to authenticate. Please try again or contact support.") - raise typer.Exit(1) - - console.print("Successfully logged in.") - return access_token - - @cli.command() -def login( - loglevel: constants.LogLevel = typer.Option( - config.loglevel, help="The log level to use." - ), -): - """Authenticate with Reflex hosting service.""" - # Set the log level. - console.set_log_level(loglevel) - - _login() - - -@cli.command() -def loginv2(loglevel: constants.LogLevel = typer.Option(config.loglevel)): +def login(loglevel: constants.LogLevel = typer.Option(config.loglevel)): """Authenicate with experimental Reflex hosting service.""" from reflex_cli.v2 import cli as hosting_cli @@ -382,26 +347,11 @@ def logout( ), ): """Log out of access to Reflex hosting service.""" - from reflex_cli.utils import hosting - - console.set_log_level(loglevel) - - hosting.log_out_on_browser() - console.debug("Deleting access token from config locally") - hosting.delete_token_from_config(include_invitation_code=True) - - -@cli.command() -def logoutv2( - loglevel: constants.LogLevel = typer.Option( - config.loglevel, help="The log level to use." - ), -): - """Log out of access to Reflex hosting service.""" - from reflex_cli.v2 import cli + from reflex_cli.v2.cli import logout check_version() - cli.logout() + + logout(loglevel) # type: ignore db_cli = typer.Typer() @@ -486,126 +436,6 @@ def makemigrations( @cli.command() def deploy( - key: Optional[str] = typer.Option( - None, - "-k", - "--deployment-key", - help="The name of the deployment. Domain name safe characters only.", - ), - app_name: str = typer.Option( - config.app_name, - "--app-name", - help="The name of the App to deploy under.", - hidden=True, - ), - regions: List[str] = typer.Option( - list(), - "-r", - "--region", - help="The regions to deploy to.", - ), - envs: List[str] = typer.Option( - list(), - "--env", - help="The environment variables to set: =. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.", - ), - cpus: Optional[int] = typer.Option( - None, help="The number of CPUs to allocate.", hidden=True - ), - memory_mb: Optional[int] = typer.Option( - None, help="The amount of memory to allocate.", hidden=True - ), - auto_start: Optional[bool] = typer.Option( - None, - help="Whether to auto start the instance.", - hidden=True, - ), - auto_stop: Optional[bool] = typer.Option( - None, - help="Whether to auto stop the instance.", - hidden=True, - ), - frontend_hostname: Optional[str] = typer.Option( - None, - "--frontend-hostname", - help="The hostname of the frontend.", - hidden=True, - ), - interactive: bool = typer.Option( - True, - help="Whether to list configuration options and ask for confirmation.", - ), - with_metrics: Optional[str] = typer.Option( - None, - help="Setting for metrics scraping for the deployment. Setup required in user code.", - hidden=True, - ), - with_tracing: Optional[str] = typer.Option( - None, - help="Setting to export tracing for the deployment. Setup required in user code.", - hidden=True, - ), - upload_db_file: bool = typer.Option( - False, - help="Whether to include local sqlite db files when uploading to hosting service.", - hidden=True, - ), - loglevel: constants.LogLevel = typer.Option( - config.loglevel, help="The log level to use." - ), -): - """Deploy the app to the Reflex hosting service.""" - from reflex_cli import cli as hosting_cli - - from reflex.utils import export as export_utils - from reflex.utils import prerequisites - - # Set the log level. - console.set_log_level(loglevel) - - # Only check requirements if interactive. There is user interaction for requirements update. - if interactive: - dependency.check_requirements() - - # Check if we are set up. - if prerequisites.needs_reinit(frontend=True): - _init(name=config.app_name, loglevel=loglevel) - prerequisites.check_latest_package_version(constants.ReflexHostingCLI.MODULE_NAME) - - hosting_cli.deploy( - app_name=app_name, - export_fn=lambda zip_dest_dir, - api_url, - deploy_url, - frontend, - backend, - zipping: export_utils.export( - zip_dest_dir=zip_dest_dir, - api_url=api_url, - deploy_url=deploy_url, - frontend=frontend, - backend=backend, - zipping=zipping, - loglevel=loglevel.subprocess_level(), - upload_db_file=upload_db_file, - ), - key=key, - regions=regions, - envs=envs, - cpus=cpus, - memory_mb=memory_mb, - auto_start=auto_start, - auto_stop=auto_stop, - frontend_hostname=frontend_hostname, - interactive=interactive, - with_metrics=with_metrics, - with_tracing=with_tracing, - loglevel=loglevel.subprocess_level(), - ) - - -@cli.command() -def deployv2( app_name: str = typer.Option( config.app_name, "--app-name", @@ -657,8 +487,8 @@ def deployv2( ), ): """Deploy the app to the Reflex hosting service.""" + from reflex_cli.utils import dependency from reflex_cli.v2 import cli as hosting_cli - from reflex_cli.v2.utils import dependency from reflex.utils import export as export_utils from reflex.utils import prerequisites @@ -702,7 +532,7 @@ def deployv2( envfile=envfile, hostname=hostname, interactive=interactive, - loglevel=loglevel.subprocess_level(), + loglevel=type(loglevel).INFO, # type: ignore token=token, project=project, ) @@ -710,15 +540,10 @@ def deployv2( cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.") cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.") -cli.add_typer( - deployments_cli, - name="deployments", - help="Subcommands for managing the Deployments.", -) cli.add_typer( hosting_cli, - name="apps", - help="Subcommands for managing the Deployments.", + name="cloud", + help="Subcommands for managing the reflex cloud.", ) cli.add_typer( custom_components_cli, diff --git a/tests/integration/test_dynamic_routes.py b/tests/integration/test_dynamic_routes.py index eed066696..c226a4d8e 100644 --- a/tests/integration/test_dynamic_routes.py +++ b/tests/integration/test_dynamic_routes.py @@ -89,6 +89,11 @@ def DynamicRoute(): @rx.page(route="/arg/[arg_str]") def arg() -> rx.Component: return rx.vstack( + rx.input( + value=DynamicState.router.session.client_token, + read_only=True, + id="token", + ), rx.data_list.root( rx.data_list.item( rx.data_list.label("rx.State.arg_str (dynamic)"), @@ -373,12 +378,14 @@ async def test_on_load_navigate_non_dynamic( async def test_render_dynamic_arg( dynamic_route: AppHarness, driver: WebDriver, + token: str, ): """Assert that dynamic arg var is rendered correctly in different contexts. Args: dynamic_route: harness for DynamicRoute app. driver: WebDriver instance. + token: The token visible in the driver browser. """ assert dynamic_route.app_instance is not None with poll_for_navigation(driver): @@ -398,7 +405,8 @@ async def test_render_dynamic_arg( el = driver.find_element(By.ID, id) assert el assert ( - dynamic_route.poll_for_content(el, exp_not_equal=expect_not) == expected + dynamic_route.poll_for_content(el, timeout=30, exp_not_equal=expect_not) + == expected ) assert_content("0", "") From 3f4dca21a8cdd77e90483902e88c1e1134e8b6b8 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 5 Dec 2024 01:17:26 -0800 Subject: [PATCH 07/12] rename loginv2 to login (#4486) * rename loginv2 to login * reflex-hosting-cli bump to 0.1.29 * relock deps --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- reflex/reflex.py | 2 +- reflex/utils/prerequisites.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index 74e5755a3..7d46e4199 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2206,13 +2206,13 @@ reflex = ">=0.6.0a" [[package]] name = "reflex-hosting-cli" -version = "0.1.28" +version = "0.1.29" description = "Reflex Hosting CLI" optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "reflex_hosting_cli-0.1.28-py3-none-any.whl", hash = "sha256:68c60e8b2cb8856d0b8eac1f06410d8fe192944884f54bfad47adf5db62bd395"}, - {file = "reflex_hosting_cli-0.1.28.tar.gz", hash = "sha256:9b4fb771396ffeba857ada0207fdfd78e2e40b8e35a5486b89cb07f1aa416867"}, + {file = "reflex_hosting_cli-0.1.29-py3-none-any.whl", hash = "sha256:fcbdad829762287f32397cd8a5d46536ab0db396e7fdb8a23c7f9343d7dc8de0"}, + {file = "reflex_hosting_cli-0.1.29.tar.gz", hash = "sha256:7b421fec6936c26549c8c65c9dda34fc042eaaec79b238dce6b9c020f848563b"}, ] [package.dependencies] @@ -3041,4 +3041,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "8d908859a32731cfe8ec4d0d855f5643a2d8150f4a2a27b3dd8d4485877862ea" +content-hash = "3810e99ff4d09952e62d88b2c26651a0d8e0ffe4007bc3274c2fb83b68243951" diff --git a/pyproject.toml b/pyproject.toml index 7c2297a68..b63fad319 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ wrapt = [ {version = ">=1.11.0,<2.0", python = "<3.11"}, ] packaging = ">=23.1,<25.0" -reflex-hosting-cli = ">=0.1.28,<2.0" +reflex-hosting-cli = ">=0.1.29,<2.0" charset-normalizer = ">=3.3.2,<4.0" wheel = ">=0.42.0,<1.0" build = ">=1.0.3,<2.0" diff --git a/reflex/reflex.py b/reflex/reflex.py index 26937e763..f9aea4982 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -337,7 +337,7 @@ def login(loglevel: constants.LogLevel = typer.Option(config.loglevel)): validated_info = hosting_cli.login() if validated_info is not None: - telemetry.send("loginv2", user_uuid=validated_info.get("user_id")) + telemetry.send("login", user_uuid=validated_info.get("user_id")) @cli.command() diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index 559f668a1..cc56bdf88 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -1413,7 +1413,7 @@ def validate_and_create_app_using_remote_template(app_name, template, templates) authenticated_token = hosting.authenticated_token() if not authenticated_token or not authenticated_token[0]: console.print( - f"Please use `reflex loginv2` to access the '{template}' template." + f"Please use `reflex login` to access the '{template}' template." ) raise typer.Exit(3) From 3a225c218006474a2d2e0d866310d36676d82f5e Mon Sep 17 00:00:00 2001 From: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:41:53 +0100 Subject: [PATCH 08/12] test dynamic route flakiness (can't reproduce locally) (#4496) * test dynamic route flakiness (can't reproduce locally) * fix typo --- tests/integration/test_dynamic_routes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/test_dynamic_routes.py b/tests/integration/test_dynamic_routes.py index c226a4d8e..8a3cde3a2 100644 --- a/tests/integration/test_dynamic_routes.py +++ b/tests/integration/test_dynamic_routes.py @@ -2,6 +2,7 @@ from __future__ import annotations +import time from typing import Callable, Coroutine, Generator, Type from urllib.parse import urlsplit @@ -177,6 +178,8 @@ def driver(dynamic_route: AppHarness) -> Generator[WebDriver, None, None]: """ assert dynamic_route.app_instance is not None, "app is not running" driver = dynamic_route.frontend() + # TODO: drop after flakiness is resolved + driver.implicitly_wait(30) try: yield driver finally: @@ -391,6 +394,9 @@ async def test_render_dynamic_arg( with poll_for_navigation(driver): driver.get(f"{dynamic_route.frontend_url}/arg/0") + # TODO: drop after flakiness is resolved + time.sleep(3) + def assert_content(expected: str, expect_not: str): ids = [ "state-arg_str", From a895eaaede10e99189cce9c6fcda995459eaa6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Fri, 6 Dec 2024 13:16:21 -0800 Subject: [PATCH 09/12] fix non-interactive flag in deploy command (#4498) --- reflex/reflex.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/reflex/reflex.py b/reflex/reflex.py index f9aea4982..bad2ecb28 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -497,8 +497,13 @@ def deploy( # Set the log level. console.set_log_level(loglevel) - # make sure user is logged in. - hosting_cli.login() + + if not token: + # make sure user is logged in. + if interactive: + hosting_cli.login() + else: + raise SystemExit("Token is required for non-interactive mode.") # Only check requirements if interactive. # There is user interaction for requirements update. From 3d89d74bdcd5afb85408ebb67a672701579f4efc Mon Sep 17 00:00:00 2001 From: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:00:01 +0100 Subject: [PATCH 10/12] only mark backend vars as dirty if they have changed (#4494) --- reflex/state.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reflex/state.py b/reflex/state.py index 55f29cf45..f38b9c863 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -1288,6 +1288,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): return if name in self.backend_vars: + # abort if unchanged + if self._backend_vars.get(name) == value: + return self._backend_vars.__setitem__(name, value) self.dirty_vars.add(name) self._mark_dirty() From 9ff386bf488fb670e5438123ffb9db8b05b2b629 Mon Sep 17 00:00:00 2001 From: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:17:51 +0100 Subject: [PATCH 11/12] add __repr__ method to MutableProxy (#4506) --- reflex/state.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reflex/state.py b/reflex/state.py index f38b9c863..e90c62bb8 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -3599,6 +3599,14 @@ class MutableProxy(wrapt.ObjectProxy): self._self_state = state self._self_field_name = field_name + def __repr__(self) -> str: + """Get the representation of the wrapped object. + + Returns: + The representation of the wrapped object. + """ + return f"{self.__class__.__name__}({self.__wrapped__})" + def _mark_dirty( self, wrapped=None, From 0a34949019f3aaab9b624b13dc401435c2caf802 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Mon, 9 Dec 2024 15:26:48 -0800 Subject: [PATCH 12/12] Add production-one-port example (#4489) * Add production-one-port example A more complex version of simple-one-port that facilitates better layer caching to shorten build times and multi-stage build to reduce final image size. Harder to understand, but ultimately nicer to use. * fix Caddyfile format to avoid complaints * docker-examples: bump all base images to python:3.13 --- .../production-app-platform/Dockerfile | 4 +- docker-example/production-compose/Dockerfile | 4 +- .../production-one-port/.dockerignore | 3 + docker-example/production-one-port/Caddyfile | 14 +++++ docker-example/production-one-port/Dockerfile | 62 +++++++++++++++++++ docker-example/production-one-port/README.md | 37 +++++++++++ docker-example/simple-one-port/Caddyfile | 2 +- docker-example/simple-one-port/Dockerfile | 4 +- docker-example/simple-two-port/Dockerfile | 2 +- 9 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 docker-example/production-one-port/.dockerignore create mode 100644 docker-example/production-one-port/Caddyfile create mode 100644 docker-example/production-one-port/Dockerfile create mode 100644 docker-example/production-one-port/README.md diff --git a/docker-example/production-app-platform/Dockerfile b/docker-example/production-app-platform/Dockerfile index 3dd9f1fed..fec3b13f1 100644 --- a/docker-example/production-app-platform/Dockerfile +++ b/docker-example/production-app-platform/Dockerfile @@ -23,7 +23,7 @@ # for example, pass `docker build --platform=linux/amd64 ...` # Stage 1: init -FROM python:3.11 as init +FROM python:3.13 as init ARG uv=/root/.local/bin/uv @@ -48,7 +48,7 @@ RUN $uv pip install -r requirements.txt RUN reflex init # Stage 2: copy artifacts into slim image -FROM python:3.11-slim +FROM python:3.13-slim WORKDIR /app RUN adduser --disabled-password --home /app reflex COPY --chown=reflex --from=init /app /app diff --git a/docker-example/production-compose/Dockerfile b/docker-example/production-compose/Dockerfile index 42345af40..757c03b8e 100644 --- a/docker-example/production-compose/Dockerfile +++ b/docker-example/production-compose/Dockerfile @@ -2,7 +2,7 @@ # instance of a Reflex app. # Stage 1: init -FROM python:3.11 as init +FROM python:3.13 as init ARG uv=/root/.local/bin/uv @@ -35,7 +35,7 @@ RUN rm -rf .web && mkdir .web RUN mv /tmp/_static .web/_static # Stage 2: copy artifacts into slim image -FROM python:3.11-slim +FROM python:3.13-slim WORKDIR /app RUN adduser --disabled-password --home /app reflex COPY --chown=reflex --from=init /app /app diff --git a/docker-example/production-one-port/.dockerignore b/docker-example/production-one-port/.dockerignore new file mode 100644 index 000000000..26ae41b83 --- /dev/null +++ b/docker-example/production-one-port/.dockerignore @@ -0,0 +1,3 @@ +.web +!.web/bun.lockb +!.web/package.json diff --git a/docker-example/production-one-port/Caddyfile b/docker-example/production-one-port/Caddyfile new file mode 100644 index 000000000..28fb01861 --- /dev/null +++ b/docker-example/production-one-port/Caddyfile @@ -0,0 +1,14 @@ +:{$PORT} + +encode gzip + +@backend_routes path /_event/* /ping /_upload /_upload/* +handle @backend_routes { + reverse_proxy localhost:8000 +} + +root * /srv +route { + try_files {path} {path}/ /404.html + file_server +} diff --git a/docker-example/production-one-port/Dockerfile b/docker-example/production-one-port/Dockerfile new file mode 100644 index 000000000..f5e157bae --- /dev/null +++ b/docker-example/production-one-port/Dockerfile @@ -0,0 +1,62 @@ +# This Dockerfile is used to deploy a single-container Reflex app instance +# to services like Render, Railway, Heroku, GCP, and others. + +# If the service expects a different port, provide it here (f.e Render expects port 10000) +ARG PORT=8080 +# Only set for local/direct access. When TLS is used, the API_URL is assumed to be the same as the frontend. +ARG API_URL + +# It uses a reverse proxy to serve the frontend statically and proxy to backend +# from a single exposed port, expecting TLS termination to be handled at the +# edge by the given platform. +FROM python:3.13 as builder + +RUN mkdir -p /app/.web +RUN python -m venv /app/.venv +ENV PATH="/app/.venv/bin:$PATH" + +WORKDIR /app + +# Install python app requirements and reflex in the container +COPY requirements.txt . +RUN pip install -r requirements.txt + +# Install reflex helper utilities like bun/fnm/node +COPY rxconfig.py ./ +RUN reflex init + +# Install pre-cached frontend dependencies (if exist) +COPY *.web/bun.lockb *.web/package.json .web/ +RUN if [ -f .web/bun.lockb ]; then cd .web && ~/.local/share/reflex/bun/bin/bun install --frozen-lockfile; fi + +# Copy local context to `/app` inside container (see .dockerignore) +COPY . . + +ARG PORT API_URL +# Download other npm dependencies and compile frontend +RUN API_URL=${API_URL:-http://localhost:$PORT} reflex export --loglevel debug --frontend-only --no-zip && mv .web/_static/* /srv/ && rm -rf .web + + +# Final image with only necessary files +FROM python:3.13-slim + +# Install Caddy and redis server inside image +RUN apt-get update -y && apt-get install -y caddy redis-server && rm -rf /var/lib/apt/lists/* + +ARG PORT API_URL +ENV PATH="/app/.venv/bin:$PATH" PORT=$PORT API_URL=${API_URL:-http://localhost:$PORT} REDIS_URL=redis://localhost PYTHONUNBUFFERED=1 + +WORKDIR /app +COPY --from=builder /app /app +COPY --from=builder /srv /srv + +# Needed until Reflex properly passes SIGTERM on backend. +STOPSIGNAL SIGKILL + +EXPOSE $PORT + +# Apply migrations before starting the backend. +CMD [ -d alembic ] && reflex db migrate; \ + caddy start && \ + redis-server --daemonize yes && \ + exec reflex run --env prod --backend-only diff --git a/docker-example/production-one-port/README.md b/docker-example/production-one-port/README.md new file mode 100644 index 000000000..f6f76620a --- /dev/null +++ b/docker-example/production-one-port/README.md @@ -0,0 +1,37 @@ +# production-one-port + +This docker deployment runs Reflex in prod mode, exposing a single HTTP port: + * `8080` (`$PORT`) - Caddy server hosting the frontend statically and proxying requests to the backend. + +The deployment also runs a local Redis server to store state for each user. + +Conceptually it is similar to the `simple-one-port` example except it: + * has layer caching for python, reflex, and node dependencies + * uses multi-stage build to reduce the size of the final image + +Using this method may be preferable for deploying in memory constrained +environments, because it serves a static frontend export, rather than running +the NextJS server via node. + +## Build + +```console +docker build -t reflex-production-one-port . +``` + +## Run + +```console +docker run -p 8080:8080 reflex-production-one-port +``` + +Note that this container has _no persistence_ and will lose all data when +stopped. You can use bind mounts or named volumes to persist the database and +uploaded_files directories as needed. + +## Usage + +This container should be used with an existing load balancer or reverse proxy to +terminate TLS. + +It is also useful for deploying to simple app platforms, such as Render or Heroku. \ No newline at end of file diff --git a/docker-example/simple-one-port/Caddyfile b/docker-example/simple-one-port/Caddyfile index 13d94ce8e..28fb01861 100644 --- a/docker-example/simple-one-port/Caddyfile +++ b/docker-example/simple-one-port/Caddyfile @@ -11,4 +11,4 @@ root * /srv route { try_files {path} {path}/ /404.html file_server -} \ No newline at end of file +} diff --git a/docker-example/simple-one-port/Dockerfile b/docker-example/simple-one-port/Dockerfile index 4cd7e9a18..0b6dba0c4 100644 --- a/docker-example/simple-one-port/Dockerfile +++ b/docker-example/simple-one-port/Dockerfile @@ -4,7 +4,7 @@ # It uses a reverse proxy to serve the frontend statically and proxy to backend # from a single exposed port, expecting TLS termination to be handled at the # edge by the given platform. -FROM python:3.11 +FROM python:3.13 # If the service expects a different port, provide it here (f.e Render expects port 10000) ARG PORT=8080 @@ -38,4 +38,4 @@ EXPOSE $PORT CMD [ -d alembic ] && reflex db migrate; \ caddy start && \ redis-server --daemonize yes && \ - exec reflex run --env prod --backend-only \ No newline at end of file + exec reflex run --env prod --backend-only diff --git a/docker-example/simple-two-port/Dockerfile b/docker-example/simple-two-port/Dockerfile index 288f605a8..6d69fa390 100644 --- a/docker-example/simple-two-port/Dockerfile +++ b/docker-example/simple-two-port/Dockerfile @@ -1,5 +1,5 @@ # This Dockerfile is used to deploy a simple single-container Reflex app instance. -FROM python:3.12 +FROM python:3.13 RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/* ENV REDIS_URL=redis://localhost PYTHONUNBUFFERED=1