Skip to content

Commit a2cbed6

Browse files
committed
Merge branch 'main' of https://github.com/reflex-dev/reflex into carlos/update-customer-navbar-link
2 parents 733c4c7 + 2aa49c5 commit a2cbed6

44 files changed

Lines changed: 2819 additions & 554 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 38 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
---
2222

2323
> [!NOTE]
24-
> 🚀 **Try [Reflex Build](https://build.reflex.dev/)** – our AI-powered app builder that generates full-stack Reflex applications in seconds.
24+
> Build faster with Reflex:
25+
>
26+
> - **[AI Builder](https://build.reflex.dev/)** - Generate full-stack Reflex apps in seconds.
27+
> - **[Agent Toolkit](https://reflex.dev/docs/ai/integrations/ai-onboarding/)** - Connect MCP and Skills to your coding assistant.
28+
> - **[App Management](https://reflex.dev/hosting)** - Deploy and manage your Reflex apps.
2529
2630
---
2731

@@ -33,7 +37,6 @@ Key features:
3337

3438
- **Pure Python** - Write your app's frontend and backend all in Python, no need to learn Javascript.
3539
- **Full Flexibility** - Reflex is easy to get started with, but can also scale to complex apps.
36-
- **Deploy Instantly** - After building, deploy your app with a [single command](https://reflex.dev/docs/hosting/deploy-quick-start/) or host it on your own server.
3740

3841
See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architecture/#the-reflex-architecture) to learn how Reflex works under the hood.
3942

@@ -43,66 +46,22 @@ See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architectu
4346

4447
## 🥳 Create your first app
4548

46-
### 1. Create the project directory
49+
Create a project, add Reflex, and start the development server with [uv](https://docs.astral.sh/uv/):
4750

48-
Replace `my_app_name` with your project name:
49-
50-
```bash
51+
```shell
5152
mkdir my_app_name
5253
cd my_app_name
53-
```
54-
55-
### 2. Install uv
56-
57-
Reflex recommends [uv](https://docs.astral.sh/uv/) for managing your project environment and dependencies.
58-
See the [uv installation docs](https://docs.astral.sh/uv/getting-started/installation/) for your platform.
59-
60-
```bash
61-
# macOS/Linux
62-
curl -LsSf https://astral.sh/uv/install.sh | sh
63-
64-
# Windows (PowerShell)
65-
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
66-
```
67-
68-
### 3. Initialize the Python project
69-
70-
```bash
7154
uv init
72-
```
73-
74-
### 4. Add Reflex
75-
76-
Reflex requires Python 3.10+:
7755

78-
```bash
7956
uv add reflex
80-
```
81-
82-
### 5. Initialize the project
83-
84-
This command initializes a template app in your new directory:
85-
86-
```bash
8757
uv run reflex init
88-
```
89-
90-
### 6. Run the app
91-
92-
You can run this app in development mode:
93-
94-
```bash
9558
uv run reflex run
9659
```
9760

9861
You should see your app running at http://localhost:3000.
9962

10063
Now you can modify the source code in `my_app_name/my_app_name.py`. Reflex has fast refreshes so you can see your changes instantly when you save your code.
10164

102-
### Troubleshooting
103-
104-
If the `reflex` command is not on your PATH, run it through uv instead: `uv run reflex init` and `uv run reflex run`
105-
10665
## 🫧 Example App
10766

10867
Build an image generation app in Python with Reflex: define the UI, manage state in a class, and call an image model from an event handler.
@@ -115,41 +74,49 @@ Build an image generation app in Python with Reflex: define the UI, manage state
11574
</video>
11675
</div>
11776

118-
## 📑 Resources
77+
```python
78+
import reflex as rx
79+
import openai
11980

120-
<div align="center">
81+
client = openai.AsyncOpenAI()
12182

122-
📑 [Docs](https://reflex.dev/docs/getting-started/introduction) &nbsp; | &nbsp; 🗞️ [Blog](https://reflex.dev/blog) &nbsp; | &nbsp; 📱 [Component Library](https://reflex.dev/docs/library) &nbsp; | &nbsp; 🖼️ [Templates](https://reflex.dev/templates/) &nbsp; | &nbsp; 🛸 [Deployment](https://reflex.dev/docs/hosting/deploy-quick-start) &nbsp;
12383

124-
</div>
125-
126-
## ✅ Status
127-
128-
Reflex launched in December 2022 with the name Pynecone.
129-
130-
🚀 Introducing [Reflex Build](https://build.reflex.dev/) — Our AI-Powered Builder
131-
Reflex Build uses AI to generate complete full-stack Python applications. It helps you quickly create, customize, and refine your Reflex apps — from frontend components to backend logic — so you can focus on your ideas instead of boilerplate code. Whether you’re prototyping or scaling, Reflex Build accelerates development by intelligently scaffolding and optimizing your app’s entire stack.
84+
class State(rx.State):
85+
prompt: str = ""
86+
image_url: str = ""
87+
processing: bool = False
13288

133-
Alongside this, [Reflex Cloud](https://cloud.reflex.dev) launched in 2025 to offer the best hosting experience for your Reflex apps. We’re continuously improving the platform with new features and capabilities.
89+
@rx.event
90+
def set_prompt(self, value: str):
91+
self.prompt = value
13492

135-
Reflex has new releases and features coming every week! Make sure to :star: star and :eyes: watch this repository to stay up to date.
93+
@rx.event
94+
async def generate(self):
95+
self.processing = True
96+
yield
97+
response = await client.images.generate(
98+
model="gpt-image-1.5",
99+
prompt=self.prompt,
100+
)
101+
self.image_url = f"data:image/png;base64,{response.data[0].b64_json}"
102+
self.processing = False
136103

137-
## Contributing
138104

139-
We welcome contributions of any size! Below are some good ways to get started in the Reflex community.
105+
def index():
106+
return rx.vstack(
107+
rx.heading("Image Generator"),
108+
rx.input(placeholder="Enter a prompt...", on_change=State.set_prompt),
109+
rx.button("Generate", on_click=State.generate, loading=State.processing),
110+
rx.image(src=State.image_url),
111+
)
140112

141-
- **Join Our Discord**: Our [Discord](https://discord.gg/T5WSbC2YtQ) is the best place to get help on your Reflex project and to discuss how you can contribute.
142-
- **GitHub Discussions**: A great way to talk about features you want added or things that are confusing/need clarification.
143-
- **GitHub Issues**: [Issues](https://github.com/reflex-dev/reflex/issues) are an excellent way to report bugs. Additionally, you can try and solve an existing issue and submit a PR.
144113

145-
We are actively looking for contributors, no matter your skill level or experience. To contribute check out [CONTRIBUTING.md](https://github.com/reflex-dev/reflex/blob/main/CONTRIBUTING.md)
114+
app = rx.App()
115+
app.add_page(index, title="Reflex:Image Generation")
116+
```
146117

147118
## All Thanks To Our Contributors:
148119

149120
<a href="https://github.com/reflex-dev/reflex/graphs/contributors">
150121
<img src="https://contrib.rocks/image?repo=reflex-dev/reflex" />
151122
</a>
152-
153-
## License
154-
155-
Reflex is open-source and licensed under the [Apache License 2.0](https://raw.githubusercontent.com/reflex-dev/reflex/main/LICENSE).

docs/app/agent_files/_plugin.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Any, Literal, Union, get_args, get_origin
88

99
from reflex.constants import Dirs
10+
from reflex_base.config import get_config
1011
from reflex_base.plugins import CommonContext, Plugin
1112
from typing_extensions import Unpack
1213

@@ -112,8 +113,6 @@ def _extract_markdown_title(source: str) -> str | None:
112113

113114
def _llms_url_for_path(url_path: Path) -> str:
114115
"""Return the public URL for a generated markdown asset."""
115-
from reflex_base.config import get_config
116-
117116
config = get_config()
118117
deploy_url = config.deploy_url.removesuffix("/") if config.deploy_url else ""
119118
frontend_path = (config.frontend_path or "").strip("/")
@@ -127,8 +126,6 @@ def _llms_url_for_path(url_path: Path) -> str:
127126

128127
def _docs_home_url() -> str:
129128
"""Return the public URL for the docs home."""
130-
from reflex_base.config import get_config
131-
132129
config = get_config()
133130
deploy_url = config.deploy_url.removesuffix("/") if config.deploy_url else ""
134131
frontend_path = (config.frontend_path or "").strip("/")
@@ -882,6 +879,8 @@ class AgentFilesPlugin(Plugin):
882879
def get_static_assets(
883880
self, **context: Unpack[CommonContext]
884881
) -> Sequence[tuple[Path, str | bytes]]:
885-
return [
886-
(Dirs.PUBLIC / path, content) for path, content in generate_agent_files()
887-
]
882+
root = Path(Dirs.PUBLIC)
883+
if frontend_path := get_config().frontend_path:
884+
# Make sure the pre-rendered HTML does not get overwritten by md files.
885+
root = root / frontend_path.lstrip("/")
886+
return [(root / path, content) for path, content in generate_agent_files()]

0 commit comments

Comments
 (0)