LUA-SPA
Backend-first SPA framework in Python.
This project includes:
- LuaTemplate file served by the backend
.lspacomponents (HTML + Python) with component import support- Client hydration at component level
- DOM diff renderer inspired by React's virtual DOM flow
useStatehook-style state management- Setup-only component contract via
Component.setup(self, props) - Server-call bridge for callable actions and lifecycle hooks
- Base app definitions isolated in
src/lua_template/spa.config.json
Requirements
- Python 3.10+
- Poetry installed
How to use
Install locally (development)
poetry install
Create a new project
lua-spa create my_project
lua-spa create my_project ./apps
Create a component from template
lua-spa new component UserCard
lua-spa new component UserCard ./apps/my_project
The CLI copies ComponentTemplate, renames files/content, and prints the exact created paths.
Run the application
poetry run lua-spa serve
Enable hot reload:
poetry run lua-spa serve --reload
When reload is enabled, watcher logs use relative paths:
Live reload activated. Watching src for file changes...
Open in browser:
http://127.0.0.1:8000
Documentation
Docs are available in the docs/ directory:
Run locally:
cd docs
npx docusaurus start
Project Structure
lua-spa/
pyproject.toml
src/
lua_spa/
app.py
codegen.py
framework.py
loader.py
main.py
renderer.py
router.py
scope.py
server.py
runtime_assets.py
lua_template/
index.lspa
spa.config.json
components/
tests/
Tests
poetry run pytest
With coverage:
poetry run pytest --cov=src/lua_spa --cov-report=term
Component Format
Components are .lspa files composed of:
- optional imports
<python>block with aComponentsubclass implementingsetup(self, props)<template>block (HTML)
setup(self, props) can return a mapping with props, state, data, actions, and lifecycle,
or omit return and let the server infer these sections from local variables/functions.
Callable actions and lifecycle entries are executed through the POST /__lua_spa_action bridge.
When actions/lifecycle mutate data, those keys are patched back to client props automatically.
Metadata
Release files for lua-spa 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lua_spa-1.2.1.tar.gz | 2.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lua_spa-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.6 MB
Release files / lua_spa-1.2.1.tar.gz
| Download URL | lua_spa-1.2.1.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65b346ab6d1db2f61f1a1d48a95b69179bde3a6382cbdcf55e399c497ad01348
|
|
BLAKE2b-256 checksum How to use checksums |
49d251696f10d63620a73fdea6aee924aaf75f54baa3b0f2c048fee67bb583c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logRelease files / lua_spa-1.2.1-py3-none-any.whl
| Download URL | lua_spa-1.2.1-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad030cdff9c5b3cf2163aa0f29b8232042b5ac242ee6c8de3411fb4649365fdb
|
|
BLAKE2b-256 checksum How to use checksums |
e5ec84f670cfb708337aba75b5edcfcfc512c3f498acc5c2da4de6b55298f6f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency log