Skip to main content

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 (.vpx files).
  • 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 volta command 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 (in volta.router).

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

volta_framework-0.1.2.tar.gz (130.2 kB view details)

Uploaded Source

Built Distribution

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

volta_framework-0.1.2-py3-none-any.whl (68.4 kB view details)

Uploaded Python 3

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

Hashes for volta_framework-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8f3452b1ba57e2859d67b09be6fbacb32881a6afb9f5383c653ce80e32980818
MD5 b2930f43942cff57a9e690549f64dc70
BLAKE2b-256 d33afdb897d97fb15033c444ca19bd0d244c0b2207650e65274117145209ecad

See more details on using hashes here.

File details

Details for the file volta_framework-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for volta_framework-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c39004bee43a79b670b02d2f7df68516ea3e834a32902f53d475b8c275757d9
MD5 f277f5908aadab14ca5485e8f48b4caa
BLAKE2b-256 8878e8c02057d3761257bbc7549288e12a20424d97569cc3c0232813ab20ee74

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