Backend-first SPA framework in Python.
Project description
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.
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
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 lua_spa-1.2.1.tar.gz.
File metadata
- Download URL: lua_spa-1.2.1.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65b346ab6d1db2f61f1a1d48a95b69179bde3a6382cbdcf55e399c497ad01348
|
|
| MD5 |
b8056d6b1c6c4b00b8529b4603712b6b
|
|
| BLAKE2b-256 |
49d251696f10d63620a73fdea6aee924aaf75f54baa3b0f2c048fee67bb583c9
|
Provenance
The following attestation bundles were made for lua_spa-1.2.1.tar.gz:
Publisher:
release-and-deploy.yaml on roderiano/lua-spa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lua_spa-1.2.1.tar.gz -
Subject digest:
65b346ab6d1db2f61f1a1d48a95b69179bde3a6382cbdcf55e399c497ad01348 - Sigstore transparency entry: 1510455263
- Sigstore integration time:
-
Permalink:
roderiano/lua-spa@104c449587e6e0fb1ec1a79f137a5bceb48ecf18 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/roderiano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-and-deploy.yaml@104c449587e6e0fb1ec1a79f137a5bceb48ecf18 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lua_spa-1.2.1-py3-none-any.whl.
File metadata
- Download URL: lua_spa-1.2.1-py3-none-any.whl
- Upload date:
- Size: 2.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad030cdff9c5b3cf2163aa0f29b8232042b5ac242ee6c8de3411fb4649365fdb
|
|
| MD5 |
8a54c7bf19af393fa688f454d3aa8bd1
|
|
| BLAKE2b-256 |
e5ec84f670cfb708337aba75b5edcfcfc512c3f498acc5c2da4de6b55298f6f8
|
Provenance
The following attestation bundles were made for lua_spa-1.2.1-py3-none-any.whl:
Publisher:
release-and-deploy.yaml on roderiano/lua-spa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lua_spa-1.2.1-py3-none-any.whl -
Subject digest:
ad030cdff9c5b3cf2163aa0f29b8232042b5ac242ee6c8de3411fb4649365fdb - Sigstore transparency entry: 1510455474
- Sigstore integration time:
-
Permalink:
roderiano/lua-spa@104c449587e6e0fb1ec1a79f137a5bceb48ecf18 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/roderiano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-and-deploy.yaml@104c449587e6e0fb1ec1a79f137a5bceb48ecf18 -
Trigger Event:
push
-
Statement type: