reflex 0.7.1a4__py3-none-any.whl → 0.7.2__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/.templates/jinja/web/utils/context.js.jinja2 +8 -8
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +3 -3
- reflex/.templates/web/utils/state.js +18 -18
- reflex/admin.py +1 -2
- reflex/app.py +46 -49
- reflex/app_mixins/lifespan.py +2 -2
- reflex/app_mixins/middleware.py +1 -2
- reflex/assets.py +1 -2
- reflex/base.py +2 -2
- reflex/compiler/compiler.py +51 -16
- reflex/compiler/utils.py +4 -13
- reflex/components/base/app_wrap.pyi +7 -7
- reflex/components/base/bare.py +3 -3
- reflex/components/base/body.pyi +7 -7
- reflex/components/base/document.py +1 -3
- reflex/components/base/document.pyi +32 -32
- reflex/components/base/error_boundary.py +2 -4
- reflex/components/base/error_boundary.pyi +11 -13
- reflex/components/base/fragment.pyi +7 -7
- reflex/components/base/head.pyi +13 -13
- reflex/components/base/link.pyi +22 -22
- reflex/components/base/meta.py +5 -7
- reflex/components/base/meta.pyi +40 -40
- reflex/components/base/script.pyi +11 -14
- reflex/components/base/strict_mode.pyi +7 -7
- reflex/components/component.py +188 -113
- reflex/components/core/auto_scroll.py +8 -1
- reflex/components/core/auto_scroll.pyi +183 -210
- reflex/components/core/banner.py +2 -4
- reflex/components/core/banner.pyi +390 -444
- reflex/components/core/breakpoints.py +5 -5
- reflex/components/core/client_side_routing.pyi +14 -14
- reflex/components/core/clipboard.py +4 -4
- reflex/components/core/clipboard.pyi +12 -14
- reflex/components/core/cond.py +17 -25
- reflex/components/core/debounce.py +3 -3
- reflex/components/core/debounce.pyi +14 -14
- reflex/components/core/foreach.py +7 -2
- reflex/components/core/html.py +1 -3
- reflex/components/core/html.pyi +184 -213
- reflex/components/core/match.py +15 -19
- reflex/components/core/sticky.pyi +930 -1078
- reflex/components/core/upload.py +4 -4
- reflex/components/core/upload.pyi +62 -62
- reflex/components/datadisplay/code.py +6 -6
- reflex/components/datadisplay/code.pyi +1159 -1165
- reflex/components/datadisplay/dataeditor.py +49 -49
- reflex/components/datadisplay/dataeditor.pyi +95 -123
- reflex/components/datadisplay/logo.py +1 -3
- reflex/components/datadisplay/shiki_code_block.py +8 -10
- reflex/components/datadisplay/shiki_code_block.pyi +1678 -1720
- reflex/components/el/element.pyi +7 -7
- reflex/components/el/elements/base.pyi +183 -210
- reflex/components/el/elements/forms.py +24 -24
- reflex/components/el/elements/forms.pyi +2572 -2934
- reflex/components/el/elements/inline.py +4 -4
- reflex/components/el/elements/inline.pyi +5191 -5953
- reflex/components/el/elements/media.py +47 -47
- reflex/components/el/elements/media.pyi +4802 -5500
- reflex/components/el/elements/metadata.py +1 -3
- reflex/components/el/elements/metadata.pyi +782 -896
- reflex/components/el/elements/other.pyi +1278 -1467
- reflex/components/el/elements/scripts.pyi +580 -667
- reflex/components/el/elements/sectioning.pyi +2761 -3166
- reflex/components/el/elements/tables.pyi +1840 -2119
- reflex/components/el/elements/typography.pyi +2772 -3179
- reflex/components/gridjs/datatable.py +7 -7
- reflex/components/gridjs/datatable.pyi +19 -19
- reflex/components/lucide/icon.pyi +21 -21
- reflex/components/markdown/markdown.py +2 -2
- reflex/components/markdown/markdown.pyi +9 -9
- reflex/components/moment/moment.py +11 -12
- reflex/components/moment/moment.pyi +44 -47
- reflex/components/next/base.pyi +7 -7
- reflex/components/next/image.py +3 -3
- reflex/components/next/image.pyi +19 -21
- reflex/components/next/link.pyi +9 -9
- reflex/components/next/video.py +1 -3
- reflex/components/next/video.pyi +9 -9
- reflex/components/plotly/plotly.py +22 -45
- reflex/components/plotly/plotly.pyi +164 -164
- reflex/components/radix/primitives/accordion.py +14 -14
- reflex/components/radix/primitives/accordion.pyi +439 -487
- reflex/components/radix/primitives/base.py +1 -3
- reflex/components/radix/primitives/base.pyi +15 -15
- reflex/components/radix/primitives/drawer.py +3 -3
- reflex/components/radix/primitives/drawer.pyi +110 -116
- reflex/components/radix/primitives/form.py +1 -1
- reflex/components/radix/primitives/form.pyi +668 -752
- reflex/components/radix/primitives/progress.py +6 -6
- reflex/components/radix/primitives/progress.pyi +225 -243
- reflex/components/radix/primitives/slider.py +6 -6
- reflex/components/radix/primitives/slider.pyi +52 -55
- reflex/components/radix/themes/base.py +3 -6
- reflex/components/radix/themes/base.pyi +197 -303
- reflex/components/radix/themes/color_mode.py +5 -5
- reflex/components/radix/themes/color_mode.pyi +366 -436
- reflex/components/radix/themes/components/alert_dialog.pyi +229 -262
- reflex/components/radix/themes/components/aspect_ratio.py +1 -3
- reflex/components/radix/themes/components/aspect_ratio.pyi +8 -8
- reflex/components/radix/themes/components/avatar.pyi +79 -94
- reflex/components/radix/themes/components/badge.pyi +252 -295
- reflex/components/radix/themes/components/button.pyi +269 -314
- reflex/components/radix/themes/components/callout.py +2 -2
- reflex/components/radix/themes/components/callout.pyi +1116 -1290
- reflex/components/radix/themes/components/card.pyi +194 -229
- reflex/components/radix/themes/components/checkbox.pyi +243 -278
- reflex/components/radix/themes/components/checkbox_cards.py +3 -7
- reflex/components/radix/themes/components/checkbox_cards.pyi +101 -135
- reflex/components/radix/themes/components/checkbox_group.py +2 -2
- reflex/components/radix/themes/components/checkbox_group.pyi +83 -96
- reflex/components/radix/themes/components/context_menu.py +18 -15
- reflex/components/radix/themes/components/context_menu.pyi +408 -458
- reflex/components/radix/themes/components/data_list.pyi +122 -147
- reflex/components/radix/themes/components/dialog.pyi +231 -264
- reflex/components/radix/themes/components/dropdown_menu.py +16 -13
- reflex/components/radix/themes/components/dropdown_menu.pyi +223 -246
- reflex/components/radix/themes/components/hover_card.py +2 -2
- reflex/components/radix/themes/components/hover_card.pyi +237 -282
- reflex/components/radix/themes/components/icon_button.pyi +269 -314
- reflex/components/radix/themes/components/inset.py +8 -8
- reflex/components/radix/themes/components/inset.pyi +232 -292
- reflex/components/radix/themes/components/popover.py +2 -2
- reflex/components/radix/themes/components/popover.pyi +229 -271
- reflex/components/radix/themes/components/progress.pyi +80 -96
- reflex/components/radix/themes/components/radio.pyi +73 -86
- reflex/components/radix/themes/components/radio_cards.py +4 -8
- reflex/components/radix/themes/components/radio_cards.pyi +117 -154
- reflex/components/radix/themes/components/radio_group.py +3 -3
- reflex/components/radix/themes/components/radio_group.pyi +250 -291
- reflex/components/radix/themes/components/scroll_area.pyi +14 -20
- reflex/components/radix/themes/components/segmented_control.py +6 -6
- reflex/components/radix/themes/components/segmented_control.pyi +89 -108
- reflex/components/radix/themes/components/select.py +7 -7
- reflex/components/radix/themes/components/select.pyi +376 -444
- reflex/components/radix/themes/components/separator.pyi +79 -93
- reflex/components/radix/themes/components/skeleton.pyi +32 -26
- reflex/components/radix/themes/components/slider.py +8 -8
- reflex/components/radix/themes/components/slider.pyi +99 -122
- reflex/components/radix/themes/components/spinner.pyi +12 -19
- reflex/components/radix/themes/components/switch.pyi +84 -99
- reflex/components/radix/themes/components/table.py +9 -9
- reflex/components/radix/themes/components/table.pyi +1440 -1794
- reflex/components/radix/themes/components/tabs.py +4 -4
- reflex/components/radix/themes/components/tabs.pyi +120 -132
- reflex/components/radix/themes/components/text_area.pyi +281 -331
- reflex/components/radix/themes/components/text_field.py +2 -2
- reflex/components/radix/themes/components/text_field.pyi +639 -734
- reflex/components/radix/themes/components/tooltip.py +6 -6
- reflex/components/radix/themes/components/tooltip.pyi +34 -43
- reflex/components/radix/themes/layout/base.pyi +85 -182
- reflex/components/radix/themes/layout/box.pyi +183 -210
- reflex/components/radix/themes/layout/center.pyi +225 -286
- reflex/components/radix/themes/layout/container.pyi +191 -224
- reflex/components/radix/themes/layout/flex.py +2 -2
- reflex/components/radix/themes/layout/flex.pyi +225 -286
- reflex/components/radix/themes/layout/grid.py +2 -2
- reflex/components/radix/themes/layout/grid.pyi +245 -315
- reflex/components/radix/themes/layout/list.py +2 -2
- reflex/components/radix/themes/layout/list.pyi +712 -815
- reflex/components/radix/themes/layout/section.pyi +187 -221
- reflex/components/radix/themes/layout/spacer.pyi +225 -286
- reflex/components/radix/themes/layout/stack.pyi +625 -768
- reflex/components/radix/themes/typography/blockquote.pyi +257 -299
- reflex/components/radix/themes/typography/code.pyi +259 -304
- reflex/components/radix/themes/typography/heading.pyi +272 -324
- reflex/components/radix/themes/typography/link.pyi +302 -358
- reflex/components/radix/themes/typography/text.pyi +1669 -1945
- reflex/components/react_player/audio.pyi +20 -22
- reflex/components/react_player/react_player.pyi +19 -19
- reflex/components/react_player/video.pyi +20 -22
- reflex/components/recharts/cartesian.py +100 -97
- reflex/components/recharts/cartesian.pyi +891 -1007
- reflex/components/recharts/charts.py +42 -42
- reflex/components/recharts/charts.pyi +212 -249
- reflex/components/recharts/general.py +22 -21
- reflex/components/recharts/general.pyi +198 -223
- reflex/components/recharts/polar.py +42 -45
- reflex/components/recharts/polar.pyi +254 -288
- reflex/components/recharts/recharts.pyi +13 -13
- reflex/components/sonner/toast.py +20 -20
- reflex/components/sonner/toast.pyi +58 -61
- reflex/components/suneditor/editor.py +9 -9
- reflex/components/suneditor/editor.pyi +78 -83
- reflex/components/tags/cond_tag.py +2 -2
- reflex/components/tags/iter_tag.py +10 -14
- reflex/components/tags/match_tag.py +2 -2
- reflex/components/tags/tag.py +10 -10
- reflex/config.py +36 -35
- reflex/constants/__init__.py +56 -53
- reflex/custom_components/custom_components.py +6 -7
- reflex/event.py +38 -42
- reflex/experimental/client_state.py +2 -4
- reflex/experimental/layout.py +2 -2
- reflex/experimental/layout.pyi +579 -663
- reflex/istate/data.py +4 -5
- reflex/middleware/hydrate_middleware.py +2 -2
- reflex/middleware/middleware.py +2 -2
- reflex/model.py +3 -5
- reflex/page.py +2 -2
- reflex/reflex.py +9 -10
- reflex/state.py +77 -49
- reflex/style.py +11 -5
- reflex/testing.py +21 -24
- reflex/utils/console.py +1 -1
- reflex/utils/decorator.py +26 -1
- reflex/utils/exec.py +6 -11
- reflex/utils/export.py +2 -3
- reflex/utils/format.py +4 -4
- reflex/utils/imports.py +12 -12
- reflex/utils/prerequisites.py +35 -84
- reflex/utils/processes.py +5 -5
- reflex/utils/pyi_generator.py +33 -22
- reflex/utils/serializers.py +60 -15
- reflex/utils/types.py +237 -56
- reflex/vars/base.py +122 -72
- reflex/vars/datetime.py +2 -2
- reflex/vars/function.py +52 -55
- reflex/vars/number.py +59 -5
- reflex/vars/object.py +57 -26
- reflex/vars/sequence.py +983 -958
- {reflex-0.7.1a4.dist-info → reflex-0.7.2.dist-info}/METADATA +3 -6
- reflex-0.7.2.dist-info/RECORD +405 -0
- {reflex-0.7.1a4.dist-info → reflex-0.7.2.dist-info}/WHEEL +1 -1
- reflex-0.7.1a4.dist-info/RECORD +0 -405
- {reflex-0.7.1a4.dist-info → reflex-0.7.2.dist-info}/LICENSE +0 -0
- {reflex-0.7.1a4.dist-info → reflex-0.7.2.dist-info}/entry_points.txt +0 -0
reflex/components/tags/tag.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, List, Mapping, Sequence
|
|
7
7
|
|
|
8
8
|
from reflex.event import EventChain
|
|
9
|
-
from reflex.utils import format
|
|
9
|
+
from reflex.utils import format
|
|
10
10
|
from reflex.vars.base import LiteralVar, Var
|
|
11
11
|
|
|
12
12
|
|
|
@@ -38,16 +38,16 @@ class Tag:
|
|
|
38
38
|
name: str = ""
|
|
39
39
|
|
|
40
40
|
# The props of the tag.
|
|
41
|
-
props:
|
|
41
|
+
props: dict[str, Any] = dataclasses.field(default_factory=dict)
|
|
42
42
|
|
|
43
43
|
# The inner contents of the tag.
|
|
44
44
|
contents: str = ""
|
|
45
45
|
|
|
46
46
|
# Special props that aren't key value pairs.
|
|
47
|
-
special_props:
|
|
47
|
+
special_props: list[Var] = dataclasses.field(default_factory=list)
|
|
48
48
|
|
|
49
49
|
# The children components.
|
|
50
|
-
children:
|
|
50
|
+
children: list[Any] = dataclasses.field(default_factory=list)
|
|
51
51
|
|
|
52
52
|
def __post_init__(self):
|
|
53
53
|
"""Post initialize the tag."""
|
|
@@ -83,14 +83,14 @@ class Tag:
|
|
|
83
83
|
"""Iterate over the tag's fields.
|
|
84
84
|
|
|
85
85
|
Yields:
|
|
86
|
-
|
|
86
|
+
tuple[str, Any]: The field name and value.
|
|
87
87
|
"""
|
|
88
88
|
for field in dataclasses.fields(self):
|
|
89
89
|
rendered_value = render_prop(getattr(self, field.name))
|
|
90
90
|
if rendered_value is not None:
|
|
91
91
|
yield field.name, rendered_value
|
|
92
92
|
|
|
93
|
-
def add_props(self, **kwargs:
|
|
93
|
+
def add_props(self, **kwargs: Any | None) -> Tag:
|
|
94
94
|
"""Add props to the tag.
|
|
95
95
|
|
|
96
96
|
Args:
|
|
@@ -103,9 +103,9 @@ class Tag:
|
|
|
103
103
|
{
|
|
104
104
|
format.to_camel_case(name, treat_hyphens_as_underscores=False): (
|
|
105
105
|
prop
|
|
106
|
-
if
|
|
106
|
+
if isinstance(prop, (EventChain, Mapping))
|
|
107
107
|
else LiteralVar.create(prop)
|
|
108
|
-
)
|
|
108
|
+
)
|
|
109
109
|
for name, prop in kwargs.items()
|
|
110
110
|
if self.is_valid_prop(prop)
|
|
111
111
|
}
|
|
@@ -128,7 +128,7 @@ class Tag:
|
|
|
128
128
|
return self
|
|
129
129
|
|
|
130
130
|
@staticmethod
|
|
131
|
-
def is_valid_prop(prop:
|
|
131
|
+
def is_valid_prop(prop: Var | None) -> bool:
|
|
132
132
|
"""Check if the prop is valid.
|
|
133
133
|
|
|
134
134
|
Args:
|
reflex/config.py
CHANGED
|
@@ -22,11 +22,7 @@ from typing import (
|
|
|
22
22
|
Annotated,
|
|
23
23
|
Any,
|
|
24
24
|
Callable,
|
|
25
|
-
Dict,
|
|
26
25
|
Generic,
|
|
27
|
-
List,
|
|
28
|
-
Optional,
|
|
29
|
-
Set,
|
|
30
26
|
TypeVar,
|
|
31
27
|
get_args,
|
|
32
28
|
get_origin,
|
|
@@ -40,7 +36,12 @@ from reflex import constants
|
|
|
40
36
|
from reflex.base import Base
|
|
41
37
|
from reflex.utils import console
|
|
42
38
|
from reflex.utils.exceptions import ConfigError, EnvironmentVarValueError
|
|
43
|
-
from reflex.utils.types import
|
|
39
|
+
from reflex.utils.types import (
|
|
40
|
+
GenericType,
|
|
41
|
+
is_union,
|
|
42
|
+
true_type_for_pydantic_field,
|
|
43
|
+
value_inside_optional,
|
|
44
|
+
)
|
|
44
45
|
|
|
45
46
|
try:
|
|
46
47
|
from dotenv import load_dotenv # pyright: ignore [reportMissingImports]
|
|
@@ -52,10 +53,10 @@ class DBConfig(Base):
|
|
|
52
53
|
"""Database config."""
|
|
53
54
|
|
|
54
55
|
engine: str
|
|
55
|
-
username:
|
|
56
|
-
password:
|
|
57
|
-
host:
|
|
58
|
-
port:
|
|
56
|
+
username: str | None = ""
|
|
57
|
+
password: str | None = ""
|
|
58
|
+
host: str | None = ""
|
|
59
|
+
port: int | None = None
|
|
59
60
|
database: str
|
|
60
61
|
|
|
61
62
|
@classmethod
|
|
@@ -361,7 +362,7 @@ class EnvVar(Generic[T]):
|
|
|
361
362
|
"""
|
|
362
363
|
return interpret_env_var_value(value, self.type_, self.name)
|
|
363
364
|
|
|
364
|
-
def getenv(self) ->
|
|
365
|
+
def getenv(self) -> T | None:
|
|
365
366
|
"""Get the interpreted environment variable value.
|
|
366
367
|
|
|
367
368
|
Returns:
|
|
@@ -598,16 +599,16 @@ class EnvironmentVariables:
|
|
|
598
599
|
REFLEX_USE_NPM: EnvVar[bool] = env_var(False)
|
|
599
600
|
|
|
600
601
|
# The npm registry to use.
|
|
601
|
-
NPM_CONFIG_REGISTRY: EnvVar[
|
|
602
|
+
NPM_CONFIG_REGISTRY: EnvVar[str | None] = env_var(None)
|
|
602
603
|
|
|
603
604
|
# Whether to use Granian for the backend. Otherwise, use Uvicorn.
|
|
604
605
|
REFLEX_USE_GRANIAN: EnvVar[bool] = env_var(False)
|
|
605
606
|
|
|
606
607
|
# The username to use for authentication on python package repository. Username and password must both be provided.
|
|
607
|
-
TWINE_USERNAME: EnvVar[
|
|
608
|
+
TWINE_USERNAME: EnvVar[str | None] = env_var(None)
|
|
608
609
|
|
|
609
610
|
# The password to use for authentication on python package repository. Username and password must both be provided.
|
|
610
|
-
TWINE_PASSWORD: EnvVar[
|
|
611
|
+
TWINE_PASSWORD: EnvVar[str | None] = env_var(None)
|
|
611
612
|
|
|
612
613
|
# Whether to use the system installed bun. If set to false, bun will be bundled with the app.
|
|
613
614
|
REFLEX_USE_SYSTEM_BUN: EnvVar[bool] = env_var(False)
|
|
@@ -632,13 +633,13 @@ class EnvironmentVariables:
|
|
|
632
633
|
Path(constants.Dirs.UPLOADED_FILES)
|
|
633
634
|
)
|
|
634
635
|
|
|
635
|
-
REFLEX_COMPILE_EXECUTOR: EnvVar[
|
|
636
|
+
REFLEX_COMPILE_EXECUTOR: EnvVar[ExecutorType | None] = env_var(None)
|
|
636
637
|
|
|
637
638
|
# Whether to use separate processes to compile the frontend and how many. If not set, defaults to thread executor.
|
|
638
|
-
REFLEX_COMPILE_PROCESSES: EnvVar[
|
|
639
|
+
REFLEX_COMPILE_PROCESSES: EnvVar[int | None] = env_var(None)
|
|
639
640
|
|
|
640
641
|
# Whether to use separate threads to compile the frontend and how many. Defaults to `min(32, os.cpu_count() + 4)`.
|
|
641
|
-
REFLEX_COMPILE_THREADS: EnvVar[
|
|
642
|
+
REFLEX_COMPILE_THREADS: EnvVar[int | None] = env_var(None)
|
|
642
643
|
|
|
643
644
|
# The directory to store reflex dependencies.
|
|
644
645
|
REFLEX_DIR: EnvVar[Path] = env_var(constants.Reflex.DIR)
|
|
@@ -708,10 +709,10 @@ class EnvironmentVariables:
|
|
|
708
709
|
REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(True)
|
|
709
710
|
|
|
710
711
|
# Additional paths to include in the hot reload. Separated by a colon.
|
|
711
|
-
REFLEX_HOT_RELOAD_INCLUDE_PATHS: EnvVar[
|
|
712
|
+
REFLEX_HOT_RELOAD_INCLUDE_PATHS: EnvVar[list[Path]] = env_var([])
|
|
712
713
|
|
|
713
714
|
# Paths to exclude from the hot reload. Takes precedence over include paths. Separated by a colon.
|
|
714
|
-
REFLEX_HOT_RELOAD_EXCLUDE_PATHS: EnvVar[
|
|
715
|
+
REFLEX_HOT_RELOAD_EXCLUDE_PATHS: EnvVar[list[Path]] = env_var([])
|
|
715
716
|
|
|
716
717
|
# Enables different behavior for when the backend would do a cold start if it was inactive.
|
|
717
718
|
REFLEX_DOES_BACKEND_COLD_START: EnvVar[bool] = env_var(False)
|
|
@@ -761,7 +762,7 @@ class Config(Base):
|
|
|
761
762
|
app_name: str
|
|
762
763
|
|
|
763
764
|
# The path to the app module.
|
|
764
|
-
app_module_import:
|
|
765
|
+
app_module_import: str | None = None
|
|
765
766
|
|
|
766
767
|
# The log level to use.
|
|
767
768
|
loglevel: constants.LogLevel = constants.LogLevel.DEFAULT
|
|
@@ -779,21 +780,19 @@ class Config(Base):
|
|
|
779
780
|
api_url: str = f"http://localhost:{constants.DefaultPorts.BACKEND_PORT}"
|
|
780
781
|
|
|
781
782
|
# The url the frontend will be hosted on.
|
|
782
|
-
deploy_url:
|
|
783
|
-
f"http://localhost:{constants.DefaultPorts.FRONTEND_PORT}"
|
|
784
|
-
)
|
|
783
|
+
deploy_url: str | None = f"http://localhost:{constants.DefaultPorts.FRONTEND_PORT}"
|
|
785
784
|
|
|
786
785
|
# The url the backend will be hosted on.
|
|
787
786
|
backend_host: str = "0.0.0.0"
|
|
788
787
|
|
|
789
788
|
# The database url used by rx.Model.
|
|
790
|
-
db_url:
|
|
789
|
+
db_url: str | None = "sqlite:///reflex.db"
|
|
791
790
|
|
|
792
791
|
# The async database url used by rx.Model.
|
|
793
|
-
async_db_url:
|
|
792
|
+
async_db_url: str | None = None
|
|
794
793
|
|
|
795
794
|
# The redis url
|
|
796
|
-
redis_url:
|
|
795
|
+
redis_url: str | None = None
|
|
797
796
|
|
|
798
797
|
# Telemetry opt-in.
|
|
799
798
|
telemetry_enabled: bool = True
|
|
@@ -805,10 +804,10 @@ class Config(Base):
|
|
|
805
804
|
static_page_generation_timeout: int = 60
|
|
806
805
|
|
|
807
806
|
# List of origins that are allowed to connect to the backend API.
|
|
808
|
-
cors_allowed_origins:
|
|
807
|
+
cors_allowed_origins: list[str] = ["*"]
|
|
809
808
|
|
|
810
809
|
# Tailwind config.
|
|
811
|
-
tailwind:
|
|
810
|
+
tailwind: dict[str, Any] | None = {"plugins": ["@tailwindcss/typography"]}
|
|
812
811
|
|
|
813
812
|
# Timeout when launching the gunicorn server. TODO(rename this to backend_timeout?)
|
|
814
813
|
timeout: int = 120
|
|
@@ -820,7 +819,7 @@ class Config(Base):
|
|
|
820
819
|
react_strict_mode: bool = True
|
|
821
820
|
|
|
822
821
|
# Additional frontend packages to install.
|
|
823
|
-
frontend_packages:
|
|
822
|
+
frontend_packages: list[str] = []
|
|
824
823
|
|
|
825
824
|
# The hosting service backend URL.
|
|
826
825
|
cp_backend_url: str = Hosting.HOSTING_SERVICE
|
|
@@ -831,7 +830,7 @@ class Config(Base):
|
|
|
831
830
|
gunicorn_worker_class: str = "uvicorn.workers.UvicornH11Worker"
|
|
832
831
|
|
|
833
832
|
# Number of gunicorn workers from user
|
|
834
|
-
gunicorn_workers:
|
|
833
|
+
gunicorn_workers: int | None = None
|
|
835
834
|
|
|
836
835
|
# Number of requests before a worker is restarted; set to 0 to disable
|
|
837
836
|
gunicorn_max_requests: int = 100
|
|
@@ -852,19 +851,19 @@ class Config(Base):
|
|
|
852
851
|
redis_token_expiration: int = constants.Expiration.TOKEN
|
|
853
852
|
|
|
854
853
|
# Attributes that were explicitly set by the user.
|
|
855
|
-
_non_default_attributes:
|
|
854
|
+
_non_default_attributes: set[str] = pydantic.PrivateAttr(set())
|
|
856
855
|
|
|
857
856
|
# Path to file containing key-values pairs to override in the environment; Dotenv format.
|
|
858
|
-
env_file:
|
|
857
|
+
env_file: str | None = None
|
|
859
858
|
|
|
860
859
|
# Whether to display the sticky "Built with Reflex" badge on all pages.
|
|
861
|
-
show_built_with_reflex:
|
|
860
|
+
show_built_with_reflex: bool | None = None
|
|
862
861
|
|
|
863
862
|
# Whether the app is running in the reflex cloud environment.
|
|
864
863
|
is_reflex_cloud: bool = False
|
|
865
864
|
|
|
866
|
-
# Extra overlay function to run after the app is built. Formatted such that `from path_0.path_1... import path[-1]`, and calling it with no arguments would work. For example, "reflex.components.moment.
|
|
867
|
-
extra_overlay_function:
|
|
865
|
+
# Extra overlay function to run after the app is built. Formatted such that `from path_0.path_1... import path[-1]`, and calling it with no arguments would work. For example, "reflex.components.moment.moment".
|
|
866
|
+
extra_overlay_function: str | None = None
|
|
868
867
|
|
|
869
868
|
def __init__(self, *args, **kwargs):
|
|
870
869
|
"""Initialize the config values.
|
|
@@ -949,7 +948,9 @@ class Config(Base):
|
|
|
949
948
|
# If the env var is set, override the config value.
|
|
950
949
|
if env_var is not None:
|
|
951
950
|
# Interpret the value.
|
|
952
|
-
value = interpret_env_var_value(
|
|
951
|
+
value = interpret_env_var_value(
|
|
952
|
+
env_var, true_type_for_pydantic_field(field), field.name
|
|
953
|
+
)
|
|
953
954
|
|
|
954
955
|
# Set the value.
|
|
955
956
|
updated_values[key] = value
|
reflex/constants/__init__.py
CHANGED
|
@@ -60,57 +60,60 @@ from .route import (
|
|
|
60
60
|
from .state import StateManagerMode
|
|
61
61
|
from .style import Tailwind
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
ALEMBIC_CONFIG,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
63
|
+
__all__ = [
|
|
64
|
+
"ALEMBIC_CONFIG",
|
|
65
|
+
"APP_HARNESS_FLAG",
|
|
66
|
+
"COOKIES",
|
|
67
|
+
"IS_LINUX",
|
|
68
|
+
"IS_MACOS",
|
|
69
|
+
"IS_WINDOWS",
|
|
70
|
+
"LOCAL_STORAGE",
|
|
71
|
+
"NOCOMPILE_FILE",
|
|
72
|
+
"POLLING_MAX_HTTP_BUFFER_SIZE",
|
|
73
|
+
"PYTEST_CURRENT_TEST",
|
|
74
|
+
"REFLEX_VAR_CLOSING_TAG",
|
|
75
|
+
"REFLEX_VAR_OPENING_TAG",
|
|
76
|
+
"ROUTER",
|
|
77
|
+
"ROUTER_DATA",
|
|
78
|
+
"ROUTER_DATA_INCLUDE",
|
|
79
|
+
"ROUTE_NOT_FOUND",
|
|
80
|
+
"SESSION_STORAGE",
|
|
81
|
+
"SETTER_PREFIX",
|
|
82
|
+
"Bun",
|
|
83
|
+
"ColorMode",
|
|
84
|
+
"CompileContext",
|
|
85
|
+
"CompileVars",
|
|
86
|
+
"ComponentName",
|
|
87
|
+
"Config",
|
|
88
|
+
"CustomComponents",
|
|
89
|
+
"DefaultPage",
|
|
90
|
+
"DefaultPorts",
|
|
91
|
+
"Dirs",
|
|
92
|
+
"Endpoint",
|
|
93
|
+
"Env",
|
|
94
|
+
"EventTriggers",
|
|
95
|
+
"Expiration",
|
|
96
|
+
"Ext",
|
|
97
|
+
"Fnm",
|
|
98
|
+
"GitIgnore",
|
|
99
|
+
"Hooks",
|
|
100
|
+
"Imports",
|
|
101
|
+
"LogLevel",
|
|
102
|
+
"MemoizationDisposition",
|
|
103
|
+
"MemoizationMode",
|
|
104
|
+
"Next",
|
|
105
|
+
"Node",
|
|
106
|
+
"PackageJson",
|
|
107
|
+
"Page404",
|
|
108
|
+
"PageNames",
|
|
109
|
+
"Ping",
|
|
110
|
+
"Reflex",
|
|
111
|
+
"RequirementsTxt",
|
|
112
|
+
"RouteArgType",
|
|
113
|
+
"RouteRegex",
|
|
114
|
+
"RouteVar",
|
|
115
|
+
"SocketEvent",
|
|
116
|
+
"StateManagerMode",
|
|
117
|
+
"Tailwind",
|
|
118
|
+
"Templates",
|
|
116
119
|
]
|
|
@@ -9,7 +9,6 @@ import sys
|
|
|
9
9
|
from collections import namedtuple
|
|
10
10
|
from contextlib import contextmanager
|
|
11
11
|
from pathlib import Path
|
|
12
|
-
from typing import Optional, Tuple
|
|
13
12
|
|
|
14
13
|
import httpx
|
|
15
14
|
import tomlkit
|
|
@@ -311,7 +310,7 @@ def _populate_custom_component_project(name_variants: NameVariants):
|
|
|
311
310
|
|
|
312
311
|
@custom_components_cli.command(name="init")
|
|
313
312
|
def init(
|
|
314
|
-
library_name:
|
|
313
|
+
library_name: str | None = typer.Option(
|
|
315
314
|
None,
|
|
316
315
|
help="The name of your library. On PyPI, package will be published as `reflex-{library-name}`.",
|
|
317
316
|
),
|
|
@@ -604,26 +603,26 @@ def _ensure_dist_dir(version_to_publish: str, build: bool):
|
|
|
604
603
|
|
|
605
604
|
@custom_components_cli.command(name="publish")
|
|
606
605
|
def publish(
|
|
607
|
-
repository:
|
|
606
|
+
repository: str | None = typer.Option(
|
|
608
607
|
None,
|
|
609
608
|
"-r",
|
|
610
609
|
"--repository",
|
|
611
610
|
help="The name of the repository. Defaults to pypi. Only supports pypi and testpypi (Test PyPI) for now.",
|
|
612
611
|
),
|
|
613
|
-
token:
|
|
612
|
+
token: str | None = typer.Option(
|
|
614
613
|
None,
|
|
615
614
|
"-t",
|
|
616
615
|
"--token",
|
|
617
616
|
help="The API token to use for authentication on python package repository. If token is provided, no username/password should be provided at the same time",
|
|
618
617
|
),
|
|
619
|
-
username:
|
|
618
|
+
username: str | None = typer.Option(
|
|
620
619
|
environment.TWINE_USERNAME.get(),
|
|
621
620
|
"-u",
|
|
622
621
|
"--username",
|
|
623
622
|
show_default="TWINE_USERNAME environment variable value if set",
|
|
624
623
|
help="The username to use for authentication on python package repository. Username and password must both be provided.",
|
|
625
624
|
),
|
|
626
|
-
password:
|
|
625
|
+
password: str | None = typer.Option(
|
|
627
626
|
environment.TWINE_PASSWORD.get(),
|
|
628
627
|
"-p",
|
|
629
628
|
"--password",
|
|
@@ -927,7 +926,7 @@ def _validate_url_with_protocol_prefix(url: str | None) -> bool:
|
|
|
927
926
|
return not url or (url.startswith("http://") or url.startswith("https://"))
|
|
928
927
|
|
|
929
928
|
|
|
930
|
-
def _get_file_from_prompt_in_loop() ->
|
|
929
|
+
def _get_file_from_prompt_in_loop() -> tuple[bytes, str] | None:
|
|
931
930
|
image_file = file_extension = None
|
|
932
931
|
while image_file is None:
|
|
933
932
|
image_filepath = Path(
|