A Python UI framework mimicking React
Project description
Volta Framework
Volta is a modern, React-inspired UI framework for Python. It allows you to build component-based user interfaces using Python functions, Hooks, and a JSX-like syntax (.vpx).
Features
- Component-Based: Build UI using functional components.
- JSX-like Syntax: Write XML-like markup directly in Python (
.vpxfiles). - Hooks API: Manage state and side effects with
use_state,use_effect,use_ref,use_context, etc. - Server-Side Rendering (SSR): Renders to valid HTML strings out of the box.
- CLI Tooling: robust
voltacommand for dev server, building, and running. - Hot Reloading: Instant feedback during development.
Installation
pip install volta-framework
(Or install from source with pip install -e .)
Quick Start
1. Create a Project
Initialize a new project structure:
volta init my-app
cd my-app
2. Run Development Server
Start the hot-reloading dev server:
volta dev
Open http://localhost:3000 to see your app.
Writing Components
Volta components are just Python functions that return elements.
App.vpx:
from volta import use_state
def Counter():
count, set_count = use_state(0)
return (
<div>
<p>Count: {count}</p>
<button onClick={lambda: set_count(count + 1)}>Increment</button>
</div>
)
def App():
return (
<div>
<h1>Welcome to Volta</h1>
<Counter />
</div>
)
CLI Reference
volta init [name]: Create a new project.volta dev [--port]: Start dev server with hot reload.volta run <file.vpx>: Execute a .vpx file directly.volta build <file.vpx>: Transpile a .vpx file to .py.volta clean: Remove cached artifacts.
Advanced Features
- Context API:
create_context,use_context. - Refs:
use_ref. - Memoization:
use_memo,use_callback. - Routing: Built-in
Router,Route,Link(involta.router).
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 volta_framework-0.1.2.tar.gz.
File metadata
- Download URL: volta_framework-0.1.2.tar.gz
- Upload date:
- Size: 130.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f3452b1ba57e2859d67b09be6fbacb32881a6afb9f5383c653ce80e32980818
|
|
| MD5 |
b2930f43942cff57a9e690549f64dc70
|
|
| BLAKE2b-256 |
d33afdb897d97fb15033c444ca19bd0d244c0b2207650e65274117145209ecad
|
File details
Details for the file volta_framework-0.1.2-py3-none-any.whl.
File metadata
- Download URL: volta_framework-0.1.2-py3-none-any.whl
- Upload date:
- Size: 68.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c39004bee43a79b670b02d2f7df68516ea3e834a32902f53d475b8c275757d9
|
|
| MD5 |
f277f5908aadab14ca5485e8f48b4caa
|
|
| BLAKE2b-256 |
8878e8c02057d3761257bbc7549288e12a20424d97569cc3c0232813ab20ee74
|