reflex 0.8.4a1__py3-none-any.whl → 0.8.5a1__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.

Files changed (143) hide show
  1. reflex/.templates/web/utils/react-theme.js +12 -17
  2. reflex/__init__.py +2 -9
  3. reflex/__init__.pyi +4 -2
  4. reflex/app.py +16 -10
  5. reflex/compiler/compiler.py +10 -3
  6. reflex/components/base/app_wrap.pyi +0 -1
  7. reflex/components/base/body.pyi +0 -2
  8. reflex/components/base/document.pyi +0 -12
  9. reflex/components/base/error_boundary.pyi +0 -2
  10. reflex/components/base/fragment.pyi +0 -2
  11. reflex/components/base/link.pyi +0 -4
  12. reflex/components/base/meta.pyi +0 -6
  13. reflex/components/base/script.py +0 -2
  14. reflex/components/base/script.pyi +0 -2
  15. reflex/components/base/strict_mode.pyi +0 -2
  16. reflex/components/component.py +2 -30
  17. reflex/components/core/auto_scroll.pyi +0 -2
  18. reflex/components/core/banner.pyi +0 -10
  19. reflex/components/core/client_side_routing.pyi +0 -2
  20. reflex/components/core/clipboard.py +1 -3
  21. reflex/components/core/clipboard.pyi +0 -2
  22. reflex/components/core/cond.py +0 -2
  23. reflex/components/core/debounce.pyi +0 -1
  24. reflex/components/core/helmet.pyi +0 -2
  25. reflex/components/core/html.pyi +0 -2
  26. reflex/components/core/match.py +1 -2
  27. reflex/components/core/sticky.pyi +0 -4
  28. reflex/components/core/upload.pyi +0 -10
  29. reflex/components/core/window_events.pyi +0 -2
  30. reflex/components/datadisplay/code.py +6 -4
  31. reflex/components/datadisplay/code.pyi +0 -4
  32. reflex/components/datadisplay/dataeditor.pyi +0 -2
  33. reflex/components/datadisplay/shiki_code_block.pyi +0 -6
  34. reflex/components/el/element.pyi +0 -2
  35. reflex/components/el/elements/base.pyi +0 -2
  36. reflex/components/el/elements/forms.py +5 -21
  37. reflex/components/el/elements/forms.pyi +0 -38
  38. reflex/components/el/elements/inline.pyi +0 -56
  39. reflex/components/el/elements/media.pyi +0 -52
  40. reflex/components/el/elements/metadata.pyi +0 -12
  41. reflex/components/el/elements/other.pyi +0 -14
  42. reflex/components/el/elements/scripts.pyi +0 -6
  43. reflex/components/el/elements/sectioning.pyi +0 -30
  44. reflex/components/el/elements/tables.pyi +0 -20
  45. reflex/components/el/elements/typography.pyi +0 -32
  46. reflex/components/gridjs/datatable.pyi +0 -4
  47. reflex/components/lucide/icon.py +12 -1
  48. reflex/components/lucide/icon.pyi +12 -7
  49. reflex/components/markdown/markdown.pyi +0 -2
  50. reflex/components/moment/moment.pyi +0 -2
  51. reflex/components/plotly/plotly.py +25 -17
  52. reflex/components/plotly/plotly.pyi +0 -18
  53. reflex/components/radix/primitives/accordion.pyi +0 -14
  54. reflex/components/radix/primitives/base.pyi +0 -4
  55. reflex/components/radix/primitives/drawer.pyi +0 -22
  56. reflex/components/radix/primitives/form.pyi +0 -20
  57. reflex/components/radix/primitives/progress.pyi +0 -10
  58. reflex/components/radix/primitives/slider.pyi +0 -10
  59. reflex/components/radix/themes/base.py +2 -4
  60. reflex/components/radix/themes/base.pyi +0 -15
  61. reflex/components/radix/themes/color_mode.pyi +0 -5
  62. reflex/components/radix/themes/components/alert_dialog.pyi +0 -11
  63. reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
  64. reflex/components/radix/themes/components/avatar.pyi +0 -2
  65. reflex/components/radix/themes/components/badge.pyi +0 -2
  66. reflex/components/radix/themes/components/button.pyi +0 -2
  67. reflex/components/radix/themes/components/callout.pyi +0 -10
  68. reflex/components/radix/themes/components/card.pyi +0 -2
  69. reflex/components/radix/themes/components/checkbox.pyi +0 -6
  70. reflex/components/radix/themes/components/checkbox_cards.pyi +0 -4
  71. reflex/components/radix/themes/components/checkbox_group.pyi +0 -4
  72. reflex/components/radix/themes/components/context_menu.pyi +0 -26
  73. reflex/components/radix/themes/components/data_list.pyi +0 -8
  74. reflex/components/radix/themes/components/dialog.pyi +0 -12
  75. reflex/components/radix/themes/components/dropdown_menu.pyi +0 -14
  76. reflex/components/radix/themes/components/hover_card.pyi +0 -7
  77. reflex/components/radix/themes/components/icon_button.pyi +0 -2
  78. reflex/components/radix/themes/components/inset.pyi +0 -2
  79. reflex/components/radix/themes/components/popover.pyi +0 -6
  80. reflex/components/radix/themes/components/progress.pyi +0 -2
  81. reflex/components/radix/themes/components/radio.pyi +0 -2
  82. reflex/components/radix/themes/components/radio_cards.pyi +0 -4
  83. reflex/components/radix/themes/components/radio_group.pyi +0 -8
  84. reflex/components/radix/themes/components/scroll_area.pyi +0 -2
  85. reflex/components/radix/themes/components/segmented_control.pyi +0 -4
  86. reflex/components/radix/themes/components/select.pyi +0 -18
  87. reflex/components/radix/themes/components/separator.pyi +0 -2
  88. reflex/components/radix/themes/components/skeleton.pyi +0 -2
  89. reflex/components/radix/themes/components/slider.pyi +0 -2
  90. reflex/components/radix/themes/components/spinner.pyi +0 -2
  91. reflex/components/radix/themes/components/switch.pyi +0 -2
  92. reflex/components/radix/themes/components/table.pyi +0 -14
  93. reflex/components/radix/themes/components/tabs.pyi +0 -10
  94. reflex/components/radix/themes/components/text_area.pyi +0 -2
  95. reflex/components/radix/themes/components/text_field.pyi +0 -6
  96. reflex/components/radix/themes/components/tooltip.pyi +0 -2
  97. reflex/components/radix/themes/layout/base.pyi +0 -2
  98. reflex/components/radix/themes/layout/box.pyi +0 -2
  99. reflex/components/radix/themes/layout/center.pyi +0 -2
  100. reflex/components/radix/themes/layout/container.pyi +0 -1
  101. reflex/components/radix/themes/layout/flex.pyi +0 -2
  102. reflex/components/radix/themes/layout/grid.pyi +0 -2
  103. reflex/components/radix/themes/layout/list.pyi +0 -10
  104. reflex/components/radix/themes/layout/section.pyi +0 -2
  105. reflex/components/radix/themes/layout/spacer.pyi +0 -2
  106. reflex/components/radix/themes/layout/stack.pyi +0 -6
  107. reflex/components/radix/themes/typography/blockquote.pyi +0 -2
  108. reflex/components/radix/themes/typography/code.pyi +0 -2
  109. reflex/components/radix/themes/typography/heading.pyi +0 -2
  110. reflex/components/radix/themes/typography/link.pyi +0 -2
  111. reflex/components/radix/themes/typography/text.pyi +0 -14
  112. reflex/components/react_player/audio.pyi +0 -2
  113. reflex/components/react_player/react_player.pyi +0 -2
  114. reflex/components/react_player/video.pyi +0 -2
  115. reflex/components/react_router/dom.pyi +0 -2
  116. reflex/components/recharts/cartesian.pyi +0 -38
  117. reflex/components/recharts/charts.pyi +0 -24
  118. reflex/components/recharts/general.pyi +0 -12
  119. reflex/components/recharts/polar.pyi +0 -12
  120. reflex/components/recharts/recharts.pyi +0 -4
  121. reflex/components/sonner/toast.pyi +0 -2
  122. reflex/components/tags/cond_tag.py +4 -3
  123. reflex/components/tags/iter_tag.py +1 -1
  124. reflex/components/tags/match_tag.py +3 -2
  125. reflex/components/tags/tag.py +39 -40
  126. reflex/constants/compiler.py +0 -8
  127. reflex/constants/installer.py +5 -5
  128. reflex/event.py +77 -15
  129. reflex/page.py +62 -4
  130. reflex/reflex.py +2 -5
  131. reflex/utils/misc.py +0 -3
  132. reflex/utils/net.py +7 -2
  133. reflex/utils/prerequisites.py +8 -71
  134. reflex/utils/processes.py +6 -6
  135. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/METADATA +2 -2
  136. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/RECORD +139 -143
  137. reflex/components/el/constants/__init__.py +0 -5
  138. reflex/components/el/constants/html.py +0 -343
  139. reflex/components/el/constants/react.py +0 -501
  140. reflex/components/el/constants/reflex.py +0 -51
  141. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/WHEEL +0 -0
  142. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/entry_points.txt +0 -0
  143. {reflex-0.8.4a1.dist-info → reflex-0.8.5a1.dist-info}/licenses/LICENSE +0 -0
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 collections.abc import Callable
7
- from typing import Any
7
+ from typing import TYPE_CHECKING
8
8
 
