reflex 0.5.1a1__py3-none-any.whl → 0.5.1a3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/app.py +3 -4
- reflex/app_module_for_backend.py +3 -0
- reflex/components/core/cond.py +9 -3
- reflex/state.py +1 -3
- reflex/utils/prerequisites.py +3 -4
- reflex/utils/telemetry.py +37 -11
- {reflex-0.5.1a1.dist-info → reflex-0.5.1a3.dist-info}/METADATA +1 -1
- {reflex-0.5.1a1.dist-info → reflex-0.5.1a3.dist-info}/RECORD +11 -11
- {reflex-0.5.1a1.dist-info → reflex-0.5.1a3.dist-info}/LICENSE +0 -0
- {reflex-0.5.1a1.dist-info → reflex-0.5.1a3.dist-info}/WHEEL +0 -0
- {reflex-0.5.1a1.dist-info → reflex-0.5.1a3.dist-info}/entry_points.txt +0 -0
reflex/app.py
CHANGED
|
@@ -1068,13 +1068,12 @@ async def process(
|
|
|
1068
1068
|
client_ip: The client_ip.
|
|
1069
1069
|
|
|
1070
1070
|
Raises:
|
|
1071
|
-
|
|
1071
|
+
Exception: If a reflex specific error occurs during processing the event.
|
|
1072
1072
|
|
|
1073
1073
|
Yields:
|
|
1074
1074
|
The state updates after processing the event.
|
|
1075
1075
|
"""
|
|
1076
1076
|
from reflex.utils import telemetry
|
|
1077
|
-
from reflex.utils.exceptions import ReflexError
|
|
1078
1077
|
|
|
1079
1078
|
try:
|
|
1080
1079
|
# Add request data to the state.
|
|
@@ -1118,8 +1117,8 @@ async def process(
|
|
|
1118
1117
|
|
|
1119
1118
|
# Yield the update.
|
|
1120
1119
|
yield update
|
|
1121
|
-
except
|
|
1122
|
-
telemetry.
|
|
1120
|
+
except Exception as ex:
|
|
1121
|
+
telemetry.send_error(ex, context="backend")
|
|
1123
1122
|
raise
|
|
1124
1123
|
|
|
1125
1124
|
|
reflex/app_module_for_backend.py
CHANGED
|
@@ -4,12 +4,14 @@ Only the app attribute is explicitly exposed.
|
|
|
4
4
|
from concurrent.futures import ThreadPoolExecutor
|
|
5
5
|
|
|
6
6
|
from reflex import constants
|
|
7
|
+
from reflex.utils import telemetry
|
|
7
8
|
from reflex.utils.exec import is_prod_mode
|
|
8
9
|
from reflex.utils.prerequisites import get_app
|
|
9
10
|
|
|
10
11
|
if "app" != constants.CompileVars.APP:
|
|
11
12
|
raise AssertionError("unexpected variable name for 'app'")
|
|
12
13
|
|
|
14
|
+
telemetry.send("compile")
|
|
13
15
|
app_module = get_app(reload=False)
|
|
14
16
|
app = getattr(app_module, constants.CompileVars.APP)
|
|
15
17
|
# For py3.8 and py3.9 compatibility when redis is used, we MUST add any decorator pages
|
|
@@ -29,5 +31,6 @@ del app_module
|
|
|
29
31
|
del compile_future
|
|
30
32
|
del get_app
|
|
31
33
|
del is_prod_mode
|
|
34
|
+
del telemetry
|
|
32
35
|
del constants
|
|
33
36
|
del ThreadPoolExecutor
|
reflex/components/core/cond.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Create a list of components from an iterable."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
|
-
from typing import Any, Dict, Optional, overload
|
|
5
|
+
from typing import Any, Dict, Optional, Union, overload
|
|
5
6
|
|
|
6
7
|
from reflex.components.base.fragment import Fragment
|
|
7
8
|
from reflex.components.component import BaseComponent, Component, MemoizationLeaf
|
|
@@ -10,7 +11,7 @@ from reflex.constants import Dirs
|
|
|
10
11
|
from reflex.constants.colors import Color
|
|
11
12
|
from reflex.style import LIGHT_COLOR_MODE, color_mode
|
|
12
13
|
from reflex.utils import format, imports
|
|
13
|
-
from reflex.vars import
|
|
14
|
+
from reflex.vars import Var, VarData
|
|
14
15
|
|
|
15
16
|
_IS_TRUE_IMPORT = {
|
|
16
17
|
f"/{Dirs.STATE_PATH}": [imports.ImportVar(tag="isTrue")],
|
|
@@ -171,6 +172,11 @@ def cond(condition: Any, c1: Any, c2: Any = None):
|
|
|
171
172
|
c2 = create_var(c2)
|
|
172
173
|
var_datas.extend([c1._var_data, c2._var_data])
|
|
173
174
|
|
|
175
|
+
c1_type = c1._var_type if isinstance(c1, Var) else type(c1)
|
|
176
|
+
c2_type = c2._var_type if isinstance(c2, Var) else type(c2)
|
|
177
|
+
|
|
178
|
+
var_type = c1_type if c1_type == c2_type else Union[c1_type, c2_type]
|
|
179
|
+
|
|
174
180
|
# Create the conditional var.
|
|
175
181
|
return cond_var._replace(
|
|
176
182
|
_var_name=format.format_cond(
|
|
@@ -179,7 +185,7 @@ def cond(condition: Any, c1: Any, c2: Any = None):
|
|
|
179
185
|
false_value=c2,
|
|
180
186
|
is_prop=True,
|
|
181
187
|
),
|
|
182
|
-
_var_type=
|
|
188
|
+
_var_type=var_type,
|
|
183
189
|
_var_is_local=False,
|
|
184
190
|
_var_full_name_needs_state_prefix=False,
|
|
185
191
|
merge_var_data=VarData.merge(*var_datas),
|
reflex/state.py
CHANGED
|
@@ -1476,7 +1476,6 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1476
1476
|
StateUpdate object
|
|
1477
1477
|
"""
|
|
1478
1478
|
from reflex.utils import telemetry
|
|
1479
|
-
from reflex.utils.exceptions import ReflexError
|
|
1480
1479
|
|
|
1481
1480
|
# Get the function to process the event.
|
|
1482
1481
|
fn = functools.partial(handler.fn, state)
|
|
@@ -1516,8 +1515,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1516
1515
|
except Exception as ex:
|
|
1517
1516
|
error = traceback.format_exc()
|
|
1518
1517
|
print(error)
|
|
1519
|
-
|
|
1520
|
-
telemetry.send("error", context="backend", detail=str(ex))
|
|
1518
|
+
telemetry.send_error(ex, context="backend")
|
|
1521
1519
|
yield state._as_state_update(
|
|
1522
1520
|
handler,
|
|
1523
1521
|
window_alert("An error occurred. See logs for details."),
|
reflex/utils/prerequisites.py
CHANGED
|
@@ -233,9 +233,8 @@ def get_app(reload: bool = False) -> ModuleType:
|
|
|
233
233
|
|
|
234
234
|
Raises:
|
|
235
235
|
RuntimeError: If the app name is not set in the config.
|
|
236
|
-
exceptions.ReflexError: Reflex specific errors.
|
|
237
236
|
"""
|
|
238
|
-
from reflex.utils import
|
|
237
|
+
from reflex.utils import telemetry
|
|
239
238
|
|
|
240
239
|
try:
|
|
241
240
|
os.environ[constants.RELOAD_CONFIG] = str(reload)
|
|
@@ -259,8 +258,8 @@ def get_app(reload: bool = False) -> ModuleType:
|
|
|
259
258
|
importlib.reload(app)
|
|
260
259
|
|
|
261
260
|
return app
|
|
262
|
-
except
|
|
263
|
-
telemetry.
|
|
261
|
+
except Exception as ex:
|
|
262
|
+
telemetry.send_error(ex, context="frontend")
|
|
264
263
|
raise
|
|
265
264
|
|
|
266
265
|
|
reflex/utils/telemetry.py
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import asyncio
|
|
5
6
|
import multiprocessing
|
|
6
7
|
import platform
|
|
8
|
+
import warnings
|
|
7
9
|
|
|
8
10
|
try:
|
|
9
11
|
from datetime import UTC, datetime
|
|
@@ -157,17 +159,7 @@ def _send_event(event_data: dict) -> bool:
|
|
|
157
159
|
return False
|
|
158
160
|
|
|
159
161
|
|
|
160
|
-
def
|
|
161
|
-
"""Send anonymous telemetry for Reflex.
|
|
162
|
-
|
|
163
|
-
Args:
|
|
164
|
-
event: The event name.
|
|
165
|
-
telemetry_enabled: Whether to send the telemetry (If None, get from config).
|
|
166
|
-
kwargs: Additional data to send with the event.
|
|
167
|
-
|
|
168
|
-
Returns:
|
|
169
|
-
Whether the telemetry was sent successfully.
|
|
170
|
-
"""
|
|
162
|
+
def _send(event, telemetry_enabled, **kwargs):
|
|
171
163
|
from reflex.config import get_config
|
|
172
164
|
|
|
173
165
|
# Get the telemetry_enabled from the config if it is not specified.
|
|
@@ -182,3 +174,37 @@ def send(event: str, telemetry_enabled: bool | None = None, **kwargs) -> bool:
|
|
|
182
174
|
if not event_data:
|
|
183
175
|
return False
|
|
184
176
|
return _send_event(event_data)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def send(event: str, telemetry_enabled: bool | None = None, **kwargs):
|
|
180
|
+
"""Send anonymous telemetry for Reflex.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
event: The event name.
|
|
184
|
+
telemetry_enabled: Whether to send the telemetry (If None, get from config).
|
|
185
|
+
kwargs: Additional data to send with the event.
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
async def async_send(event, telemetry_enabled, **kwargs):
|
|
189
|
+
return _send(event, telemetry_enabled, **kwargs)
|
|
190
|
+
|
|
191
|
+
try:
|
|
192
|
+
# Within an event loop context, send the event asynchronously.
|
|
193
|
+
asyncio.create_task(async_send(event, telemetry_enabled, **kwargs))
|
|
194
|
+
except RuntimeError:
|
|
195
|
+
# If there is no event loop, send the event synchronously.
|
|
196
|
+
warnings.filterwarnings("ignore", category=RuntimeWarning)
|
|
197
|
+
_send(event, telemetry_enabled, **kwargs)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def send_error(error: Exception, context: str):
|
|
201
|
+
"""Send an error event.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
error: The error to send.
|
|
205
|
+
context: The context of the error (e.g. "frontend" or "backend")
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
Whether the telemetry was sent successfully.
|
|
209
|
+
"""
|
|
210
|
+
return send("error", detail=type(error).__name__, context=context)
|
|
@@ -66,8 +66,8 @@ reflex/__init__.py,sha256=fzBYk8qUFWkUlD3U-97xEAdv9N1tTMRmAzQat_9cZW0,5831
|
|
|
66
66
|
reflex/__init__.pyi,sha256=y4jPgnR9f6xOpFAK9-WM7p-T05Y5jGFYkx7Thdok_3I,7791
|
|
67
67
|
reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
|
|
68
68
|
reflex/admin.py,sha256=-bTxFUEoHo4X9FzmcSa6KSVVPpF7wh38lBvF67GhSvQ,373
|
|
69
|
-
reflex/app.py,sha256=
|
|
70
|
-
reflex/app_module_for_backend.py,sha256=
|
|
69
|
+
reflex/app.py,sha256=vROxTXBLlPCUjI_9_-8_S7XOaExVls2j-kUE50u6-W0,47127
|
|
70
|
+
reflex/app_module_for_backend.py,sha256=zGsgZWpl11exOuH34JZUimNgBnWpjL7WH4SW6LItxgY,1227
|
|
71
71
|
reflex/base.py,sha256=nqvgm-f1Fcj1WQrphKFniZWIM13bzr48OgfPBo1KZd8,4274
|
|
72
72
|
reflex/compiler/__init__.py,sha256=r8jqmDSFf09iV2lHlNhfc9XrTLjNxfDNwPYlxS4cmHE,27
|
|
73
73
|
reflex/compiler/compiler.py,sha256=_ywbGHWnyM6tqPV-oriyBhFkblm5jQSJ6UuZT0LtkBo,17455
|
|
@@ -240,7 +240,7 @@ reflex/components/core/banner.pyi,sha256=Su21s78LOsIyYy3n7rtBeYDgXl2PO2Oo9cMAztP
|
|
|
240
240
|
reflex/components/core/client_side_routing.py,sha256=mdZsGuc1V9qvOE0TaLEnXmXo0qHuPjc_dZrSjnlZsqc,1873
|
|
241
241
|
reflex/components/core/client_side_routing.pyi,sha256=7Zel95b6tqfW0ulIJEHh9fmG_6av9eNeNjtORZ73jjM,6264
|
|
242
242
|
reflex/components/core/colors.py,sha256=-hzVGLEq3TiqroqzMi_YzGBCPXMvkNsen3pS_NzIQNk,590
|
|
243
|
-
reflex/components/core/cond.py,sha256=
|
|
243
|
+
reflex/components/core/cond.py,sha256=4jKcg9IBprpWAGY28Iymxe5Pu0UMEH-2e64zIkmf7_w,6163
|
|
244
244
|
reflex/components/core/debounce.py,sha256=HUR2yHkWEFawc64GZ7CakzLCx6WwCRhiPssAGJbtkSY,4820
|
|
245
245
|
reflex/components/core/debounce.pyi,sha256=VGBX3hsRQo3xFP0xkYJuy25rDQ5rxRIk58mCV34fHSI,4216
|
|
246
246
|
reflex/components/core/foreach.py,sha256=utMZhwg_k118EFwvO5jLXeQylZS3AAKS38fAIG9N2wE,4732
|
|
@@ -494,7 +494,7 @@ reflex/model.py,sha256=WMcJiT04HSM4fKTP9SIZJQoDrIO2vaPTsoao-X169V4,13227
|
|
|
494
494
|
reflex/page.py,sha256=NPT0xMownZGTiYiRtrUJnvAe_4oEvlzEJEkG-vrGhqI,2077
|
|
495
495
|
reflex/reflex.py,sha256=VJZAwe9lIqbS3VB3QkP5-OMmNXmM4gi-5TWMCJgZPcc,17826
|
|
496
496
|
reflex/route.py,sha256=WZS7stKgO94nekFFYHaOqNgN3zZGpJb3YpGF4ViTHmw,4198
|
|
497
|
-
reflex/state.py,sha256=
|
|
497
|
+
reflex/state.py,sha256=muy6eMhNKwv0T-mcpSoKIvI_7MAsZPnb2Y4M8RtPVbI,107042
|
|
498
498
|
reflex/style.py,sha256=iqXJzDZ5pgkpaYHkIn_AZxu7iz1DmVg5mBSFShZhPSE,9389
|
|
499
499
|
reflex/testing.py,sha256=vY6eRztzOVmrFqKdCVOEOICaFBuhF9K6948G68moNns,31461
|
|
500
500
|
reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
|
|
@@ -507,17 +507,17 @@ reflex/utils/export.py,sha256=UJd4BYFW9_eexhLCP4C5Ri8Cq2tWAPNVspq70lPLCyo,2270
|
|
|
507
507
|
reflex/utils/format.py,sha256=BFadhZX6oFvIZLQ0aUnul8SDN2iURSkFz-7tJcvDlRk,25149
|
|
508
508
|
reflex/utils/imports.py,sha256=v_xLZiMn7UxxPu5mXln74tXi52wYKqPuZe11Ka31WuM,2309
|
|
509
509
|
reflex/utils/path_ops.py,sha256=Vy6fU_bXvOcCvbXdTSmeLwy_C4h9seYU-3yIrVdZEZQ,4737
|
|
510
|
-
reflex/utils/prerequisites.py,sha256=
|
|
510
|
+
reflex/utils/prerequisites.py,sha256=g2iXfhIv0-m_oK0lNr_p1D_54XFKj11Bgp4uaJLdAnU,52824
|
|
511
511
|
reflex/utils/processes.py,sha256=3viom6wOhrZKgbSC6qvcRiQlYDKnHm1jgdJEcGyReFM,11972
|
|
512
512
|
reflex/utils/pyi_generator.py,sha256=cOfDESTXjnIvJhi8-anKVDNllgpnsGd4OyRmwdw1z5Y,30637
|
|
513
513
|
reflex/utils/serializers.py,sha256=bKY4UxwumFfzE-75tpCFQWRfCeXn301fALwCAUgzgDw,9037
|
|
514
|
-
reflex/utils/telemetry.py,sha256=
|
|
514
|
+
reflex/utils/telemetry.py,sha256=t4cvQmoAxTKAWF53vGH6ZEX5QYrK_KEcarmvMy-4_E4,5568
|
|
515
515
|
reflex/utils/types.py,sha256=1CJQsNf2wMrMJi-3th7eELZ3MFOFUBgoIs3j5rU-MNE,15152
|
|
516
516
|
reflex/utils/watch.py,sha256=HzGrHQIZ_62Di0BO46kd2AZktNA3A6nFIBuf8c6ip30,2609
|
|
517
517
|
reflex/vars.py,sha256=MlooFk2EYY-1FeaJOSDovBWKGiEhVgR9Nrk_feid0FI,69074
|
|
518
518
|
reflex/vars.pyi,sha256=p7rrP7ZcV0KN26a8LSqjTWP7IzZXXSee0H9Rl4fjEtg,5753
|
|
519
|
-
reflex-0.5.
|
|
520
|
-
reflex-0.5.
|
|
521
|
-
reflex-0.5.
|
|
522
|
-
reflex-0.5.
|
|
523
|
-
reflex-0.5.
|
|
519
|
+
reflex-0.5.1a3.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
520
|
+
reflex-0.5.1a3.dist-info/METADATA,sha256=4Fy6e5bOAsm_S9x0rbBUPE84IfcdVW8nW3nuv365a-E,12089
|
|
521
|
+
reflex-0.5.1a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
522
|
+
reflex-0.5.1a3.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
523
|
+
reflex-0.5.1a3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|