You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting_started/installation.md
+49-63Lines changed: 49 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,8 @@ Reflex requires Python 3.10+.
20
20
21
21
We **highly recommend** creating a virtual environment for your project.
22
22
23
-
[venv]({constants.VENV_URL}) is the standard option. [conda]({constants.CONDA_URL}) and [poetry]({constants.POETRY_URL}) are some alternatives.
23
+
[uv]({constants.UV_URL}) is the recommended modern option. [venv]({constants.VENV_URL}), [conda]({constants.CONDA_URL}) and [poetry]({constants.POETRY_URL}) are some alternatives.
24
+
24
25
25
26
# Install Reflex on your system
26
27
@@ -29,11 +30,22 @@ We **highly recommend** creating a virtual environment for your project.
29
30
--tab macOS/Linux
30
31
## Install on macOS/Linux
31
32
32
-
We will go with [venv]({constants.VENV_URL}) here.
33
+
We will go with [uv]({constants.UV_URL}) here.
33
34
34
35
35
36
### Prerequisites
36
-
macOS (Apple Silicon) users should install [Rosetta 2](https://support.apple.com/en-us/HT211861). Run this command:
37
+
38
+
#### Install uv
39
+
40
+
```bash
41
+
curl -LsSf https://astral.sh/uv/install.sh | sh
42
+
```
43
+
44
+
After installation, restart your terminal or run `source ~/.bashrc` (or `source ~/.zshrc` for zsh).
45
+
46
+
Alternatively, install via [Homebrew, PyPI, or other methods](https://docs.astral.sh/uv/getting-started/installation/).
47
+
48
+
**macOS (Apple Silicon) users:** Install [Rosetta 2](https://support.apple.com/en-us/HT211861). Run this command:
While Python typically ships with `venv` it is not installed by default on some systems.
62
-
If so, please install it manually. E.g. on Ubuntu Linux, run `sudo apt-get install python3-venv`.
63
-
```
64
-
65
-
### Install Reflex package
66
-
67
-
Reflex is available as a [pip]({constants.PIP_URL}) package.
68
+
### Add Reflex to the project
68
69
69
70
```bash
70
-
pip install reflex
71
-
```
72
-
73
-
```md alert info
74
-
# Getting `command not found: pip`?
75
-
76
-
While Python typically ships with `pip` as the standard package management tool, it is not installed by default on some systems.
77
-
You may need to install it manually. E.g. on Ubuntu Linux, run `apt-get install python3-pip`
71
+
uv add reflex
78
72
```
79
73
80
-
## Initialize the project
74
+
###Initialize the Reflex project
81
75
82
76
```bash
83
-
reflex init
77
+
uv run reflex init
84
78
```
85
79
86
-
```md alert warning
87
-
# Error `command not found: reflex` Mac / Linux
88
-
If you install Reflex with no virtual environment and get this error it means your `PATH` cannot find the reflex package.
89
-
A virtual environment should solve this problem, or you can try running `python3 -m` before the reflex command.
90
-
```
91
80
92
81
--
93
82
--tab Windows
94
83
## Install on Windows
95
84
96
-
### Prerequisites
97
85
For Windows users, we recommend using [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/about) for optimal performance.
98
86
99
-
WSL users should refer to instructions for Linux above.
87
+
**WSL users:** Refer to the macOS/Linux instructions above.
100
88
101
89
For the rest of this section we will work with native Windows (non-WSL).
102
90
103
-
We will go with [venv]({constants.VENV_URL}) here, for virtual environments.
After installation, restart your terminal (PowerShell or Command Prompt).
102
+
103
+
Alternatively, install via [WinGet, Scoop, or other methods](https://docs.astral.sh/uv/getting-started/installation/).
104
104
105
105
### Create the project directory
106
106
@@ -111,76 +111,62 @@ mkdir {app_name}
111
111
cd {app_name}
112
112
```
113
113
114
-
### Setup virtual environment
114
+
### Initialize uv project
115
115
116
116
```bash
117
-
py -3 -m venv .venv
118
-
.venv\\Scripts\\activate
117
+
uv init
119
118
```
120
119
121
-
### Install Reflex package
122
-
123
-
Reflex is available as a [pip](constants.PIP_URL) package.
120
+
### Add Reflex to the project
124
121
125
122
```bash
126
-
pip install reflex
123
+
uv add reflex
127
124
```
128
125
129
-
## Initialize the project
126
+
###Initialize the Reflex project
130
127
131
128
```bash
132
-
reflex init
133
-
```
134
-
135
-
```md alert warning
136
-
# Error `command not found: reflex` Windows
137
-
138
-
The Reflex framework includes the `reflex` command line (CLI) tool. Using a virtual environment is highly recommended for a seamless experience.",
129
+
uv run reflex init
139
130
```
140
131
141
132
```md alert warning
142
133
# Error `Install Failed - You are missing a DLL required to run bun.exe` Windows
143
-
Bun requires runtime components of Visual C++ libraries to run on windows. This issue is fixed by installing [Microsoft Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=53840).
134
+
Bun requires runtime components of Visual C++ libraries to run on Windows. This issue is fixed by installing [Microsoft Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=53840).
144
135
```
145
136
--
146
137
147
138
---
148
139
149
140
150
-
The command will return several template options to choose from as shown below.
141
+
Running `uv run reflex init`will return the option to start with a blank Reflex app, premade templates built by the Reflex team, or to try our [AI builder]({constants.REFLEX_BUILD_URL}).
151
142
152
143
```bash
153
144
Initializing the web directory.
154
145
155
146
Get started with a template:
156
-
(0) blank (https://blank-template.reflex.run) - A minimal template
157
-
(1) dashboard (https://dashboard-new.reflex.run/) - A dashboard with tables and graphs
158
-
(2) sales (https://sales-new.reflex.run/) - An app to manage sales and customers
159
-
(3) ai_image_gen (https://ai-image-gen.reflex.run/) - An app to generate images using AI
160
-
(4) ci_template (https://cijob.reflex.run/) - A template for continuous integration
161
-
(5) api_admin_panel (https://api-admin-panel.reflex.run/) - An admin panel for an api.
162
-
(6) nba (https://nba-new.reflex.run/) - A data visualization app for NBA data.
163
-
(7) customer_data_app (https://customer-data-app.reflex.run/) - An app to manage customer data.
147
+
(0) A blank Reflex app.
148
+
(1) Premade templates built by the Reflex team.
149
+
(2) Try our AI builder.
164
150
Which template would you like to use? (0):
165
151
```
166
152
167
-
From here select a template.
153
+
From here select an option.
168
154
169
155
170
156
## Run the App
171
157
172
158
Run it in development mode:
173
159
174
160
```bash
175
-
reflex run
161
+
uv run reflex run
176
162
```
177
163
178
164
Your app runs at [http://localhost:3000](http://localhost:3000).
179
165
180
166
Reflex prints logs to the terminal. To increase log verbosity to help with debugging, use the `--loglevel` flag:
181
167
182
168
```bash
183
-
reflex run --loglevel debug
169
+
uv run reflex run --loglevel debug
184
170
```
185
171
186
172
Reflex will *hot reload* any code changes in real time when running in development mode. Your code edits will show up on [http://localhost:3000](http://localhost:3000) automatically.
Copy file name to clipboardExpand all lines: docs/getting_started/introduction.md
+24-6Lines changed: 24 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,11 @@ from pcweb.pages.docs.library import library
7
7
from pcweb.pages.docs import pages
8
8
from pcweb.pages.docs importvars
9
9
from pcweb.styles.colors import c_color
10
+
from pcweb.pages.docs import styling
10
11
from pcweb.styles.fonts import base
12
+
from pcweb.pages.docs import hosting
11
13
from pcweb.flexdown import markdown_with_shiki
14
+
from pcweb.pages.docs import advanced_onboarding
12
15
```
13
16
14
17
<!-- TODO how do we consistently rename page title? -->
@@ -47,19 +50,22 @@ Here, we go over a simple counter app that lets the user count up or down.
47
50
classCounterExampleState(rx.State):
48
51
count: int=0
49
52
53
+
@rx.event
50
54
defincrement(self):
51
55
self.count +=1
52
56
57
+
@rx.event
53
58
defdecrement(self):
54
59
self.count -=1
55
60
56
61
classIntroTabsState(rx.State):
57
62
"""The app state."""
58
63
59
-
value ="tab1"
60
-
tab_selected =""
64
+
value: str="tab1"
65
+
tab_selected: str=""
61
66
62
-
defchange_value(self, val):
67
+
@rx.event
68
+
defchange_value(self, val: str):
63
69
self.tab_selected =f"{val} clicked!"
64
70
self.value = val
65
71
@@ -151,9 +157,11 @@ rx.box(
151
157
"""class State(rx.State):
152
158
count: int = 0
153
159
160
+
@rx.event
154
161
def increment(self):
155
162
self.count += 1
156
163
164
+
@rx.event
157
165
def decrement(self):
158
166
self.count -= 1""",
159
167
background=rx.cond(
@@ -241,9 +249,11 @@ Here our state has a single var, `count`, which holds the current value of the c
241
249
### Event Handlers
242
250
243
251
```python
252
+
@rx.event
244
253
defincrement(self):
245
254
self.count +=1
246
255
256
+
@rx.event
247
257
defdecrement(self):
248
258
self.count -=1
249
259
```
@@ -278,7 +288,7 @@ def index():
278
288
279
289
This function defines the app's user interface.
280
290
281
-
We use different components such as `rx.hstack`, `rx.button`, and `rx.heading` to build the frontend. Components can be nested to create complex layouts, and can be styled using the full power of CSS.
291
+
We use different components such as `rx.hstack`, `rx.button`, and `rx.heading` to build the frontend. Components can be nested to create complex layouts, and can be styled using the full power of CSS or [Tailwind CSS]({styling.tailwind.path}).
282
292
283
293
Reflex comes with [50+ built-in components]({library.path}) to help you get started.
284
294
We are actively adding more components. Also, it's easy to [wrap your own React components]({wrapping_react.overview.path}).
@@ -327,9 +337,17 @@ app.add_page(index)
327
337
328
338
We've created a simple, yet fully interactive web app in pure Python.
329
339
330
-
By continuing with our documentation, you will learn how to build awesome apps with Reflex.
340
+
By continuing with our documentation, you will learn how to build awesome apps with Reflex. Use the sidebar to navigate through the sections, or search (`Ctrl+K` or `Cmd+K`) to quickly find a page.
331
341
332
342
For a glimpse of the possibilities, check out these resources:
333
343
334
344
* For a more real-world example, check out either the [dashboard tutorial]({getting_started.dashboard_tutorial.path}) or the [chatapp tutorial]({getting_started.chatapp_tutorial.path}).
335
-
* We have bots that can answer questions and generate Reflex code for you. Check them out in #ask-ai in our [Discord]({constants.DISCORD_URL})!
345
+
* Check out our open-source [templates]({getting_started.open_source_templates.path})!
346
+
* We have an AI Builder that can generate full Reflex apps or help with your existing app! Check it out at [Reflex Build]({constants.REFLEX_BUILD_URL})!
347
+
* Deploy your app with a single command using [Reflex Cloud]({hosting.deploy_quick_start.path})!
348
+
349
+
If you want to learn more about how Reflex works, check out the [How Reflex Works]({advanced_onboarding.how_reflex_works.path}) section.
350
+
351
+
## Join our Community
352
+
353
+
If you have questions about anything related to Reflex, you're always welcome to ask our community on [GitHub Discussions]({constants.GITHUB_DISCUSSIONS_URL}), [Discord]({constants.DISCORD_URL}), [Forum]({constants.FORUM_URL}), and [X]({constants.TWITTER_URL}).
0 commit comments