reflex 0.7.2a1__py3-none-any.whl → 0.7.2.dev1__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.
- benchmarks/__init__.py +3 -0
- benchmarks/benchmark_compile_times.py +147 -0
- benchmarks/benchmark_imports.py +128 -0
- benchmarks/benchmark_lighthouse.py +75 -0
- benchmarks/benchmark_package_size.py +135 -0
- benchmarks/benchmark_web_size.py +106 -0
- benchmarks/conftest.py +20 -0
- benchmarks/lighthouse.sh +77 -0
- benchmarks/utils.py +74 -0
- reflex/.templates/web/utils/state.js +18 -18
- reflex/components/el/elements/forms.py +1 -1
- reflex/components/el/elements/forms.pyi +1 -1
- reflex/reflex.py +6 -2
- reflex/style.py +3 -3
- reflex/utils/prerequisites.py +3 -45
- reflex/utils/pyi_generator.py +2 -2
- reflex/utils/redir.py +3 -12
- reflex/vars/base.py +3 -2
- {reflex-0.7.2a1.dist-info → reflex-0.7.2.dev1.dist-info}/METADATA +39 -46
- {reflex-0.7.2a1.dist-info → reflex-0.7.2.dev1.dist-info}/RECORD +23 -14
- {reflex-0.7.2a1.dist-info → reflex-0.7.2.dev1.dist-info}/WHEEL +1 -1
- reflex-0.7.2.dev1.dist-info/entry_points.txt +5 -0
- reflex-0.7.2a1.dist-info/entry_points.txt +0 -3
- {reflex-0.7.2a1.dist-info → reflex-0.7.2.dev1.dist-info/licenses}/LICENSE +0 -0
benchmarks/utils.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""Utility functions for the benchmarks."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import subprocess
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
from httpx import HTTPError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_python_version(venv_path: Path, os_name):
|
|
12
|
+
"""Get the python version of python in a virtual env.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
venv_path: Path to virtual environment.
|
|
16
|
+
os_name: Name of os.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
The python version.
|
|
20
|
+
"""
|
|
21
|
+
python_executable = (
|
|
22
|
+
venv_path / "bin" / "python"
|
|
23
|
+
if "windows" not in os_name
|
|
24
|
+
else venv_path / "Scripts" / "python.exe"
|
|
25
|
+
)
|
|
26
|
+
try:
|
|
27
|
+
output = subprocess.check_output(
|
|
28
|
+
[str(python_executable), "--version"], stderr=subprocess.STDOUT
|
|
29
|
+
)
|
|
30
|
+
python_version = output.decode("utf-8").strip().split()[1]
|
|
31
|
+
return ".".join(python_version.split(".")[:-1])
|
|
32
|
+
except subprocess.CalledProcessError:
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_directory_size(directory: Path):
|
|
37
|
+
"""Get the size of a directory in bytes.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
directory: The directory to check.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
The size of the dir in bytes.
|
|
44
|
+
"""
|
|
45
|
+
total_size = 0
|
|
46
|
+
for dirpath, _, filenames in os.walk(directory):
|
|
47
|
+
for f in filenames:
|
|
48
|
+
fp = Path(dirpath) / f
|
|
49
|
+
total_size += fp.stat().st_size
|
|
50
|
+
return total_size
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def send_data_to_posthog(event, properties):
|
|
54
|
+
"""Send data to PostHog.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
event: The event to send.
|
|
58
|
+
properties: The properties to send.
|
|
59
|
+
|
|
60
|
+
Raises:
|
|
61
|
+
HTTPError: When there is an error sending data to PostHog.
|
|
62
|
+
"""
|
|
63
|
+
event_data = {
|
|
64
|
+
"api_key": "phc_JoMo0fOyi0GQAooY3UyO9k0hebGkMyFJrrCw1Gt5SGb",
|
|
65
|
+
"event": event,
|
|
66
|
+
"properties": properties,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
with httpx.Client() as client:
|
|
70
|
+
response = client.post("https://app.posthog.com/capture/", json=event_data)
|
|
71
|
+
if response.status_code != 200:
|
|
72
|
+
raise HTTPError(
|
|
73
|
+
f"Error sending data to PostHog: {response.status_code} - {response.text}"
|
|
74
|
+
)
|
|
@@ -179,7 +179,7 @@ export const applyEvent = async (event, socket) => {
|
|
|
179
179
|
// Handle special events
|
|
180
180
|
if (event.name == "_redirect") {
|
|
181
181
|
if (event.payload.external) {
|
|
182
|
-
window.open(event.payload.path, "_blank");
|
|
182
|
+
window.open(event.payload.path, "_blank", "noopener");
|
|
183
183
|
} else if (event.payload.replace) {
|
|
184
184
|
Router.replace(event.payload.path);
|
|
185
185
|
} else {
|
|
@@ -227,8 +227,8 @@ export const applyEvent = async (event, socket) => {
|
|
|
227
227
|
a.href = eval?.(
|
|
228
228
|
event.payload.url.replace(
|
|
229
229
|
"getBackendURL(env.UPLOAD)",
|
|
230
|
-
`"${getBackendURL(env.UPLOAD)}"
|
|
231
|
-
)
|
|
230
|
+
`"${getBackendURL(env.UPLOAD)}"`
|
|
231
|
+
)
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
a.download = event.payload.filename;
|
|
@@ -341,7 +341,7 @@ export const applyRestEvent = async (event, socket) => {
|
|
|
341
341
|
event.payload.files,
|
|
342
342
|
event.payload.upload_id,
|
|
343
343
|
event.payload.on_upload_progress,
|
|
344
|
-
socket
|
|
344
|
+
socket
|
|
345
345
|
);
|
|
346
346
|
return false;
|
|
347
347
|
}
|
|
@@ -408,7 +408,7 @@ export const connect = async (
|
|
|
408
408
|
dispatch,
|
|
409
409
|
transports,
|
|
410
410
|
setConnectErrors,
|
|
411
|
-
client_storage = {}
|
|
411
|
+
client_storage = {}
|
|
412
412
|
) => {
|
|
413
413
|
// Get backend URL object from the endpoint.
|
|
414
414
|
const endpoint = getBackendURL(EVENTURL);
|
|
@@ -499,7 +499,7 @@ export const uploadFiles = async (
|
|
|
499
499
|
files,
|
|
500
500
|
upload_id,
|
|
501
501
|
on_upload_progress,
|
|
502
|
-
socket
|
|
502
|
+
socket
|
|
503
503
|
) => {
|
|
504
504
|
// return if there's no file to upload
|
|
505
505
|
if (files === undefined || files.length === 0) {
|
|
@@ -604,7 +604,7 @@ export const Event = (
|
|
|
604
604
|
name,
|
|
605
605
|
payload = {},
|
|
606
606
|
event_actions = {},
|
|
607
|
-
handler = null
|
|
607
|
+
handler = null
|
|
608
608
|
) => {
|
|
609
609
|
return { name, payload, handler, event_actions };
|
|
610
610
|
};
|
|
@@ -631,7 +631,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
|
631
631
|
for (const state_key in client_storage.local_storage) {
|
|
632
632
|
const options = client_storage.local_storage[state_key];
|
|
633
633
|
const local_storage_value = localStorage.getItem(
|
|
634
|
-
options.name || state_key
|
|
634
|
+
options.name || state_key
|
|
635
635
|
);
|
|
636
636
|
if (local_storage_value !== null) {
|
|
637
637
|
client_storage_values[state_key] = local_storage_value;
|
|
@@ -642,7 +642,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
|
642
642
|
for (const state_key in client_storage.session_storage) {
|
|
643
643
|
const session_options = client_storage.session_storage[state_key];
|
|
644
644
|
const session_storage_value = sessionStorage.getItem(
|
|
645
|
-
session_options.name || state_key
|
|
645
|
+
session_options.name || state_key
|
|
646
646
|
);
|
|
647
647
|
if (session_storage_value != null) {
|
|
648
648
|
client_storage_values[state_key] = session_storage_value;
|
|
@@ -667,7 +667,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
|
667
667
|
const applyClientStorageDelta = (client_storage, delta) => {
|
|
668
668
|
// find the main state and check for is_hydrated
|
|
669
669
|
const unqualified_states = Object.keys(delta).filter(
|
|
670
|
-
(key) => key.split(".").length === 1
|
|
670
|
+
(key) => key.split(".").length === 1
|
|
671
671
|
);
|
|
672
672
|
if (unqualified_states.length === 1) {
|
|
673
673
|
const main_state = delta[unqualified_states[0]];
|
|
@@ -701,7 +701,7 @@ const applyClientStorageDelta = (client_storage, delta) => {
|
|
|
701
701
|
const session_options = client_storage.session_storage[state_key];
|
|
702
702
|
sessionStorage.setItem(
|
|
703
703
|
session_options.name || state_key,
|
|
704
|
-
delta[substate][key]
|
|
704
|
+
delta[substate][key]
|
|
705
705
|
);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
@@ -721,7 +721,7 @@ const applyClientStorageDelta = (client_storage, delta) => {
|
|
|
721
721
|
export const useEventLoop = (
|
|
722
722
|
dispatch,
|
|
723
723
|
initial_events = () => [],
|
|
724
|
-
client_storage = {}
|
|
724
|
+
client_storage = {}
|
|
725
725
|
) => {
|
|
726
726
|
const socket = useRef(null);
|
|
727
727
|
const router = useRouter();
|
|
@@ -735,7 +735,7 @@ export const useEventLoop = (
|
|
|
735
735
|
|
|
736
736
|
event_actions = events.reduce(
|
|
737
737
|
(acc, e) => ({ ...acc, ...e.event_actions }),
|
|
738
|
-
event_actions ?? {}
|
|
738
|
+
event_actions ?? {}
|
|
739
739
|
);
|
|
740
740
|
|
|
741
741
|
const _e = args.filter((o) => o?.preventDefault !== undefined)[0];
|
|
@@ -763,7 +763,7 @@ export const useEventLoop = (
|
|
|
763
763
|
debounce(
|
|
764
764
|
combined_name,
|
|
765
765
|
() => queueEvents(events, socket),
|
|
766
|
-
event_actions.debounce
|
|
766
|
+
event_actions.debounce
|
|
767
767
|
);
|
|
768
768
|
} else {
|
|
769
769
|
queueEvents(events, socket);
|
|
@@ -782,7 +782,7 @@ export const useEventLoop = (
|
|
|
782
782
|
query,
|
|
783
783
|
asPath,
|
|
784
784
|
}))(router),
|
|
785
|
-
}))
|
|
785
|
+
}))
|
|
786
786
|
);
|
|
787
787
|
sentHydrate.current = true;
|
|
788
788
|
}
|
|
@@ -828,7 +828,7 @@ export const useEventLoop = (
|
|
|
828
828
|
dispatch,
|
|
829
829
|
["websocket"],
|
|
830
830
|
setConnectErrors,
|
|
831
|
-
client_storage
|
|
831
|
+
client_storage
|
|
832
832
|
);
|
|
833
833
|
}
|
|
834
834
|
}
|
|
@@ -876,7 +876,7 @@ export const useEventLoop = (
|
|
|
876
876
|
vars[storage_to_state_map[e.key]] = e.newValue;
|
|
877
877
|
const event = Event(
|
|
878
878
|
`${state_name}.reflex___state____update_vars_internal_state.update_vars_internal`,
|
|
879
|
-
{ vars: vars }
|
|
879
|
+
{ vars: vars }
|
|
880
880
|
);
|
|
881
881
|
addEvents([event], e);
|
|
882
882
|
}
|
|
@@ -969,7 +969,7 @@ export const getRefValues = (refs) => {
|
|
|
969
969
|
return refs.map((ref) =>
|
|
970
970
|
ref.current
|
|
971
971
|
? ref.current.value || ref.current.getAttribute("aria-valuenow")
|
|
972
|
-
: null
|
|
972
|
+
: null
|
|
973
973
|
);
|
|
974
974
|
};
|
|
975
975
|
|
|
@@ -32,7 +32,7 @@ HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
|
|
|
32
32
|
ev.preventDefault()
|
|
33
33
|
const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}};
|
|
34
34
|
|
|
35
|
-
({{ on_submit_event_chain }}());
|
|
35
|
+
({{ on_submit_event_chain }}(ev));
|
|
36
36
|
|
|
37
37
|
if ({{ reset_on_submit }}) {
|
|
38
38
|
$form.reset()
|
|
@@ -17,7 +17,7 @@ from .base import BaseHTML
|
|
|
17
17
|
|
|
18
18
|
FORM_DATA = Var(_js_expr="form_data")
|
|
19
19
|
HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
|
|
20
|
-
"\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}};\n\n ({{ on_submit_event_chain }}());\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n "
|
|
20
|
+
"\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}};\n\n ({{ on_submit_event_chain }}(ev));\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n "
|
|
21
21
|
)
|
|
22
22
|
ButtonType = Literal["submit", "reset", "button"]
|
|
23
23
|
|
reflex/reflex.py
CHANGED
|
@@ -13,7 +13,7 @@ from reflex import constants
|
|
|
13
13
|
from reflex.config import environment, get_config
|
|
14
14
|
from reflex.custom_components.custom_components import custom_components_cli
|
|
15
15
|
from reflex.state import reset_disk_state_manager
|
|
16
|
-
from reflex.utils import console, telemetry
|
|
16
|
+
from reflex.utils import console, redir, telemetry
|
|
17
17
|
|
|
18
18
|
# Disable typer+rich integration for help panels
|
|
19
19
|
typer.core.rich = None # pyright: ignore [reportPrivateImportUsage]
|
|
@@ -70,6 +70,10 @@ def _init(
|
|
|
70
70
|
# Show system info
|
|
71
71
|
exec.output_system_info()
|
|
72
72
|
|
|
73
|
+
if ai:
|
|
74
|
+
redir.reflex_build_redirect()
|
|
75
|
+
return
|
|
76
|
+
|
|
73
77
|
# Validate the app name.
|
|
74
78
|
app_name = prerequisites.validate_app_name(name)
|
|
75
79
|
console.rule(f"[bold]Initializing {app_name}")
|
|
@@ -83,7 +87,7 @@ def _init(
|
|
|
83
87
|
prerequisites.initialize_frontend_dependencies()
|
|
84
88
|
|
|
85
89
|
# Initialize the app.
|
|
86
|
-
template = prerequisites.initialize_app(app_name, template
|
|
90
|
+
template = prerequisites.initialize_app(app_name, template)
|
|
87
91
|
|
|
88
92
|
# Initialize the .gitignore.
|
|
89
93
|
prerequisites.initialize_gitignore()
|
reflex/style.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any, Literal, Type
|
|
5
|
+
from typing import Any, Literal, Mapping, Type
|
|
6
6
|
|
|
7
7
|
from reflex import constants
|
|
8
8
|
from reflex.components.core.breakpoints import Breakpoints, breakpoints_values
|
|
@@ -10,7 +10,7 @@ from reflex.event import EventChain, EventHandler, EventSpec, run_script
|
|
|
10
10
|
from reflex.utils import format
|
|
11
11
|
from reflex.utils.exceptions import ReflexError
|
|
12
12
|
from reflex.utils.imports import ImportVar
|
|
13
|
-
from reflex.utils.types import
|
|
13
|
+
from reflex.utils.types import typehint_issubclass
|
|
14
14
|
from reflex.vars import VarData
|
|
15
15
|
from reflex.vars.base import LiteralVar, Var
|
|
16
16
|
from reflex.vars.function import FunctionVar
|
|
@@ -189,7 +189,7 @@ def convert(
|
|
|
189
189
|
or (isinstance(value, list) and all(not isinstance(v, dict) for v in value))
|
|
190
190
|
or (
|
|
191
191
|
isinstance(value, ObjectVar)
|
|
192
|
-
and not
|
|
192
|
+
and not typehint_issubclass(value._var_type, Mapping)
|
|
193
193
|
)
|
|
194
194
|
else (key,)
|
|
195
195
|
)
|
reflex/utils/prerequisites.py
CHANGED
|
@@ -37,7 +37,7 @@ from redis.exceptions import RedisError
|
|
|
37
37
|
from reflex import constants, model
|
|
38
38
|
from reflex.compiler import templates
|
|
39
39
|
from reflex.config import Config, environment, get_config
|
|
40
|
-
from reflex.utils import console, net, path_ops, processes
|
|
40
|
+
from reflex.utils import console, net, path_ops, processes
|
|
41
41
|
from reflex.utils.exceptions import (
|
|
42
42
|
GeneratedCodeHasNoFunctionDefsError,
|
|
43
43
|
SystemPackageMissingError,
|
|
@@ -1695,31 +1695,6 @@ def validate_and_create_app_using_remote_template(
|
|
|
1695
1695
|
)
|
|
1696
1696
|
|
|
1697
1697
|
|
|
1698
|
-
def generate_template_using_ai(template: str | None = None) -> str:
|
|
1699
|
-
"""Generate a template using AI(Flexgen).
|
|
1700
|
-
|
|
1701
|
-
Args:
|
|
1702
|
-
template: The name of the template.
|
|
1703
|
-
|
|
1704
|
-
Returns:
|
|
1705
|
-
The generation hash.
|
|
1706
|
-
|
|
1707
|
-
Raises:
|
|
1708
|
-
Exit: If the template and ai flags are used.
|
|
1709
|
-
"""
|
|
1710
|
-
if template is None:
|
|
1711
|
-
# If AI is requested and no template specified, redirect the user to reflex.build.
|
|
1712
|
-
return redir.reflex_build_redirect()
|
|
1713
|
-
elif is_generation_hash(template):
|
|
1714
|
-
# Otherwise treat the template as a generation hash.
|
|
1715
|
-
return template
|
|
1716
|
-
else:
|
|
1717
|
-
console.error(
|
|
1718
|
-
"Cannot use `--template` option with `--ai` option. Please remove `--template` option."
|
|
1719
|
-
)
|
|
1720
|
-
raise typer.Exit(2)
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
1698
|
def fetch_remote_templates(
|
|
1724
1699
|
template: str,
|
|
1725
1700
|
) -> tuple[str, dict[str, Template]]:
|
|
@@ -1744,15 +1719,12 @@ def fetch_remote_templates(
|
|
|
1744
1719
|
return template, available_templates
|
|
1745
1720
|
|
|
1746
1721
|
|
|
1747
|
-
def initialize_app(
|
|
1748
|
-
app_name: str, template: str | None = None, ai: bool = False
|
|
1749
|
-
) -> str | None:
|
|
1722
|
+
def initialize_app(app_name: str, template: str | None = None) -> str | None:
|
|
1750
1723
|
"""Initialize the app either from a remote template or a blank app. If the config file exists, it is considered as reinit.
|
|
1751
1724
|
|
|
1752
1725
|
Args:
|
|
1753
1726
|
app_name: The name of the app.
|
|
1754
1727
|
template: The name of the template to use.
|
|
1755
|
-
ai: Whether to use AI to generate the template.
|
|
1756
1728
|
|
|
1757
1729
|
Returns:
|
|
1758
1730
|
The name of the template.
|
|
@@ -1768,11 +1740,6 @@ def initialize_app(
|
|
|
1768
1740
|
telemetry.send("reinit")
|
|
1769
1741
|
return
|
|
1770
1742
|
|
|
1771
|
-
generation_hash = None
|
|
1772
|
-
if ai:
|
|
1773
|
-
generation_hash = generate_template_using_ai(template)
|
|
1774
|
-
template = constants.Templates.DEFAULT
|
|
1775
|
-
|
|
1776
1743
|
templates: dict[str, Template] = {}
|
|
1777
1744
|
|
|
1778
1745
|
# Don't fetch app templates if the user directly asked for DEFAULT.
|
|
@@ -1781,11 +1748,7 @@ def initialize_app(
|
|
|
1781
1748
|
|
|
1782
1749
|
if template is None:
|
|
1783
1750
|
template = prompt_for_template_options(get_init_cli_prompt_options())
|
|
1784
|
-
if template == constants.Templates.
|
|
1785
|
-
generation_hash = generate_template_using_ai()
|
|
1786
|
-
# change to the default to allow creation of default app
|
|
1787
|
-
template = constants.Templates.DEFAULT
|
|
1788
|
-
elif template == constants.Templates.CHOOSE_TEMPLATES:
|
|
1751
|
+
if template == constants.Templates.CHOOSE_TEMPLATES:
|
|
1789
1752
|
console.print(
|
|
1790
1753
|
f"Go to the templates page ({constants.Templates.REFLEX_TEMPLATES_URL}) and copy the command to init with a template."
|
|
1791
1754
|
)
|
|
@@ -1800,11 +1763,6 @@ def initialize_app(
|
|
|
1800
1763
|
app_name=app_name, template=template, templates=templates
|
|
1801
1764
|
)
|
|
1802
1765
|
|
|
1803
|
-
# If a reflex.build generation hash is available, download the code and apply it to the main module.
|
|
1804
|
-
if generation_hash:
|
|
1805
|
-
initialize_main_module_index_from_generation(
|
|
1806
|
-
app_name, generation_hash=generation_hash
|
|
1807
|
-
)
|
|
1808
1766
|
telemetry.send("init", template=template)
|
|
1809
1767
|
|
|
1810
1768
|
return template
|
reflex/utils/pyi_generator.py
CHANGED
|
@@ -348,7 +348,7 @@ def _extract_class_props_as_ast_nodes(
|
|
|
348
348
|
all_props = []
|
|
349
349
|
kwargs = []
|
|
350
350
|
for target_class in clzs:
|
|
351
|
-
event_triggers = target_class().get_event_triggers()
|
|
351
|
+
event_triggers = target_class._create([]).get_event_triggers()
|
|
352
352
|
# Import from the target class to ensure type hints are resolvable.
|
|
353
353
|
exec(f"from {target_class.__module__} import *", type_hint_globals)
|
|
354
354
|
for name, value in target_class.__annotations__.items():
|
|
@@ -575,7 +575,7 @@ def _generate_component_create_functiondef(
|
|
|
575
575
|
return ast.Name(id=f"{' | '.join(map(ast.unparse, all_count_args_type))}")
|
|
576
576
|
return ast.Name(id="EventType[Any]")
|
|
577
577
|
|
|
578
|
-
event_triggers = clz().get_event_triggers()
|
|
578
|
+
event_triggers = clz._create([]).get_event_triggers()
|
|
579
579
|
|
|
580
580
|
# event handler kwargs
|
|
581
581
|
kwargs.extend(
|
reflex/utils/redir.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""Utilities to handle redirection to browser UI."""
|
|
2
2
|
|
|
3
3
|
import time
|
|
4
|
-
import uuid
|
|
5
4
|
import webbrowser
|
|
6
5
|
|
|
7
6
|
import httpx
|
|
@@ -48,14 +47,6 @@ def open_browser_and_wait(
|
|
|
48
47
|
return response
|
|
49
48
|
|
|
50
49
|
|
|
51
|
-
def reflex_build_redirect() ->
|
|
52
|
-
"""Open the browser window to reflex.build
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
The selected generation hash.
|
|
56
|
-
"""
|
|
57
|
-
token = str(uuid.uuid4())
|
|
58
|
-
target_url = constants.Templates.REFLEX_BUILD_URL.format(reflex_init_token=token)
|
|
59
|
-
poll_url = constants.Templates.REFLEX_BUILD_POLL_URL.format(reflex_init_token=token)
|
|
60
|
-
response = open_browser_and_wait(target_url, poll_url)
|
|
61
|
-
return response.json()["generation_hash"]
|
|
50
|
+
def reflex_build_redirect() -> None:
|
|
51
|
+
"""Open the browser window to reflex.build."""
|
|
52
|
+
open_browser(constants.Templates.REFLEX_BUILD_FRONTEND)
|
reflex/vars/base.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import contextlib
|
|
6
|
+
import copy
|
|
6
7
|
import dataclasses
|
|
7
8
|
import datetime
|
|
8
9
|
import functools
|
|
@@ -2146,7 +2147,7 @@ class ComputedVar(Var[RETURN_TYPE]):
|
|
|
2146
2147
|
"fget": kwargs.pop("fget", self._fget),
|
|
2147
2148
|
"initial_value": kwargs.pop("initial_value", self._initial_value),
|
|
2148
2149
|
"cache": kwargs.pop("cache", self._cache),
|
|
2149
|
-
"deps": kwargs.pop("deps", self._static_deps),
|
|
2150
|
+
"deps": kwargs.pop("deps", copy.copy(self._static_deps)),
|
|
2150
2151
|
"auto_deps": kwargs.pop("auto_deps", self._auto_deps),
|
|
2151
2152
|
"interval": kwargs.pop("interval", self._update_interval),
|
|
2152
2153
|
"backend": kwargs.pop("backend", self._backend),
|
|
@@ -2318,7 +2319,7 @@ class ComputedVar(Var[RETURN_TYPE]):
|
|
|
2318
2319
|
if not _isinstance(value, self._var_type, nested=1, treat_var_as_type=False):
|
|
2319
2320
|
console.error(
|
|
2320
2321
|
f"Computed var '{type(instance).__name__}.{self._js_expr}' must return"
|
|
2321
|
-
f" type '{self._var_type}', got '{type(value)}
|
|
2322
|
+
f" a value of type '{self._var_type}', got '{value}' of type {type(value)}."
|
|
2322
2323
|
)
|
|
2323
2324
|
|
|
2324
2325
|
def _deps(
|
|
@@ -1,51 +1,45 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: reflex
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2.dev1
|
|
4
4
|
Summary: Web apps in pure Python.
|
|
5
|
-
License: Apache-2.0
|
|
6
5
|
Keywords: web,framework
|
|
7
|
-
Author:
|
|
8
|
-
Author-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: python-
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist: reflex-hosting-cli
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist: twine
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist:
|
|
44
|
-
Requires-Dist: wheel (>=0.42.0,<1.0)
|
|
45
|
-
Requires-Dist: wrapt (>=1.17.0,<2.0)
|
|
46
|
-
Project-URL: Documentation, https://reflex.dev/docs/getting-started/introduction
|
|
47
|
-
Project-URL: Homepage, https://reflex.dev
|
|
48
|
-
Project-URL: Repository, https://github.com/reflex-dev/reflex
|
|
6
|
+
Author: Elijah Ahianyo
|
|
7
|
+
Author-Email: Nikhil Rao <nikhil@reflex.dev>, Alek Petuskey <alek@reflex.dev>, Masen Furer <masen@reflex.dev>, =?utf-8?q?Thomas_Brand=C3=A9ho?= <thomas@reflex.dev>, Khaleel Al-Adhami <khaleel@reflex.dev>
|
|
8
|
+
Maintainer-Email: Masen Furer <masen@reflex.dev>, =?utf-8?q?Thomas_Brand=C3=A9ho?= <thomas@reflex.dev>, Khaleel Al-Adhami <khaleel@reflex.dev>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Project-URL: homepage, https://reflex.dev
|
|
11
|
+
Project-URL: repository, https://github.com/reflex-dev/reflex
|
|
12
|
+
Project-URL: documentation, https://reflex.dev/docs/getting-started/introduction
|
|
13
|
+
Requires-Python: <4.0,>=3.10
|
|
14
|
+
Requires-Dist: fastapi!=0.111.0,!=0.111.1,>=0.96.0
|
|
15
|
+
Requires-Dist: gunicorn<24.0,>=20.1.0
|
|
16
|
+
Requires-Dist: jinja2<4.0,>=3.1.2
|
|
17
|
+
Requires-Dist: psutil<8.0,>=5.9.4
|
|
18
|
+
Requires-Dist: pydantic<3.0,>=1.10.21
|
|
19
|
+
Requires-Dist: python-multipart<0.1,>=0.0.5
|
|
20
|
+
Requires-Dist: python-socketio<6.0,>=5.7.0
|
|
21
|
+
Requires-Dist: redis<6.0,>=4.3.5
|
|
22
|
+
Requires-Dist: rich<14.0,>=13.0.0
|
|
23
|
+
Requires-Dist: sqlmodel<0.1,>=0.0.14
|
|
24
|
+
Requires-Dist: typer<1.0,>=0.15.1
|
|
25
|
+
Requires-Dist: uvicorn>=0.20.0
|
|
26
|
+
Requires-Dist: starlette-admin<1.0,>=0.11.0
|
|
27
|
+
Requires-Dist: alembic<2.0,>=1.11.1
|
|
28
|
+
Requires-Dist: platformdirs<5.0,>=3.10.0
|
|
29
|
+
Requires-Dist: distro<2.0,>=1.8.0; platform_system == "Linux"
|
|
30
|
+
Requires-Dist: python-engineio!=4.6.0
|
|
31
|
+
Requires-Dist: wrapt<2.0,>=1.17.0
|
|
32
|
+
Requires-Dist: packaging<25.0,>=23.1
|
|
33
|
+
Requires-Dist: reflex-hosting-cli>=0.1.29
|
|
34
|
+
Requires-Dist: charset-normalizer<4.0,>=3.3.2
|
|
35
|
+
Requires-Dist: wheel<1.0,>=0.42.0
|
|
36
|
+
Requires-Dist: build<2.0,>=1.0.3
|
|
37
|
+
Requires-Dist: setuptools>=75.0
|
|
38
|
+
Requires-Dist: httpx<1.0,>=0.25.1
|
|
39
|
+
Requires-Dist: twine<7.0,>=4.0.0
|
|
40
|
+
Requires-Dist: tomlkit<1.0,>=0.12.4
|
|
41
|
+
Requires-Dist: lazy_loader>=0.4
|
|
42
|
+
Requires-Dist: typing_extensions>=4.6.0
|
|
49
43
|
Description-Content-Type: text/markdown
|
|
50
44
|
|
|
51
45
|
|
|
@@ -307,4 +301,3 @@ We are actively looking for contributors, no matter your skill level or experien
|
|
|
307
301
|
## License
|
|
308
302
|
|
|
309
303
|
Reflex is open-source and licensed under the [Apache License 2.0](LICENSE).
|
|
310
|
-
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
benchmarks/__init__.py,sha256=EPwQDZ_qYgf5GFMdYQGHWDbpkLvR1OdQiEvPkVByYpM,89
|
|
2
|
+
benchmarks/benchmark_compile_times.py,sha256=DA0MuUVF2SGXun1cIO6So_B7FE78YZepJkq2JUvHHK4,4500
|
|
3
|
+
benchmarks/benchmark_imports.py,sha256=rC9Ke0n4h9lty3GEfLF0nODZpbMpiiAPqWVkDLATdHk,3733
|
|
4
|
+
benchmarks/benchmark_lighthouse.py,sha256=EdoTJ9oOyWTalj3OZn5C_-J76kR3Tedw_WjDxzM52F8,2347
|
|
5
|
+
benchmarks/benchmark_package_size.py,sha256=118Np7CIX-T2lG5OGFISm_KPfrni-pMRz3aFfrFUdkw,3824
|
|
6
|
+
benchmarks/benchmark_web_size.py,sha256=KG3rWk8ARg6K7eqtwg5qTIjgBDev0zG3rPz_MlMAqLo,2972
|
|
7
|
+
benchmarks/conftest.py,sha256=ekR_xO0FL2c9W_zLCTMRn35uPjdqPma0IbIcSn2WKPU,487
|
|
8
|
+
benchmarks/lighthouse.sh,sha256=fbOaaTOvE69Z23nEhA4od-v_WehyLvtI1FJfPjYdPPk,2139
|
|
9
|
+
benchmarks/utils.py,sha256=NTI9WzkTvr4lE20GKh-DZ30Wc0Xqs-KN2Nb5og2dPzQ,1968
|
|
10
|
+
reflex-0.7.2.dev1.dist-info/METADATA,sha256=31Tj75jzbJX_H6-g04JcBF9sbkiHtjYKM5OQCLzzrlE,11764
|
|
11
|
+
reflex-0.7.2.dev1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
12
|
+
reflex-0.7.2.dev1.dist-info/entry_points.txt,sha256=XfumVjOeM8bxbPMTjy5CvSe65xnMKHCBQ4MxWWHCidM,61
|
|
13
|
+
reflex-0.7.2.dev1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
1
14
|
reflex/.templates/apps/blank/assets/favicon.ico,sha256=baxxgDAQ2V4-G5Q4S2yK5uUJTUGkv-AOWBQ0xd6myUo,4286
|
|
2
15
|
reflex/.templates/apps/blank/code/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
16
|
reflex/.templates/apps/blank/code/blank.py,sha256=oKnsBBZM1-_RFAuwGKgfiCzgsrHlN_m_XP0-Fpnld7k,926
|
|
@@ -35,7 +48,7 @@ reflex/.templates/web/utils/helpers/debounce.js,sha256=xGhtTRtS_xIcaeqnYVvYJNseL
|
|
|
35
48
|
reflex/.templates/web/utils/helpers/paste.js,sha256=ef30HsR83jRzzvZnl8yV79yqFP8TC_u8SlN99cCS_OM,1799
|
|
36
49
|
reflex/.templates/web/utils/helpers/range.js,sha256=FevdZzCVxjF57ullfjpcUpeOXRxh5v09YnBB0jPbrS4,1152
|
|
37
50
|
reflex/.templates/web/utils/helpers/throttle.js,sha256=qxeyaEojaTeX36FPGftzVWrzDsRQU4iqg3U9RJz9Vj4,566
|
|
38
|
-
reflex/.templates/web/utils/state.js,sha256=
|
|
51
|
+
reflex/.templates/web/utils/state.js,sha256=Y2OYTzc1IJArMkudtTwXrG9i96jj_QXuo_stwAPfxFE,29761
|
|
39
52
|
reflex/__init__.py,sha256=64HB9b6MKesl3Yv6aZMsozdMKKpgnxirKk-aeN45UYY,10341
|
|
40
53
|
reflex/__init__.pyi,sha256=j4ZkO-mKKw5dFBhJVbaOg7AlncO-JCckV2cHENPiLG0,11303
|
|
41
54
|
reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
|
|
@@ -125,8 +138,8 @@ reflex/components/el/elements/__init__.py,sha256=Slx-rO0DOJeHTUbhocKyYm2wb570MJO
|
|
|
125
138
|
reflex/components/el/elements/__init__.pyi,sha256=0D3Iw6gktb0vio95VVR69WNY7HXwULQdsy8YMIam9xk,9900
|
|
126
139
|
reflex/components/el/elements/base.py,sha256=4jnwyCQUHvWcIfwiIWVCiIC_jbwZlkAiOgx73t7tdw8,3075
|
|
127
140
|
reflex/components/el/elements/base.pyi,sha256=lCvreiB4vd87UWsmmZqEvUe4Bn7XoK7cqmyZbRKVpOU,9872
|
|
128
|
-
reflex/components/el/elements/forms.py,sha256=
|
|
129
|
-
reflex/components/el/elements/forms.pyi,sha256=
|
|
141
|
+
reflex/components/el/elements/forms.py,sha256=Uv7Pr7iblKuFdJ0d21wA5sOi2Z1uFPY522oXfc4N6JQ,20142
|
|
142
|
+
reflex/components/el/elements/forms.pyi,sha256=NJYmmpd8WeU2S80DyHQWJyWhApeH7SgGAvGntDOoBec,124663
|
|
130
143
|
reflex/components/el/elements/inline.py,sha256=GxOYtkNm1OfdMeqNvrFY_AUm-SVdc4Zg4JdSf3V3S6g,4064
|
|
131
144
|
reflex/components/el/elements/inline.pyi,sha256=3THlwfna_Jf75fxgxvLuUgsAiNdNtDobf8v_jEz0RSw,228048
|
|
132
145
|
reflex/components/el/elements/media.py,sha256=Ae7BxSc8XPpQtC2dATMbd1B2aCuuXyCTPk2ZDfuA6ms,12797
|
|
@@ -363,10 +376,10 @@ reflex/middleware/middleware.py,sha256=p5VVoIgQ_NwOg_GOY6g0S4fmrV76_VE1zt-HiwbMw
|
|
|
363
376
|
reflex/model.py,sha256=k6qCweATPW1YRB_qcHwa5X35btJmtIlB4zEQ63FaW3w,17527
|
|
364
377
|
reflex/page.py,sha256=qEt8n5EtawSywCzdsiaNQJWhC8ie-vg8ig0JGuVavPI,2386
|
|
365
378
|
reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
366
|
-
reflex/reflex.py,sha256=
|
|
379
|
+
reflex/reflex.py,sha256=de26qs1UOfnvYjDrmBti5SX7gxAgIMPhuXgsS2LF4AY,19393
|
|
367
380
|
reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
|
|
368
381
|
reflex/state.py,sha256=nnNIr-uQ2qfmzQVF7D5jghzdKZ8vL7-nBiFBlDnSww4,141506
|
|
369
|
-
reflex/style.py,sha256=
|
|
382
|
+
reflex/style.py,sha256=dilXPn8de80NzsXT53GPJrmjELC5nPYIlCgongyq1zM,13145
|
|
370
383
|
reflex/testing.py,sha256=wzqppu_-4e1QeFJ-vLVpW19egTGm-JpU_c7wUPiURlE,35693
|
|
371
384
|
reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
|
|
372
385
|
reflex/utils/build.py,sha256=gm_lRsOqKeRD5mBiRToJcT4Vt_ZQPzDuazGfvJlSeeQ,9024
|
|
@@ -382,24 +395,20 @@ reflex/utils/imports.py,sha256=-EkUt9y5U3qmImjfpsXwYh7JI9qJHd_L6X9y12EPJew,3921
|
|
|
382
395
|
reflex/utils/lazy_loader.py,sha256=-3DcwIqHNft2fb1ikgDYAMiEwNfbiWfrTBAf1gEVX2o,1367
|
|
383
396
|
reflex/utils/net.py,sha256=0Yd9OLK8R_px2sqnqrDkTky6hYHtG2pEDvvilOjDfjc,1219
|
|
384
397
|
reflex/utils/path_ops.py,sha256=Sio_pZ9-dqu6pAPUkO_JA9ONXDsyLGKWOVRoA-dCrec,7903
|
|
385
|
-
reflex/utils/prerequisites.py,sha256=
|
|
398
|
+
reflex/utils/prerequisites.py,sha256=fhpp1yaRkBr0_zAowNSFeaRDZ1qjsmhR6_Tz34nebK0,63578
|
|
386
399
|
reflex/utils/processes.py,sha256=1iZe-3Yrg-ja8jZxxAfggljqqcJgsFu8fi4bu4XQGx0,13489
|
|
387
|
-
reflex/utils/pyi_generator.py,sha256=
|
|
388
|
-
reflex/utils/redir.py,sha256=
|
|
400
|
+
reflex/utils/pyi_generator.py,sha256=cKdssbtAtGj2deOSDos9OF96w10qte8JM-TlfbzSdtw,41602
|
|
401
|
+
reflex/utils/redir.py,sha256=kTqY2WSouF5_ftOe5bnvPEyU3SLpg3pcysTcxFH1UxI,1505
|
|
389
402
|
reflex/utils/registry.py,sha256=bseD0bIO8b3pctHKpD5J2MRdDzcf7eWKtHEZVutVNJ0,1401
|
|
390
403
|
reflex/utils/serializers.py,sha256=K8-erpNIjJNIKif0cDFExa9f5DEVuQUq0j5v5VH6aBI,13408
|
|
391
404
|
reflex/utils/telemetry.py,sha256=qwJBwjdtAV-OGKgO4h-NWhgTvfC3gbduBdn1UB8Ikes,5608
|
|
392
405
|
reflex/utils/types.py,sha256=nGX44Q_Jp33wIaxf2vxANwBWe1743V2B8RRS8H9yV4c,33449
|
|
393
406
|
reflex/vars/__init__.py,sha256=2Kv6Oh9g3ISZFESjL1al8KiO7QBZUXmLKGMCBsP-DoY,1243
|
|
394
|
-
reflex/vars/base.py,sha256=
|
|
407
|
+
reflex/vars/base.py,sha256=uJqKCT6maryYQ_5YON4hjFbyfoMwYva9Upwxyyn6zGk,101345
|
|
395
408
|
reflex/vars/datetime.py,sha256=WOEzQF6qjMjYvCat80XxgB_4hmVNHwIIZNMBSmfu0PM,5790
|
|
396
409
|
reflex/vars/dep_tracking.py,sha256=kluvF4Pfbpdqf0GcpmYHjT1yP-D1erAzaSQP6qIxjB0,13846
|
|
397
410
|
reflex/vars/function.py,sha256=2sVnhgetPSwtor8VFtAiYJdzZ9IRNzAKdsUJG6dXQcE,14461
|
|
398
411
|
reflex/vars/number.py,sha256=RHY_KsUxliIgn7sptYPPyDubIfLkGYr0TZjX4PB_dgI,29334
|
|
399
412
|
reflex/vars/object.py,sha256=cHVXN7I1MNw32KfpYKcmgStNSD4BnF3Y2CjkPABmjeo,16233
|
|
400
413
|
reflex/vars/sequence.py,sha256=X4Gducv2u6fSEZm9uBlMr030bhDO0jUxnKkUXNg4Mwg,54878
|
|
401
|
-
reflex-0.7.
|
|
402
|
-
reflex-0.7.2a1.dist-info/METADATA,sha256=2qIMYXarpwUY25SFLVcKQuctQA3O-T5-bQh8UNhq2u8,11875
|
|
403
|
-
reflex-0.7.2a1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
404
|
-
reflex-0.7.2a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
405
|
-
reflex-0.7.2a1.dist-info/RECORD,,
|
|
414
|
+
reflex-0.7.2.dev1.dist-info/RECORD,,
|