reflex 0.8.4a2__py3-none-any.whl → 0.8.5__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/__init__.py +2 -9
- reflex/__init__.pyi +4 -2
- reflex/app.py +16 -10
- reflex/compiler/compiler.py +10 -3
- reflex/compiler/utils.py +6 -12
- reflex/components/base/app_wrap.pyi +0 -1
- reflex/components/base/body.pyi +0 -2
- reflex/components/base/document.pyi +0 -12
- reflex/components/base/error_boundary.pyi +0 -2
- reflex/components/base/fragment.pyi +0 -2
- reflex/components/base/link.pyi +0 -4
- reflex/components/base/meta.pyi +0 -6
- reflex/components/base/script.py +0 -2
- reflex/components/base/script.pyi +0 -2
- reflex/components/base/strict_mode.pyi +0 -2
- reflex/components/component.py +2 -30
- reflex/components/core/auto_scroll.py +14 -13
- reflex/components/core/auto_scroll.pyi +0 -2
- reflex/components/core/banner.pyi +0 -10
- reflex/components/core/client_side_routing.pyi +0 -2
- reflex/components/core/clipboard.py +1 -3
- reflex/components/core/clipboard.pyi +0 -2
- reflex/components/core/cond.py +0 -2
- reflex/components/core/debounce.pyi +0 -1
- reflex/components/core/helmet.pyi +0 -2
- reflex/components/core/html.pyi +0 -2
- reflex/components/core/match.py +1 -2
- reflex/components/core/sticky.pyi +0 -4
- reflex/components/core/upload.pyi +0 -10
- reflex/components/core/window_events.pyi +0 -2
- reflex/components/datadisplay/code.py +6 -4
- reflex/components/datadisplay/code.pyi +0 -4
- reflex/components/datadisplay/dataeditor.pyi +0 -2
- reflex/components/datadisplay/shiki_code_block.pyi +0 -6
- reflex/components/el/element.pyi +0 -2
- reflex/components/el/elements/base.pyi +0 -2
- reflex/components/el/elements/forms.py +5 -21
- reflex/components/el/elements/forms.pyi +0 -38
- reflex/components/el/elements/inline.pyi +0 -56
- reflex/components/el/elements/media.pyi +0 -52
- reflex/components/el/elements/metadata.pyi +0 -12
- reflex/components/el/elements/other.pyi +0 -14
- reflex/components/el/elements/scripts.pyi +0 -6
- reflex/components/el/elements/sectioning.pyi +0 -30
- reflex/components/el/elements/tables.pyi +0 -20
- reflex/components/el/elements/typography.pyi +0 -32
- reflex/components/gridjs/datatable.pyi +0 -4
- reflex/components/lucide/icon.py +12 -1
- reflex/components/lucide/icon.pyi +12 -7
- reflex/components/markdown/markdown.pyi +0 -2
- reflex/components/moment/moment.pyi +0 -2
- reflex/components/plotly/plotly.py +25 -17
- reflex/components/plotly/plotly.pyi +0 -18
- reflex/components/radix/primitives/accordion.pyi +0 -14
- reflex/components/radix/primitives/base.pyi +0 -4
- reflex/components/radix/primitives/drawer.pyi +0 -22
- reflex/components/radix/primitives/form.pyi +0 -20
- reflex/components/radix/primitives/progress.pyi +0 -10
- reflex/components/radix/primitives/slider.pyi +0 -10
- reflex/components/radix/themes/base.py +2 -4
- reflex/components/radix/themes/base.pyi +0 -15
- reflex/components/radix/themes/color_mode.pyi +0 -5
- reflex/components/radix/themes/components/alert_dialog.pyi +0 -11
- reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
- reflex/components/radix/themes/components/avatar.pyi +0 -2
- reflex/components/radix/themes/components/badge.pyi +0 -2
- reflex/components/radix/themes/components/button.pyi +0 -2
- reflex/components/radix/themes/components/callout.pyi +0 -10
- reflex/components/radix/themes/components/card.pyi +0 -2
- reflex/components/radix/themes/components/checkbox.pyi +0 -6
- reflex/components/radix/themes/components/checkbox_cards.pyi +0 -4
- reflex/components/radix/themes/components/checkbox_group.pyi +0 -4
- reflex/components/radix/themes/components/context_menu.pyi +0 -26
- reflex/components/radix/themes/components/data_list.pyi +0 -8
- reflex/components/radix/themes/components/dialog.pyi +0 -12
- reflex/components/radix/themes/components/dropdown_menu.pyi +0 -14
- reflex/components/radix/themes/components/hover_card.pyi +0 -7
- reflex/components/radix/themes/components/icon_button.pyi +0 -2
- reflex/components/radix/themes/components/inset.pyi +0 -2
- reflex/components/radix/themes/components/popover.pyi +0 -6
- reflex/components/radix/themes/components/progress.pyi +0 -2
- reflex/components/radix/themes/components/radio.pyi +0 -2
- reflex/components/radix/themes/components/radio_cards.pyi +0 -4
- reflex/components/radix/themes/components/radio_group.pyi +0 -8
- reflex/components/radix/themes/components/scroll_area.pyi +0 -2
- reflex/components/radix/themes/components/segmented_control.pyi +0 -4
- reflex/components/radix/themes/components/select.pyi +0 -18
- reflex/components/radix/themes/components/separator.pyi +0 -2
- reflex/components/radix/themes/components/skeleton.pyi +0 -2
- reflex/components/radix/themes/components/slider.pyi +0 -2
- reflex/components/radix/themes/components/spinner.pyi +0 -2
- reflex/components/radix/themes/components/switch.pyi +0 -2
- reflex/components/radix/themes/components/table.pyi +0 -14
- reflex/components/radix/themes/components/tabs.pyi +0 -10
- reflex/components/radix/themes/components/text_area.pyi +0 -2
- reflex/components/radix/themes/components/text_field.pyi +0 -6
- reflex/components/radix/themes/components/tooltip.pyi +0 -2
- reflex/components/radix/themes/layout/base.pyi +0 -2
- reflex/components/radix/themes/layout/box.pyi +0 -2
- reflex/components/radix/themes/layout/center.pyi +0 -2
- reflex/components/radix/themes/layout/container.pyi +0 -1
- reflex/components/radix/themes/layout/flex.pyi +0 -2
- reflex/components/radix/themes/layout/grid.pyi +0 -2
- reflex/components/radix/themes/layout/list.pyi +0 -10
- reflex/components/radix/themes/layout/section.pyi +0 -2
- reflex/components/radix/themes/layout/spacer.pyi +0 -2
- reflex/components/radix/themes/layout/stack.pyi +0 -6
- reflex/components/radix/themes/typography/blockquote.pyi +0 -2
- reflex/components/radix/themes/typography/code.pyi +0 -2
- reflex/components/radix/themes/typography/heading.pyi +0 -2
- reflex/components/radix/themes/typography/link.pyi +0 -2
- reflex/components/radix/themes/typography/text.pyi +0 -14
- reflex/components/react_player/audio.pyi +0 -2
- reflex/components/react_player/react_player.pyi +0 -2
- reflex/components/react_player/video.pyi +0 -2
- reflex/components/react_router/dom.pyi +0 -2
- reflex/components/recharts/cartesian.pyi +0 -38
- reflex/components/recharts/charts.pyi +0 -24
- reflex/components/recharts/general.pyi +0 -12
- reflex/components/recharts/polar.pyi +0 -12
- reflex/components/recharts/recharts.pyi +0 -4
- reflex/components/sonner/toast.pyi +0 -2
- reflex/components/tags/cond_tag.py +4 -3
- reflex/components/tags/iter_tag.py +1 -1
- reflex/components/tags/match_tag.py +3 -2
- reflex/components/tags/tag.py +39 -40
- reflex/constants/base.py +4 -58
- reflex/constants/compiler.py +0 -8
- reflex/constants/installer.py +5 -5
- reflex/environment.py +0 -10
- reflex/event.py +77 -15
- reflex/page.py +62 -4
- reflex/reflex.py +2 -5
- reflex/utils/net.py +7 -2
- reflex/utils/prerequisites.py +8 -71
- reflex/utils/processes.py +6 -6
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/METADATA +2 -2
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/RECORD +141 -145
- reflex/components/el/constants/__init__.py +0 -5
- reflex/components/el/constants/html.py +0 -343
- reflex/components/el/constants/react.py +0 -501
- reflex/components/el/constants/reflex.py +0 -51
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/WHEEL +0 -0
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.4a2.dist-info → reflex-0.8.5.dist-info}/licenses/LICENSE +0 -0
reflex/event.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
4
|
import inspect
|
|
5
|
+
import sys
|
|
5
6
|
import types
|
|
6
7
|
import urllib.parse
|
|
7
8
|
from base64 import b64encode
|
|
@@ -403,7 +404,7 @@ class CallableEventSpec(EventSpec):
|
|
|
403
404
|
|
|
404
405
|
Args:
|
|
405
406
|
fn: The function to decorate.
|
|
406
|
-
**kwargs: The kwargs to pass to
|
|
407
|
+
**kwargs: The kwargs to pass to the EventSpec constructor.
|
|
407
408
|
"""
|
|
408
409
|
if fn is not None:
|
|
409
410
|
default_event_spec = fn()
|
|
@@ -635,6 +636,27 @@ def checked_input_event(e: ObjectVar[JavascriptInputEvent]) -> tuple[Var[bool]]:
|
|
|
635
636
|
return (e.target.checked,)
|
|
636
637
|
|
|
637
638
|
|
|
639
|
+
FORM_DATA = Var(_js_expr="form_data")
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
def on_submit_event() -> tuple[Var[dict[str, Any]]]:
|
|
643
|
+
"""Event handler spec for the on_submit event.
|
|
644
|
+
|
|
645
|
+
Returns:
|
|
646
|
+
The event handler spec.
|
|
647
|
+
"""
|
|
648
|
+
return (FORM_DATA,)
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
def on_submit_string_event() -> tuple[Var[dict[str, str]]]:
|
|
652
|
+
"""Event handler spec for the on_submit event.
|
|
653
|
+
|
|
654
|
+
Returns:
|
|
655
|
+
The event handler spec.
|
|
656
|
+
"""
|
|
657
|
+
return (FORM_DATA,)
|
|
658
|
+
|
|
659
|
+
|
|
638
660
|
class KeyInputInfo(TypedDict):
|
|
639
661
|
"""Information about a key input event."""
|
|
640
662
|
|
|
@@ -1243,19 +1265,6 @@ def download(
|
|
|
1243
1265
|
)
|
|
1244
1266
|
|
|
1245
1267
|
|
|
1246
|
-
# This function seems unused. Check if we still need it. If not, remove in 0.7.0
|
|
1247
|
-
def _callback_arg_spec(eval_result: Any):
|
|
1248
|
-
"""ArgSpec for call_script callback function.
|
|
1249
|
-
|
|
1250
|
-
Args:
|
|
1251
|
-
eval_result: The result of the javascript execution.
|
|
1252
|
-
|
|
1253
|
-
Returns:
|
|
1254
|
-
Args for the callback function
|
|
1255
|
-
"""
|
|
1256
|
-
return [eval_result]
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
1268
|
def call_script(
|
|
1260
1269
|
javascript_code: str | Var[str],
|
|
1261
1270
|
callback: "EventType[Any] | None" = None,
|
|
@@ -2197,7 +2206,9 @@ else:
|
|
|
2197
2206
|
class EventNamespace:
|
|
2198
2207
|
"""A namespace for event related classes."""
|
|
2199
2208
|
|
|
2209
|
+
# Core Event Classes
|
|
2200
2210
|
Event = Event
|
|
2211
|
+
EventActionsMixin = EventActionsMixin
|
|
2201
2212
|
EventHandler = EventHandler
|
|
2202
2213
|
EventSpec = EventSpec
|
|
2203
2214
|
CallableEventSpec = CallableEventSpec
|
|
@@ -2206,8 +2217,44 @@ class EventNamespace:
|
|
|
2206
2217
|
LiteralEventVar = LiteralEventVar
|
|
2207
2218
|
EventChainVar = EventChainVar
|
|
2208
2219
|
LiteralEventChainVar = LiteralEventChainVar
|
|
2209
|
-
EventType = EventType
|
|
2210
2220
|
EventCallback = EventCallback
|
|
2221
|
+
LambdaEventCallback = LambdaEventCallback
|
|
2222
|
+
|
|
2223
|
+
# Javascript Event Classes
|
|
2224
|
+
JavascriptHTMLInputElement = JavascriptHTMLInputElement
|
|
2225
|
+
JavascriptInputEvent = JavascriptInputEvent
|
|
2226
|
+
JavascriptKeyboardEvent = JavascriptKeyboardEvent
|
|
2227
|
+
JavascriptMouseEvent = JavascriptMouseEvent
|
|
2228
|
+
JavascriptPointerEvent = JavascriptPointerEvent
|
|
2229
|
+
|
|
2230
|
+
# Type Info Classes
|
|
2231
|
+
KeyInputInfo = KeyInputInfo
|
|
2232
|
+
MouseEventInfo = MouseEventInfo
|
|
2233
|
+
PointerEventInfo = PointerEventInfo
|
|
2234
|
+
IdentityEventReturn = IdentityEventReturn
|
|
2235
|
+
|
|
2236
|
+
# File Upload
|
|
2237
|
+
FileUpload = FileUpload
|
|
2238
|
+
|
|
2239
|
+
# Type Aliases
|
|
2240
|
+
EventType = EventType
|
|
2241
|
+
LAMBDA_OR_STATE = LAMBDA_OR_STATE
|
|
2242
|
+
BASIC_EVENT_TYPES = BASIC_EVENT_TYPES
|
|
2243
|
+
IndividualEventType = IndividualEventType
|
|
2244
|
+
|
|
2245
|
+
# Constants
|
|
2246
|
+
BACKGROUND_TASK_MARKER = BACKGROUND_TASK_MARKER
|
|
2247
|
+
_EVENT_FIELDS = _EVENT_FIELDS
|
|
2248
|
+
FORM_DATA = FORM_DATA
|
|
2249
|
+
upload_files = upload_files
|
|
2250
|
+
stop_propagation = stop_propagation
|
|
2251
|
+
prevent_default = prevent_default
|
|
2252
|
+
|
|
2253
|
+
# Private/Internal Functions
|
|
2254
|
+
_values_returned_from_event = staticmethod(_values_returned_from_event)
|
|
2255
|
+
_check_event_args_subclass_of_callback = staticmethod(
|
|
2256
|
+
_check_event_args_subclass_of_callback
|
|
2257
|
+
)
|
|
2211
2258
|
|
|
2212
2259
|
@overload
|
|
2213
2260
|
def __new__(
|
|
@@ -2359,10 +2406,22 @@ class EventNamespace:
|
|
|
2359
2406
|
check_fn_match_arg_spec = staticmethod(check_fn_match_arg_spec)
|
|
2360
2407
|
resolve_annotation = staticmethod(resolve_annotation)
|
|
2361
2408
|
parse_args_spec = staticmethod(parse_args_spec)
|
|
2409
|
+
unwrap_var_annotation = staticmethod(unwrap_var_annotation)
|
|
2410
|
+
get_fn_signature = staticmethod(get_fn_signature)
|
|
2411
|
+
|
|
2412
|
+
# Event Spec Functions
|
|
2362
2413
|
passthrough_event_spec = staticmethod(passthrough_event_spec)
|
|
2363
2414
|
input_event = staticmethod(input_event)
|
|
2415
|
+
int_input_event = staticmethod(int_input_event)
|
|
2416
|
+
float_input_event = staticmethod(float_input_event)
|
|
2417
|
+
checked_input_event = staticmethod(checked_input_event)
|
|
2364
2418
|
key_event = staticmethod(key_event)
|
|
2419
|
+
pointer_event_spec = staticmethod(pointer_event_spec)
|
|
2365
2420
|
no_args_event_spec = staticmethod(no_args_event_spec)
|
|
2421
|
+
on_submit_event = staticmethod(on_submit_event)
|
|
2422
|
+
on_submit_string_event = staticmethod(on_submit_string_event)
|
|
2423
|
+
|
|
2424
|
+
# Server Side Events
|
|
2366
2425
|
server_side = staticmethod(server_side)
|
|
2367
2426
|
redirect = staticmethod(redirect)
|
|
2368
2427
|
console_log = staticmethod(console_log)
|
|
@@ -2383,6 +2442,9 @@ class EventNamespace:
|
|
|
2383
2442
|
call_script = staticmethod(call_script)
|
|
2384
2443
|
call_function = staticmethod(call_function)
|
|
2385
2444
|
run_script = staticmethod(run_script)
|
|
2445
|
+
__file__ = __file__
|
|
2386
2446
|
|
|
2387
2447
|
|
|
2388
2448
|
event = EventNamespace
|
|
2449
|
+
event.event = event # pyright: ignore[reportAttributeAccessIssue]
|
|
2450
|
+
sys.modules[__name__] = event # pyright: ignore[reportArgumentType]
|
reflex/page.py
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import sys
|
|
5
6
|
from collections import defaultdict
|
|
6
|
-
from
|
|
7
|
-
from typing import Any
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
from
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from reflex.event import EventType
|
|
11
14
|
|
|
12
15
|
DECORATED_PAGES: dict[str, list] = defaultdict(list)
|
|
13
16
|
|
|
@@ -42,6 +45,7 @@ def page(
|
|
|
42
45
|
Returns:
|
|
43
46
|
The decorated function.
|
|
44
47
|
"""
|
|
48
|
+
from reflex.config import get_config
|
|
45
49
|
|
|
46
50
|
def decorator(render_fn: Callable):
|
|
47
51
|
kwargs = {}
|
|
@@ -65,3 +69,57 @@ def page(
|
|
|
65
69
|
return render_fn
|
|
66
70
|
|
|
67
71
|
return decorator
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class PageNamespace:
|
|
75
|
+
"""A namespace for page names."""
|
|
76
|
+
|
|
77
|
+
DECORATED_PAGES = DECORATED_PAGES
|
|
78
|
+
|
|
79
|
+
def __new__(
|
|
80
|
+
cls,
|
|
81
|
+
route: str | None = None,
|
|
82
|
+
title: str | None = None,
|
|
83
|
+
image: str | None = None,
|
|
84
|
+
description: str | None = None,
|
|
85
|
+
meta: list[Any] | None = None,
|
|
86
|
+
script_tags: list[Any] | None = None,
|
|
87
|
+
on_load: EventType[()] | None = None,
|
|
88
|
+
):
|
|
89
|
+
"""Decorate a function as a page.
|
|
90
|
+
|
|
91
|
+
rx.App() will automatically call add_page() for any method decorated with page
|
|
92
|
+
when App.compile is called.
|
|
93
|
+
|
|
94
|
+
All defaults are None because they will use the one from add_page().
|
|
95
|
+
|
|
96
|
+
Note: the decorated functions still need to be imported.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
route: The route to reach the page.
|
|
100
|
+
title: The title of the page.
|
|
101
|
+
image: The favicon of the page.
|
|
102
|
+
description: The description of the page.
|
|
103
|
+
meta: Additional meta to add to the page.
|
|
104
|
+
on_load: The event handler(s) called when the page load.
|
|
105
|
+
script_tags: scripts to attach to the page
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
The decorated function.
|
|
109
|
+
"""
|
|
110
|
+
return page(
|
|
111
|
+
route=route,
|
|
112
|
+
title=title,
|
|
113
|
+
image=image,
|
|
114
|
+
description=description,
|
|
115
|
+
meta=meta,
|
|
116
|
+
script_tags=script_tags,
|
|
117
|
+
on_load=on_load,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
page = staticmethod(page)
|
|
121
|
+
__file__ = __file__
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
page_namespace = PageNamespace
|
|
125
|
+
sys.modules[__name__] = page_namespace # pyright: ignore[reportArgumentType]
|
reflex/reflex.py
CHANGED
|
@@ -216,12 +216,9 @@ def _run(
|
|
|
216
216
|
*args,
|
|
217
217
|
**kwargs,
|
|
218
218
|
)
|
|
219
|
-
|
|
219
|
+
compile_future.result()
|
|
220
220
|
else:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if not validation_result:
|
|
224
|
-
raise click.exceptions.Exit(1)
|
|
221
|
+
app_task(*args, **kwargs)
|
|
225
222
|
|
|
226
223
|
# Get the frontend and backend commands, based on the environment.
|
|
227
224
|
setup_frontend = frontend_cmd = backend_cmd = None
|
reflex/utils/net.py
CHANGED
|
@@ -152,14 +152,19 @@ def _httpx_client():
|
|
|
152
152
|
import httpx
|
|
153
153
|
from httpx._utils import get_environment_proxies
|
|
154
154
|
|
|
155
|
+
verify_setting = _httpx_verify_kwarg()
|
|
155
156
|
return httpx.Client(
|
|
156
157
|
transport=httpx.HTTPTransport(
|
|
157
158
|
local_address=_httpx_local_address_kwarg(),
|
|
158
|
-
verify=
|
|
159
|
+
verify=verify_setting,
|
|
159
160
|
),
|
|
160
161
|
mounts={
|
|
161
162
|
key: (
|
|
162
|
-
None
|
|
163
|
+
None
|
|
164
|
+
if url is None
|
|
165
|
+
else httpx.HTTPTransport(
|
|
166
|
+
proxy=httpx.Proxy(url=url), verify=verify_setting
|
|
167
|
+
)
|
|
163
168
|
)
|
|
164
169
|
for key, url in get_environment_proxies().items()
|
|
165
170
|
},
|
reflex/utils/prerequisites.py
CHANGED
|
@@ -7,8 +7,6 @@ import dataclasses
|
|
|
7
7
|
import functools
|
|
8
8
|
import importlib
|
|
9
9
|
import importlib.metadata
|
|
10
|
-
import importlib.util
|
|
11
|
-
import io
|
|
12
10
|
import json
|
|
13
11
|
import os
|
|
14
12
|
import platform
|
|
@@ -498,86 +496,25 @@ def compile_app(
|
|
|
498
496
|
)
|
|
499
497
|
|
|
500
498
|
|
|
501
|
-
def _can_colorize() -> bool:
|
|
502
|
-
"""Check if the output can be colorized.
|
|
503
|
-
|
|
504
|
-
Copied from _colorize.can_colorize.
|
|
505
|
-
|
|
506
|
-
https://raw.githubusercontent.com/python/cpython/refs/heads/main/Lib/_colorize.py
|
|
507
|
-
|
|
508
|
-
Returns:
|
|
509
|
-
If the output can be colorized
|
|
510
|
-
"""
|
|
511
|
-
file = sys.stdout
|
|
512
|
-
|
|
513
|
-
if not sys.flags.ignore_environment:
|
|
514
|
-
if os.environ.get("PYTHON_COLORS") == "0":
|
|
515
|
-
return False
|
|
516
|
-
if os.environ.get("PYTHON_COLORS") == "1":
|
|
517
|
-
return True
|
|
518
|
-
if os.environ.get("NO_COLOR"):
|
|
519
|
-
return False
|
|
520
|
-
if os.environ.get("FORCE_COLOR"):
|
|
521
|
-
return True
|
|
522
|
-
if os.environ.get("TERM") == "dumb":
|
|
523
|
-
return False
|
|
524
|
-
|
|
525
|
-
if not hasattr(file, "fileno"):
|
|
526
|
-
return False
|
|
527
|
-
|
|
528
|
-
if sys.platform == "win32":
|
|
529
|
-
try:
|
|
530
|
-
import nt
|
|
531
|
-
|
|
532
|
-
if not nt._supports_virtual_terminal():
|
|
533
|
-
return False
|
|
534
|
-
except (ImportError, AttributeError):
|
|
535
|
-
return False
|
|
536
|
-
|
|
537
|
-
try:
|
|
538
|
-
return os.isatty(file.fileno())
|
|
539
|
-
except io.UnsupportedOperation:
|
|
540
|
-
return file.isatty()
|
|
541
|
-
|
|
542
|
-
|
|
543
499
|
def compile_or_validate_app(
|
|
544
500
|
compile: bool = False,
|
|
545
501
|
check_if_schema_up_to_date: bool = False,
|
|
546
502
|
prerender_routes: bool = False,
|
|
547
|
-
)
|
|
503
|
+
):
|
|
548
504
|
"""Compile or validate the app module based on the default config.
|
|
549
505
|
|
|
550
506
|
Args:
|
|
551
507
|
compile: Whether to compile the app.
|
|
552
508
|
check_if_schema_up_to_date: If True, check if the schema is up to date.
|
|
553
509
|
prerender_routes: Whether to prerender routes.
|
|
554
|
-
|
|
555
|
-
Returns:
|
|
556
|
-
If the app is compiled successfully.
|
|
557
510
|
"""
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
validate_app(check_if_schema_up_to_date=check_if_schema_up_to_date)
|
|
566
|
-
except Exception as e:
|
|
567
|
-
if isinstance(e, click.exceptions.Exit):
|
|
568
|
-
return False
|
|
569
|
-
|
|
570
|
-
import traceback
|
|
571
|
-
|
|
572
|
-
sys_exception = sys.exception()
|
|
573
|
-
|
|
574
|
-
try:
|
|
575
|
-
colorize = _can_colorize()
|
|
576
|
-
traceback.print_exception(e, colorize=colorize) # pyright: ignore[reportCallIssue]
|
|
577
|
-
except Exception:
|
|
578
|
-
traceback.print_exception(sys_exception)
|
|
579
|
-
return False
|
|
580
|
-
return True
|
|
511
|
+
if compile:
|
|
512
|
+
compile_app(
|
|
513
|
+
check_if_schema_up_to_date=check_if_schema_up_to_date,
|
|
514
|
+
prerender_routes=prerender_routes,
|
|
515
|
+
)
|
|
516
|
+
else:
|
|
517
|
+
validate_app(check_if_schema_up_to_date=check_if_schema_up_to_date)
|
|
581
518
|
|
|
582
519
|
|
|
583
520
|
def get_redis() -> Redis | None:
|
reflex/utils/processes.py
CHANGED
|
@@ -87,13 +87,13 @@ def _can_bind_at_any_port(address_family: socket.AddressFamily | int) -> bool:
|
|
|
87
87
|
Returns:
|
|
88
88
|
Whether any port is available for binding.
|
|
89
89
|
"""
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
try:
|
|
91
|
+
with closing(socket.socket(address_family, socket.SOCK_STREAM)) as sock:
|
|
92
92
|
sock.bind(("", 0)) # Bind to any available port
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
return True
|
|
94
|
+
except (OverflowError, PermissionError, OSError) as e:
|
|
95
|
+
console.debug(f"Unable to bind to any port for {address_family}: {e}")
|
|
96
|
+
return False
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
def is_process_on_port(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reflex
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5
|
|
4
4
|
Summary: Web apps in pure Python.
|
|
5
5
|
Project-URL: homepage, https://reflex.dev
|
|
6
6
|
Project-URL: repository, https://github.com/reflex-dev/reflex
|
|
@@ -30,7 +30,7 @@ Requires-Dist: pydantic<3.0,>=1.10.21
|
|
|
30
30
|
Requires-Dist: python-multipart<1.0,>=0.0.20
|
|
31
31
|
Requires-Dist: python-socketio<6.0,>=5.12.0
|
|
32
32
|
Requires-Dist: redis<7.0,>=5.2.1
|
|
33
|
-
Requires-Dist: reflex-hosting-cli>=0.1.
|
|
33
|
+
Requires-Dist: reflex-hosting-cli>=0.1.53
|
|
34
34
|
Requires-Dist: rich<15,>=13
|
|
35
35
|
Requires-Dist: sqlmodel<0.1,>=0.0.24
|
|
36
36
|
Requires-Dist: starlette>=0.47.0
|