9
- from reflex.config import get_config
10
- from reflex.event import EventType
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
- validation_result = compile_future.result()
219
+ compile_future.result()
220
220
  else:
221
- validation_result = app_task(*args, **kwargs)
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/misc.py CHANGED
@@ -113,8 +113,6 @@ if (typeof document !== 'undefined') {
113
113
  const systemPreference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
114
114
  const resolvedTheme = theme === "system" ? systemPreference : theme;
115
115
 
116
- console.log("[PRELOAD] Theme applied:", resolvedTheme, "from theme:", theme, "system:", systemPreference);
117
-
118
116
  // Apply theme immediately - blocks until complete
119
117
  // Use classList to avoid overwriting other classes
120
118
  document.documentElement.classList.remove("light", "dark");
@@ -124,7 +122,6 @@ if (typeof document !== 'undefined') {
124
122
  } catch (e) {
125
123
  // Fallback to system preference on any error (resolve "system" to actual theme)
126
124
  const fallbackTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
127
- console.log("[PRELOAD] Error, falling back to:", fallbackTheme);
128
125
  document.documentElement.classList.remove("light", "dark");
129
126
  document.documentElement.classList.add(fallbackTheme);
130
127
  document.documentElement.style.colorScheme = fallbackTheme;
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=_httpx_verify_kwarg(),
159
+ verify=verify_setting,
159
160
  ),
160
161
  mounts={
161
162
  key: (
162
- None if url is None else httpx.HTTPTransport(proxy=httpx.Proxy(url=url))
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
  },
@@ -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
- ) -> bool:
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
- try:
559
- if compile:
560
- compile_app(
561
- check_if_schema_up_to_date=check_if_schema_up_to_date,
562
- prerender_routes=prerender_routes,
563
- )
564
- else:
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
- with closing(socket.socket(address_family, socket.SOCK_STREAM)) as sock:
91
- try:
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
- except (OverflowError, PermissionError, OSError) as e:
94
- console.debug(f"Unable to bind to any port for {address_family}: {e}")
95
- return False
96
- return True
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.4a1
3
+ Version: 0.8.5a1
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.51
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