Skip to main content

Violit: Faster than Light, Beautiful as Violet. The High-Performance Python Web Framework (Streamlit Alternative with Zero Rerun).

Project description

Violitโ„ข Logo

๐Ÿ’œ Violit

"Faster than Light, Beautiful as Violet." Structure of Streamlit ร— Performance of React

Violit is a next-generation Python web framework that adopts an O(1) State Architecture for instant reactivity, unlike Streamlit's Full Script Rerun structure.

Build applications that react at the speed of light with the most elegant syntax.

PyPI Python 3.10+ MIT License FastAPI Shoelace


๐Ÿ“ธ Demo

A dashboard built with Violit running in real-time.

Violit Showcase Demo


โšก Why Violit?

Architectural Differences

Violit and Streamlit are similar in that they build UIs with Python code, but their internal mechanisms are fundamentally different.

Feature Streamlit (Traditional) Violit (Reactive)
Execution Model Full Rerun (O(N))
Reruns the entire script on every user interaction.
Zero Rerun (O(1))
Updates only the components connected to the modified State.
Performance Response speed may degrade as data size increases. Maintains consistent reactivity regardless of data scale.
Optimization Requires optimization decorators like @cache, @fragment. Optimized by design without extra optimization code.
Deployment Optimized for web browser execution. Supports both Web Browser and Desktop Native App modes.
Design Focuses on providing basic UI. Provides ready-to-use designs with 30+ professional themes.

Key Features

  1. Optimization by Design (Streamlit-Like Syntax, No Complexity): Streamlit's intuitive syntax is maintained, but complex optimization tools are removed at the architecture level.

    • โŒ No @cache_data, @fragment, st.rerun: Thanks to the O(1) structure, manual optimization is unnecessary.
    • โŒ No key Management: No need to manually specify unique keys for widget state management.
    • โŒ No Complex Callbacks: No need to define complex callbacks/classes like Dash or Panel.
  2. Ultra-Fast Speed: Even if you move the slider in 0.1s increments, the chart reacts in real-time without stuttering.

  3. Hybrid Runtime:

    • WebSocket Mode: Ultra-low latency bidirectional communication (Default)
    • Lite Mode: HTTP-based, advantageous for handling large-scale concurrent connections
  4. Desktop Mode: Can run as a perfect desktop application without Electron using the --native option.


๐ŸŽจ Theme Gallery

You don't need to know CSS at all. Violit provides over 30 themes. (Soon, users will be able to easily add Custom Themes.)

Theme demo will be updated soon.

Theme Gallery Grid

# Configuration at initialization
app = vl.App(theme='cyberpunk')

# Runtime change
app.set_theme('ocean')
Theme Family Examples
Dark ๐ŸŒ‘ dark, dracula, monokai, ocean, forest, sunset
Light โ˜€๏ธ light, pastel, retro, nord, soft_neu
Tech ๐Ÿค– cyberpunk, terminal, cyber_hud, blueprint
Professional ๐Ÿ’ผ editorial, bootstrap, ant, material, lg_innotek

๐Ÿ“ˆ Benchmarks & Performance

Benchmark results showing how efficient Violit's O(1) update method is compared to the existing O(N) method.

Detailed benchmark data will be updated soon.

Benchmark Chart


๐Ÿš€ Comparison

Python UI Frameworks

Framework Architecture Learning Curve Performance Desktop App Real-time
Streamlit Full Rerun Very Easy Slow โŒ โ–ณ
Dash Callback Medium Fast โŒ โ–ณ
Panel Param Hard Fast โŒ โœ…
Reflex React (Compile) Hard Fast โŒ โœ…
NiceGUI Vue Easy Fast โœ… โœ…
Violit Signal Very Easy Fast โœ… โœ…

Code Comparison

1. vs Streamlit (Rerun vs Signal)

Streamlit re-executes the entire script on button click, but Violit executes only that function.

# Streamlit
import streamlit as st

if "count" not in st.session_state:
    st.session_state.count = 0

if st.button("Click"):
    st.session_state.count += 1 # Rerun triggers here

st.write(st.session_state.count)
# Violit
import violit as vl
app = vl.App()

count = app.state(0)

# Update only count on click (No Rerun)
app.button("Click", on_click=lambda: count.set(count.value + 1))
app.write(count) 

2. vs Dash (Callback Hell vs Auto-Reactivity)

Dash requires complex Callbacks connecting Input/Output, but Violit only needs a single State.

# Dash
from dash import Dash, html, Input, Output, callback

app = Dash(__name__)
app.layout = html.Div([
    html.Button("Click", id="btn"),
    html.Div(id="out")
])

@callback(Output("out", "children"), Input("btn", "n_clicks"))
def update(n):
    return f"Value: {n}" if n else "Value: 0"
# Violit
count = app.state(0)

app.button("Click", on_click=lambda: count.set(count.value + 1))
# Automatic state dependency tracking -> No Callback needed
app.write(lambda: f"Value: {count.value}")

3. vs NiceGUI (Binding vs Direct State)

NiceGUI is also great, but Violit offers a more concise syntax in the style of Streamlit.

# NiceGUI
from nicegui import ui

