reflex 0.8.8a2__py3-none-any.whl → 0.8.9a2__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.

@@ -453,6 +453,7 @@ LUCIDE_ICON_LIST = [
453
453
  "chevrons_up_down",
454
454
  "chevrons_up",
455
455
  "chrome",
456
+ "chromium",
456
457
  "church",
457
458
  "cigarette_off",
458
459
  "cigarette",
@@ -1198,11 +1199,13 @@ LUCIDE_ICON_LIST = [
1198
1199
  "panel_left_close",
1199
1200
  "panel_left_dashed",
1200
1201
  "panel_left_open",
1202
+ "panel_left_right_dashed",
1201
1203
  "panel_left",
1202
1204
  "panel_right_close",
1203
1205
  "panel_right_dashed",
1204
1206
  "panel_right_open",
1205
1207
  "panel_right",
1208
+ "panel_top_bottom_dashed",
1206
1209
  "panel_top_close",
1207
1210
  "panel_top_dashed",
1208
1211
  "panel_top_open",
@@ -518,6 +518,7 @@ LUCIDE_ICON_LIST = [
518
518
  "chevrons_up_down",
519
519
  "chevrons_up",
520
520
  "chrome",
521
+ "chromium",
521
522
  "church",
522
523
  "cigarette_off",
523
524
  "cigarette",
@@ -1263,11 +1264,13 @@ LUCIDE_ICON_LIST = [
1263
1264
  "panel_left_close",
1264
1265
  "panel_left_dashed",
1265
1266
  "panel_left_open",
1267
+ "panel_left_right_dashed",
1266
1268
  "panel_left",
1267
1269
  "panel_right_close",
1268
1270
  "panel_right_dashed",
1269
1271
  "panel_right_open",
1270
1272
  "panel_right",
1273
+ "panel_top_bottom_dashed",
1271
1274
  "panel_top_close",
1272
1275
  "panel_top_dashed",
1273
1276
  "panel_top_open",
@@ -249,6 +249,7 @@ class DrawerPortal(DrawerComponent):
249
249
  """
250
250
 
251
251
  class DrawerContent(DrawerComponent):
252
+ def add_style(self) -> dict: ...
252
253
  @classmethod
253
254
  def create(
254
255
  cls,
@@ -309,6 +310,7 @@ class DrawerContent(DrawerComponent):
309
310
  """
310
311
 
311
312
  class DrawerOverlay(DrawerComponent):
313
+ def add_style(self) -> dict: ...
312
314
  @classmethod
313
315
  def create(
314
316
  cls,
@@ -411,6 +413,7 @@ class DrawerClose(DrawerTrigger):
411
413
  """
412
414
 
413
415
  class DrawerTitle(DrawerComponent):
416
+ def add_style(self) -> dict: ...
414
417
  @classmethod
415
418
  def create(
416
419
  cls,
@@ -462,6 +465,7 @@ class DrawerTitle(DrawerComponent):
462
465
  """
463
466
 
464
467
  class DrawerDescription(DrawerComponent):
468
+ def add_style(self) -> dict: ...
465
469
  @classmethod
466
470
  def create(
467
471
  cls,
reflex/config.py CHANGED
@@ -237,7 +237,7 @@ class BaseConfig:
237
237
  env_file: str | None = None
238
238
 
239
239
  # Whether to automatically create setters for state base vars
240
- state_auto_setters: bool = True
240
+ state_auto_setters: bool | None = None
241
241
 
242
242
  # Whether to display the sticky "Built with Reflex" badge on all pages.
243
243
  show_built_with_reflex: bool | None = None
@@ -267,9 +267,12 @@ _PLUGINS_ENABLED_BY_DEFAULT = [
267
267
 
268
268
  @dataclasses.dataclass(kw_only=True, init=False)
269
269
  class Config(BaseConfig):
270
- """The config defines runtime settings for the app.
270
+ """Configuration class for Reflex applications.
271
271
 
272
- By default, the config is defined in an `rxconfig.py` file in the root of the app.
272
+ The config defines runtime settings for your app including server ports, database connections,
273
+ frontend packages, and deployment settings.
274
+
275
+ By default, the config is defined in an `rxconfig.py` file in the root of your app:
273
276
 
274
277
  ```python
275
278
  # rxconfig.py
@@ -277,14 +280,38 @@ class Config(BaseConfig):
277
280
 
278
281
  config = rx.Config(
279
282
  app_name="myapp",
280
- api_url="http://localhost:8000",
283
+ # Server configuration
284
+ frontend_port=3000,
285
+ backend_port=8000,
286
+ # Database
287
+ db_url="postgresql://user:pass@localhost:5432/mydb",
288
+ # Additional frontend packages
289
+ frontend_packages=["react-icons"],
290
+ # CORS settings for production
291
+ cors_allowed_origins=["https://mydomain.com"],
281
292
  )
282
293
  ```
283
294
 
284
- Every config value can be overridden by an environment variable with the same name in uppercase and a REFLEX_ prefix.
285
- For example, `db_url` can be overridden by setting the `REFLEX_DB_URL` environment variable.
295
+ ## Environment Variable Overrides
296
+
297
+ Any config value can be overridden by setting an environment variable with the `REFLEX_`
298
+ prefix and the parameter name in uppercase:
299
+
300
+ ```bash
301
+ REFLEX_DB_URL="postgresql://user:pass@localhost/db" reflex run
302
+ REFLEX_FRONTEND_PORT=3001 reflex run
303
+ ```
304
+
305
+ ## Key Configuration Areas
306
+
307
+ - **App Settings**: `app_name`, `loglevel`, `telemetry_enabled`
308
+ - **Server**: `frontend_port`, `backend_port`, `api_url`, `cors_allowed_origins`
309
+ - **Database**: `db_url`, `async_db_url`, `redis_url`
310
+ - **Frontend**: `frontend_packages`, `react_strict_mode`
311
+ - **State Management**: `state_manager_mode`, `state_auto_setters`
312
+ - **Plugins**: `plugins`, `disable_plugins`
286
313
 
287
- See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info.
314
+ See the [configuration docs](https://reflex.dev/docs/advanced-onboarding/configuration) for complete details on all available options.
288
315
  """
289
316
 
290
317
  # Track whether the app name has already been validated for this Config instance.
@@ -14,7 +14,7 @@ class Bun(SimpleNamespace):
14
14
  """Bun constants."""
15
15
 
16
16
  # The Bun version.
17
- VERSION = "1.2.20"
17
+ VERSION = "1.2.21"
18
18
 
19
19
  # Min Bun Version
20
20
  MIN_VERSION = "1.2.17"
@@ -75,7 +75,7 @@ fetch-retries=0
75
75
 
76
76
 
77
77
  def _determine_react_router_version() -> str:
78
- default_version = "7.8.1"
78
+ default_version = "7.8.2"
79
79
  if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
80
80
  from reflex.utils import console
81
81
 
@@ -143,11 +143,11 @@ class PackageJson(SimpleNamespace):
143
143
  "postcss-import": "16.1.1",
144
144
  "@react-router/dev": _react_router_version,
145
145
  "@react-router/fs-routes": _react_router_version,
146
- "vite": "npm:rolldown-vite@7.1.3",
146
+ "vite": "npm:rolldown-vite@7.1.5",
147
147
  }
148
148
  OVERRIDES = {
149
149
  # This should always match the `react` version in DEPENDENCIES for recharts compatibility.
150
150
  "react-is": _react_version,
151
151
  "cookie": "1.0.2",
152
- "vite": "npm:rolldown-vite@7.1.3",
152
+ "vite": "npm:rolldown-vite@7.1.5",
153
153
  }
reflex/environment.py CHANGED
@@ -6,7 +6,6 @@ import concurrent.futures
6
6
  import dataclasses
7
7
  import enum
8
8
  import importlib
9
- import inspect
10
9
  import multiprocessing
11
10
  import os
12
11
  import platform
@@ -159,7 +158,7 @@ def interpret_plugin_env(value: str, field_name: str) -> Plugin:
159
158
  msg = f"Failed to get plugin class {plugin_name!r} from module {import_path!r} for {field_name}: {e}"
160
159
  raise EnvironmentVarValueError(msg) from e
161
160
 
162
- if not inspect.isclass(plugin_class) or not issubclass(plugin_class, Plugin):
161
+ if not isinstance(plugin_class, type) or not issubclass(plugin_class, Plugin):
163
162
  msg = f"Invalid plugin class: {plugin_name!r} for {field_name}. Must be a subclass of Plugin."
164
163
  raise EnvironmentVarValueError(msg)
165
164
 
@@ -236,7 +235,7 @@ def interpret_env_var_value(
236
235
  )
237
236
  for i, v in enumerate(value.split(":"))
238
237
  ]
239
- if inspect.isclass(field_type) and issubclass(field_type, enum.Enum):
238
+ if isinstance(field_type, type) and issubclass(field_type, enum.Enum):
240
239
  return interpret_enum_env(value, field_type, field_name)
241
240
 
242
241
  msg = f"Invalid type for environment variable {field_name}: {field_type}. This is probably an issue in Reflex."
@@ -640,6 +639,12 @@ class EnvironmentVariables:
640
639
  # Enable full logging of debug messages to reflex user directory.
641
640
  REFLEX_ENABLE_FULL_LOGGING: EnvVar[bool] = env_var(False)
642
641
 
642
+ # Whether to enable hot module replacement
643
+ VITE_HMR: EnvVar[bool] = env_var(True)
644
+
645
+ # Whether to force a full reload on changes.
646
+ VITE_FORCE_FULL_RELOAD: EnvVar[bool] = env_var(False)
647
+
643
648
 
644
649
  environment = EnvironmentVariables()
645
650
 
reflex/istate/data.py CHANGED
@@ -83,6 +83,11 @@ class HeaderData(_HeaderData):
83
83
  )
84
84
 
85
85
 
86
+ @serializer(to=dict)
87
+ def _serialize_header_data(obj: HeaderData) -> dict:
88
+ return {k.name: getattr(obj, k.name) for k in dataclasses.fields(obj)}
89
+
90
+
86
91
  @serializer(to=dict)
87
92
  def serialize_frozen_dict_str_str(obj: _FrozenDictStrStr) -> dict:
88
93
  """Serialize a _FrozenDictStrStr object to a dict.
@@ -165,6 +170,11 @@ class PageData:
165
170
  )
166
171
 
167
172
 
173
+ @serializer(to=dict)
174
+ def _serialize_page_data(obj: PageData) -> dict:
175
+ return dataclasses.asdict(obj)
176
+
177
+
168
178
  @dataclasses.dataclass(frozen=True)
169
179
  class SessionData:
170
180
  """An object containing session data."""
@@ -190,6 +200,11 @@ class SessionData:
190
200
  )
191
201
 
192
202
 
203
+ @serializer(to=dict)
204
+ def _serialize_session_data(obj: SessionData) -> dict:
205
+ return dataclasses.asdict(obj)
206
+
207
+
193
208
  @dataclasses.dataclass(frozen=True)
194
209
  class RouterData:
195
210
  """An object containing RouterData."""
reflex/plugins/sitemap.py CHANGED
@@ -5,8 +5,7 @@ from collections.abc import Sequence
5
5
  from pathlib import Path
6
6
  from types import SimpleNamespace
7
7
  from typing import TYPE_CHECKING, Literal, TypedDict
8
- from xml.dom import minidom
9
- from xml.etree.ElementTree import Element, SubElement, tostring
8
+ from xml.etree.ElementTree import Element, SubElement, indent, tostring
10
9
 
11
10
  from typing_extensions import NotRequired
12
11
 
@@ -104,10 +103,8 @@ def generate_xml(links: Sequence[SitemapLink]) -> str:
104
103
  if (priority := link.get("priority")) is not None:
105
104
  priority_element = SubElement(url, "priority")
106
105
  priority_element.text = str(priority)
107
-
108
- rough_string = tostring(urlset, "utf-8")
109
- reparsed = minidom.parseString(rough_string)
110
- return reparsed.toprettyxml(indent=" ")
106
+ indent(urlset, " ")
107
+ return tostring(urlset, encoding="utf-8", xml_declaration=True).decode("utf-8")
111
108
 
112
109
 
113
110
  def is_route_dynamic(route: str) -> bool:
reflex/reflex.py CHANGED
@@ -360,7 +360,13 @@ def run(
360
360
  default=False,
361
361
  help="Run the command without making any changes.",
362
362
  )
363
- def compile(dry: bool):
363
+ @click.option(
364
+ "--rich/--no-rich",
365
+ default=True,
366
+ is_flag=True,
367
+ help="Whether to use rich progress bars.",
368
+ )
369
+ def compile(dry: bool, rich: bool):
364
370
  """Compile the app in the current directory."""
365
371
  import time
366
372
 
@@ -371,7 +377,7 @@ def compile(dry: bool):
371
377
  _init(name=get_config().app_name)
372
378
  get_config(reload=True)
373
379
  starting_time = time.monotonic()
374
- prerequisites.get_compiled_app(dry_run=dry)
380
+ prerequisites.get_compiled_app(dry_run=dry, use_rich=rich)
375
381
  elapsed_time = time.monotonic() - starting_time
376
382
  console.success(f"App compiled successfully in {elapsed_time:.3f} seconds.")
377
383
 
reflex/state.py CHANGED
@@ -225,8 +225,20 @@ class EventHandlerSetVar(EventHandler):
225
225
  EventHandlerValueError: If the given Var name is not a str
226
226
  NotImplementedError: If the setter for the given Var is async
227
227
  """
228
+ from reflex.config import get_config
228
229
  from reflex.utils.exceptions import EventHandlerValueError
229
230
 
231
+ config = get_config()
232
+ if config.state_auto_setters is None:
233
+ console.deprecate(
234
+ feature_name="state_auto_setters defaulting to True",
235
+ reason="The default value will be changed to False in a future release. Set state_auto_setters explicitly or define setters explicitly. "
236
+ f"Used {self.state_cls.__name__}.setvar without defining it.",
237
+ deprecation_version="0.8.9",
238
+ removal_version="0.9.0",
239
+ dedupe=True,
240
+ )
241
+
230
242
  if args:
231
243
  if not isinstance(args[0], str):
232
244
  msg = f"Var name must be passed as a string, got {args[0]!r}"
@@ -1036,7 +1048,7 @@ class BaseState(EvenMoreBasicBaseState):
1036
1048
  )
1037
1049
  raise VarTypeError(msg)
1038
1050
  cls._set_var(name, prop)
1039
- if cls.is_user_defined() and get_config().state_auto_setters:
1051
+ if cls.is_user_defined() and get_config().state_auto_setters is not False:
1040
1052
  cls._create_setter(name, prop)
1041
1053
  cls._set_default_value(name, prop)
1042
1054
 
@@ -1096,11 +1108,14 @@ class BaseState(EvenMoreBasicBaseState):
1096
1108
  setattr(cls, name, prop)
1097
1109
 
1098
1110
  @classmethod
1099
- def _create_event_handler(cls, fn: Any):
1111
+ def _create_event_handler(
1112
+ cls, fn: Any, event_handler_cls: type[EventHandler] = EventHandler
1113
+ ):
1100
1114
  """Create an event handler for the given function.
1101
1115
 
1102
1116
  Args:
1103
1117
  fn: The function to create an event handler for.
1118
+ event_handler_cls: The event handler class to use.
1104
1119
 
1105
1120
  Returns:
1106
1121
  The event handler.
@@ -1108,7 +1123,7 @@ class BaseState(EvenMoreBasicBaseState):
1108
1123
  # Check if function has stored event_actions from decorator
1109
1124
  event_actions = getattr(fn, "_rx_event_actions", {})
1110
1125
 
1111
- return EventHandler(
1126
+ return event_handler_cls(
1112
1127
  fn=fn, state_full_name=cls.get_full_name(), event_actions=event_actions
1113
1128
  )
1114
1129
 
@@ -1125,9 +1140,34 @@ class BaseState(EvenMoreBasicBaseState):
1125
1140
  name: The name of the var.
1126
1141
  prop: The var to create a setter for.
1127
1142
  """
1143
+ from reflex.config import get_config
1144
+
1145
+ config = get_config()
1146
+ _create_event_handler_kwargs = {}
1147
+
1148
+ if config.state_auto_setters is None:
1149
+
1150
+ class EventHandlerDeprecatedSetter(EventHandler):
1151
+ def __call__(self, *args, **kwargs):
1152
+ console.deprecate(
1153
+ feature_name="state_auto_setters defaulting to True",
1154
+ reason="The default value will be changed to False in a future release. Set state_auto_setters explicitly or define setters explicitly. "
1155
+ f"Used {setter_name} in {cls.__name__} without defining it.",
1156
+ deprecation_version="0.8.9",
1157
+ removal_version="0.9.0",
1158
+ dedupe=True,
1159
+ )
1160
+ return super().__call__(*args, **kwargs)
1161
+
1162
+ _create_event_handler_kwargs["event_handler_cls"] = (
1163
+ EventHandlerDeprecatedSetter
1164
+ )
1165
+
1128
1166
  setter_name = Var._get_setter_name_for_name(name)
1129
1167
  if setter_name not in cls.__dict__:
1130
- event_handler = cls._create_event_handler(prop._get_setter(name))
1168
+ event_handler = cls._create_event_handler(
1169
+ prop._get_setter(name), **_create_event_handler_kwargs
1170
+ )
1131
1171
  cls.event_handlers[setter_name] = event_handler
1132
1172
  setattr(cls, setter_name, event_handler)
1133
1173
 
@@ -1810,7 +1850,7 @@ class BaseState(EvenMoreBasicBaseState):
1810
1850
  hinted_args = value_inside_optional(hinted_args)
1811
1851
  if (
1812
1852
  isinstance(value, dict)
1813
- and inspect.isclass(hinted_args)
1853
+ and isinstance(hinted_args, type)
1814
1854
  and not types.is_generic_alias(hinted_args) # py3.10
1815
1855
  ):
1816
1856
  if issubclass(hinted_args, Model):
@@ -2341,7 +2381,7 @@ def _serialize_type(type_: Any) -> str:
2341
2381
  Returns:
2342
2382
  The serialized type.
2343
2383
  """
2344
- if not inspect.isclass(type_):
2384
+ if not isinstance(type_, type):
2345
2385
  return f"{type_}"
2346
2386
  return f"{type_.__module__}.{type_.__qualname__}"
2347
2387
 
reflex/testing.py CHANGED
@@ -472,7 +472,7 @@ class AppHarness:
472
472
  Returns:
473
473
  The rendered app global code.
474
474
  """
475
- if not inspect.isclass(value) and not inspect.isfunction(value):
475
+ if not isinstance(value, type) and not inspect.isfunction(value):
476
476
  return f"{key} = {value!r}"
477
477
  return inspect.getsource(value)
478
478
 
reflex/utils/console.py CHANGED
@@ -7,12 +7,13 @@ import datetime
7
7
  import inspect
8
8
  import os
9
9
  import shutil
10
+ import sys
10
11
  import time
11
12
  from pathlib import Path
12
13
  from types import FrameType
13
14
 
14
15
  from rich.console import Console
15
- from rich.progress import MofNCompleteColumn, Progress, TimeElapsedColumn
16
+ from rich.progress import MofNCompleteColumn, Progress, TaskID, TimeElapsedColumn
16
17
  from rich.prompt import Prompt
17
18
 
18
19
  from reflex.constants import LogLevel
@@ -244,23 +245,38 @@ def warn(msg: str, *, dedupe: bool = False, **kwargs):
244
245
  print_to_log_file(f"[orange1]Warning: {msg}[/orange1]", **kwargs)
245
246
 
246
247
 
247
- def _get_first_non_framework_frame() -> FrameType | None:
248
+ @once
249
+ def _exclude_paths_from_frame_info() -> list[Path]:
250
+ import importlib.util
251
+
248
252
  import click
253
+ import granian
254
+ import socketio
249
255
  import typing_extensions
250
256
 
251
257
  import reflex as rx
252
258
 
253
259
  # Exclude utility modules that should never be the source of deprecated reflex usage.
254
- exclude_modules = [click, rx, typing_extensions]
260
+ exclude_modules = [click, rx, typing_extensions, socketio, granian]
261
+ modules_paths = [file for m in exclude_modules if (file := m.__file__)] + [
262
+ spec.origin
263
+ for m in [*sys.builtin_module_names, *sys.stdlib_module_names]
264
+ if (spec := importlib.util.find_spec(m)) and spec.origin
265
+ ]
255
266
  exclude_roots = [
256
267
  p.parent.resolve() if (p := Path(file)).name == "__init__.py" else p.resolve()
257
- for m in exclude_modules
258
- if (file := m.__file__)
268
+ for file in modules_paths
259
269
  ]
260
270
  # Specifically exclude the reflex cli module.
261
271
  if reflex_bin := shutil.which(b"reflex"):
262
272
  exclude_roots.append(Path(reflex_bin.decode()))
263
273
 
274
+ return exclude_roots
275
+
276
+
277
+ def _get_first_non_framework_frame() -> FrameType | None:
278
+ exclude_roots = _exclude_paths_from_frame_info()
279
+
264
280
  frame = inspect.currentframe()
265
281
  while frame := frame and frame.f_back:
266
282
  frame_path = Path(inspect.getfile(frame)).resolve()
@@ -297,13 +313,13 @@ def deprecate(
297
313
  filename = Path(origin_frame.f_code.co_filename)
298
314
  if filename.is_relative_to(Path.cwd()):
299
315
  filename = filename.relative_to(Path.cwd())
300
- loc = f"{filename}:{origin_frame.f_lineno}"
316
+ loc = f" ({filename}:{origin_frame.f_lineno})"
301
317
  dedupe_key = f"{dedupe_key} {loc}"
302
318
 
303
319
  if dedupe_key not in _EMITTED_DEPRECATION_WARNINGS:
304
320
  msg = (
305
321
  f"{feature_name} has been deprecated in version {deprecation_version}. {reason.rstrip('.').lstrip('. ')}. It will be completely "
306
- f"removed in {removal_version}. ({loc})"
322
+ f"removed in {removal_version}.{loc}"
307
323
  )
308
324
  if _LOG_LEVEL <= LogLevel.WARNING:
309
325
  print(f"[yellow]DeprecationWarning: {msg}[/yellow]", **kwargs)
@@ -395,3 +411,47 @@ def timing(msg: str):
395
411
  yield
396
412
  finally:
397
413
  debug(f"[white]\\[timing] {msg}: {time.time() - start:.2f}s[/white]")
414
+
415
+
416
+ class PoorProgress:
417
+ """A poor man's progress bar."""
418
+
419
+ def __init__(self):
420
+ """Initialize the progress bar."""
421
+ super().__init__()
422
+ self.tasks = {}
423
+ self.progress = 0
424
+ self.total = 0
425
+
426
+ def add_task(self, task: str, total: int):
427
+ """Add a task to the progress bar.
428
+
429
+ Args:
430
+ task: The task name.
431
+ total: The total number of steps for the task.
432
+
433
+ Returns:
434
+ The task ID.
435
+ """
436
+ self.total += total
437
+ task_id = TaskID(len(self.tasks))
438
+ self.tasks[task_id] = {"total": total, "current": 0}
439
+ return task_id
440
+
441
+ def advance(self, task: TaskID, advance: int = 1):
442
+ """Advance the progress of a task.
443
+
444
+ Args:
445
+ task: The task ID.
446
+ advance: The number of steps to advance.
447
+ """
448
+ if task in self.tasks:
449
+ self.tasks[task]["current"] += advance
450
+ self.progress += advance
451
+ _console.print(f"Progress: {self.progress}/{self.total}")
452
+
453
+ def start(self):
454
+ """Start the progress bar."""
455
+
456
+ def stop(self):
457
+ """Stop the progress bar."""
@@ -10,6 +10,7 @@ import click
10
10
  from reflex import constants
11
11
  from reflex.compiler import templates
12
12
  from reflex.config import Config, get_config
13
+ from reflex.environment import environment
13
14
  from reflex.utils import console, path_ops
14
15
  from reflex.utils.prerequisites import get_project_hash, get_web_dir
15
16
  from reflex.utils.registry import get_npm_registry
@@ -192,7 +193,11 @@ def _compile_vite_config(config: Config):
192
193
  base = "/"
193
194
  if frontend_path := config.frontend_path.strip("/"):
194
195
  base += frontend_path + "/"
195
- return templates.vite_config_template(base=base)
196
+ return templates.vite_config_template(
197
+ base=base,
198
+ hmr=environment.VITE_HMR.get(),
199
+ force_full_reload=environment.VITE_FORCE_FULL_RELOAD.get(),
200
+ )
196
201
 
197
202
 
198
203
  def initialize_vite_config():
reflex/utils/imports.py CHANGED
@@ -135,7 +135,7 @@ class ImportVar:
135
135
  if self.alias:
136
136
  return (
137
137
  self.alias
138
- if self.is_default
138
+ if self.is_default and self.tag != "*"
139
139
  else (self.tag + " as " + self.alias if self.tag else self.alias)
140
140
  )
141
141
  return self.tag or ""
@@ -248,6 +248,7 @@ def get_compiled_app(
248
248
  prerender_routes: bool = False,
249
249
  dry_run: bool = False,
250
250
  check_if_schema_up_to_date: bool = False,
251
+ use_rich: bool = True,
251
252
  ) -> ModuleType:
252
253
  """Get the app module based on the default config after first compiling it.
253
254
 
@@ -256,6 +257,7 @@ def get_compiled_app(
256
257
  prerender_routes: Whether to prerender routes.
257
258
  dry_run: If True, do not write the compiled app to disk.
258
259
  check_if_schema_up_to_date: If True, check if the schema is up to date.
260
+ use_rich: Whether to use rich progress bars.
259
261
 
260
262
  Returns:
261
263
  The compiled app based on the default config.
@@ -263,7 +265,7 @@ def get_compiled_app(
263
265
  app, app_module = get_and_validate_app(
264
266
  reload=reload, check_if_schema_up_to_date=check_if_schema_up_to_date
265
267
  )
266
- app._compile(prerender_routes=prerender_routes, dry_run=dry_run)
268
+ app._compile(prerender_routes=prerender_routes, dry_run=dry_run, use_rich=use_rich)
267
269
  return app_module
268
270
 
269
271
 
@@ -547,7 +547,7 @@ def _generate_component_create_functiondef(
547
547
  kwargs.extend(prop_kwargs)
548
548
 
549
549
  def figure_out_return_type(annotation: Any):
550
- if inspect.isclass(annotation) and issubclass(annotation, inspect._empty):
550
+ if isinstance(annotation, type) and issubclass(annotation, inspect._empty):
551
551
  return ast.Name(id="EventType[Any]")
552
552
 
553
553
  if not isinstance(annotation, str) and get_origin(annotation) is tuple:
@@ -1181,7 +1181,7 @@ class PyiGenerator:
1181
1181
  class_names = {
1182
1182
  name: obj
1183
1183
  for name, obj in vars(module).items()
1184
- if inspect.isclass(obj)
1184
+ if isinstance(obj, type)
1185
1185
  and (
1186
1186
  rx_types.safe_issubclass(obj, Component)
1187
1187
  or rx_types.safe_issubclass(obj, SimpleNamespace)
@@ -187,7 +187,7 @@ def get_serializer(type_: type) -> Serializer | None:
187
187
 
188
188
  # If the type is not registered, check if it is a subclass of a registered type.
189
189
  for registered_type, serializer in reversed(SERIALIZERS.items()):
190
- if types._issubclass(type_, registered_type):
190
+ if issubclass(type_, registered_type):
191
191
  return serializer
192
192
 
193
193
  # If there is no serializer, return None.
@@ -211,7 +211,7 @@ def get_serializer_type(type_: type) -> type | None:
211
211
 
212
212
  # If the type is not registered, check if it is a subclass of a registered type.
213
213
  for registered_type, serializer in reversed(SERIALIZER_TYPES.items()):
214
- if types._issubclass(type_, registered_type):
214
+ if issubclass(type_, registered_type):
215
215
  return serializer
216
216
 
217
217
  # If there is no serializer, return None.
@@ -244,11 +244,11 @@ def can_serialize(type_: type, into_type: type | None = None) -> bool:
244
244
  Returns:
245
245
  Whether there is a serializer for the type.
246
246
  """
247
- return has_serializer(type_, into_type) or (
247
+ return (
248
248
  isinstance(type_, type)
249
249
  and dataclasses.is_dataclass(type_)
250
250
  and (into_type is None or into_type is dict)
251
- )
251
+ ) or has_serializer(type_, into_type)
252
252
 
253
253
 
254
254
  @serializer(to=str)