reflex 0.8.5a1__py3-none-any.whl → 0.8.5a2__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/compiler/utils.py CHANGED
@@ -23,8 +23,7 @@ from reflex.constants.state import FIELD_MARKER
23
23
  from reflex.istate.storage import Cookie, LocalStorage, SessionStorage
24
24
  from reflex.state import BaseState, _resolve_delta
25
25
  from reflex.style import Style
26
- from reflex.utils import console, format, imports, path_ops
27
- from reflex.utils.exec import is_in_app_harness
26
+ from reflex.utils import format, imports, path_ops
28
27
  from reflex.utils.imports import ImportVar, ParsedImportDict
29
28
  from reflex.utils.prerequisites import get_web_dir
30
29
  from reflex.vars.base import Field, Var
@@ -201,16 +200,11 @@ def compile_state(state: type[BaseState]) -> dict:
201
200
  except RuntimeError:
202
201
  pass
203
202
  else:
204
- if is_in_app_harness():
205
- # Playwright tests already have an event loop running, so we can't use asyncio.run.
206
- with concurrent.futures.ThreadPoolExecutor() as pool:
207
- resolved_initial_state = pool.submit(
208
- asyncio.run, _resolve_delta(initial_state)
209
- ).result()
210
- console.warn(
211
- f"Had to get initial state in a thread 🤮 {resolved_initial_state}",
212
- )
213
- return _sorted_keys(resolved_initial_state)
203
+ with concurrent.futures.ThreadPoolExecutor() as pool:
204
+ resolved_initial_state = pool.submit(
205
+ asyncio.run, _resolve_delta(initial_state)
206
+ ).result()
207
+ return _sorted_keys(resolved_initial_state)
214
208
 
215
209
  # Normally the compile runs before any event loop starts, we asyncio.run is available for calling.
216
210
  return _sorted_keys(asyncio.run(_resolve_delta(initial_state)))
@@ -52,11 +52,12 @@ class AutoScroll(Div):
52
52
  The hooks required for the component.
53
53
  """
54
54
  ref_name = self.get_ref()
55
+ unique_id = ref_name
55
56
  return [
56
- "const wasNearBottom = useRef(false);",
57
- "const hadScrollbar = useRef(false);",
57
+ f"const wasNearBottom_{unique_id} = useRef(false);",
58
+ f"const hadScrollbar_{unique_id} = useRef(false);",
58
59
  f"""
