Compare commits
1 Commits
main
...
lendemor/r
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3b07e5e313 |
8
.github/workflows/benchmarks.yml
vendored
8
.github/workflows/benchmarks.yml
vendored
@ -81,15 +81,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# Show OS combos first in GUI
|
# Show OS combos first in GUI
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0']
|
python-version: ['3.10.13', '3.11.5', '3.12.0']
|
||||||
exclude:
|
exclude:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10.13'
|
python-version: '3.10.13'
|
||||||
- os: windows-latest
|
|
||||||
python-version: '3.9.18'
|
|
||||||
# keep only one python version for MacOS
|
# keep only one python version for MacOS
|
||||||
- os: macos-latest
|
|
||||||
python-version: '3.9.18'
|
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
python-version: '3.10.13'
|
python-version: '3.10.13'
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@ -97,8 +93,6 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10.11'
|
python-version: '3.10.11'
|
||||||
- os: windows-latest
|
|
||||||
python-version: '3.9.13'
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -16,7 +16,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: ./.github/actions/setup_build_env
|
- uses: ./.github/actions/setup_build_env
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.10'
|
||||||
run-poetry-install: true
|
run-poetry-install: true
|
||||||
create-venv-at-path: .venv
|
create-venv-at-path: .venv
|
||||||
|
|
||||||
|
6
.github/workflows/integration_tests.yml
vendored
6
.github/workflows/integration_tests.yml
vendored
@ -43,17 +43,13 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# Show OS combos first in GUI
|
# Show OS combos first in GUI
|
||||||
os: [ubuntu-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest]
|
||||||
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0', '3.13.0']
|
python-version: ['3.10.13', '3.11.5', '3.12.0', '3.13.0']
|
||||||
exclude:
|
exclude:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10.13'
|
python-version: '3.10.13'
|
||||||
- os: windows-latest
|
|
||||||
python-version: '3.9.18'
|
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10.11'
|
python-version: '3.10.11'
|
||||||
- os: windows-latest
|
|
||||||
python-version: '3.9.13'
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
8
.github/workflows/unit_tests.yml
vendored
8
.github/workflows/unit_tests.yml
vendored
@ -28,18 +28,14 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest]
|
||||||
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0', '3.13.0']
|
python-version: ['3.10.13', '3.11.5', '3.12.0', '3.13.0']
|
||||||
# Windows is a bit behind on Python version availability in Github
|
# Windows is a bit behind on Python version availability in Github
|
||||||
exclude:
|
exclude:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10.13'
|
python-version: '3.10.13'
|
||||||
- os: windows-latest
|
|
||||||
python-version: '3.9.18'
|
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: '3.10.11'
|
python-version: '3.10.11'
|
||||||
- os: windows-latest
|
|
||||||
python-version: '3.9.13'
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
# Service containers to run with `runner-job`
|
# Service containers to run with `runner-job`
|
||||||
@ -89,7 +85,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# Note: py39, py310 versions chosen due to available arm64 darwin builds.
|
# Note: py39, py310 versions chosen due to available arm64 darwin builds.
|
||||||
python-version: ['3.9.13', '3.10.11', '3.11.5', '3.12.0', '3.13.0']
|
python-version: ['3.10.11', '3.11.5', '3.12.0', '3.13.0']
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -8,7 +8,7 @@ Here is a quick guide on how to run Reflex repo locally so you can start contrib
|
|||||||
|
|
||||||
**Prerequisites:**
|
**Prerequisites:**
|
||||||
|
|
||||||
- Python >= 3.9
|
- Python >= 3.10
|
||||||
- Poetry version >= 1.4.0 and add it to your path (see [Poetry Docs](https://python-poetry.org/docs/#installation) for more info).
|
- Poetry version >= 1.4.0 and add it to your path (see [Poetry Docs](https://python-poetry.org/docs/#installation) for more info).
|
||||||
|
|
||||||
**1. Fork this repository:**
|
**1. Fork this repository:**
|
||||||
@ -87,7 +87,7 @@ poetry run ruff format .
|
|||||||
```
|
```
|
||||||
|
|
||||||
Consider installing git pre-commit hooks so Ruff, Pyright, Darglint and `make_pyi` will run automatically before each commit.
|
Consider installing git pre-commit hooks so Ruff, Pyright, Darglint and `make_pyi` will run automatically before each commit.
|
||||||
Note that pre-commit will only be installed when you use a Python version >= 3.9.
|
Note that pre-commit will only be installed when you use a Python version >= 3.10.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
@ -34,7 +34,7 @@ See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architectu
|
|||||||
|
|
||||||
## ⚙️ Installation
|
## ⚙️ Installation
|
||||||
|
|
||||||
Open a terminal and run (Requires Python 3.9+):
|
Open a terminal and run (Requires Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -34,7 +34,7 @@ Auf unserer [Architektur-Seite](https://reflex.dev/blog/2024-03-21-reflex-archit
|
|||||||
|
|
||||||
## ⚙️ Installation
|
## ⚙️ Installation
|
||||||
|
|
||||||
Öffne ein Terminal und führe den folgenden Befehl aus (benötigt Python 3.9+):
|
Öffne ein Terminal und führe den folgenden Befehl aus (benötigt Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -35,7 +35,7 @@ Consulta nuestra [página de arquitectura](https://reflex.dev/blog/2024-03-21-re
|
|||||||
|
|
||||||
## ⚙️ Instalación
|
## ⚙️ Instalación
|
||||||
|
|
||||||
Abra un terminal y ejecute (Requiere Python 3.9+):
|
Abra un terminal y ejecute (Requiere Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -35,7 +35,7 @@ Reflex के अंदर के कामकाज को जानने क
|
|||||||
|
|
||||||
## ⚙️ इंस्टॉलेशन (Installation)
|
## ⚙️ इंस्टॉलेशन (Installation)
|
||||||
|
|
||||||
एक टर्मिनल खोलें और चलाएं (Python 3.9+ की आवश्यकता है):
|
एक टर्मिनल खोलें और चलाएं (Python 3.10+ की आवश्यकता है):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
## ⚙️ Installazione
|
## ⚙️ Installazione
|
||||||
|
|
||||||
Apri un terminale ed esegui (Richiede Python 3.9+):
|
Apri un terminale ed esegui (Richiede Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -37,7 +37,7 @@ Reflex がどのように動作しているかを知るには、[アーキテク
|
|||||||
|
|
||||||
## ⚙️ インストール
|
## ⚙️ インストール
|
||||||
|
|
||||||
ターミナルを開いて以下のコマンドを実行してください。(Python 3.9 以上が必要です。):
|
ターミナルを開いて以下のコマンドを実行してください。(Python 3.10 以上が必要です。):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
---
|
---
|
||||||
## ⚙️ 설치
|
## ⚙️ 설치
|
||||||
|
|
||||||
터미널을 열고 실행하세요. (Python 3.9+ 필요):
|
터미널을 열고 실행하세요. (Python 3.10+ 필요):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
## ⚙️ Installation - نصب و راه اندازی
|
## ⚙️ Installation - نصب و راه اندازی
|
||||||
|
|
||||||
یک ترمینال را باز کنید و اجرا کنید (نیازمند Python 3.9+):
|
یک ترمینال را باز کنید و اجرا کنید (نیازمند Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
---
|
---
|
||||||
## ⚙️ Instalação
|
## ⚙️ Instalação
|
||||||
|
|
||||||
Abra um terminal e execute (Requer Python 3.9+):
|
Abra um terminal e execute (Requer Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
## ⚙️ Kurulum
|
## ⚙️ Kurulum
|
||||||
|
|
||||||
Bir terminal açın ve çalıştırın (Python 3.9+ gerekir):
|
Bir terminal açın ve çalıştırın (Python 3.10+ gerekir):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -34,7 +34,7 @@ Các tính năng chính:
|
|||||||
|
|
||||||
## ⚙️ Cài đặt
|
## ⚙️ Cài đặt
|
||||||
|
|
||||||
Mở cửa sổ lệnh và chạy (Yêu cầu Python phiên bản 3.9+):
|
Mở cửa sổ lệnh và chạy (Yêu cầu Python phiên bản 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -34,7 +34,7 @@ Reflex 是一个使用纯Python构建全栈web应用的库。
|
|||||||
|
|
||||||
## ⚙️ 安装
|
## ⚙️ 安装
|
||||||
|
|
||||||
打开一个终端并且运行(要求Python3.9+):
|
打开一个终端并且运行(要求Python3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
@ -36,7 +36,7 @@ Reflex 是一個可以用純 Python 構建全端網頁應用程式的函式庫
|
|||||||
|
|
||||||
## ⚙️ 安裝
|
## ⚙️ 安裝
|
||||||
|
|
||||||
開啟一個終端機並且執行 (需要 Python 3.9+):
|
開啟一個終端機並且執行 (需要 Python 3.10+):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install reflex
|
pip install reflex
|
||||||
|
1129
poetry.lock
generated
1129
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@ classifiers = ["Development Status :: 4 - Beta"]
|
|||||||
packages = [{ include = "reflex" }]
|
packages = [{ include = "reflex" }]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.9"
|
python = "^3.10"
|
||||||
fastapi = ">=0.96.0,!=0.111.0,!=0.111.1"
|
fastapi = ">=0.96.0,!=0.111.0,!=0.111.1"
|
||||||
gunicorn = ">=20.1.0,<24.0"
|
gunicorn = ">=20.1.0,<24.0"
|
||||||
jinja2 = ">=3.1.2,<4.0"
|
jinja2 = ">=3.1.2,<4.0"
|
||||||
@ -103,5 +103,5 @@ asyncio_default_fixture_loop_scope = "function"
|
|||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
|
|
||||||
[tool.codespell]
|
[tool.codespell]
|
||||||
skip = "docs/*,*.html,examples/*, *.pyi"
|
skip = "docs/*,*.html,examples/*, *.pyi, poetry.lock"
|
||||||
ignore-words-list = "te, TreeE"
|
ignore-words-list = "te, TreeE"
|
@ -8,7 +8,7 @@ version = "0.0.1"
|
|||||||
description = "Reflex custom component {{ module_name }}"
|
description = "Reflex custom component {{ module_name }}"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "Apache-2.0" }
|
license = { text = "Apache-2.0" }
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.10"
|
||||||
authors = [{ name = "", email = "YOUREMAIL@domain.com" }]
|
authors = [{ name = "", email = "YOUREMAIL@domain.com" }]
|
||||||
keywords = ["reflex","reflex-custom-components"]
|
keywords = ["reflex","reflex-custom-components"]
|
||||||
|
|
||||||
|
@ -364,22 +364,3 @@ getattr, __dir__, __all__ = lazy_loader.attach(
|
|||||||
submodules=_SUBMODULES,
|
submodules=_SUBMODULES,
|
||||||
submod_attrs=_SUBMOD_ATTRS,
|
submod_attrs=_SUBMOD_ATTRS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def __getattr__(name):
|
|
||||||
if name == "chakra":
|
|
||||||
from reflex.utils import console
|
|
||||||
|
|
||||||
console.deprecate(
|
|
||||||
"rx.chakra",
|
|
||||||
reason="and moved to a separate package. "
|
|
||||||
"To continue using Chakra UI components, install the `reflex-chakra` package via `pip install "
|
|
||||||
"reflex-chakra`.",
|
|
||||||
deprecation_version="0.6.0",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
dedupe=True,
|
|
||||||
)
|
|
||||||
import reflex_chakra as rc
|
|
||||||
|
|
||||||
return rc
|
|
||||||
return getattr(name)
|
|
||||||
|
@ -14,7 +14,7 @@ from reflex.components.radix.themes.layout.box import Box
|
|||||||
from reflex.constants.colors import Color
|
from reflex.constants.colors import Color
|
||||||
from reflex.event import set_clipboard
|
from reflex.event import set_clipboard
|
||||||
from reflex.style import Style
|
from reflex.style import Style
|
||||||
from reflex.utils import console, format
|
from reflex.utils import format
|
||||||
from reflex.utils.imports import ImportVar
|
from reflex.utils.imports import ImportVar
|
||||||
from reflex.vars.base import LiteralVar, Var, VarData
|
from reflex.vars.base import LiteralVar, Var, VarData
|
||||||
|
|
||||||
@ -445,17 +445,6 @@ class CodeBlock(Component, MarkdownComponentMap):
|
|||||||
dark=Theme.one_dark,
|
dark=Theme.one_dark,
|
||||||
)
|
)
|
||||||
|
|
||||||
# react-syntax-highlighter doesn't have an explicit "light" or "dark" theme so we use one-light and one-dark
|
|
||||||
# themes respectively to ensure code compatibility.
|
|
||||||
if "theme" in props and not isinstance(props["theme"], Var):
|
|
||||||
props["theme"] = getattr(Theme, format.to_snake_case(props["theme"])) # type: ignore
|
|
||||||
console.deprecate(
|
|
||||||
feature_name="theme prop as string",
|
|
||||||
reason="Use code_block.themes instead.",
|
|
||||||
deprecation_version="0.6.0",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
|
|
||||||
if can_copy:
|
if can_copy:
|
||||||
code = children[0]
|
code = children[0]
|
||||||
copy_button = ( # type: ignore
|
copy_button = ( # type: ignore
|
||||||
|
@ -40,7 +40,11 @@ from typing_extensions import (
|
|||||||
from reflex import constants
|
from reflex import constants
|
||||||
from reflex.constants.state import FRONTEND_EVENT_STATE
|
from reflex.constants.state import FRONTEND_EVENT_STATE
|
||||||
from reflex.utils import console, format
|
from reflex.utils import console, format
|
||||||
from reflex.utils.exceptions import EventFnArgMismatch, EventHandlerArgTypeMismatch
|
from reflex.utils.exceptions import (
|
||||||
|
EventFnArgMismatch,
|
||||||
|
EventHandlerArgTypeMismatch,
|
||||||
|
VarAnnotationError,
|
||||||
|
)
|
||||||
from reflex.utils.types import ArgsSpec, GenericType, typehint_issubclass
|
from reflex.utils.types import ArgsSpec, GenericType, typehint_issubclass
|
||||||
from reflex.vars import VarData
|
from reflex.vars import VarData
|
||||||
from reflex.vars.base import LiteralVar, Var
|
from reflex.vars.base import LiteralVar, Var
|
||||||
@ -1330,19 +1334,15 @@ def resolve_annotation(annotations: dict[str, Any], arg_name: str):
|
|||||||
annotations: The annotations.
|
annotations: The annotations.
|
||||||
arg_name: The argument name.
|
arg_name: The argument name.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
VarAnnotationError: If the annotation for given arg_name is None.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The resolved annotation.
|
The resolved annotation.
|
||||||
"""
|
"""
|
||||||
annotation = annotations.get(arg_name)
|
annotation = annotations.get(arg_name)
|
||||||
if annotation is None:
|
if annotation is None:
|
||||||
console.deprecate(
|
raise VarAnnotationError(var_name=arg_name, annotation_value=annotation)
|
||||||
feature_name="Unannotated event handler arguments",
|
|
||||||
reason="Provide type annotations for event handler arguments.",
|
|
||||||
deprecation_version="0.6.3",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
# Allow arbitrary attribute access two levels deep until removed.
|
|
||||||
return Dict[str, dict]
|
|
||||||
return annotation
|
return annotation
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ from reflex.components.sonner.toast import toast as toast
|
|||||||
|
|
||||||
from ..utils.console import warn
|
from ..utils.console import warn
|
||||||
from . import hooks as hooks
|
from . import hooks as hooks
|
||||||
from .assets import asset as asset
|
|
||||||
from .client_state import ClientStateVar as ClientStateVar
|
from .client_state import ClientStateVar as ClientStateVar
|
||||||
from .layout import layout as layout
|
from .layout import layout as layout
|
||||||
from .misc import run_in_thread as run_in_thread
|
from .misc import run_in_thread as run_in_thread
|
||||||
@ -62,7 +61,6 @@ class ExperimentalNamespace(SimpleNamespace):
|
|||||||
|
|
||||||
|
|
||||||
_x = ExperimentalNamespace(
|
_x = ExperimentalNamespace(
|
||||||
asset=asset,
|
|
||||||
client_state=ClientStateVar.create,
|
client_state=ClientStateVar.create,
|
||||||
hooks=hooks,
|
hooks=hooks,
|
||||||
layout=layout,
|
layout=layout,
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
"""Helper functions for adding assets to the app."""
|
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from reflex import assets
|
|
||||||
from reflex.utils import console
|
|
||||||
|
|
||||||
|
|
||||||
def asset(relative_filename: str, subfolder: Optional[str] = None) -> str:
|
|
||||||
"""DEPRECATED: use `rx.asset` with `shared=True` instead.
|
|
||||||
|
|
||||||
Add an asset to the app.
|
|
||||||
Place the file next to your including python file.
|
|
||||||
Copies the file to the app's external assets directory.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```python
|
|
||||||
rx.script(src=rx._x.asset("my_custom_javascript.js"))
|
|
||||||
rx.image(src=rx._x.asset("test_image.png","subfolder"))
|
|
||||||
```
|
|
||||||
|
|
||||||
Args:
|
|
||||||
relative_filename: The relative filename of the asset.
|
|
||||||
subfolder: The directory to place the asset in.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The relative URL to the copied asset.
|
|
||||||
"""
|
|
||||||
console.deprecate(
|
|
||||||
feature_name="rx._x.asset",
|
|
||||||
reason="Use `rx.asset` with `shared=True` instead of `rx._x.asset`.",
|
|
||||||
deprecation_version="0.6.6",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
return assets.asset(
|
|
||||||
relative_filename, shared=True, subfolder=subfolder, _stack_level=2
|
|
||||||
)
|
|
@ -4,9 +4,9 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
from reflex import color, cond
|
|
||||||
from reflex.components.base.fragment import Fragment
|
from reflex.components.base.fragment import Fragment
|
||||||
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
||||||
|
from reflex.components.core import color, cond
|
||||||
from reflex.components.radix.primitives.drawer import DrawerRoot, drawer
|
from reflex.components.radix.primitives.drawer import DrawerRoot, drawer
|
||||||
from reflex.components.radix.themes.components.icon_button import IconButton
|
from reflex.components.radix.themes.components.icon_button import IconButton
|
||||||
from reflex.components.radix.themes.layout.box import Box
|
from reflex.components.radix.themes.layout.box import Box
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
from typing import Any, Dict, List, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex import color
|
|
||||||
from reflex.components.base.fragment import Fragment
|
from reflex.components.base.fragment import Fragment
|
||||||
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
||||||
|
from reflex.components.core import color
|
||||||
from reflex.components.radix.primitives.drawer import DrawerRoot
|
from reflex.components.radix.primitives.drawer import DrawerRoot
|
||||||
from reflex.components.radix.themes.layout.box import Box
|
from reflex.components.radix.themes.layout.box import Box
|
||||||
from reflex.event import BASE_STATE, EventType
|
from reflex.event import BASE_STATE, EventType
|
||||||
|
@ -1772,7 +1772,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
if (
|
if (
|
||||||
isinstance(value, dict)
|
isinstance(value, dict)
|
||||||
and inspect.isclass(hinted_args)
|
and inspect.isclass(hinted_args)
|
||||||
and not types.is_generic_alias(hinted_args) # py3.9-py3.10
|
and not types.is_generic_alias(hinted_args) # py3.10
|
||||||
):
|
):
|
||||||
if issubclass(hinted_args, Model):
|
if issubclass(hinted_args, Model):
|
||||||
# Remove non-fields from the payload
|
# Remove non-fields from the payload
|
||||||
|
@ -49,16 +49,7 @@ def set_log_level(log_level: LogLevel):
|
|||||||
ValueError: If the log level is invalid.
|
ValueError: If the log level is invalid.
|
||||||
"""
|
"""
|
||||||
if not isinstance(log_level, LogLevel):
|
if not isinstance(log_level, LogLevel):
|
||||||
deprecate(
|
raise ValueError("Invalid log level")
|
||||||
feature_name="Passing a string to set_log_level",
|
|
||||||
reason="use reflex.constants.LogLevel enum instead",
|
|
||||||
deprecation_version="0.6.6",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
log_level = getattr(LogLevel, log_level.upper())
|
|
||||||
except AttributeError as ae:
|
|
||||||
raise ValueError(f"Invalid log level: {log_level}") from ae
|
|
||||||
|
|
||||||
global _LOG_LEVEL
|
global _LOG_LEVEL
|
||||||
_LOG_LEVEL = log_level
|
_LOG_LEVEL = log_level
|
||||||
|
@ -59,6 +59,19 @@ class VarAttributeError(ReflexError, AttributeError):
|
|||||||
"""Custom AttributeError for var related errors."""
|
"""Custom AttributeError for var related errors."""
|
||||||
|
|
||||||
|
|
||||||
|
class VarAnnotationError(ReflexError, TypeError):
|
||||||
|
"""Custom TypeError for var annotation related errors."""
|
||||||
|
|
||||||
|
def __init__(self, var_name, annotation_value):
|
||||||
|
"""Initialize the exception.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
var_name: The name of the var.
|
||||||
|
annotation_value: The value of the annotation.
|
||||||
|
"""
|
||||||
|
super().__init__(f"Invalid annotation for var '{var_name}': {annotation_value}")
|
||||||
|
|
||||||
|
|
||||||
class UploadValueError(ReflexError, ValueError):
|
class UploadValueError(ReflexError, ValueError):
|
||||||
"""Custom ValueError for upload related errors."""
|
"""Custom ValueError for upload related errors."""
|
||||||
|
|
||||||
|
@ -495,48 +495,3 @@ def is_prod_mode() -> bool:
|
|||||||
"""
|
"""
|
||||||
current_mode = environment.REFLEX_ENV_MODE.get()
|
current_mode = environment.REFLEX_ENV_MODE.get()
|
||||||
return current_mode == constants.Env.PROD
|
return current_mode == constants.Env.PROD
|
||||||
|
|
||||||
|
|
||||||
def is_frontend_only() -> bool:
|
|
||||||
"""Check if the app is running in frontend-only mode.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
True if the app is running in frontend-only mode.
|
|
||||||
"""
|
|
||||||
console.deprecate(
|
|
||||||
"is_frontend_only() is deprecated and will be removed in a future release.",
|
|
||||||
reason="Use `environment.REFLEX_FRONTEND_ONLY.get()` instead.",
|
|
||||||
deprecation_version="0.6.5",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
return environment.REFLEX_FRONTEND_ONLY.get()
|
|
||||||
|
|
||||||
|
|
||||||
def is_backend_only() -> bool:
|
|
||||||
"""Check if the app is running in backend-only mode.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
True if the app is running in backend-only mode.
|
|
||||||
"""
|
|
||||||
console.deprecate(
|
|
||||||
"is_backend_only() is deprecated and will be removed in a future release.",
|
|
||||||
reason="Use `environment.REFLEX_BACKEND_ONLY.get()` instead.",
|
|
||||||
deprecation_version="0.6.5",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
return environment.REFLEX_BACKEND_ONLY.get()
|
|
||||||
|
|
||||||
|
|
||||||
def should_skip_compile() -> bool:
|
|
||||||
"""Whether the app should skip compile.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
True if the app should skip compile.
|
|
||||||
"""
|
|
||||||
console.deprecate(
|
|
||||||
"should_skip_compile() is deprecated and will be removed in a future release.",
|
|
||||||
reason="Use `environment.REFLEX_SKIP_COMPILE.get()` instead.",
|
|
||||||
deprecation_version="0.6.5",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
return environment.REFLEX_SKIP_COMPILE.get()
|
|
||||||
|
@ -11,7 +11,6 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
|
|||||||
from reflex import constants
|
from reflex import constants
|
||||||
from reflex.constants.state import FRONTEND_EVENT_STATE
|
from reflex.constants.state import FRONTEND_EVENT_STATE
|
||||||
from reflex.utils import exceptions
|
from reflex.utils import exceptions
|
||||||
from reflex.utils.console import deprecate
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from reflex.components.component import ComponentStyle
|
from reflex.components.component import ComponentStyle
|
||||||
@ -502,37 +501,6 @@ if TYPE_CHECKING:
|
|||||||
from reflex.vars import Var
|
from reflex.vars import Var
|
||||||
|
|
||||||
|
|
||||||
def format_event_chain(
|
|
||||||
event_chain: EventChain | Var[EventChain],
|
|
||||||
event_arg: Var | None = None,
|
|
||||||
) -> str:
|
|
||||||
"""DEPRECATED: format an event chain as a javascript invocation.
|
|
||||||
|
|
||||||
Use str(rx.Var.create(event_chain)) instead.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
event_chain: The event chain to format.
|
|
||||||
event_arg: this argument is ignored.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Compiled javascript code to queue the given event chain on the frontend.
|
|
||||||
"""
|
|
||||||
deprecate(
|
|
||||||
feature_name="format_event_chain",
|
|
||||||
reason="Use str(rx.Var.create(event_chain)) instead",
|
|
||||||
deprecation_version="0.6.0",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
|
|
||||||
from reflex.vars import Var
|
|
||||||
from reflex.vars.function import ArgsFunctionOperation
|
|
||||||
|
|
||||||
result = Var.create(event_chain)
|
|
||||||
if isinstance(result, ArgsFunctionOperation):
|
|
||||||
result = result._return_expr
|
|
||||||
return str(result)
|
|
||||||
|
|
||||||
|
|
||||||
def format_queue_events(
|
def format_queue_events(
|
||||||
events: EventType | None = None,
|
events: EventType | None = None,
|
||||||
args_spec: Optional[ArgsSpec] = None,
|
args_spec: Optional[ArgsSpec] = None,
|
||||||
|
@ -75,18 +75,6 @@ def get_web_dir() -> Path:
|
|||||||
return environment.REFLEX_WEB_WORKDIR.get()
|
return environment.REFLEX_WEB_WORKDIR.get()
|
||||||
|
|
||||||
|
|
||||||
def _python_version_check():
|
|
||||||
"""Emit deprecation warning for deprecated python versions."""
|
|
||||||
# Check for end-of-life python versions.
|
|
||||||
if sys.version_info < (3, 10):
|
|
||||||
console.deprecate(
|
|
||||||
feature_name="Support for Python 3.9 and older",
|
|
||||||
reason="please upgrade to Python 3.10 or newer",
|
|
||||||
deprecation_version="0.6.0",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def check_latest_package_version(package_name: str):
|
def check_latest_package_version(package_name: str):
|
||||||
"""Check if the latest version of the package is installed.
|
"""Check if the latest version of the package is installed.
|
||||||
|
|
||||||
@ -109,8 +97,6 @@ def check_latest_package_version(package_name: str):
|
|||||||
console.warn(
|
console.warn(
|
||||||
f"Your version ({current_version}) of {package_name} is out of date. Upgrade to {latest_version} with 'pip install {package_name} --upgrade'"
|
f"Your version ({current_version}) of {package_name} is out of date. Upgrade to {latest_version} with 'pip install {package_name} --upgrade'"
|
||||||
)
|
)
|
||||||
# Check for deprecated python versions
|
|
||||||
_python_version_check()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -122,10 +122,10 @@ def _prepare_event(event: str, **kwargs) -> dict:
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
if UTC is None:
|
if UTC is None:
|
||||||
# for python 3.9 & 3.10
|
# for python 3.10
|
||||||
stamp = datetime.utcnow().isoformat()
|
stamp = datetime.utcnow().isoformat()
|
||||||
else:
|
else:
|
||||||
# for python 3.11 & 3.12
|
# for python 3.11 & later
|
||||||
stamp = datetime.now(UTC).isoformat()
|
stamp = datetime.now(UTC).isoformat()
|
||||||
|
|
||||||
cpuinfo = get_cpu_info()
|
cpuinfo = get_cpu_info()
|
||||||
|
@ -541,38 +541,17 @@ class Var(Generic[VAR_TYPE]):
|
|||||||
def create(
|
def create(
|
||||||
cls,
|
cls,
|
||||||
value: Any,
|
value: Any,
|
||||||
_var_is_local: bool | None = None,
|
|
||||||
_var_is_string: bool | None = None,
|
|
||||||
_var_data: VarData | None = None,
|
_var_data: VarData | None = None,
|
||||||
) -> Var:
|
) -> Var:
|
||||||
"""Create a var from a value.
|
"""Create a var from a value.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
value: The value to create the var from.
|
value: The value to create the var from.
|
||||||
_var_is_local: Whether the var is local. Deprecated.
|
|
||||||
_var_is_string: Whether the var is a string literal. Deprecated.
|
|
||||||
_var_data: Additional hooks and imports associated with the Var.
|
_var_data: Additional hooks and imports associated with the Var.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The var.
|
The var.
|
||||||
"""
|
"""
|
||||||
if _var_is_local is not None:
|
|
||||||
console.deprecate(
|
|
||||||
feature_name="_var_is_local",
|
|
||||||
reason="The _var_is_local argument is not supported for Var."
|
|
||||||
"If you want to create a Var from a raw Javascript expression, use the constructor directly",
|
|
||||||
deprecation_version="0.6.0",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
if _var_is_string is not None:
|
|
||||||
console.deprecate(
|
|
||||||
feature_name="_var_is_string",
|
|
||||||
reason="The _var_is_string argument is not supported for Var."
|
|
||||||
"If you want to create a Var from a raw Javascript expression, use the constructor directly",
|
|
||||||
deprecation_version="0.6.0",
|
|
||||||
removal_version="0.7.0",
|
|
||||||
)
|
|
||||||
|
|
||||||
# If the value is already a var, do nothing.
|
# If the value is already a var, do nothing.
|
||||||
if isinstance(value, Var):
|
if isinstance(value, Var):
|
||||||
return value
|
return value
|
||||||
@ -581,12 +560,6 @@ class Var(Generic[VAR_TYPE]):
|
|||||||
if not isinstance(value, str):
|
if not isinstance(value, str):
|
||||||
return LiteralVar.create(value)
|
return LiteralVar.create(value)
|
||||||
|
|
||||||
if _var_is_string is False or _var_is_local is True:
|
|
||||||
return cls(
|
|
||||||
_js_expr=value,
|
|
||||||
_var_data=_var_data,
|
|
||||||
)
|
|
||||||
|
|
||||||
return LiteralVar.create(value, _var_data=_var_data)
|
return LiteralVar.create(value, _var_data=_var_data)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM python:3.9
|
FROM python:3.10
|
||||||
|
|
||||||
ARG USERNAME=kerrigan
|
ARG USERNAME=kerrigan
|
||||||
RUN useradd -m $USERNAME
|
RUN useradd -m $USERNAME
|
||||||
|
Loading…
Reference in New Issue
Block a user