github reflex-dev/reflex v0.7.9

latest releases: v0.8.22, v0.8.21, v0.8.20...
7 months ago

Release Notes

Improvements to Tailwind Config Wrapping

Thanks to @itsmeadarsh2008, the tailwind config got expanded:

plugins = [
    "@tailwindcss/forms",  # simple require
    {
        "name": "@heroui/theme",
        "import": {"name": "heroui", "from": "@heroui/theme"},
        "call": "heroui"
    },
    {
        "name": "tailwindcss-theme-variants",
        "import": {"name": "themeVariants", "from": "tailwindcss-theme-variants"},
        "call": "themeVariants",
        "args": {
            "themes": {
                "light": { "selector": ".light-theme" },
                "dark": { "selector": ".dark-theme" }
            }
        }
    }
]

Enable Granian as default

We have had fixes going into Granian that should make the experience as good as it was on Uvicorn/Gunicorn and in some cases better. There are most certainly issues so feel free to report them and we will do our best to mitigate them.

Include all rx.memo components in the build

This saves us from doing another scan to discover them.

This also adds the ability to call memoized components from dynamic components!

class State(rx.State):
    name: str = "Bob"

    @rx.var
    def count(self) -> rx.Component:
        return counter(
            name=self.name,
        )


@rx.memo
def counter(name: str):
    return rx.hstack(
        rx.button(name),
        rx.button(f"Not {name}"),
    )


def index():
    return rx.vstack(rx.text("Who Are You?"), State.count)

Deprecate .api in favor of api_transformer

If you were doing something like:

app = rx.App()

@app.api.get("/pong")
def pong():
    return {"message": "pong"}

You should instead do

fastapi_app = FastAPI()

@fastapi_app.get("/pong")
def pong():
    return {"message": "pong"}

app = rx.App(api_transformer=fastapi_app)

The api_transformer takes one or multiple (a list) of Starlette/FastAPI apps. It can also take a function that takes ASGIApp and returns a different ASGIApp that mounts the previous one. For example, the above code is equivalent to:

from reflex.utils.types import ASGIApp

fastapi_app = FastAPI()

@fastapi_app.get("/pong")
def pong():
    return {"message": "pong"}

def fastapi_transformer(app: ASGIApp):
    fastapi_app.mount("", app)
    return app

app = rx.App(api_transformer=fastapi_transformer)

Raise error when using @rx.event with events starting with an underscore.

Private events is not a thing and this can help to error earlier.

Replace typer with click

In our quest to cut down on dependencies we are simplifying our CI across reflex and reflex-hosting-cli to use click over typer (which what typer uses under the hood).

Misc

Bugfixes

Chores

New Contributors

Full Changelog: v0.7.8...v0.7.9

Don't miss a new reflex release

NewReleases is sending notifications on new releases.