violit 0.0.3__tar.gz

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.
Files changed (31) hide show
  1. violit-0.0.3/LICENSE +21 -0
  2. violit-0.0.3/PKG-INFO +397 -0
  3. violit-0.0.3/README.md +356 -0
  4. violit-0.0.3/pyproject.toml +67 -0
  5. violit-0.0.3/setup.cfg +4 -0
  6. violit-0.0.3/src/violit/__init__.py +3 -0
  7. violit-0.0.3/src/violit/app.py +1988 -0
  8. violit-0.0.3/src/violit/broadcast.py +690 -0
  9. violit-0.0.3/src/violit/broadcast_primitives.py +197 -0
  10. violit-0.0.3/src/violit/component.py +38 -0
  11. violit-0.0.3/src/violit/context.py +10 -0
  12. violit-0.0.3/src/violit/engine.py +46 -0
  13. violit-0.0.3/src/violit/state.py +76 -0
  14. violit-0.0.3/src/violit/theme.py +749 -0
  15. violit-0.0.3/src/violit/widgets/__init__.py +30 -0
  16. violit-0.0.3/src/violit/widgets/card_widgets.py +595 -0
  17. violit-0.0.3/src/violit/widgets/chart_widgets.py +253 -0
  18. violit-0.0.3/src/violit/widgets/chat_widgets.py +222 -0
  19. violit-0.0.3/src/violit/widgets/data_widgets.py +529 -0
  20. violit-0.0.3/src/violit/widgets/form_widgets.py +421 -0
  21. violit-0.0.3/src/violit/widgets/input_widgets.py +745 -0
  22. violit-0.0.3/src/violit/widgets/layout_widgets.py +419 -0
  23. violit-0.0.3/src/violit/widgets/list_widgets.py +107 -0
  24. violit-0.0.3/src/violit/widgets/media_widgets.py +173 -0
  25. violit-0.0.3/src/violit/widgets/status_widgets.py +255 -0
  26. violit-0.0.3/src/violit/widgets/text_widgets.py +413 -0
  27. violit-0.0.3/src/violit.egg-info/PKG-INFO +397 -0
  28. violit-0.0.3/src/violit.egg-info/SOURCES.txt +29 -0
  29. violit-0.0.3/src/violit.egg-info/dependency_links.txt +1 -0
  30. violit-0.0.3/src/violit.egg-info/requires.txt +12 -0
  31. violit-0.0.3/src/violit.egg-info/top_level.txt +1 -0
