violit 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,504 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: violit
3
- Version: 0.0.2
4
- Summary: Violit: Faster than Light, Beautiful as Violet. The High-Performance Python Web Framework (Streamlit Alternative with Zero Rerun).
5
- Author-email: Violit Team <violit.company@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/violit-dev/violit
8
- Project-URL: Documentation, https://github.com/violit-dev/violit
9
- Project-URL: Repository, https://github.com/violit-dev/violit
10
- Project-URL: Issues, https://github.com/violit-dev/violit/issues
11
- Keywords: web,framework,streamlit,dashboard,ui,fastapi,reactive,zero-rerun,shoelace,websocket,data-science
12
- Classifier: Development Status :: 2 - Pre-Alpha
13
- Classifier: Intended Audience :: Developers
14
- Classifier: Intended Audience :: Science/Research
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Operating System :: OS Independent
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.10
19
- Classifier: Programming Language :: Python :: 3.11
20
- Classifier: Programming Language :: Python :: 3.12
21
- Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
22
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
23
- Classifier: Topic :: Software Development :: User Interfaces
24
- Classifier: Framework :: FastAPI
25
- Requires-Python: >=3.10
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
- Requires-Dist: fastapi>=0.68.0
29
- Requires-Dist: uvicorn>=0.15.0
30
- Requires-Dist: python-multipart>=0.0.5
31
- Requires-Dist: pywebview>=4.0.0
32
- Requires-Dist: cachetools>=4.2.0
33
- Requires-Dist: pandas>=1.3.0
34
- Requires-Dist: numpy>=1.20.0
35
- Requires-Dist: plotly>=5.0.0
36
- Requires-Dist: matplotlib>=3.4.0
37
- Requires-Dist: jinja2>=3.0.0
38
- Requires-Dist: websockets>=10.0
39
- Requires-Dist: bcrypt>=4.0.0
40
- Dynamic: license-file
41
-
42
- # 💜 Violit
43
-
44
- > **"Faster than Light, Beautiful as Violet."**
45
- > **Streamlit's Intuition × React's Performance**
46
-
47
- **Violit** is a next-generation Python web framework that perfectly solves Streamlit's critical **Full Script Rerun** issue with **O(1) State Architecture**.
48
-
49
- Build applications that react at the speed of light with the most elegant syntax.
50
-
51
- <p align="center">
52
- <img src="https://img.shields.io/pypi/v/violit?color=blueviolet&style=flat-square" alt="PyPI">
53
- <img src="https://img.shields.io/badge/Python-3.10+-blue.svg?style=flat-square" alt="Python 3.10+">
54
- <img src="https://img.shields.io/badge/License-MIT-green.svg?style=flat-square" alt="MIT License">
55
- <img src="https://img.shields.io/badge/Framework-FastAPI-009688.svg?style=flat-square" alt="FastAPI">
56
- <img src="https://img.shields.io/badge/UI-Shoelace-7C4DFF.svg?style=flat-square" alt="Shoelace">
57
- </p>
58
-
59
- ---
60
-
61
- ## ⚡ Why Violit?
62
-
63
- ### 🎯 Going Beyond Streamlit's Limits
64
-
65
- Violit isn't just "faster Streamlit". **The architecture itself is different.**
66
-
67
- | Feature | Streamlit 🐢 | **Violit 💜** |
68
- | --- | --- | --- |
69
- | **Architecture** | **Full Rerun (O(N))**<br><br>Re-executes the entire code on a single button press | **Zero Rerun (O(1))** ⚡<br><br>Updates only the changed components exactly |
70
- | **UX/UI** | Slow response, screen flickering | **React-grade Reactivity**, smooth with no flicker |
71
- | **Optimization** | Complex optimizations like `@cache`, `@fragment` required | **No optimization code needed** (Optimized by design) |
72
- | **Scalability** | Limited concurrent users (High memory usage) | **Lite Mode** supports massive traffic 🌐 |
73
- | **Deployment** | Web browser only | Web + **Desktop App Mode** 💻 |
74
- | **Design** | Basic default design | **30+ Premium Themes** built-in 🎨 |
75
-
76
- ### ⭐ Violit Signatures
77
-
78
- 1. **Ultra-Fast Speed**: Charts react in real-time without stutter, even when dragging sliders in 0.1s increments.
79
- 2. **Streamlit-Like API**: Existing Streamlit users can adapt in 10 minutes. Code is 90% compatible.
80
- 3. **Hybrid Runtime**:
81
- * **WebSocket Mode**: Ultra-low latency bidirectional communication, real-time broadcasting (Default) ⚡
82
- * **Lite Mode**: HTTP-based, handles thousands of concurrent users (For large-scale dashboards)
83
- 4. **Run as Desktop Mode**: Create a perfect desktop app without Electron using a single `--native` flag.
84
-
85
- ---
86
-
87
- ## 🔥 Why Violit Over Others?
88
-
89
- ### 📊 Python UI Framework Comparison
90
-
91
- | Framework | Architecture | Learning Curve | Performance | Desktop App | Real-time |
92
- |-----------|---------|----------|---------|------------|------------|
93
- | **Streamlit** | Full Rerun (O(N)) | ⭐⭐⭐⭐⭐ Very Easy | 🐢 Slow | ❌ | ❌ (Limited) |
94
- | **Dash (Plotly)** | Callback Based | ⭐⭐⭐ Average | ⚡ Fast | ❌ | ✅ (Complex) |
95
- | **Panel** | Param Based | ⭐⭐ Hard | ⚡ Fast | ❌ | ✅ |
96
- | **NiceGUI** | Vue Based | ⭐⭐⭐⭐ Easy | ⚡ Fast | ✅ | ✅ |
97
- | **Reflex** | React Style | ⭐⭐ Hard | ⚡ Fast | ❌ | ✅ |
98
- | **Violit 💜** | **Zero Rerun (O(1))** | ⭐⭐⭐⭐⭐ **Very Easy** | **⚡⚡ Fastest** | **✅** | **✅ Built-in** |
99
-
100
- ### 🎯 Reasons to Choose Violit
101
-
102
- #### 1️⃣ **vs Streamlit**: Same Syntax, 100x Faster
103
- ```python
104
- # Easy like Streamlit, but instant reaction without re-rendering
105
- app.button("Click", on_click=lambda: count.set(count.value + 1))
106
- app.write("Count:", count) # Updates only this part when State changes!
107
- ```
108
- - Keeps Streamlit's **intuitive API**, removes **Full Rerun pain** completely.
109
- - No need for complex optimizations like caching, fragments, or reruns.
110
-
111
- #### 2️⃣ **vs Dash**: Reactivity Without Callback Hell
112
- ```python
113
- # Dash needs complex callback chains, but
114
- # Violit automatically updates dependent components just by changing State
115
- count = app.state(0)
116
- app.write(lambda: f"Value: {count.value}") # Auto-tracking
117
- ```
118
- - Removes Dash's **`@callback` boilerplate hell**.
119
- - More intuitive State-based reactivity.
120
-
121
- #### 3️⃣ **vs Panel**: Power Without the Learning Curve
122
- ```python
123
- # Simple, without Panel's Param class
124
- name = app.state("World")
125
- app.write(lambda: f"Hello, {name.value}!")
126
- ```
127
- - No need for Panel's **complex Param system**.
128
- - Easy like Streamlit, powerful like Panel.
129
-
130
- #### 4️⃣ **vs NiceGUI**: Desktop Apps with Python Only
131
- - Supports **real-time WebSocket** like NiceGUI.
132
- - But Violit adds **30+ Premium Themes** and **Desktop Mode**.
133
- - No Vue.js knowledge needed, Python is enough.
134
-
135
- #### 5️⃣ **vs Reflex**: Start Immediately Without Config
136
- ```python
137
- # Reflex needs complex config and compilation, Violit is:
138
- import violit as vl
139
- app = vl.App()
140
- app.title("Hello!")
141
- app.run() # Done!
142
- ```
143
- - No **Node.js dependency** like Reflex.
144
- - **No separate build step**, complete with a single Python file.
145
-
146
- ### 💎 Violit's Unique Advantages
147
-
148
- 1. **Zero Configuration**: `pip install violit` → Start immediately.
149
- 2. **Zero Learning Curve**: If you know Streamlit, you're done in 5 minutes.
150
- 3. **Zero Performance Issues**: O(1) architecture scales to any size.
151
- 4. **Desktop Mode**: Run desktop mode with a single `--native` line.
152
- 5. **30+ Premium Themes**: Expert-level UI without a designer.
153
- 6. **Real-time Broadcasting**: Multi-user synchronization built-in.
154
-
155
- ---
156
-
157
- ## 🐢 Streamlit vs 🏎️ Violit
158
-
159
- ### Streamlit Way (Inefficient)
160
-
161
- The code **re-runs from top to bottom** on every interaction. Data is re-loaded every time.
162
-
163
- ```python
164
- import streamlit as st
165
-
166
- # ⚠️ This heavy function runs repeatedly on every button click
167
- df = load_huge_dataset()
168
-
169
- if 'count' not in st.session_state:
170
- st.session_state.count = 0
171
-
172
- # ⚠️ Screen flickers due to full page reload
173
- if st.button('Increase'):
174
- st.session_state.count += 1
175
-
176
- st.write(f"Count: {st.session_state.count}")
177
- ```
178
-
179
- ### Violit Way (Elegant)
180
-
181
- The script **runs only once**. UI automatically reacts when State changes.
182
-
183
- ```python
184
- import violit as vl
185
-
186
- app = vl.App()
187
-
188
- # ✅ Runs only once! 0% resource waste
189
- df = load_huge_dataset()
190
-
191
- # Declare State (Signal based)
192
- count = app.state(0)
193
-
194
- # Changing value on click -> UI reflects instantly (No Rerun)
195
- app.button("Increase", on_click=lambda: count.set(count.value + 1))
196
-
197
- # ✨ Auto-Reactive by passing State object directly!
198
- app.write("Count:", count)
199
-
200
- app.run()
201
- ```
202
-
203
- ---
204
-
205
- ## 🧩 The "Zero Rerun" Philosophy
206
-
207
- Violit eliminates the **unnecessary complexity** that plagued developers.
208
-
209
- ### 🚫 What You Don't Need Anymore
210
-
211
- * ❌ **`@st.cache_data`**: Why cache when code only runs once?
212
- * ❌ **`@st.fragment`**: All Violit widgets are already independent. (Though `@app.fragment` is supported if you want!)
213
- * ❌ **`st.rerun()`**: No need to force re-execution. Just change the state.
214
- * ❌ **`key="widget_1"`**: No need to manage keys to preserve widget state.
215
- * ❌ **Complex Callback Chains**: No need to link Input/Output like in Dash. State solves everything.
216
- * ❌ **Defining Param Classes**: No need to write complex parameter classes like in Panel.
217
-
218
- ### ✅ Violit's Innovative Approach
219
-
220
- ```python
221
- # 1. State-based Reactivity (Solid.js Signals style)
222
- counter = app.state(0)
223
- app.write(counter) # Auto-update when counter changes!
224
-
225
- # 2. Dynamic Content with Lambdas
226
- app.write(lambda: f"Current Time: {time.time()}") # Auto-dependency tracking
227
-
228
- # 3. Clear Actions with Callbacks
229
- app.button("Click", on_click=lambda: counter.set(counter.value + 1))
230
-
231
- # 4. Group with Fragment if needed (Streamlit-like)
232
- @app.fragment
233
- def dashboard():
234
- # This area re-runs when internal State changes
235
- app.header("Dashboard")
236
- app.metric("Visitors", visitors.value)
237
- ```
238
-
239
- ---
240
-
241
- ## 🎨 30+ Premium Themes
242
-
243
- You don't need to know CSS at all. Violit provides over 30 designer-tuned themes.
244
-
245
- ```python
246
- # Change theme with one line
247
- app = vl.App(theme='cyberpunk', title='My App')
248
-
249
- # Change at runtime
250
- app.set_theme('ocean')
251
- ```
252
-
253
- | Theme Family | Examples |
254
- | --- | --- |
255
- | **Dark 🌑** | `dark`, `dracula`, `monokai`, `ocean`, `forest`, `sunset` |
256
- | **Light ☀️** | `light`, `pastel`, `retro`, `nord`, `soft_neu` |
257
- | **Tech 🤖** | `cyberpunk`, `terminal`, `cyber_hud`, `blueprint` |
258
- | **Professional 💼** | `editorial`, `bootstrap`, `ant`, `material`, `lg_innotek` |
259
-
260
- **Comparison with others:**
261
- - **Streamlit**: Only basic themes, complex customization.
262
- - **Dash**: Must write CSS manually.
263
- - **Panel**: Limited theme options.
264
- - **Violit**: 30+ ready-to-use expert themes 💜
265
-
266
- ---
267
-
268
- ## 🚀 Quick Start
269
-
270
- ### 1. Installation
271
-
272
- Install `violit` from PyPI. (Python 3.10+ required)
273
-
274
- ```bash
275
- pip install violit
276
-
277
- # Or development version
278
- pip install git+https://github.com/yourusername/violit.git
279
- ```
280
-
281
- ### 2. Hello, Violit!
282
-
283
- Create a `hello.py` file.
284
-
285
- ```python
286
- import violit as vl
287
-
288
- # Create Violit app instance
289
- app = vl.App(title="Hello Violit", theme='ocean')
290
-
291
- app.title("💜 Hello, Violit!")
292
- app.markdown("Experience the speed of **Zero Rerun**.")
293
-
294
- # Define State
295
- count = app.state(0)
296
-
297
- col1, col2 = app.columns(2)
298
-
299
- with col1:
300
- # Cleanly change value on click
301
- app.button("➕ Plus", on_click=lambda: [count.set(count.value + 1), app.balloons()])
302
-
303
- with col2:
304
- app.button("➖ Minus", on_click=lambda: count.set(count.value - 1))
305
-
306
- # Real-time reactive metric
307
- app.metric("Current Count", count)
308
-
309
- app.run()
310
- ```
311
-
312
- ### 3. Run
313
-
314
- Run in web browser mode or desktop app mode.
315
-
316
- ```bash
317
- # Run in Web Browser (Default: WebSocket Mode)
318
- python hello.py
319
-
320
- # Run in Lite Mode (For handling massive traffic)
321
- python hello.py --mode lite
322
-
323
- # 🖥️ Desktop App Mode (Highly Recommended!)
324
- python hello.py --native --splash
325
- ```
326
-
327
- ---
328
-
329
- ## 📊 Streamlit API Support Matrix
330
-
331
- Violit supports most major Streamlit APIs, improving some structures for better performance.
332
-
333
- ### 1. Text & Media Elements
334
- | Streamlit | Violit Support | Status | Note |
335
- |---|---|---|---|
336
- | `st.write` | `app.write` | ✅ | 100% Compatible (Signal/State auto-detect) |
337
- | `st.markdown` | `app.markdown` | ✅ | Markdown syntax supported |
338
- | `st.title`, `st.header` | `app.title`, `app.header` | ✅ | Gradient effects auto-applied |
339
- | `st.subheader`, `st.caption` | `app.subheader`, `app.caption` | ✅ | |
340
- | `st.code` | `app.code` | ✅ | Syntax Highlighting supported |
341
- | `st.text` | `app.text` | ✅ | |
342
- | `st.latex` | `app.latex` | ❌ | Recommend using Markdown math `$..$` |
343
- | `st.divider` | `app.divider` | ✅ | |
344
- | `st.image` | `app.image` | ✅ | URL, Local File, NumPy, PIL supported |
345
- | `st.audio`, `st.video` | `app.audio`, `app.video` | ✅ | |
346
-
347
- ### 2. Data & Charts
348
- | Streamlit | Violit Support | Status | Note |
349
- |---|---|---|---|
350
- | `st.dataframe` | `app.dataframe` | ✅ | **Ag-Grid Native** (High Performance) |
351
- | `st.table` | `app.table` | ✅ | |
352
- | `st.metric` | `app.metric` | ✅ | Supports `delta` and auto-color |
353
- | `st.json` | `app.json` | ✅ | |
354
- | `st.data_editor` | `app.data_editor` | ✅ | Simplified version provided |
355
- | `st.plotly_chart` | `app.plotly_chart` | ✅ | Full Plotly compatibility |
356
- | `st.pyplot` | `app.pyplot` | ✅ | Matplotlib supported |
357
- | `st.line/bar/area_chart` | `app.line_chart` etc. | ✅ | |
358
- | `st.scatter_chart` | `app.scatter_chart` | ✅ | |
359
- | `st.map` | `app.map` | ❌ | Recommend Mapbox via `plotly_chart` |
360
-
361
- ### 3. Input Widgets
362
- | Streamlit | Violit Support | Status | Note |
363
- |---|---|---|---|
364
- | `st.button` | `app.button` | ✅ | `key` not needed, `on_click` recommended |
365
- | `st.download_button` | `app.download_button` | ✅ | |
366
- | `st.link_button` | `app.link_button` | ✅ | |
367
- | `st.text_input` | `app.text_input` | ✅ | |
368
- | `st.number_input` | `app.number_input` | ✅ | |
369
- | `st.text_area` | `app.text_area` | ✅ | |
370
- | `st.checkbox`, `st.toggle` | `app.checkbox`, `app.toggle` | ✅ | |
371
- | `st.radio` | `app.radio` | ✅ | |
372
- | `st.selectbox` | `app.selectbox` | ✅ | |
373
- | `st.multiselect` | `app.multiselect` | ✅ | |
374
- | `st.slider` | `app.slider` | ✅ | |
375
- | `st.date/time_input` | `app.date_input` etc. | ✅ | |
376
- | `st.file_uploader` | `app.file_uploader` | ✅ | |
377
- | `st.color_picker` | `app.color_picker` | ✅ | |
378
- | `st.camera_input` | `app.camera_input` | ❌ | Not supported |
379
-
380
- ### 4. Layout & Containers
381
- | Streamlit | Violit Support | Status | Note |
382
- |---|---|---|---|
383
- | `st.columns` | `app.columns` | ✅ | List ratios supported (e.g., `[1, 2, 1]`) |
384
- | `st.container` | `app.container` | ✅ | |
385
- | `st.expander` | `app.expander` | ✅ | |
386
- | `st.tabs` | `app.tabs` | ✅ | |
387
- | `st.empty` | `app.empty` | ✅ | For dynamic updates |
388
- | `st.sidebar` | `app.sidebar` | ✅ | Use `with app.sidebar:` syntax |
389
- | `st.dialog` | `app.dialog` | ✅ | Modal Decorator supported |
390
- | `st.popover` | `app.popover` | ❌ | Recommend using `app.dialog` |
391
-
392
- ### 5. Chat & Status
393
- | Streamlit | Violit Support | Status | Note |
394
- |---|---|---|---|
395
- | `st.chat_message` | `app.chat_message` | ✅ | Avatar supported |
396
- | `st.chat_input` | `app.chat_input` | ✅ | |
397
- | `st.status` | `app.status` | ✅ | |
398
- | `st.spinner` | `app.spinner` | ✅ | |
399
- | `st.progress` | `app.progress` | ✅ | |
400
- | `st.toast` | `app.toast` | ✅ | |
401
- | `st.balloons`, `st.snow` | `app.balloons` etc. | ✅ | |
402
- | `st.success/error/warning` | `app.success` etc. | ✅ | |
403
-
404
- ### 6. Control Flow (Removed)
405
- | Streamlit | Violit Approach | Note |
406
- |---|---|---|
407
- | `st.rerun` | **Unnecessary** | Instant partial update on State change (Zero Rerun) |
408
- | `st.stop` | **Unnecessary** | Handle with Python flow control (`return`, etc.) |
409
- | `st.form` | `app.form` | ✅ Supported (For batch input) |
410
-
411
- ---
412
-
413
- ## 🔌 Third-Party Library Support
414
-
415
- Violit is absorbing the features of popular Streamlit third-party libraries **natively**.
416
-
417
- | Library | Violit Status | Description |
418
- |---|---|---|
419
- | **streamlit-aggrid** | ✅ **Native** | `app.dataframe` natively uses high-performance AG-Grid. No separate install needed. |
420
- | **Plotly** | ✅ **Native** | Perfectly supported via `app.plotly_chart`. |
421
- | **streamlit-lottie** | ❌ **Planned** | Currently unsupported (Will add `app.lottie`). |
422
- | **streamlit-option-menu** | ✅ **Native** | Built-in Sidebar perfectly replaces Multi-page Navigation. |
423
- | **streamlit-extras** | ⚠️ **Partial** | Some design elements like Metric Cards can be replaced with Violit's theme system. |
424
- | **streamlit-webrtc** | ⚠️ **Planned** | Planned support via WebSocket-based real-time communication. |
425
-
426
- ### 🎁 Violit Exclusive Features
427
-
428
- Unique features found only in Violit, not in Streamlit:
429
- - **Broadcasting API**: Real-time multi-user synchronization (`app.broadcaster`)
430
- - **Card List**: Auto-managed dynamic list UI (`app.card_list`)
431
- - **Desktop Mode**: Instant desktop app via `--native` flag
432
- - **Hot Reload**: Auto-refresh on code change (Dev mode)
433
- - **Animation Modes**: Smooth page transitions (`animation_mode='soft'`)
434
-
435
- ---
436
-
437
- ## 🛠️ Tech Stack
438
-
439
- Violit combines modern web technologies with the power of Python.
440
-
441
- * **Backend**: FastAPI (Async Python) - High-performance async processing
442
- * **Frontend**: Web Components (Shoelace) - Modern UI components
443
- * **Protocol**: WebSocket (default) & HTTP/HTMX (lite mode) - Hybrid choice
444
- * **State**: Signal-based Reactivity - Solid.js style fine-grained reactivity
445
- * **Charts**: Plotly.js - Interactive charts
446
- * **Data Grid**: AG-Grid - Enterprise-grade data tables
447
- * **Desktop**: pywebview - Lightweight desktop apps without Electron
448
-
449
- ### 📦 Zero Dependencies Bloat
450
-
451
- Unlike other frameworks, Violit:
452
- - ❌ No Node.js required (Unlike Reflex)
453
- - ❌ No React/Vue build required (Pure Web Components)
454
- - ❌ No complex compilation steps
455
- - ✅ Just Python and pip!
456
-
457
- ---
458
-
459
- ## 📂 Project Structure
460
-
461
- ```bash
462
- .
463
- ├── demo_*.py # Various demo applications
464
- ├── violit/ # Framework source code
465
- │ ├── app.py # Main App class & entry point
466
- │ ├── broadcast.py # Real-time WebSocket broadcasting
467
- │ ├── state.py # Reactive State engine
468
- │ ├── theme.py # Theme management
469
- │ ├── assets/ # Built-in static files
470
- │ └── widgets/ # Widget implementations
471
- │ ├── input_widgets.py
472
- │ ├── data_widgets.py
473
- │ ├── layout_widgets.py
474
- │ └── ...
475
- └── requirements.txt # Dependencies
476
- ```
477
-
478
- ---
479
-
480
- ## 🤝 Contributing
481
-
482
- **Violit** is an open-source project. Let's build the future of faster, more beautiful Python UI together.
483
-
484
- 1. Fork this repository
485
- 2. Create your feature branch (`git checkout -b feature/amazing`)
486
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
487
- 4. Push to the branch (`git push origin feature/amazing`)
488
- 5. Open a Pull Request
489
-
490
- ---
491
-
492
- ## 📝 License
493
-
494
- MIT License
495
-
496
- ---
497
-
498
-
499
-
500
- <p align="center">
501
- <strong>Made with 💜 by the Violit Team</strong>
502
- <br>
503
- <em>Faster than Light, Beautiful as Violet.</em>
504
- </p>