DEV Community

Sn3llius
Sn3llius

Posted on

Rio: WebApps in pure Python. No JavaScript, HTML and CSS needed!

Hi everyone! We're excited to announce that our reactive web UI framework is now public. This project has been in the works for quite some time, and we're excited to share it with you. Feel free to check it out and share your feedback!

What My Project Does

Rio is a brand new GUI framework designed to let you create modern web apps with just a few lines of Python. Our goal is to simplify web and app development, allowing you to focus on what matters most instead of getting stuck on complicated user interface details.

We achieve this by adhering to the core principles of Python that we all know and love. Python is meant to be simple and concise, and Rio embodies this philosophy. There's no need to learn additional languages like HTML, CSS, or JavaScript, as all UI, logic, components, and even layout are managed entirely in Python. Moreover, there's no separation between front-end and back-end; Rio transparently handles all communication for you.

Showcase

Rio doesn't just serve HTML templates like you might be used to from frameworks like Flask. In Rio you define components as simple dataclasses with a React/Flutter style build method. Rio continuously watches your attributes for changes and updates the UI as necessary.

class MyComponent(rio.Component):
    clicks: int = 0

    def _on_press(self) -> None:
        self.clicks += 1

    def build(self) -> rio.Component:
        return rio.Column(
            rio.Button('Click me', on_press=self._on_press),
            rio.Text(f'You clicked the button {self.clicks} time(s)'),
        )

app = rio.App(build=MyComponent)
app.run_in_browser()
Enter fullscreen mode Exit fullscreen mode

Notice how there is no need for any explicit HTTP requests. In fact there isn't even a distinction between frontend and backend. Rio handles all communication transparently for you. Unlike ancient libraries like tkinter, Rio ships with over 50 builtin components in Google's Material Design. Moreover the same exact codebase can be used for both local apps and websites.

Key Features

  • Full-Stack Web Development: Rio handles front-end and backend for you. In fact, you won't even notice they exist. Create your UI, and Rio will take care of the rest.
  • Python Native: Rio apps are written in 100% Python, meaning you don't need to write a single line of CSS or JavaScript.
  • Modern Python: We embrace modern Python features, such as type annotations and asynchrony. This keeps your code clean and maintainable, and helps your code editor help you out with code completions and type checking.
  • Python Debugger Compatible: Since Rio runs on Python, you can connect directly to the running process with a debugger. This makes it easy to identify and fix bugs in your code.
  • Declarative Interface: Rio apps are built using reusable components, inspired by react, flutter & vue. They're declaratively combined to create modular and maintainable UIs.
  • Batteries included: Over 50 builtin components based on Google's Material Design

Target Audience

Rio is perfect for developers who want to create web apps without spending time learning new languages. It’s also ideal for those who want to build modern, professional-looking apps without stressing over the details

We Want Your Feedback!

We welcome your thoughts and questions in the comments! If you like the project, please give us a star on GitHub to show your support and help us continue improving it.

Top comments (2)

Collapse
 
sw33tblo55om profile image
Nicole

Looks quite cool! πŸ‘

But how does it scale?

Collapse
 
sn3llius profile image
Sn3llius

Thanks! But please keep in mind, that this is only our first alpha release. Currently, our primary focus is to make sure all components and features are present to make Rio a robust and versatile tool for developers. And indeed, it's already proving useful for a variety of use cases for anything from internal company tools like dashboards, CRUD applications and forecasting tools, to personal sites like portfolios and blogs and such. Our own website is also built with Rio.

That being said, we are aware that performance still has to improve, to ensure Rio works for even high-traffic websites and have plans to implement several optimizations in the future. We're experimenting with a caching mechanism (similar to server-side rendering) written in Rust. By having Rust deal with repetitive requests, Python would only have to handle previously unseen states. With all of that in mind, we're confident that we'll soon be suitable even for high-traffic websites