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.0.tar.gz (29.4 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.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file volta_framework-0.1.0.tar.gz.

File metadata

  • Download URL: volta_framework-0.1.0.tar.gz
  • Upload date:
  • Size: 29.4 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.0.tar.gz
Algorithm Hash digest
SHA256 d377c9224c790b2ad2e67a87413660aa94412b8f8b167b7d4b0116f5b7eb4e6a
MD5 986006a03dc85b2a0371f00ddb5ce956
BLAKE2b-256 c084cfee2cdd48e3f987c6c90d0b13ab2c2805bbef32aa0b326af61391df584d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for volta_framework-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0825be74359043e14bc186e02e3c24f8b74005994903f75a7c76dd3879d71686
MD5 e5462b24f3b94c4c826cbe5fa326466b
BLAKE2b-256 aa72d24392150e329f031480157a4532f013bb02ed79a8ca01a9ec8b9efb37bb

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