Skip to main content

Web apps in pure Python.

Project description

Reflex Logo

✨ Performant, customizable web apps in pure Python. Deploy in seconds. ✨

PyPI version versions Documentation PyPI Downloads Discord Twitter


[!NOTE] Build faster with Reflex:


Introduction

Reflex is a library to build full-stack web apps in pure Python.

Key features:

  • Pure Python - Write your app's frontend and backend all in Python, no need to learn Javascript.
  • Full Flexibility - Reflex is easy to get started with, but can also scale to complex apps.

See our architecture page to learn how Reflex works under the hood.

⚙️ Installation

Important: We strongly recommend using a virtual environment to ensure the reflex command is available in your PATH.

🥳 Create your first app

Create a project, add Reflex, and start the development server with uv:

mkdir my_app_name
cd my_app_name
uv init

uv add reflex
uv run reflex init
uv run reflex run

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

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.

🫧 Example App

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.

import reflex as rx
import openai

client = openai.AsyncOpenAI()


class State(rx.State):
    prompt: str = ""
    image_url: str = ""
    processing: bool = False

    @rx.event
    def set_prompt(self, value: str):
        self.prompt = value

    @rx.event
    async def generate(self):
        self.processing = True
        yield
        response = await client.images.generate(
            model="gpt-image-1.5",
            prompt=self.prompt,
        )
        self.image_url = f"data:image/png;base64,{response.data[0].b64_json}"
        self.processing = False


def index():
    return rx.vstack(
        rx.heading("Image Generator"),
        rx.input(placeholder="Enter a prompt...", on_change=State.set_prompt),
        rx.button("Generate", on_click=State.generate, loading=State.processing),
        rx.image(src=State.image_url),
    )


app = rx.App()
app.add_page(index, title="Reflex:Image Generation")

All Thanks To Our Contributors:

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reflex-0.9.4a1.tar.gz (384.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reflex-0.9.4a1-py3-none-any.whl (639.1 kB view details)

Uploaded Python 3

File details

Details for the file reflex-0.9.4a1.tar.gz.

File metadata

  • Download URL: reflex-0.9.4a1.tar.gz
  • Upload date:
  • Size: 384.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reflex-0.9.4a1.tar.gz
Algorithm Hash digest
SHA256 9c93812bbe0589b61cab9e1ddb71c709c38234f9d09d1f0dc44fce014d6ff2dd
MD5 5c9ac57cd6cb14ca9a74ad94bfcd11a2
BLAKE2b-256 060cf36b0eaf3e51cc55362e91db5b1ac5b68b4d9f9f0a4cc7ada34bc2b98c2f

See more details on using hashes here.

File details

Details for the file reflex-0.9.4a1-py3-none-any.whl.

File metadata

  • Download URL: reflex-0.9.4a1-py3-none-any.whl
  • Upload date:
  • Size: 639.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reflex-0.9.4a1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b7c3cc0dfa4bfa5f78c9321a55ef64d1ae6d347266d53636d33670a9abf3680
MD5 9cc7e1a2d0154c6ed4c688fb60ec9b6a
BLAKE2b-256 5e41f054f2427edbb954bd4246691074e5bdaafeaf189957b95f0a20f5bb8a2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page