count = {'val': 0}
ui.button('Click', on_click=lambda: count.update(val=count['val'] + 1))
ui.label().bind_text_from(count, 'val', backward=lambda x: f'Value: {x}')
# Violit
count = app.state(0)
app.button('Click', on_click=lambda: count.set(count.value + 1))
app.write(count) # No need for complex connections like .bind_text

4. vs Reflex (Class & Compile vs Pure Python)

Reflex requires State class definition and compilation, but Violit is a pure Python script.

# Reflex
import reflex as rx

class State(rx.State):
    count: int = 0
    def increment(self):
        self.count += 1

def index():
    return rx.vstack(
        rx.button("Click", on_click=State.increment),
        rx.text(State.count)
    )
# Violit
# No class definition needed, no compilation needed
count = app.state(0)
app.button("Click", on_click=lambda: count.set(count.value + 1))
app.write(count)

๐Ÿš€ Quick Start

1. Installation

Can be installed in Python 3.10+ environments.

pip install violit

# Or development version
pip install git+https://github.com/violit-dev/violit.git

2. Hello, Violit!

Create a hello.py file.

import violit as vl

app = vl.App(title="Hello Violit", theme='ocean')

app.title("๐Ÿ’œ Hello, Violit!")
app.markdown("Experience the speed of **Zero Rerun**.")

count = app.state(0)

col1, col2 = app.columns(2)
with col1:
    app.button("โž• Plus", on_click=lambda: count.set(count.value + 1))
with col2:
    app.button("โž– Minus", on_click=lambda: count.set(count.value - 1))

app.metric("Current Count", count)

app.run()

3. Execution

# Basic run (WebSocket Mode)
python hello.py

# Desktop App Mode (Recommended)
python hello.py --native

# Port configuration
python hello.py --port 8020

๐Ÿ“š Widget Support

Violit supports core Streamlit widgets, and some features have been redesigned for greater efficiency.

For a detailed compatibility list and information on unsupported widgets, please refer to the Streamlit API Support Matrix document.


๐Ÿ› ๏ธ Tech Stack

  • Backend: FastAPI (Async Python)
  • Frontend: Web Components (Shoelace), Plotly.js, AG-Grid
  • Protocol: WebSocket & HTTP/HTMX Hybrid
  • State: Signal-based Reactivity

๐Ÿ—บ๏ธ Roadmap

Violit is continuously evolving.

  • โœ… Core: Signal State Engine, Theme System
  • โœ… Widgets: Plotly, Dataframe, Input Widgets
  • โณ Homepage: Official Homepage Open
  • โณ Documentation: Official Technical Documentation and API Reference Update
  • โณ Custom Components: User-defined Custom Component Support
  • โณ Custom Theme: User-defined Custom Theme Support
  • โณ async: Async processing support
  • โณ More examples: Provide more real-world usable example code
  • โณ Violit.Cloud: Cloud deployment service
  • โณ Expansion: Integration of more third-party libraries

๐Ÿ“‚ Project Structure

.
โ”œโ”€โ”€ violit/            # Framework source code
โ”‚   โ”œโ”€โ”€ app.py         # Main App class and entry point
โ”‚   โ”œโ”€โ”€ broadcast.py   # Real-time WebSocket broadcasting
โ”‚   โ”œโ”€โ”€ state.py       # Reactive State Engine
โ”‚   โ”œโ”€โ”€ theme.py       # Theme management
โ”‚   โ”œโ”€โ”€ assets/        # Built-in static files
โ”‚   โ””โ”€โ”€ widgets/       # Widget implementations
โ”‚       โ”œโ”€โ”€ input_widgets.py
โ”‚       โ”œโ”€โ”€ data_widgets.py
โ”‚       โ”œโ”€โ”€ layout_widgets.py
โ”‚       โ””โ”€โ”€ ...
โ””โ”€โ”€ requirements.txt   # Dependency list

๐Ÿค Contributing

Violit is an open-source project. Let's build the future of faster and more beautiful Python UIs together.

  1. Fork this repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

๐Ÿ“ License

MIT License

Violitโ„ข is a trademark of The Violit Team.


Made with ๐Ÿ’œ by the Violit Team
Faster than Light, Beautiful as Violet.

Project details


Download files

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

Source Distribution

violit-0.0.5.tar.gz (81.1 kB view details)

Uploaded Source

Built Distribution

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

violit-0.0.5-py3-none-any.whl (84.2 kB view details)

Uploaded Python 3

File details

Details for the file violit-0.0.5.tar.gz.

File metadata

  • Download URL: violit-0.0.5.tar.gz
  • Upload date:
  • Size: 81.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.7

File hashes

Hashes for violit-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e6d53cc76e5804cb41acca94b946e0bf883ac51d27638d4e369b38f222f27dae
MD5 0426ad3a01bfc866fb0665d6a06dd001
BLAKE2b-256 89c28d8e410ecdda0e4b588874d49fd911bb29f9ca76d5f17ba7dc293d7931df

See more details on using hashes here.

File details

Details for the file violit-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: violit-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 84.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.7

File hashes

Hashes for violit-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5e6c9bdfd248d4cc00147400e46f006f41c7b9f06ea051dd05bd114cde8eafa2
MD5 0af019bb389db08a9b868c18ca673fc7
BLAKE2b-256 3a63801be7c5c2204d47747c9599460320e350f0214a6829d0cbd59c31dfa47a

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