Skip to content

Commit 42d5b9d

Browse files
authored
promote run_in_thread from experimental (#5016)
1 parent a46e4ff commit 42d5b9d

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

reflex/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@
344344
"istate.wrappers": ["get_state"],
345345
"style": ["Style", "toggle_color_mode"],
346346
"utils.imports": ["ImportDict", "ImportVar"],
347+
"utils.misc": ["run_in_thread"],
347348
"utils.serializers": ["serializer"],
348349
"vars": ["Var", "field", "Field"],
349350
}

reflex/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ from .style import Style as Style
197197
from .style import toggle_color_mode as toggle_color_mode
198198
from .utils.imports import ImportDict as ImportDict
199199
from .utils.imports import ImportVar as ImportVar
200+
from .utils.misc import run_in_thread as run_in_thread
200201
from .utils.serializers import serializer as serializer
201202
from .vars import Field as Field
202203
from .vars import Var as Var

reflex/experimental/__init__.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from reflex.components.sonner.toast import toast as toast
99

1010
from ..utils.console import warn
11+
from ..utils.misc import run_in_thread
1112
from . import hooks as hooks
1213
from .client_state import ClientStateVar as ClientStateVar
1314
from .layout import layout as layout
14-
from .misc import run_in_thread as run_in_thread
1515

1616

1717
class ExperimentalNamespace(SimpleNamespace):
@@ -46,23 +46,35 @@ def toast(self):
4646

4747
@property
4848
def progress(self):
49-
"""Temporary property returning the toast namespace.
49+
"""Temporary property returning the progress component.
5050
51-
Remove this property when toast is fully promoted.
51+
Remove this property when progress is fully promoted.
5252
5353
Returns:
54-
The toast namespace.
54+
The progress component.
5555
"""
5656
self.register_component_warning("progress")
5757
return progress
5858

59+
@property
60+
def run_in_thread(self):
61+
"""Temporary property returning the run_in_thread helper function.
62+
63+
Remove this property when run_in_thread is fully promoted.
64+
65+
Returns:
66+
The run_in_thread helper function.
67+
"""
68+
self.register_component_warning("run_in_thread")
69+
return run_in_thread
70+
5971
@staticmethod
6072
def register_component_warning(component_name: str):
6173
"""Add component to emitted warnings and throw a warning if it
6274
doesn't exist.
6375
6476
Args:
65-
component_name: name of the component.
77+
component_name: name of the component.
6678
"""
6779
warn(
6880
f"`rx._x.{component_name}` was promoted to `rx.{component_name}`.",
@@ -75,6 +87,5 @@ def register_component_warning(component_name: str):
7587
hooks=hooks,
7688
layout=layout,
7789
PropsBase=PropsBase,
78-
run_in_thread=run_in_thread,
7990
code_block=code_block,
8091
)

0 commit comments

Comments
 (0)