violit-0.0.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Violit Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
violit-0.0.3/PKG-INFO ADDED
@@ -0,0 +1,397 @@
1
+ Metadata-Version: 2.4
2
+ Name: violit
3
+ Version: 0.0.3
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
+ <p align="center">
43
+ <img src="./assets/violit_glare_small.png" alt="Violitβ„’ Logo" width=80%>
44
+ </p>
45
+
46
+
47
+ # πŸ’œ Violit
48
+
49
+ > **"Faster than Light, Beautiful as Violet."**
50
+ > **Structure of Streamlit Γ— Performance of React**
51
+
52
+ **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.
53
+
54
+ Build applications that react at the speed of light with the most elegant syntax.
55
+
56
+ <p align="center">
57
+ <img src="https://img.shields.io/pypi/v/violit?color=blueviolet&style=flat-square&ignore=cache" alt="PyPI">
58
+ <img src="https://img.shields.io/badge/Python-3.10+-blue.svg?style=flat-square" alt="Python 3.10+">
59
+ <img src="https://img.shields.io/badge/License-MIT-green.svg?style=flat-square" alt="MIT License">
60
+ <img src="https://img.shields.io/badge/Framework-FastAPI-009688.svg?style=flat-square" alt="FastAPI">
61
+ <img src="https://img.shields.io/badge/UI-Shoelace-7C4DFF.svg?style=flat-square" alt="Shoelace">
62
+ </p>
63
+
64
+ ---
65
+
66
+ ## πŸ“Έ Demo
67
+
68
+ *A dashboard built with Violit running in real-time.*
69
+
70
+ <p align="center">
71
+ <img src="./assets/demo_show_main_small.gif" alt="Violit Showcase Demo" width=60%>
72
+ </p>
73
+
74
+
75
+ ---
76
+
77
+ ## ⚑ Why Violit?
78
+
79
+ ### Architectural Differences
80
+
81
+ Violit and Streamlit are similar in that they build UIs with Python code, but their internal mechanisms are fundamentally different.
82
+
83
+ | Feature | Streamlit (Traditional) | **Violit (Reactive)** |
84
+ | --- | --- | --- |
85
+ | **Execution Model** | **Full Rerun (O(N))**<br>Reruns the entire script on every user interaction. | **Zero Rerun (O(1))**<br>Updates only the components connected to the modified State. |
86
+ | **Performance** | Response speed may degrade as data size increases. | Maintains consistent reactivity regardless of data scale. |
87
+ | **Optimization** | Requires optimization decorators like `@cache`, `@fragment`. | Optimized by design without extra optimization code. |
88
+ | **Deployment** | Optimized for web browser execution. | Supports both Web Browser and **Desktop Native App** modes. |
89
+ | **Design** | Focuses on providing basic UI. | Provides ready-to-use designs with **30+ professional themes**. |
90
+
91
+ ### Key Features
92
+
93
+ 1. **Optimization by Design (Streamlit-Like Syntax, No Complexity)**:
94
+ Streamlit's intuitive syntax is maintained, but complex optimization tools are removed at the architecture level.
95
+ * ❌ **No `@cache_data`, `@fragment`, `st.rerun`**: Thanks to the O(1) structure, manual optimization is unnecessary.
96
+ * ❌ **No `key` Management**: No need to manually specify unique keys for widget state management.
97
+ * ❌ **No Complex Callbacks**: No need to define complex callbacks/classes like Dash or Panel.
98
+
99
+ 2. **Ultra-Fast Speed**: Even if you move the slider in 0.1s increments, the chart reacts in real-time without stuttering.
100
+
101
+ 3. **Hybrid Runtime**:
102
+ * **WebSocket Mode**: Ultra-low latency bidirectional communication (Default)
103
+ * **Lite Mode**: HTTP-based, advantageous for handling large-scale concurrent connections
104
+
105
+ 4. **Desktop Mode**: Can run as a perfect desktop application without Electron using the `--native` option.
106
+
107
+ ---
108
+
109
+ ## 🎨 Theme Gallery
110
+
111
+ You don't need to know CSS at all. Violit provides over 30 themes. (Soon, users will be able to easily add Custom Themes.)
112
+
113
+ *Theme demo will be updated soon.*
114
+
115
+ ![Theme Gallery Grid](PLACEHOLDER_FOR_THEME_GALLERY_GRID)
116
+
117
+ ```python
118
+ # Configuration at initialization
119
+ app = vl.App(theme='cyberpunk')
120
+
121
+ # Runtime change
122
+ app.set_theme('ocean')
123
+ ```
124
+
125
+ | Theme Family | Examples |
126
+ | --- | --- |
127
+ | **Dark πŸŒ‘** | `dark`, `dracula`, `monokai`, `ocean`, `forest`, `sunset` |
128
+ | **Light β˜€οΈ** | `light`, `pastel`, `retro`, `nord`, `soft_neu` |
129
+ | **Tech πŸ€–** | `cyberpunk`, `terminal`, `cyber_hud`, `blueprint` |
130
+ | **Professional πŸ’Ό** | `editorial`, `bootstrap`, `ant`, `material`, `lg_innotek` |
131
+
132
+ ---
133
+
134
+ ## πŸ“ˆ Benchmarks & Performance
135
+
136
+ Benchmark results showing how efficient Violit's O(1) update method is compared to the existing O(N) method.
137
+
138
+
139
+
140
+ *Detailed benchmark data will be updated soon.*
141
+
142
+ ![Benchmark Chart](PLACEHOLDER_FOR_BENCHMARK_CHART)
143
+
144
+
145
+ ---
146
+
147
+ ## πŸš€ Comparison
148
+
149
+ ### Python UI Frameworks
150
+
151
+ | Framework | Architecture | Learning Curve | Performance | Desktop App | Real-time |
152
+ |-----------|---------|----------|---------|------------|------------|
153
+ | **Streamlit** | Full Rerun | Very Easy | Slow | ❌ | β–³ |
154
+ | **Dash** | Callback | Medium | Fast | ❌ | β–³ |
155
+ | **Panel** | Param | Hard | Fast | ❌ | βœ… |
156
+ | **Reflex** | React (Compile) | Hard | Fast | ❌ | βœ… |
157
+ | **NiceGUI** | Vue | Easy | Fast | βœ… | βœ… |
158
+ | **Violit** | **Signal** | **Very Easy** | **Fast** | **βœ…** | **βœ…** |
159
+
160
+ ### Code Comparison
161
+
162
+ #### **1. vs Streamlit** (Rerun vs Signal)
163
+ *Streamlit re-executes the **entire script** on button click, but Violit executes only **that function**.*
164
+
165
+ ```python
166
+ # Streamlit
167
+ import streamlit as st
168
+
169
+ if "count" not in st.session_state:
170
+ st.session_state.count = 0
171
+
172
+ if st.button("Click"):
173
+ st.session_state.count += 1 # Rerun triggers here
174
+
175
+ st.write(st.session_state.count)
176
+ ```
177
+
178
+ ```python
179
+ # Violit
180
+ import violit as vl
181
+ app = vl.App()
182
+
183
+ count = app.state(0)
184
+
185
+ # Update only count on click (No Rerun)
186
+ app.button("Click", on_click=lambda: count.set(count.value + 1))
187
+ app.write(count)
188
+ ```
189
+
190
+ #### **2. vs Dash** (Callback Hell vs Auto-Reactivity)
191
+ *Dash requires complex **Callbacks** connecting Input/Output, but Violit only needs a single **State**.*
192
+
193
+ ```python
194
+ # Dash
195
+ from dash import Dash, html, Input, Output, callback
196
+
197
+ app = Dash(__name__)
198
+ app.layout = html.Div([
199
+ html.Button("Click", id="btn"),
200
+ html.Div(id="out")
201
+ ])
202
+
203
+ @callback(Output("out", "children"), Input("btn", "n_clicks"))
204
+ def update(n):
205
+ return f"Value: {n}" if n else "Value: 0"
206
+ ```
207
+
208
+ ```python
209
+ # Violit
210
+ count = app.state(0)
211
+
212
+ app.button("Click", on_click=lambda: count.set(count.value + 1))
213
+ # Automatic state dependency tracking -> No Callback needed
214
+ app.write(lambda: f"Value: {count.value}")
215
+ ```
216
+
217
+ #### **3. vs NiceGUI** (Binding vs Direct State)
218
+ *NiceGUI is also great, but Violit offers a **more concise syntax** in the style of Streamlit.*
219
+
220
+ ```python
221
+ # NiceGUI
222
+ from nicegui import ui
223
+
224
+ count = {'val': 0}
225
+ ui.button('Click', on_click=lambda: count.update(val=count['val'] + 1))
226
+ ui.label().bind_text_from(count, 'val', backward=lambda x: f'Value: {x}')
227
+ ```
228
+
229
+ ```python
230
+ # Violit
231
+ count = app.state(0)
232
+ app.button('Click', on_click=lambda: count.set(count.value + 1))
233
+ app.write(count) # No need for complex connections like .bind_text
234
+ ```
235
+
236
+ #### **4. vs Reflex** (Class & Compile vs Pure Python)
237
+ *Reflex requires State **class definition** and **compilation**, but Violit is a **pure Python** script.*
238
+
239
+ ```python
240
+ # Reflex
241
+ import reflex as rx
242
+
243
+ class State(rx.State):
244
+ count: int = 0
245
+ def increment(self):
246
+ self.count += 1
247
+
248
+ def index():
249
+ return rx.vstack(
250
+ rx.button("Click", on_click=State.increment),
251
+ rx.text(State.count)
252
+ )
253
+ ```
254
+
255
+ ```python
256
+ # Violit
257
+ # No class definition needed, no compilation needed
258
+ count = app.state(0)
259
+ app.button("Click", on_click=lambda: count.set(count.value + 1))
260
+ app.write(count)
261
+ ```
262
+
263
+ ---
264
+
265
+ ## πŸš€ Quick Start
266
+
267
+ ### 1. Installation
268
+
269
+ Can be installed in Python 3.10+ environments.
270
+
271
+ ```bash
272
+ pip install violit
273
+
274
+ # Or development version
275
+ pip install git+https://github.com/violit-dev/violit.git
276
+ ```
277
+
278
+
279
+ ### 2. Hello, Violit!
280
+
281
+ Create a `hello.py` file.
282
+
283
+ ```python
284
+ import violit as vl
285
+
286
+ app = vl.App(title="Hello Violit", theme='ocean')
287
+
288
+ app.title("πŸ’œ Hello, Violit!")
289
+ app.markdown("Experience the speed of **Zero Rerun**.")
290
+
291
+ count = app.state(0)
292
+
293
+ col1, col2 = app.columns(2)
294
+ with col1:
295
+ app.button("βž• Plus", on_click=lambda: count.set(count.value + 1))
296
+ with col2:
297
+ app.button("βž– Minus", on_click=lambda: count.set(count.value - 1))
298
+
299
+ app.metric("Current Count", count)
300
+
301
+ app.run()
302
+ ```
303
+
304
+ ### 3. Execution
305
+
306
+ ```bash
307
+ # Basic run (WebSocket Mode)
308
+ python hello.py
309
+
310
+ # Desktop App Mode (Recommended)
311
+ python hello.py --native
312
+
313
+ # Port configuration
314
+ python hello.py --port 8020
315
+ ```
316
+
317
+ ---
318
+
319
+ ## πŸ“š Widget Support
320
+
321
+ Violit supports core Streamlit widgets, and some features have been redesigned for greater efficiency.
322
+
323
+ For a detailed compatibility list and information on unsupported widgets, please refer to the [Streamlit API Support Matrix](./doc/Streamlit%20API%20Support%20Matrix.md) document.
324
+
325
+ ---
326
+
327
+ ## πŸ› οΈ Tech Stack
328
+
329
+ * **Backend**: FastAPI (Async Python)
330
+ * **Frontend**: Web Components (Shoelace), Plotly.js, AG-Grid
331
+ * **Protocol**: WebSocket & HTTP/HTMX Hybrid
332
+ * **State**: Signal-based Reactivity
333
+
334
+ ---
335
+
336
+ ## πŸ—ΊοΈ Roadmap
337
+
338
+ Violit is continuously evolving.
339
+
340
+ * βœ… **Core**: Signal State Engine, Theme System
341
+ * βœ… **Widgets**: Plotly, Dataframe, Input Widgets
342
+ * ⏳ **Homepage**: Official Homepage Open
343
+ * ⏳ **Documentation**: Official Technical Documentation and API Reference Update
344
+ * ⏳ **Custom Components**: User-defined Custom Component Support
345
+ * ⏳ **Custom Theme**: User-defined Custom Theme Support
346
+ * ⏳ **async**: Async processing support
347
+ * ⏳ **More examples**: Provide more real-world usable example code
348
+ * ⏳ **Violit.Cloud**: Cloud deployment service
349
+ * ⏳ **Expansion**: Integration of more third-party libraries
350
+
351
+ ---
352
+
353
+ ## πŸ“‚ Project Structure
354
+
355
+ ```bash
356
+ .
357
+ β”œβ”€β”€ violit/ # Framework source code
358
+ β”‚ β”œβ”€β”€ app.py # Main App class and entry point
359
+ β”‚ β”œβ”€β”€ broadcast.py # Real-time WebSocket broadcasting
360
+ β”‚ β”œβ”€β”€ state.py # Reactive State Engine
361
+ β”‚ β”œβ”€β”€ theme.py # Theme management
362
+ β”‚ β”œβ”€β”€ assets/ # Built-in static files
363
+ β”‚ └── widgets/ # Widget implementations
364
+ β”‚ β”œβ”€β”€ input_widgets.py
365
+ β”‚ β”œβ”€β”€ data_widgets.py
366
+ β”‚ β”œβ”€β”€ layout_widgets.py
367
+ β”‚ └── ...
368
+ └── requirements.txt # Dependency list
369
+ ```
370
+
371
+ ---
372
+
373
+ ## 🀝 Contributing
374
+
375
+ **Violit** is an open-source project. Let's build the future of faster and more beautiful Python UIs together.
376
+
377
+ 1. Fork this repository
378
+ 2. Create your feature branch
379
+ 3. Commit your changes
380
+ 4. Push to the branch
381
+ 5. Open a Pull Request
382
+
383
+ ---
384
+
385
+ ## πŸ“ License
386
+
387
+ MIT License
388
+
389
+ **Violitβ„’ is a trademark of The Violit Team.**
390
+
391
+ ---
392
+
393
+ <p align="center">
394
+ <strong>Made with πŸ’œ by the Violit Team</strong>
395
+ <br>
396
+ <em>Faster than Light, Beautiful as Violet.</em>
397
+ </p>