Skip to main content

Build modern Websites and Apps just with Python

Project description

Rio Discord Python Version Version License

Rio Logo

🌊 You've arrived at Rio, an easy to use framework for creating websites and apps.

🐍 Rio is based entirely on Python. You won't need a single line of HTML, CSS, or JavaScript to create beautiful, modern apps.

Tutorial - Examples - Discord - Docs - Source Code

Rio brings React-style components to Python. Pull from a wealth of built-in components and combine them to create your own custom components. Then combine those into entire apps. Best of all, Rio apps can run both locally on your machine and on the web.

Features 🧩

  • Modern, declarative UI framework
  • 100% Python - Zero HTML, CSS, or JavaScript required
  • Over 50 Built-in components for common UI elements, such as rio.Switch, rio.Button, and rio.Text, and many more
  • Integrates with modern Python tooling: Thanks to being entirely Type Safe editors can give you instant suggestions and highlight problems right away
  • Apps can run both locally and on the web
  • Open Source & Free forever

Installation 🛠️

Rio is available on PyPI, so you can install it using pip:

pip install rio-ui

Getting Started 🎓

Rio comes with a very helpful command line utility to help you out. Create a new project in one short command:

rio new

You can choose from a variety of built-in templates to get you started. Here's a complete example to create a project based on the tic-tac-toe template:

rio new my-app --type website --template "Tic-Tac-Toe"
cd my-project
rio run

You'll have your first app up and running in seconds!

How it works 🧠

TODO: Minimal example

from typing import *  # type: ignore
import rio
from openai import AsyncOpenAI

client = AsyncOpenAI()


class DallEPage(rio.Component):

    prompt: str = ""
    image_url: str = ""
    is_loading: bool = False

    async def get_image(self) -> None:
        """Get an image by prompt."""

        self.is_loading = True
        await self.force_refresh()

        if self.prompt == "":
            self.image_url = ""
            self.is_loading = False
            return

        try:
            response = await client.images.generate(
                model="dall-e-2",
                prompt=self.prompt,
                size="256x256",
                quality="standard",
                n=1,
            )
            self.image_url = response.data[0].url

        finally:
            self.is_loading = False

    def build(self) -> rio.Component:

        return rio.Rectangle(
            content=rio.Card(
                rio.Column(
                    rio.Text("DALL-E", style="heading1"),
                    rio.TextInput(
                        text=self.bind().prompt,
                        label="Prompt:",
                    ),
                    rio.Button(
                        "Create Image",
                        on_press=self.get_image,
                        is_loading=self.is_loading,
                    ),
                    # Add the image to the page if it exists
                    *(
                        [
                            rio.Image(
                                rio.URL(self.image_url),
                                height=36,
                            )
                        ]
                        if self.image_url
                        else []
                    ),
                    spacing=1,
                    margin=2,
                ),
                width=40,
                align_x=0.5,
                align_y=0.5,
                margin=2,
            ),
            fill=rio.Color.GREY,
        )


# Run the app
app = rio.App(
    pages=[
        rio.Page(
            page_url="",
            build=DallEPage,
        ),
    ],
)

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

rio_ui-0.5.7.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

rio_ui-0.5.7-py3-none-any.whl (3.2 MB view details)

Uploaded Python 3

File details

Details for the file rio_ui-0.5.7.tar.gz.

File metadata

  • Download URL: rio_ui-0.5.7.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.8.4-arch1-1

File hashes

Hashes for rio_ui-0.5.7.tar.gz
Algorithm Hash digest
SHA256 8fdfec77b0c5216df995504862a911a8fd3757752afe127595edf5aa7e893db8
MD5 799a4b3127e335b39fe6bad8a0d5d4bf
BLAKE2b-256 8bdbe25d5cef577ce30701747a3a5b76340f6daf0fc514345b566d89dd08782f

See more details on using hashes here.

File details

Details for the file rio_ui-0.5.7-py3-none-any.whl.

File metadata

  • Download URL: rio_ui-0.5.7-py3-none-any.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.8.4-arch1-1

File hashes

Hashes for rio_ui-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 43beafaa3ef8853d5eeb600cd45c1f5a091e551215d15ced376169e52eb899fc
MD5 4c04e4cd888ebece1a5cefe12da4d68d
BLAKE2b-256 4c77fcc14fa389798539a32f68b835545de72430b518c0cee0b1f5ea0b07ea68

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