Violit: Faster than Light, Beautiful as Violet. The High-Performance Python Web Framework (Streamlit Alternative with Zero Rerun).
Project description
๐ Violit
"Faster than Light, Beautiful as Violet." Structure of Streamlit ร Performance of React
Violit is a next-generation Python web framework that adopts a Fine-Grained 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.
๐ธ Demo
A dashboard built with Violit running in real-time.
โก 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 Script Rerun Reruns the entire script on every user interaction. |
Fine-Grained Updates 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 20+ professional themes. |
Key Features
-
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 fine-grained structure, manual optimization is unnecessary. - โ No
keyManagement: 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.
- โ No
-
Ultra-Fast Speed: Even if you move the slider in 0.1s increments, the chart reacts in real-time without stuttering.
-
Hybrid Runtime:
- WebSocket Mode: Ultra-low latency bidirectional communication (Default)
- Lite Mode: HTTP-based, advantageous for handling large-scale concurrent connections
-
Desktop Mode: Can run as a perfect desktop application without Electron using the
--nativeoption.
๐จ Theme Gallery
You don't need to know CSS at all. Violit provides over 20 themes. (Soon, users will be able to easily add Custom Themes.)
Theme demo will be updated soon.
# 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 fine-grained update method is compared to the existing full rerun method.
Detailed benchmark data will be updated soon.
๐ 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.
- Fork this repository
- Create your feature branch
- Commit your changes
- Push to the branch
- 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file violit-0.2.0.tar.gz.
File metadata
- Download URL: violit-0.2.0.tar.gz
- Upload date:
- Size: 2.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef5d2be1854dd7d2ee3484111e26eb2f9ab4d42448f6909fc983a663513eb48
|
|
| MD5 |
e958f23eb82492c53de7a43f2b7bf97a
|
|
| BLAKE2b-256 |
6b0a938a5374fd7271a4b99766b043b28a58ca85f79e0b3ed85a05569461c054
|
File details
Details for the file violit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: violit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f5f009f7f8a068cd7e7b1d459a8287fd4d4a62aad2eb9b82cb5506b28f24d38
|
|
| MD5 |
dc0200815ddde4c090ccfaa143cc45f0
|
|
| BLAKE2b-256 |
4ef1d1470880d2b6e7d3a008a4ca3430494dc05e0890e01fad1c14e5361df356
|