59
- const checkIfNearBottom = () => {{
60
+ const checkIfNearBottom_{unique_id} = () => {{
60
61
  if (!{ref_name}.current) return;
61
62
 
62
63
  const container = {ref_name}.current;
@@ -64,14 +65,14 @@ const checkIfNearBottom = () => {{
64
65
 
65
66
  const distanceFromBottom = container.scrollHeight - container.scrollTop - container.clientHeight;
66
67
 
67
- wasNearBottom.current = distanceFromBottom <= nearBottomThreshold;
68
+ wasNearBottom_{unique_id}.current = distanceFromBottom <= nearBottomThreshold;
68
69
 
69
70
  // Track if container had a scrollbar
70
- hadScrollbar.current = container.scrollHeight > container.clientHeight;
71
+ hadScrollbar_{unique_id}.current = container.scrollHeight > container.clientHeight;
71
72
  }};
72
73
  """,
73
74
  f"""
74
- const scrollToBottomIfNeeded = () => {{
75
+ const scrollToBottomIfNeeded_{unique_id} = () => {{
75
76
  if (!{ref_name}.current) return;
76
77
 
77
78
  const container = {ref_name}.current;
@@ -80,12 +81,12 @@ const scrollToBottomIfNeeded = () => {{
80
81
  // Scroll if:
81
82
  // 1. User was near bottom, OR
82
83
  // 2. Container didn't have scrollbar before but does now
83
- if (wasNearBottom.current || (!hadScrollbar.current && hasScrollbarNow)) {{
84
+ if (wasNearBottom_{unique_id}.current || (!hadScrollbar_{unique_id}.current && hasScrollbarNow)) {{
84
85
  container.scrollTop = container.scrollHeight;
85
86
  }}
86
87
 
87
88
  // Update scrollbar state for next check
88
- hadScrollbar.current = hasScrollbarNow;
89
+ hadScrollbar_{unique_id}.current = hasScrollbarNow;
89
90
  }};
90
91
  """,
91
92
  f"""
@@ -93,24 +94,24 @@ useEffect(() => {{
93
94
  const container = {ref_name}.current;
94
95
  if (!container) return;
95
96
 
96
- scrollToBottomIfNeeded();
97
+ scrollToBottomIfNeeded_{unique_id}();
97
98
 
98
99
  // Create ResizeObserver to detect height changes
99
100
  const resizeObserver = new ResizeObserver(() => {{
100
- scrollToBottomIfNeeded();
101
+ scrollToBottomIfNeeded_{unique_id}();
101
102
  }});
102
103
 
103
104
  // Track scroll position before height changes
104
- container.addEventListener('scroll', checkIfNearBottom);
105
+ container.addEventListener('scroll', checkIfNearBottom_{unique_id});
105
106
 
106
107
  // Initial check
107
- checkIfNearBottom();
108
+ checkIfNearBottom_{unique_id}();
108
109
 
109
110
  // Observe container for size changes
110
111
  resizeObserver.observe(container);
111
112
 
112
113
  return () => {{
113
- container.removeEventListener('scroll', checkIfNearBottom);
114
+ container.removeEventListener('scroll', checkIfNearBottom_{unique_id});
114
115
  resizeObserver.disconnect();
115
116
  }};
116
117
  }});
reflex/constants/base.py CHANGED
@@ -11,8 +11,6 @@ from typing import Literal
11
11
 
12
12
  from platformdirs import PlatformDirs
13
13
 
14
- from .utils import classproperty
15
-
16
14
  IS_WINDOWS = platform.system() == "Windows"
17
15
  IS_MACOS = platform.system() == "Darwin"
18
16
  IS_LINUX = platform.system() == "Linux"
@@ -119,9 +117,6 @@ class ReflexHostingCLI(SimpleNamespace):
119
117
  class Templates(SimpleNamespace):
120
118
  """Constants related to Templates."""
121
119
 
122
- # The route on Reflex backend to query which templates are available and their URLs.
123
- APP_TEMPLATES_ROUTE = "/app-templates"
124
-
125
120
  # The default template
126
121
  DEFAULT = "blank"
127
122
 
@@ -132,58 +127,12 @@ class Templates(SimpleNamespace):
132
127
  CHOOSE_TEMPLATES = "choose-templates"
133
128
 
134
129
  # The URL to find reflex templates.
135
- REFLEX_TEMPLATES_URL = "https://reflex.dev/templates"
136
-
137
- # Demo url for the default template.
138
- DEFAULT_TEMPLATE_URL = "https://blank-template.reflex.run"
130
+ REFLEX_TEMPLATES_URL = (
131
+ "https://reflex.dev/docs/getting-started/open-source-templates/"
132
+ )
139
133
 
140
134
  # The reflex.build frontend host
141
- REFLEX_BUILD_FRONTEND = "https://reflex.build"
142
-
143
- # The reflex.build backend host
144
- REFLEX_BUILD_BACKEND = "https://flexgen-prod-flexgen.fly.dev"
145
-
146
- @classproperty
147
- @classmethod
148
- def REFLEX_BUILD_URL(cls):
149
- """The URL to redirect to reflex.build.
150
-
151
- Returns:
152
- The URL to redirect to reflex.build.
153
- """
154
- from reflex.environment import environment
155
-
156
- return (
157
- environment.REFLEX_BUILD_FRONTEND.get()
158
- + "/gen?reflex_init_token={reflex_init_token}"
159
- )
160
-
161
- @classproperty
162
- @classmethod
163
- def REFLEX_BUILD_POLL_URL(cls):
164
- """The URL to poll waiting for the user to select a generation.
165
-
166
- Returns:
167
- The URL to poll waiting for the user to select a generation.
168
- """
169
- from reflex.environment import environment
170
-
171
- return environment.REFLEX_BUILD_BACKEND.get() + "/api/init/{reflex_init_token}"
172
-
173
- @classproperty
174
- @classmethod
175
- def REFLEX_BUILD_CODE_URL(cls):
176
- """The URL to fetch the generation's reflex code.
177
-
178
- Returns:
179
- The URL to fetch the generation's reflex code.
180
- """
181
- from reflex.environment import environment
182
-
183
- return (
184
- environment.REFLEX_BUILD_BACKEND.get()
185
- + "/api/gen/{generation_hash}/refactored"
186
- )
135
+ REFLEX_BUILD_FRONTEND = "https://build.reflex.dev"
187
136
 
188
137
  class Dirs(SimpleNamespace):
189
138
  """Folders used by the template system of Reflex."""
@@ -204,9 +153,6 @@ class Javascript(SimpleNamespace):
204
153
  # The node modules directory.
205
154
  NODE_MODULES = "node_modules"
206
155
 
207
- # The package lock file.
208
- PACKAGE_LOCK = "package-lock.json"
209
-
210
156
 
211
157
  class ReactRouter(Javascript):
212
158
  """Constants related to React Router."""
reflex/environment.py CHANGED
@@ -563,16 +563,6 @@ class EnvironmentVariables:
563
563
  # Whether to skip purging the web directory in dev mode.
564
564
  REFLEX_PERSIST_WEB_DIR: EnvVar[bool] = env_var(False)
565
565
 
566
- # The reflex.build frontend host.
567
- REFLEX_BUILD_FRONTEND: EnvVar[str] = env_var(
568
- constants.Templates.REFLEX_BUILD_FRONTEND
569
- )
570
-
571
- # The reflex.build backend host.
572
- REFLEX_BUILD_BACKEND: EnvVar[str] = env_var(
573
- constants.Templates.REFLEX_BUILD_BACKEND
574
- )
575
-
576
566
  # This env var stores the execution mode of the app
577
567
  REFLEX_ENV_MODE: EnvVar[constants.Env] = env_var(constants.Env.DEV)
578
568
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.8.5a1
3
+ Version: 0.8.5a2
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
@@ -6,7 +6,7 @@ reflex/app.py,sha256=Yg4CYS5aHTvScfhqW8jC9-JeYoz-Yjii2nDWz7GFuF0,75310
6
6
  reflex/assets.py,sha256=l5O_mlrTprC0lF7Rc_McOe3a0OtSLnRdNl_PqCpDCBA,3431
7
7
  reflex/base.py,sha256=Oh664QL3fZEHErhUasFqP7fE4olYf1y-9Oj6uZI2FCU,1173
8
8
  reflex/config.py,sha256=HgJ57Op-glTro23GoQKmyXwUplvGYgZFKjvClYpD27s,19359
9
- reflex/environment.py,sha256=PQF1QSLgu_tpUUP0vXWdvuC4t3wFts94nw2urt9Id8o,23227
9
+ reflex/environment.py,sha256=G-s20hBr-7K1_b6992XTgvNnBojcuL9Y33NAIUJLvT8,22940
10
10
  reflex/event.py,sha256=Yv9-tY-NH4q0Up72ljsABfBfnobnC0__DMvSWhFEo6M,74791
11
11
  reflex/model.py,sha256=l1-6fm7NHRFWH-xK9oV9UzAVfvKeUXG1f-tCrF7vmfI,19403
12
12
  reflex/page.py,sha256=ssCbMVFuIy60vH-YhJUzN0OxzUwXFCCD3ej56dVjp3g,3525
@@ -65,7 +65,7 @@ reflex/app_mixins/mixin.py,sha256=R1YncalqDrbdPZvpKVbm72ZKmQZxYAWfuFq9JknzTqQ,30
65
65
  reflex/compiler/__init__.py,sha256=r8jqmDSFf09iV2lHlNhfc9XrTLjNxfDNwPYlxS4cmHE,27
66
66
  reflex/compiler/compiler.py,sha256=AEGoZRG3PVOUf_5lZxlAt0pwsXg-lYIdOluyzpMuyOI,29088
67
67
  reflex/compiler/templates.py,sha256=mQifVgvE7cKyzMFL9F5jxdJb9KFxucWJa7nuOp09ZUo,6002
68
- reflex/compiler/utils.py,sha256=Eo0-zLCj4rFhkVZQNWSMoMSGTSAkHIivoNwoAgMBYi8,19266
68
+ reflex/compiler/utils.py,sha256=587KMP1BDYYigAY6looM9L69Eoq3PEOxCB8k7r9BW5A,18922
69
69
  reflex/components/__init__.py,sha256=eWpgWFbSQDj2TpGp6StEbxU7roQgzY7ZM0XIcIc5RE8,588
70
70
  reflex/components/__init__.pyi,sha256=7VFHtJGIjvGtD3IiPk848IPWYSCcPRT1EyPGljLhYlU,736
71
71
  reflex/components/component.py,sha256=DyeMdHSPkhYUXn18QcVZneJZKV8qzAlPMR9M8kY7_K8,98462
@@ -96,7 +96,7 @@ reflex/components/base/strict_mode.py,sha256=_Rl2uGzL8gXTANOpoSU7uxsUQRH5JeTk2EI
96
96
  reflex/components/base/strict_mode.pyi,sha256=1n6EHlv51hLnkK18t0xHQ23FphSXb8pfSSVn6vDcHZY,2380
97
97
  reflex/components/core/__init__.py,sha256=IRNnqXeQUT_Mhiaca05E3vKldxXzfkHGv5EDz_jAIqk,1418
98
98
  reflex/components/core/__init__.pyi,sha256=Nr68v8pdwvBX93HhV-gHzPPYLAvRJ63kNrdICzBJxPk,1991
99
- reflex/components/core/auto_scroll.py,sha256=3jtFUqMUM1R_YyxWjbNVLiLktw6HHp50EzIFTkFtgto,3616
99
+ reflex/components/core/auto_scroll.py,sha256=zCHP5Mr_sLAmm4zvkC0-rQ1cU5cy35R7FKVo2jsmYaQ,3815
100
100
  reflex/components/core/auto_scroll.pyi,sha256=0R5NvVJ00X42-dSTX23zOGPbwGWGt1lQ_4iV5dn_JxY,8889
101
101
  reflex/components/core/banner.py,sha256=JEutUBT1UfpgnaDJthE2BoSzpIEE-cSHoQZlEvQb0dw,18471
102
102
  reflex/components/core/banner.pyi,sha256=F7LPVH4wkdsBnTaXG3NW3NkULYQSm5wAmvHerEOFdjQ,25480
@@ -334,7 +334,7 @@ reflex/components/tags/match_tag.py,sha256=cMSa_hbuEV8uFg0iCwLhRJ0J6-oU5rKQf9Z2-
334
334
  reflex/components/tags/tag.py,sha256=AbB8MtmmMUAvlMtQe7XLL-afsb1rckzo4R1MJ1RsNQs,3865
335
335
  reflex/components/tags/tagless.py,sha256=qO7Gm4V0ITDyymHkyltfz53155ZBt-W_WIPDYy93ca0,587
336
336
  reflex/constants/__init__.py,sha256=q2Jf-LBbNcGrOmx5M7QotIAYW_t3m02TsmmdtJ5_IhM,2190
337
- reflex/constants/base.py,sha256=sFv9DhRZtEM2fix6U8SwTcBn05zl5Z_X8X-bqr3fh2E,9065
337
+ reflex/constants/base.py,sha256=3JpSXkVxQEbMB2nVM0koaf_rMgqM2olXTEUfD2esBHQ,7498
338
338
  reflex/constants/colors.py,sha256=n-FN7stNrvk5rCN0TAvE28dqwUeQZHue-b5q1CO0EyQ,2048
339
339
  reflex/constants/compiler.py,sha256=bzmC1OW6kWr06rV1Gwoa2AtQ4yPoGhEzeoqpiNY0jwU,5703
340
340
  reflex/constants/config.py,sha256=8OIjiBdZZJrRVHsNBheMwopE9AwBFFzau0SXqXKcrPg,1715
@@ -397,8 +397,8 @@ reflex/vars/number.py,sha256=tO7pnvFaBsedq1HWT4skytnSqHWMluGEhUbjAUMx8XQ,28190
397
397
  reflex/vars/object.py,sha256=BDmeiwG8v97s_BnR1Egq3NxOKVjv9TfnREB3cz0zZtk,17322
398
398
  reflex/vars/sequence.py,sha256=1kBrqihspyjyQ1XDqFPC8OpVGtZs_EVkOdIKBro5ilA,55249
399
399
  scripts/hatch_build.py,sha256=-4pxcLSFmirmujGpQX9UUxjhIC03tQ_fIQwVbHu9kc0,1861
400
- reflex-0.8.5a1.dist-info/METADATA,sha256=SN7VniEy2wgwl35t0psn-EUxLuHRr3fqlPrKRxyBa90,12372
401
- reflex-0.8.5a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
402
- reflex-0.8.5a1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
403
- reflex-0.8.5a1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
404
- reflex-0.8.5a1.dist-info/RECORD,,
400
+ reflex-0.8.5a2.dist-info/METADATA,sha256=lO1cEJpg5qXPc5COdvcy0vJmH6Lv38sY6iPaDFNXdnw,12372
401
+ reflex-0.8.5a2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
402
+ reflex-0.8.5a2.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
403
+ reflex-0.8.5a2.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
404
+ reflex-0.8.5a2.dist-info/RECORD,,