diff --git a/poetry.lock b/poetry.lock index 0700cef0ad..514b8ffcc4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1346,20 +1346,6 @@ files = [ [package.dependencies] six = ">=1.5" -[[package]] -name = "python-dotenv" -version = "0.13.0" -description = "Add .env support to your django/flask apps in development and deployments" -optional = false -python-versions = "*" -files = [ - {file = "python-dotenv-0.13.0.tar.gz", hash = "sha256:3b9909bc96b0edc6b01586e1eed05e71174ef4e04c71da5786370cebea53ad74"}, - {file = "python_dotenv-0.13.0-py2.py3-none-any.whl", hash = "sha256:25c0ff1a3e12f4bde8d592cc254ab075cfe734fc5dd989036716fd17ee7e5ec7"}, -] - -[package.extras] -cli = ["click (>=5.0)"] - [[package]] name = "python-engineio" version = "4.5.1" @@ -2139,4 +2125,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "7ba5a63b5a857eaa7e48c4addedd829727d6a074b60a1430e52ea7530547686a" +content-hash = "2b00be45f1c3b5118e2d54b315991c37f65e9da3fa081dab6adb4c7bb1205c74" diff --git a/pyproject.toml b/pyproject.toml index 307153586c..e58b983e24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ importlib-metadata = {version = "^6.7.0", python = ">=3.7, <3.8"} alembic = "^1.11.1" platformdirs = "^3.10.0" distro = {version = "^1.8.0", platform = "linux"} +python-engineio = "!=4.6.0" [tool.poetry.group.dev.dependencies] pytest = "^7.1.2" diff --git a/reflex/components/datadisplay/datatable.py b/reflex/components/datadisplay/datatable.py index 880e375406..2fe6528739 100644 --- a/reflex/components/datadisplay/datatable.py +++ b/reflex/components/datadisplay/datatable.py @@ -1,6 +1,6 @@ """Table components.""" -from typing import Any, List +from typing import Any, Dict, List, Union from reflex.components.component import Component from reflex.components.tags import Tag @@ -38,7 +38,7 @@ class DataTable(Gridjs): resizable: Var[bool] # Enable pagination. - pagination: Var[bool] + pagination: Var[Union[bool, Dict]] @classmethod def create(cls, *children, **props): diff --git a/reflex/model.py b/reflex/model.py index 4bc55912ce..2e9d275b5c 100644 --- a/reflex/model.py +++ b/reflex/model.py @@ -43,12 +43,9 @@ def get_engine(url: Optional[str] = None): ) # Print the SQL queries if the log level is INFO or lower. echo_db_query = os.environ.get("SQLALCHEMY_ECHO") == "True" - return sqlmodel.create_engine( - url, - echo=echo_db_query, - # Needed for the admin dash. - connect_args={"check_same_thread": False}, - ) + # Needed for the admin dash on sqlite. + connect_args = {"check_same_thread": False} if url.startswith("sqlite") else {} + return sqlmodel.create_engine(url, echo=echo_db_query, connect_args=connect_args) class Model(Base, sqlmodel.SQLModel): diff --git a/reflex/vars.py b/reflex/vars.py index 0373ca06a8..2db292c1e6 100644 --- a/reflex/vars.py +++ b/reflex/vars.py @@ -30,7 +30,7 @@ from reflex import constants from reflex.base import Base -from reflex.utils import format, types +from reflex.utils import console, format, types if TYPE_CHECKING: from reflex.state import State @@ -831,7 +831,16 @@ def setter(state: State, value: Any): state: The state within which we add the setter function. value: The value to set. """ - setattr(state, self.name, value) + if self.type_ in [int, float]: + try: + value = self.type_(value) + setattr(state, self.name, value) + except ValueError: + console.warn( + f"{self.name}: Failed conversion of {value} to '{self.type_.__name__}'. Value not set.", + ) + else: + setattr(state, self.name, value) setter.__qualname__ = self.get_setter_name()