Skip to content

Commit 42a0e64

Browse files
authored
ENG-8666: ENG-8667: Update intro docs (#1734)
* ENG-8666: ENG-8667: Update intro docs * Update accordion styling (#1733)
1 parent d4595bc commit 42a0e64

File tree

4 files changed

+75
-70
lines changed

4 files changed

+75
-70
lines changed

assets/tailwind-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@
16961696
/* max-height: 350px !important; */
16971697
border-radius: 0.75rem !important;
16981698
border: 1px solid var(--c-slate-4);
1699-
background: var(--c-slate-2) !important;
1699+
background: var(--c-slate-2);
17001700
color: var(--c-slate-12) !important;
17011701
resize: none !important;
17021702
outline: none !important;

docs/getting_started/installation.md

Lines changed: 49 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Reflex requires Python 3.10+.
2020

2121
We **highly recommend** creating a virtual environment for your project.
2222

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+
2425

2526
# Install Reflex on your system
2627

@@ -29,11 +30,22 @@ We **highly recommend** creating a virtual environment for your project.
2930
--tab macOS/Linux
3031
## Install on macOS/Linux
3132

32-
We will go with [venv]({constants.VENV_URL}) here.
33+
We will go with [uv]({constants.UV_URL}) here.
3334

3435

3536
### 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:
3749

3850
`/usr/sbin/softwareupdate --install-rosetta --agree-to-license`
3951

@@ -47,60 +59,48 @@ mkdir {app_name}
4759
cd {app_name}
4860
```
4961

50-
### Setup virtual environment
62+
### Initialize uv project
5163

5264
```bash
53-
python3 -m venv .venv
54-
source .venv/bin/activate
65+
uv init
5566
```
5667

57-
58-
```md alert info
59-
# Getting `No module named venv`?
60-
61-
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
6869

6970
```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
7872
```
7973

80-
## Initialize the project
74+
### Initialize the Reflex project
8175

8276
```bash
83-
reflex init
77+
uv run reflex init
8478
```
8579

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-
```
9180

9281
--
9382
--tab Windows
9483
## Install on Windows
9584

96-
### Prerequisites
9785
For Windows users, we recommend using [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/about) for optimal performance.
9886

99-
WSL users should refer to instructions for Linux above.
87+
**WSL users:** Refer to the macOS/Linux instructions above.
10088

10189
For the rest of this section we will work with native Windows (non-WSL).
10290

103-
We will go with [venv]({constants.VENV_URL}) here, for virtual environments.
91+
We will go with [uv]({constants.UV_URL}) here.
92+
93+
### Prerequisites
94+
95+
#### Install uv
96+
97+
```powershell
98+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
99+
```
100+
101+
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/).
104104

105105
### Create the project directory
106106

@@ -111,76 +111,62 @@ mkdir {app_name}
111111
cd {app_name}
112112
```
113113

114-
### Setup virtual environment
114+
### Initialize uv project
115115

116116
```bash
117-
py -3 -m venv .venv
118-
.venv\\Scripts\\activate
117+
uv init
119118
```
120119

121-
### Install Reflex package
122-
123-
Reflex is available as a [pip](constants.PIP_URL) package.
120+
### Add Reflex to the project
124121

125122
```bash
126-
pip install reflex
123+
uv add reflex
127124
```
128125

129-
## Initialize the project
126+
### Initialize the Reflex project
130127

131128
```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
139130
```
140131

141132
```md alert warning
142133
# 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).
144135
```
145136
--
146137

147138
---
148139

149140

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}).
151142

152143
```bash
153144
Initializing the web directory.
154145

155146
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.
164150
Which template would you like to use? (0):
165151
```
166152

167-
From here select a template.
153+
From here select an option.
168154

169155

170156
## Run the App
171157

172158
Run it in development mode:
173159

174160
```bash
175-
reflex run
161+
uv run reflex run
176162
```
177163

178164
Your app runs at [http://localhost:3000](http://localhost:3000).
179165

180166
Reflex prints logs to the terminal. To increase log verbosity to help with debugging, use the `--loglevel` flag:
181167

182168
```bash
183-
reflex run --loglevel debug
169+
uv run reflex run --loglevel debug
184170
```
185171

186172
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.

docs/getting_started/introduction.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ from pcweb.pages.docs.library import library
77
from pcweb.pages.docs import pages
88
from pcweb.pages.docs import vars
99
from pcweb.styles.colors import c_color
10+
from pcweb.pages.docs import styling
1011
from pcweb.styles.fonts import base
12+
from pcweb.pages.docs import hosting
1113
from pcweb.flexdown import markdown_with_shiki
14+
from pcweb.pages.docs import advanced_onboarding
1215
```
1316

1417
<!-- 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.
4750
class CounterExampleState(rx.State):
4851
count: int = 0
4952

53+
@rx.event
5054
def increment(self):
5155
self.count += 1
5256

57+
@rx.event
5358
def decrement(self):
5459
self.count -= 1
5560

5661
class IntroTabsState(rx.State):
5762
"""The app state."""
5863

59-
value = "tab1"
60-
tab_selected = ""
64+
value: str = "tab1"
65+
tab_selected: str = ""
6166

62-
def change_value(self, val):
67+
@rx.event
68+
def change_value(self, val: str):
6369
self.tab_selected = f"{val} clicked!"
6470
self.value = val
6571

@@ -151,9 +157,11 @@ rx.box(
151157
"""class State(rx.State):
152158
count: int = 0
153159
160+
@rx.event
154161
def increment(self):
155162
self.count += 1
156163
164+
@rx.event
157165
def decrement(self):
158166
self.count -= 1""",
159167
background=rx.cond(
@@ -241,9 +249,11 @@ Here our state has a single var, `count`, which holds the current value of the c
241249
### Event Handlers
242250

243251
```python
252+
@rx.event
244253
def increment(self):
245254
self.count += 1
246255

256+
@rx.event
247257
def decrement(self):
248258
self.count -= 1
249259
```
@@ -278,7 +288,7 @@ def index():
278288

279289
This function defines the app's user interface.
280290

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}).
282292

283293
Reflex comes with [50+ built-in components]({library.path}) to help you get started.
284294
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)
327337

328338
We've created a simple, yet fully interactive web app in pure Python.
329339

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.
331341

332342
For a glimpse of the possibilities, check out these resources:
333343

334344
* 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}).

pcweb/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
POETRY_URL = "https://python-poetry.org/"
5454
PIPENV_URL = "https://pipenv.pypa.io/en/latest/"
5555
PIP_URL = "https://pypi.org/project/pip/"
56+
UV_URL = "https://docs.astral.sh/uv/"
5657
VENV_URL = "https://docs.python.org/3/library/venv.html"
5758
VIRTUALENV_URL = "https://virtualenv.pypa.io/en/latest/"
5859
CONDA_URL = "https://conda.io/"

0 commit comments

Comments
 (0)