Skip to main content

A lightning-fast, opinionated web framework with a high-performance Zig substrate

Project description

Volt ⚡

An opinionated, lightning-fast ASGI-based Python web framework with rich and expressive Developer Experience.

Installation

pip install volt-framework

Vision

Why Volt?

  • Create easy SPA-like applications - Built with HTMX in mind, you can create high quality, responsive applications, without a separate frontend
  • Type-safe templating - The Jinja templating you know and love, with the power to generate type safe dataclass components for template context
  • Batteries included - Everything you need for modern web development in one package
  • Simple developer experience - One command to run, deploy, and scale

Quick Start

import logging

from volt import Request, Response, Volt, config, http
from custom_types import NavSelected
from components import Home

log = logging.getLogger()
app = Volt()

# Easily wrap your handlers in middleware!
@app.middleware
async def logging_middleware(request, handler):
    start = time.time()
    response = await handler(request)
    end = time.time() - start
    log.info(f"Request - Path: {request.path}, Time: {end * 1_000 * 1_000}μs")
    return response

# Routes and handlers are simple to define
@app.route("/", method="GET")
def root(request: HttpRequest) -> HttpResponse:
    context = Home.Context(
        request=request,
        selected=NavSelected.HOME,  # HTMX Powered!
    )
    return http.Response(
        Home(context).render(request),
    )


if __name__ == "__main__":
    uvicorn.run(...)

Platform Support:

  • ✅ Linux
  • ✅ macOS
  • ✅ Windows

Why ASGI?

WSGI servers limit your web application to one request being handled at a time, to completion. ASGI supercharges your handlers, leveraging Pythons asynchronous capabilities, enabling efficient task switching across handlers, across requests! Learn more here

Current Status

⚠️ Alpha Release - Volt is in early development. Core functionality is well underway, but Volt is not production-ready just yet. Keep an eye out for a 1.x release!

Working:

  • HTTP server and request routing
  • Custom middleware support
  • Header handling
  • Static file serving
  • Built-in templating engine
  • Template component generation

Coming Soon:

  • ORM integration
  • Advanced middleware (CSRF, CORS, etc.)
  • Production deployment tools

Philosophy

Volt is opinionated by design. Like Django, we believe in convention over configuration, but we take it further - aiming to make it as simple as possible to create a production ready SPA-like web application that is a delight to work on, and doesn't compromise.

Volt gives you the full stack in one package, optimized from the ground up.


Volt is in active development. Star this repo to follow progress.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

volt_framework-0.2.2-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file volt_framework-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: volt_framework-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for volt_framework-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1dbe5e90ffedad75b8ee62a8104f5d265b94b1a544afc90c0e9b3cb56b678d73
MD5 c6ae6a91c4db48cf9d81edb7684ae3d7
BLAKE2b-256 6e32136370c3aec66252b2deb882b478c792195846a201f93199337e29896fbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for volt_framework-0.2.2-py3-none-any.whl:

Publisher: pypi.yml on trkl-dev/volt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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