vuka 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vuka-0.1.0/.github/workflows/docs.yml +70 -0
- vuka-0.1.0/.github/workflows/release.yml +146 -0
- vuka-0.1.0/.github/workflows/test.yml +24 -0
- vuka-0.1.0/.github/workflows/wheels.yml +82 -0
- vuka-0.1.0/.gitignore +11 -0
- vuka-0.1.0/CHANGELOG.md +110 -0
- vuka-0.1.0/LICENSE +21 -0
- vuka-0.1.0/PKG-INFO +185 -0
- vuka-0.1.0/README.md +138 -0
- vuka-0.1.0/RELEASING.md +141 -0
- vuka-0.1.0/bench/.gitignore +1 -0
- vuka-0.1.0/bench/BENCH.md +290 -0
- vuka-0.1.0/bench/Makefile +10 -0
- vuka-0.1.0/bench/driver/go.mod +5 -0
- vuka-0.1.0/bench/driver/go.sum +2 -0
- vuka-0.1.0/bench/driver/http.go +39 -0
- vuka-0.1.0/bench/driver/main.go +710 -0
- vuka-0.1.0/bench/driver/stubhost/main.go +325 -0
- vuka-0.1.0/bench/fixtures/go/.gitignore +3 -0
- vuka-0.1.0/bench/fixtures/go/feed/feed.go +11 -0
- vuka-0.1.0/bench/fixtures/go/go.mod +17 -0
- vuka-0.1.0/bench/fixtures/go/go.sum +56 -0
- vuka-0.1.0/bench/fixtures/go/main.go +68 -0
- vuka-0.1.0/bench/fixtures/go/pages/cached.vuka.html +38 -0
- vuka-0.1.0/bench/fixtures/go/pages/feed.vuka.html +66 -0
- vuka-0.1.0/bench/fixtures/go/pages/index.vuka.html +38 -0
- vuka-0.1.0/bench/fixtures/python/app.py +71 -0
- vuka-0.1.0/bench/fixtures/python/manifest.py +18 -0
- vuka-0.1.0/bench/fixtures/python/pages/cached.vuka.html +25 -0
- vuka-0.1.0/bench/fixtures/python/pages/feed.vuka.html +42 -0
- vuka-0.1.0/bench/fixtures/python/pages/index.vuka.html +24 -0
- vuka-0.1.0/bench/fixtures/python/pages/work.vuka.html +25 -0
- vuka-0.1.0/bench/fixtures/python-reads/.gitignore +1 -0
- vuka-0.1.0/bench/fixtures/python-reads/app.py +62 -0
- vuka-0.1.0/bench/fixtures/python-reads/pages/orders_host.vuka.html +24 -0
- vuka-0.1.0/bench/fixtures/python-reads/pages/orders_read.vuka.html +21 -0
- vuka-0.1.0/bench/reads.sh +91 -0
- vuka-0.1.0/bench/results/2026-12-02-m1pro.hostcalls.txt +15 -0
- vuka-0.1.0/bench/results/2026-12-02-m1pro.jsonl +130 -0
- vuka-0.1.0/bench/results/2026-12-02-m1pro.meta.txt +9 -0
- vuka-0.1.0/bench/results/2026-12-03-m1pro-cache.hostcalls.txt +15 -0
- vuka-0.1.0/bench/results/2026-12-03-m1pro-cache.jsonl +145 -0
- vuka-0.1.0/bench/results/2026-12-03-m1pro-cache.meta.txt +9 -0
- vuka-0.1.0/bench/results/2026-12-03-m1pro-reads.hostcalls.txt +10 -0
- vuka-0.1.0/bench/results/2026-12-03-m1pro-reads.jsonl +10 -0
- vuka-0.1.0/bench/results/2026-12-03-m1pro-reads.meta.txt +5 -0
- vuka-0.1.0/bench/run.sh +138 -0
- vuka-0.1.0/docs/.gitignore +3 -0
- vuka-0.1.0/docs/.vitepress/config.mts +107 -0
- vuka-0.1.0/docs/.vitepress/theme/custom.css +265 -0
- vuka-0.1.0/docs/.vitepress/theme/index.ts +14 -0
- vuka-0.1.0/docs/.vitepress/vuka-html.tmLanguage.json +36 -0
- vuka-0.1.0/docs/_parts/counter.md +25 -0
- vuka-0.1.0/docs/guide/apis.md +298 -0
- vuka-0.1.0/docs/guide/assets.md +78 -0
- vuka-0.1.0/docs/guide/cli.md +224 -0
- vuka-0.1.0/docs/guide/components.md +300 -0
- vuka-0.1.0/docs/guide/configuration.md +292 -0
- vuka-0.1.0/docs/guide/crons.md +143 -0
- vuka-0.1.0/docs/guide/databases.md +435 -0
- vuka-0.1.0/docs/guide/deferred.md +178 -0
- vuka-0.1.0/docs/guide/deploying.md +203 -0
- vuka-0.1.0/docs/guide/errors.md +255 -0
- vuka-0.1.0/docs/guide/forms.md +289 -0
- vuka-0.1.0/docs/guide/getting-started.md +243 -0
- vuka-0.1.0/docs/guide/how-it-works.md +196 -0
- vuka-0.1.0/docs/guide/layouts.md +221 -0
- vuka-0.1.0/docs/guide/pages.md +593 -0
- vuka-0.1.0/docs/guide/performance.md +347 -0
- vuka-0.1.0/docs/guide/services.md +301 -0
- vuka-0.1.0/docs/guide/streams.md +275 -0
- vuka-0.1.0/docs/guide/testing.md +363 -0
- vuka-0.1.0/docs/guide/users.md +371 -0
- vuka-0.1.0/docs/index.md +116 -0
- vuka-0.1.0/docs/package-lock.json +2343 -0
- vuka-0.1.0/docs/package.json +13 -0
- vuka-0.1.0/docs/public/logo.svg +62 -0
- vuka-0.1.0/docs/reference/index.md +175 -0
- vuka-0.1.0/docs/reference/limits.md +103 -0
- vuka-0.1.0/examples/counter/api.py +20 -0
- vuka-0.1.0/examples/counter/app.py +11 -0
- vuka-0.1.0/examples/counter/pages/feed.vuka.html +42 -0
- vuka-0.1.0/examples/counter/pages/index.vuka.html +24 -0
- vuka-0.1.0/examples/counter/ticker.py +25 -0
- vuka-0.1.0/examples/islands/app.py +4 -0
- vuka-0.1.0/examples/islands/islands/Counter.ts +32 -0
- vuka-0.1.0/examples/islands/pages/index.vuka.html +25 -0
- vuka-0.1.0/examples/kit/app.py +4 -0
- vuka-0.1.0/examples/kit/pages/index.vuka.html +48 -0
- vuka-0.1.0/examples/search/app.py +4 -0
- vuka-0.1.0/examples/search/pages/greet.vuka.html +18 -0
- vuka-0.1.0/examples/search/pages/index.vuka.html +39 -0
- vuka-0.1.0/examples/shop/app.py +7 -0
- vuka-0.1.0/examples/shop/errors/404.vuka.html +5 -0
- vuka-0.1.0/examples/shop/errors/default.vuka.html +4 -0
- vuka-0.1.0/examples/shop/guards.py +22 -0
- vuka-0.1.0/examples/shop/layouts/default.vuka.html +14 -0
- vuka-0.1.0/examples/shop/layouts/panel.vuka.html +1 -0
- vuka-0.1.0/examples/shop/orders.py +9 -0
- vuka-0.1.0/examples/shop/pages/account.vuka.html +12 -0
- vuka-0.1.0/examples/shop/pages/index.vuka.html +17 -0
- vuka-0.1.0/examples/shop/pages/login.vuka.html +11 -0
- vuka-0.1.0/hatch_build.py +41 -0
- vuka-0.1.0/pyproject.toml +79 -0
- vuka-0.1.0/scripts/build_wheels.py +124 -0
- vuka-0.1.0/scripts/gopins/go.mod +42 -0
- vuka-0.1.0/scripts/gopins/go.sum +84 -0
- vuka-0.1.0/scripts/smoke_wheel.py +47 -0
- vuka-0.1.0/src/vuka/__init__.py +182 -0
- vuka-0.1.0/src/vuka/_aio.py +135 -0
- vuka-0.1.0/src/vuka/_api.py +208 -0
- vuka-0.1.0/src/vuka/_app.py +371 -0
- vuka-0.1.0/src/vuka/_build.py +368 -0
- vuka-0.1.0/src/vuka/_console.py +452 -0
- vuka-0.1.0/src/vuka/_context.py +332 -0
- vuka-0.1.0/src/vuka/_crons.py +263 -0
- vuka-0.1.0/src/vuka/_css.py +122 -0
- vuka-0.1.0/src/vuka/_dev.py +365 -0
- vuka-0.1.0/src/vuka/_di.py +1070 -0
- vuka-0.1.0/src/vuka/_endpoints.py +534 -0
- vuka-0.1.0/src/vuka/_errorpages.py +112 -0
- vuka-0.1.0/src/vuka/_errors.py +175 -0
- vuka-0.1.0/src/vuka/_fields.py +441 -0
- vuka-0.1.0/src/vuka/_flash.py +92 -0
- vuka-0.1.0/src/vuka/_forms.py +455 -0
- vuka-0.1.0/src/vuka/_guard.py +229 -0
- vuka-0.1.0/src/vuka/_html.py +26 -0
- vuka-0.1.0/src/vuka/_identity.py +570 -0
- vuka-0.1.0/src/vuka/_ir.py +531 -0
- vuka-0.1.0/src/vuka/_islands.py +124 -0
- vuka-0.1.0/src/vuka/_layouts.py +177 -0
- vuka-0.1.0/src/vuka/_live.py +1428 -0
- vuka-0.1.0/src/vuka/_markup.py +322 -0
- vuka-0.1.0/src/vuka/_pages.py +175 -0
- vuka-0.1.0/src/vuka/_pool.py +314 -0
- vuka-0.1.0/src/vuka/_procs.py +492 -0
- vuka-0.1.0/src/vuka/_protocol.py +334 -0
- vuka-0.1.0/src/vuka/_reads.py +258 -0
- vuka-0.1.0/src/vuka/_routes.py +276 -0
- vuka-0.1.0/src/vuka/_run.py +919 -0
- vuka-0.1.0/src/vuka/_templates.py +164 -0
- vuka-0.1.0/src/vuka/_uploads.py +117 -0
- vuka-0.1.0/src/vuka/_visitor.py +267 -0
- vuka-0.1.0/src/vuka/_watch.py +274 -0
- vuka-0.1.0/src/vuka/_worker.py +401 -0
- vuka-0.1.0/src/vuka/cache.py +524 -0
- vuka-0.1.0/src/vuka/config.py +510 -0
- vuka-0.1.0/src/vuka/db/__init__.py +114 -0
- vuka-0.1.0/src/vuka/db/_async.py +304 -0
- vuka-0.1.0/src/vuka/db/_providers.py +93 -0
- vuka-0.1.0/src/vuka/db/_settings.py +199 -0
- vuka-0.1.0/src/vuka/db/_sync.py +427 -0
- vuka-0.1.0/src/vuka/db/_testing.py +222 -0
- vuka-0.1.0/src/vuka/db/_url.py +159 -0
- vuka-0.1.0/src/vuka/db/alembic.py +49 -0
- vuka-0.1.0/src/vuka/db/sqlalchemy.py +158 -0
- vuka-0.1.0/src/vuka/py.typed +0 -0
- vuka-0.1.0/src/vuka/testing.py +909 -0
- vuka-0.1.0/src/vuka/tokens.py +118 -0
- vuka-0.1.0/tests/conformance/generate.py +478 -0
- vuka-0.1.0/tests/conformance/host.py +29 -0
- vuka-0.1.0/tests/conftest.py +47 -0
- vuka-0.1.0/tests/fake_engine.py +99 -0
- vuka-0.1.0/tests/fixtures/ir/feed.ir.json +60 -0
- vuka-0.1.0/tests/fixtures/ir/index.ir.json +54 -0
- vuka-0.1.0/tests/fixtures/signals/app.py +4 -0
- vuka-0.1.0/tests/fixtures/signals/pages/index.vuka.html +30 -0
- vuka-0.1.0/tests/golden/counter.manifest.json +160 -0
- vuka-0.1.0/tests/test_api.py +161 -0
- vuka-0.1.0/tests/test_async.py +870 -0
- vuka-0.1.0/tests/test_bind.py +173 -0
- vuka-0.1.0/tests/test_bind_e2e.py +103 -0
- vuka-0.1.0/tests/test_build.py +230 -0
- vuka-0.1.0/tests/test_build_e2e.py +130 -0
- vuka-0.1.0/tests/test_cache.py +234 -0
- vuka-0.1.0/tests/test_cache_shared.py +219 -0
- vuka-0.1.0/tests/test_config.py +339 -0
- vuka-0.1.0/tests/test_config_e2e.py +235 -0
- vuka-0.1.0/tests/test_conformance.py +75 -0
- vuka-0.1.0/tests/test_console.py +494 -0
- vuka-0.1.0/tests/test_context.py +376 -0
- vuka-0.1.0/tests/test_crons.py +318 -0
- vuka-0.1.0/tests/test_css.py +199 -0
- vuka-0.1.0/tests/test_css_e2e.py +114 -0
- vuka-0.1.0/tests/test_db.py +750 -0
- vuka-0.1.0/tests/test_db_e2e.py +205 -0
- vuka-0.1.0/tests/test_deferred.py +557 -0
- vuka-0.1.0/tests/test_dev_e2e.py +194 -0
- vuka-0.1.0/tests/test_dev_run.py +123 -0
- vuka-0.1.0/tests/test_di.py +840 -0
- vuka-0.1.0/tests/test_docs.py +359 -0
- vuka-0.1.0/tests/test_e2e.py +276 -0
- vuka-0.1.0/tests/test_e2e_api.py +264 -0
- vuka-0.1.0/tests/test_e2e_cache.py +168 -0
- vuka-0.1.0/tests/test_e2e_cache_shared.py +216 -0
- vuka-0.1.0/tests/test_e2e_context.py +271 -0
- vuka-0.1.0/tests/test_e2e_crons.py +151 -0
- vuka-0.1.0/tests/test_e2e_ctx.py +125 -0
- vuka-0.1.0/tests/test_e2e_deferred.py +150 -0
- vuka-0.1.0/tests/test_e2e_expr.py +112 -0
- vuka-0.1.0/tests/test_e2e_flash.py +97 -0
- vuka-0.1.0/tests/test_e2e_identity.py +293 -0
- vuka-0.1.0/tests/test_e2e_kit.py +163 -0
- vuka-0.1.0/tests/test_e2e_layouts.py +112 -0
- vuka-0.1.0/tests/test_e2e_processes.py +284 -0
- vuka-0.1.0/tests/test_e2e_replicas.py +185 -0
- vuka-0.1.0/tests/test_e2e_routes.py +179 -0
- vuka-0.1.0/tests/test_e2e_sessions.py +163 -0
- vuka-0.1.0/tests/test_e2e_signals.py +238 -0
- vuka-0.1.0/tests/test_e2e_templates.py +147 -0
- vuka-0.1.0/tests/test_e2e_title_nav.py +164 -0
- vuka-0.1.0/tests/test_e2e_vendored.py +114 -0
- vuka-0.1.0/tests/test_endpoints.py +337 -0
- vuka-0.1.0/tests/test_expr_html.py +143 -0
- vuka-0.1.0/tests/test_flash_errors.py +211 -0
- vuka-0.1.0/tests/test_forms.py +250 -0
- vuka-0.1.0/tests/test_forms_e2e.py +162 -0
- vuka-0.1.0/tests/test_identity.py +252 -0
- vuka-0.1.0/tests/test_invalid.py +115 -0
- vuka-0.1.0/tests/test_invalid_e2e.py +69 -0
- vuka-0.1.0/tests/test_ir_nodes.py +81 -0
- vuka-0.1.0/tests/test_islands.py +261 -0
- vuka-0.1.0/tests/test_islands_e2e.py +161 -0
- vuka-0.1.0/tests/test_layouts_guards.py +280 -0
- vuka-0.1.0/tests/test_live.py +378 -0
- vuka-0.1.0/tests/test_manifest.py +155 -0
- vuka-0.1.0/tests/test_markup.py +139 -0
- vuka-0.1.0/tests/test_pages.py +256 -0
- vuka-0.1.0/tests/test_pool.py +374 -0
- vuka-0.1.0/tests/test_procs.py +277 -0
- vuka-0.1.0/tests/test_protocol.py +231 -0
- vuka-0.1.0/tests/test_public.py +72 -0
- vuka-0.1.0/tests/test_public_e2e.py +95 -0
- vuka-0.1.0/tests/test_reads.py +204 -0
- vuka-0.1.0/tests/test_reads_e2e.py +166 -0
- vuka-0.1.0/tests/test_routes.py +165 -0
- vuka-0.1.0/tests/test_run.py +281 -0
- vuka-0.1.0/tests/test_run_compiler_e2e.py +210 -0
- vuka-0.1.0/tests/test_streams.py +187 -0
- vuka-0.1.0/tests/test_streams_e2e.py +212 -0
- vuka-0.1.0/tests/test_templates.py +204 -0
- vuka-0.1.0/tests/test_testing.py +198 -0
- vuka-0.1.0/tests/test_uploads.py +226 -0
- vuka-0.1.0/tests/test_user_errors.py +351 -0
- vuka-0.1.0/tests/test_user_errors_e2e.py +177 -0
- vuka-0.1.0/tests/test_visitor.py +85 -0
- vuka-0.1.0/tests/test_watch.py +370 -0
- vuka-0.1.0/tests/test_worker.py +187 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths: ["docs/**", "src/**", "scripts/gopins/**", "tests/test_docs.py", ".github/workflows/docs.yml"]
|
|
7
|
+
pull_request:
|
|
8
|
+
paths: ["docs/**", "src/**", "scripts/gopins/**", "tests/test_docs.py", ".github/workflows/docs.yml"]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: pages-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0 # lastUpdated reads git history
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
- uses: actions/setup-go@v5
|
|
29
|
+
with:
|
|
30
|
+
go-version-file: scripts/gopins/go.mod
|
|
31
|
+
cache-dependency-path: scripts/gopins/go.sum
|
|
32
|
+
- uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version: 22
|
|
35
|
+
cache: npm
|
|
36
|
+
cache-dependency-path: docs/package-lock.json
|
|
37
|
+
- run: pip install -e '.[test]'
|
|
38
|
+
# the compiler the wheels bundle, so every sample builds as an app
|
|
39
|
+
- name: vuka compiler
|
|
40
|
+
working-directory: scripts/gopins
|
|
41
|
+
run: go build -trimpath -o "$RUNNER_TEMP/bin/" github.com/vuka-lang/vuka/cmd/vuka/v2
|
|
42
|
+
- name: docs samples and links
|
|
43
|
+
env:
|
|
44
|
+
VUKA_BIN: ${{ runner.temp }}/bin/vuka
|
|
45
|
+
run: pytest tests/test_docs.py -rs
|
|
46
|
+
- name: site
|
|
47
|
+
working-directory: docs
|
|
48
|
+
run: |
|
|
49
|
+
npm ci
|
|
50
|
+
npm run build
|
|
51
|
+
- uses: actions/upload-pages-artifact@v5
|
|
52
|
+
with:
|
|
53
|
+
path: docs/.vitepress/dist
|
|
54
|
+
|
|
55
|
+
deploy:
|
|
56
|
+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
|
57
|
+
needs: build
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
permissions:
|
|
60
|
+
pages: write
|
|
61
|
+
id-token: write
|
|
62
|
+
concurrency:
|
|
63
|
+
group: pages
|
|
64
|
+
cancel-in-progress: false
|
|
65
|
+
environment:
|
|
66
|
+
name: github-pages
|
|
67
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
68
|
+
steps:
|
|
69
|
+
- id: deployment
|
|
70
|
+
uses: actions/deploy-pages@v5
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Builds and publishes a release to PyPI: see RELEASING.md.
|
|
4
|
+
#
|
|
5
|
+
# A v* tag builds the five platform wheels (wheels.yml: each tested on its
|
|
6
|
+
# own platform against the bundled binaries) and the sdist, checks them
|
|
7
|
+
# all, and publishes them to PyPI with Trusted Publishing (OIDC, no token).
|
|
8
|
+
# The publish job does nothing until a trusted publisher for this
|
|
9
|
+
# repository, this workflow and the "pypi" environment is configured on
|
|
10
|
+
# PyPI. A manual run (workflow_dispatch) builds and checks the same files
|
|
11
|
+
# and, with "testpypi" chosen, publishes them to TestPyPI instead; it never
|
|
12
|
+
# publishes to PyPI. A pull request touching this file builds and checks
|
|
13
|
+
# without publishing.
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
tags: ["v*"]
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
inputs:
|
|
19
|
+
testpypi:
|
|
20
|
+
description: "Publish the built files to TestPyPI"
|
|
21
|
+
type: boolean
|
|
22
|
+
default: false
|
|
23
|
+
pull_request:
|
|
24
|
+
paths:
|
|
25
|
+
- .github/workflows/release.yml
|
|
26
|
+
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
concurrency:
|
|
31
|
+
group: release-${{ github.ref }}
|
|
32
|
+
cancel-in-progress: false
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
wheels:
|
|
36
|
+
uses: ./.github/workflows/wheels.yml
|
|
37
|
+
|
|
38
|
+
sdist:
|
|
39
|
+
name: sdist
|
|
40
|
+
runs-on: ubuntu-24.04
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- uses: actions/setup-python@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: "3.11"
|
|
46
|
+
- run: python -m pip install build
|
|
47
|
+
- name: a v* tag names the package's version
|
|
48
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
49
|
+
run: |
|
|
50
|
+
version=$(python -c "import re, pathlib; print(re.search(r'^__version__ = \"([^\"]+)\"', pathlib.Path('src/vuka/__init__.py').read_text(), re.M)[1])")
|
|
51
|
+
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
|
|
52
|
+
echo "the tag is $GITHUB_REF_NAME but src/vuka/__init__.py says __version__ = \"$version\""
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
- run: python -m build --sdist
|
|
56
|
+
- name: the sdist carries no binaries
|
|
57
|
+
run: |
|
|
58
|
+
if tar tzf dist/*.tar.gz | grep -q '/src/vuka/_bin/'; then
|
|
59
|
+
echo "the sdist holds src/vuka/_bin"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
- name: install the sdist in a fresh venv and run the unit tests
|
|
63
|
+
# no binaries anywhere: the end-to-end tests skip, and the
|
|
64
|
+
# no-binaries test checks the message pointing at the wheels
|
|
65
|
+
run: |
|
|
66
|
+
python -m venv "$RUNNER_TEMP/venv"
|
|
67
|
+
"$RUNNER_TEMP/venv/bin/python" -m pip install dist/*.tar.gz pytest websockets aiosqlite
|
|
68
|
+
env -u VUKA_ENGINE_BIN -u VUKA_BIN GOBIN="$RUNNER_TEMP/no-go-bin" "$RUNNER_TEMP/venv/bin/python" -m pytest -rs
|
|
69
|
+
- uses: actions/upload-artifact@v4
|
|
70
|
+
with:
|
|
71
|
+
name: sdist
|
|
72
|
+
path: dist/*.tar.gz
|
|
73
|
+
if-no-files-found: error
|
|
74
|
+
|
|
75
|
+
check:
|
|
76
|
+
name: check the release files
|
|
77
|
+
needs: [wheels, sdist]
|
|
78
|
+
runs-on: ubuntu-24.04
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/download-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
path: dist
|
|
83
|
+
merge-multiple: true
|
|
84
|
+
- uses: actions/setup-python@v5
|
|
85
|
+
with:
|
|
86
|
+
python-version: "3.11"
|
|
87
|
+
- run: python -m pip install twine
|
|
88
|
+
- name: twine check
|
|
89
|
+
run: python -m twine check --strict dist/*
|
|
90
|
+
- name: five platform wheels and one sdist, one version
|
|
91
|
+
run: |
|
|
92
|
+
ls -l dist
|
|
93
|
+
wheels=$(ls dist/*.whl | wc -l)
|
|
94
|
+
sdists=$(ls dist/*.tar.gz | wc -l)
|
|
95
|
+
versions=$(ls dist | sed -E 's/^vuka-([^-]+)(-py3-none-.*\.whl|\.tar\.gz)$/\1/' | sort -u | wc -l)
|
|
96
|
+
if [ "$wheels" != 5 ] || [ "$sdists" != 1 ] || [ "$versions" != 1 ]; then
|
|
97
|
+
echo "expected 5 wheels and 1 sdist of one version, found $wheels wheels, $sdists sdists, $versions versions"
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
if ls dist/*-none-any.whl >/dev/null 2>&1; then
|
|
101
|
+
echo "a pure wheel (no binaries) is among the release files"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
- uses: actions/upload-artifact@v4
|
|
105
|
+
with:
|
|
106
|
+
name: release-files
|
|
107
|
+
path: dist/*
|
|
108
|
+
if-no-files-found: error
|
|
109
|
+
|
|
110
|
+
pypi:
|
|
111
|
+
name: publish to PyPI
|
|
112
|
+
needs: check
|
|
113
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
114
|
+
runs-on: ubuntu-24.04
|
|
115
|
+
environment:
|
|
116
|
+
name: pypi
|
|
117
|
+
url: https://pypi.org/project/vuka/
|
|
118
|
+
permissions:
|
|
119
|
+
id-token: write
|
|
120
|
+
steps:
|
|
121
|
+
- uses: actions/download-artifact@v4
|
|
122
|
+
with:
|
|
123
|
+
name: release-files
|
|
124
|
+
path: dist
|
|
125
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
126
|
+
|
|
127
|
+
testpypi:
|
|
128
|
+
name: publish to TestPyPI
|
|
129
|
+
needs: check
|
|
130
|
+
if: github.event_name == 'workflow_dispatch' && inputs.testpypi
|
|
131
|
+
runs-on: ubuntu-24.04
|
|
132
|
+
environment:
|
|
133
|
+
name: testpypi
|
|
134
|
+
url: https://test.pypi.org/project/vuka/
|
|
135
|
+
permissions:
|
|
136
|
+
id-token: write
|
|
137
|
+
steps:
|
|
138
|
+
- uses: actions/download-artifact@v4
|
|
139
|
+
with:
|
|
140
|
+
name: release-files
|
|
141
|
+
path: dist
|
|
142
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
143
|
+
with:
|
|
144
|
+
repository-url: https://test.pypi.org/legacy/
|
|
145
|
+
# TestPyPI takes each version once: a second dry run of one version skips what's there
|
|
146
|
+
skip-existing: true
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, macos-latest]
|
|
15
|
+
python: ["3.11", "3.12", "3.13"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python }}
|
|
21
|
+
- run: pip install -e '.[test]'
|
|
22
|
+
# the end-to-end test needs the engine and compiler binaries and is
|
|
23
|
+
# skipped without them (VUKA_ENGINE_BIN, VUKA_BIN)
|
|
24
|
+
- run: pytest -rs
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: wheels
|
|
2
|
+
|
|
3
|
+
# Platform wheels bundling vuka-engine and vuka (scripts/build_wheels.py).
|
|
4
|
+
# Each leg builds one target's binaries and wheel, installs the wheel in a
|
|
5
|
+
# fresh venv and tests it on the runner's own platform, then uploads it.
|
|
6
|
+
# release.yml calls this workflow to build a release's wheels and publishes
|
|
7
|
+
# them; this one never publishes.
|
|
8
|
+
on:
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
workflow_call:
|
|
11
|
+
pull_request:
|
|
12
|
+
paths:
|
|
13
|
+
- hatch_build.py
|
|
14
|
+
- pyproject.toml
|
|
15
|
+
- scripts/**
|
|
16
|
+
- src/vuka/_run.py
|
|
17
|
+
- .github/workflows/wheels.yml
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
wheel:
|
|
24
|
+
name: wheel (${{ matrix.name }})
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
strategy:
|
|
27
|
+
fail-fast: false
|
|
28
|
+
matrix:
|
|
29
|
+
include:
|
|
30
|
+
- { name: macos-arm64, target: darwin/arm64, os: macos-15, arch: arm64, check: pytest }
|
|
31
|
+
# cross-compiled on the arm64 runner (GOARCH=amd64), tested under
|
|
32
|
+
# Rosetta: the x64 Python is universal2, so it's run as x86_64
|
|
33
|
+
- { name: macos-x86_64, target: darwin/amd64, os: macos-15, arch: x64, check: pytest, as: arch -x86_64 }
|
|
34
|
+
- { name: linux-x86_64, target: linux/amd64, os: ubuntu-24.04, arch: x64, check: pytest }
|
|
35
|
+
- { name: linux-arm64, target: linux/arm64, os: ubuntu-24.04-arm, arch: arm64, check: pytest }
|
|
36
|
+
# the SDK talks to the engine over a unix socket, which CPython
|
|
37
|
+
# doesn't offer on Windows: the wheel is checked without serving
|
|
38
|
+
- { name: windows-amd64, target: windows/amd64, os: windows-2022, arch: x64, check: smoke }
|
|
39
|
+
defaults:
|
|
40
|
+
run:
|
|
41
|
+
shell: bash
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
- uses: actions/setup-go@v5
|
|
45
|
+
with:
|
|
46
|
+
go-version-file: scripts/gopins/go.mod
|
|
47
|
+
cache-dependency-path: scripts/gopins/go.sum
|
|
48
|
+
- uses: actions/setup-python@v5
|
|
49
|
+
with:
|
|
50
|
+
python-version: "3.11"
|
|
51
|
+
architecture: ${{ matrix.arch }}
|
|
52
|
+
- run: python -m pip install build
|
|
53
|
+
- name: build the binaries and the wheel
|
|
54
|
+
run: python scripts/build_wheels.py ${{ matrix.target }}
|
|
55
|
+
- name: install the wheel in a fresh venv
|
|
56
|
+
run: |
|
|
57
|
+
python -m venv "$RUNNER_TEMP/venv"
|
|
58
|
+
if [ -x "$RUNNER_TEMP/venv/Scripts/python.exe" ]; then
|
|
59
|
+
PY="$RUNNER_TEMP/venv/Scripts/python.exe"
|
|
60
|
+
else
|
|
61
|
+
PY="$RUNNER_TEMP/venv/bin/python"
|
|
62
|
+
fi
|
|
63
|
+
echo "PY=$PY" >> "$GITHUB_ENV"
|
|
64
|
+
${{ matrix.as }} "$PY" -c "import platform; print('testing on', platform.machine())"
|
|
65
|
+
${{ matrix.as }} "$PY" -m pip install dist/*.whl pytest websockets
|
|
66
|
+
- name: smoke (the bundled binaries, no environment overrides)
|
|
67
|
+
run: env -u VUKA_ENGINE_BIN -u VUKA_BIN ${{ matrix.as }} "$PY" scripts/smoke_wheel.py
|
|
68
|
+
- name: the test suite against the installed wheel
|
|
69
|
+
if: matrix.check == 'pytest'
|
|
70
|
+
run: |
|
|
71
|
+
env -u VUKA_ENGINE_BIN -u VUKA_BIN ${{ matrix.as }} "$PY" -m pytest -rs | tee pytest.log
|
|
72
|
+
# the end-to-end test must run on the bundled binaries, not skip
|
|
73
|
+
if grep -qE "SKIPPED.*tests/test_e2e\.py:" pytest.log; then
|
|
74
|
+
echo "the end-to-end test was skipped: the wheel's binaries weren't found"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
- uses: actions/upload-artifact@v4
|
|
78
|
+
with:
|
|
79
|
+
name: wheel-${{ matrix.name }}
|
|
80
|
+
path: dist/*.whl
|
|
81
|
+
if-no-files-found: error
|
|
82
|
+
|
vuka-0.1.0/.gitignore
ADDED
vuka-0.1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `vuka` Python package. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package
|
|
5
|
+
uses [semantic versioning](https://semver.org/) with 0.x releases: a minor
|
|
6
|
+
release may change the API while the SDK is in beta.
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-12-04
|
|
11
|
+
|
|
12
|
+
The first release on PyPI.
|
|
13
|
+
|
|
14
|
+
### Pages and live state
|
|
15
|
+
|
|
16
|
+
- A page is one `.vuka.html` file: a Python class holding the page's state
|
|
17
|
+
and event handlers, then its markup. `python app.py` with `vuka.run()`
|
|
18
|
+
serves the app; the engine renders, diffs and keeps the live sockets, and
|
|
19
|
+
calls Python only for `mount`, events and broadcast messages.
|
|
20
|
+
- `@vuka.live()` pages with typed state fields, `vuka.Url[T]` fields bound to
|
|
21
|
+
the URL, the `update(self)` hook on a URL change, and `vuka.publish` /
|
|
22
|
+
`info(self, topic, data)` broadcasts.
|
|
23
|
+
- `vuka.Bind` fields and `on_change` for bound inputs; element reads.
|
|
24
|
+
- `vuka.State[T]` browser signals.
|
|
25
|
+
- Streams and presence for live pages.
|
|
26
|
+
- Uploads: `vuka.Upload` fields and `ctx.uploads()`.
|
|
27
|
+
- Deferred loading: `vuka.Deferred` fields and `@vuka.loads`.
|
|
28
|
+
- Field errors from a form's submit handler with `vuka.Invalid`.
|
|
29
|
+
- Forms: a `vuka.Form[T]` field holding a dataclass of `vuka.field(...)`s —
|
|
30
|
+
the engine keeps the form, renders its fields with the ui kit and
|
|
31
|
+
validates them; choices given by the app's functions.
|
|
32
|
+
- `vuka.Html` fields for trusted markup.
|
|
33
|
+
- Page titles, crumbs and the document head; `navigate`, `patch` and
|
|
34
|
+
`push_event` from handlers.
|
|
35
|
+
- Flash messages and `errors/` error pages.
|
|
36
|
+
- `ctx` in markup: `{ctx.user.name}`, `if ctx.user` and `ctx.can("perm")`,
|
|
37
|
+
answered by the engine with no Python call.
|
|
38
|
+
- Named routes: `name=` on pages and endpoints, `vuka.url(...)` and
|
|
39
|
+
`route(...)` links, moves by name.
|
|
40
|
+
|
|
41
|
+
### Application structure
|
|
42
|
+
|
|
43
|
+
- Layouts and guards around pages.
|
|
44
|
+
- Template components from `components/`; a component under
|
|
45
|
+
`components/ui/` takes the place of the ui kit's component of that name.
|
|
46
|
+
- `@vuka.context_processor` and `vuka.refresh`: template variables for every
|
|
47
|
+
page, layout and component.
|
|
48
|
+
- Endpoints: `@vuka.get`, `post`, `put`, `patch` and `delete` beside the pages.
|
|
49
|
+
- APIs: `vuka.api` token-only prefixes, bearer tokens with `vuka.tokens`, JWTs,
|
|
50
|
+
and `vuka.CORS`.
|
|
51
|
+
- Dependency injection: `@vuka.provide`, `vuka.Context`, `vuka.override`.
|
|
52
|
+
- Crons: `@vuka.cron`.
|
|
53
|
+
- `async def` handlers, endpoints, guards and providers.
|
|
54
|
+
- A worker pool with per-session ordering.
|
|
55
|
+
- Several worker processes: `vuka.run(processes=N)` (default 1), scheduled
|
|
56
|
+
by the engine with each session's calls kept in order.
|
|
57
|
+
|
|
58
|
+
### Data, sessions and users
|
|
59
|
+
|
|
60
|
+
- `vuka.db`: SQLite, PostgreSQL and MySQL (drivers as extras: `vuka[sqlite]`,
|
|
61
|
+
`vuka[postgres]`, `vuka[mysql]`, `vuka[sqlalchemy]`).
|
|
62
|
+
- Sessions: `ctx.visitor` and the engine's visitor session.
|
|
63
|
+
- Users and sign-in: `@vuka.users`, `vuka.sign_in` / `vuka.sign_out`,
|
|
64
|
+
`ctx.user`, gates and a login throttle.
|
|
65
|
+
- `vuka.Cache` and `vuka.cache.purge`: the engine's page cache.
|
|
66
|
+
- `vuka.cache`: the engine's shared cache — `get` / `set` / `delete`,
|
|
67
|
+
`remember` and `@vuka.cache.memo`.
|
|
68
|
+
- Engine-run reads: `vuka.query(...)` fields and `load=vuka.query(...)`
|
|
69
|
+
pages the engine fills from the database itself, with no Python call.
|
|
70
|
+
- `vuka.toml` settings: `vuka.config`, `[server]`, `--config` and
|
|
71
|
+
`--config-dump`.
|
|
72
|
+
- Production settings in `[server]`: `trusted_proxies`, `compression`,
|
|
73
|
+
`max_body` and response `headers`.
|
|
74
|
+
- Several replicas of one app behind a load balancer: `[server]` `relay`,
|
|
75
|
+
`live_key` and `replicas`.
|
|
76
|
+
|
|
77
|
+
### Frontend
|
|
78
|
+
|
|
79
|
+
- Styles: `app.css` (or `styles/app.css`) built and linked by the engine,
|
|
80
|
+
Tailwind included when `tailwindcss` is on `PATH`.
|
|
81
|
+
- Islands: browser components from `islands/` placed in pages.
|
|
82
|
+
- The ui kit on Python pages.
|
|
83
|
+
- Static files: a `public/` folder beside `pages/`, served by the engine.
|
|
84
|
+
|
|
85
|
+
### Tooling
|
|
86
|
+
|
|
87
|
+
- The dev loop (`--dev`): watches pages and modules, rebuilds, restarts the
|
|
88
|
+
engine, and trial-runs an edited `app.py` before switching to it.
|
|
89
|
+
- `python app.py build`: an artifact `vuka.run()` serves without the compiler.
|
|
90
|
+
- `vuka.testing`: a page test harness on the real engine.
|
|
91
|
+
- A console banner with timed startup stages.
|
|
92
|
+
- Mistakes in the app's code caught while serving (`vuka.UserError`) are
|
|
93
|
+
reported as one located line, without the SDK's traceback; repeats
|
|
94
|
+
collapse.
|
|
95
|
+
- The host conformance suite (`tests/test_conformance.py`, with
|
|
96
|
+
`VUKA_CONFORMANCE_BIN`) checks the SDK against the engine's corpus.
|
|
97
|
+
- Ships `py.typed`.
|
|
98
|
+
|
|
99
|
+
### Packaging
|
|
100
|
+
|
|
101
|
+
- Platform wheels bundle the engine (`vuka-engine`) and the compiler
|
|
102
|
+
(`vuka`): macOS arm64 and x86_64, Linux x86_64 and arm64 (glibc and musl),
|
|
103
|
+
and Windows amd64. The Windows wheel installs and compiles pages, but
|
|
104
|
+
`vuka.run()` does not serve there yet.
|
|
105
|
+
- Without a platform wheel (the sdist, an editable install, another
|
|
106
|
+
platform), the SDK finds `go install`ed binaries on `PATH` or in the Go bin
|
|
107
|
+
directories, and says how to get them when it finds none.
|
|
108
|
+
|
|
109
|
+
[Unreleased]: https://github.com/vuka-lang/python/compare/v0.1.0...HEAD
|
|
110
|
+
[0.1.0]: https://github.com/vuka-lang/python/releases/tag/v0.1.0
|
vuka-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vuka-lang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
vuka-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: vuka
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Live pages from Python, served by a Go engine: sockets, rendering, diffing, state and caching in a compiled binary; your Python runs only the handlers
|
|
5
|
+
Project-URL: Homepage, https://github.com/vuka-lang/python
|
|
6
|
+
Project-URL: Documentation, https://vuka-lang.github.io/python/
|
|
7
|
+
Project-URL: Source, https://github.com/vuka-lang/python
|
|
8
|
+
Project-URL: Issues, https://github.com/vuka-lang/python/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/vuka-lang/python/blob/main/CHANGELOG.md
|
|
10
|
+
Author: vuka-lang
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: html templates,live views,real-time,server-rendered,vuka,web framework,websocket
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Go
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.11
|
|
30
|
+
Provides-Extra: mysql
|
|
31
|
+
Requires-Dist: aiomysql>=0.2; extra == 'mysql'
|
|
32
|
+
Requires-Dist: pymysql>=1.1; extra == 'mysql'
|
|
33
|
+
Provides-Extra: postgres
|
|
34
|
+
Requires-Dist: psycopg-pool>=3.2; extra == 'postgres'
|
|
35
|
+
Requires-Dist: psycopg[binary]>=3.1; extra == 'postgres'
|
|
36
|
+
Provides-Extra: sqlalchemy
|
|
37
|
+
Requires-Dist: sqlalchemy[asyncio]>=2; extra == 'sqlalchemy'
|
|
38
|
+
Provides-Extra: sqlite
|
|
39
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'sqlite'
|
|
40
|
+
Provides-Extra: test
|
|
41
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'test'
|
|
42
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
43
|
+
Requires-Dist: websockets>=13; extra == 'test'
|
|
44
|
+
Provides-Extra: testing
|
|
45
|
+
Requires-Dist: websockets>=13; extra == 'testing'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# vuka for Python
|
|
49
|
+
|
|
50
|
+
Live pages from Python, served by a Go engine. A page is one
|
|
51
|
+
`.vuka.html` file: a Python class holding the page's state and event
|
|
52
|
+
handlers, then the markup. You run `python app.py` and the engine — a
|
|
53
|
+
compiled binary the wheel ships, no Go toolchain needed — owns
|
|
54
|
+
everything that has to be fast, while your Python runs only your
|
|
55
|
+
handlers.
|
|
56
|
+
|
|
57
|
+
**Documentation: [vuka-lang.github.io/python](https://vuka-lang.github.io/python/)**
|
|
58
|
+
|
|
59
|
+
**The engine is the point.** It is the HTTP server and the socket
|
|
60
|
+
server; it renders pages, diffs them and patches the browser; it holds
|
|
61
|
+
every session's state, fans out broadcasts, enforces guards and runs
|
|
62
|
+
validation; it serves cached pages, static responses, signal updates
|
|
63
|
+
and JS chains without calling Python at all. What reaches your process
|
|
64
|
+
is the part only your app can answer: `mount`, an event, a broadcast
|
|
65
|
+
message. The split shows up directly in the numbers
|
|
66
|
+
([bench/BENCH.md](https://github.com/vuka-lang/python/blob/main/bench/BENCH.md)): a cached page serves **45,815
|
|
67
|
+
requests/s — 86% of the same page written in Go** — because a cached
|
|
68
|
+
GET never leaves the engine, and your state is safe in the engine's
|
|
69
|
+
memory whatever happens to the Python process. Plain Python, engine
|
|
70
|
+
speed.
|
|
71
|
+
|
|
72
|
+
## Quickstart
|
|
73
|
+
|
|
74
|
+
```console
|
|
75
|
+
$ pip install vuka
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<!-- pages/index.vuka.html -->
|
|
80
|
+
<script lang="python">
|
|
81
|
+
import vuka
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@vuka.live()
|
|
85
|
+
class Counter(vuka.Live):
|
|
86
|
+
count: int = 0
|
|
87
|
+
step: vuka.Url[int] = 5
|
|
88
|
+
|
|
89
|
+
def add(self, n: int):
|
|
90
|
+
self.count += n
|
|
91
|
+
|
|
92
|
+
def reset(self):
|
|
93
|
+
self.count = 0
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<main class="counter">
|
|
97
|
+
<p class="count">{count}</p>
|
|
98
|
+
<button onClick={add(1)}>+1</button>
|
|
99
|
+
<button onClick={add(step)}>+{step}</button>
|
|
100
|
+
<button onClick={reset}>reset</button>
|
|
101
|
+
</main>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
# app.py
|
|
106
|
+
import vuka
|
|
107
|
+
|
|
108
|
+
vuka.run()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```console
|
|
112
|
+
$ python app.py
|
|
113
|
+
vuka: serving counter on http://localhost:8080 (1 page)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Open the page, click: the click goes over the page's live socket to the
|
|
117
|
+
engine, the engine calls `add(1)` in your process with the page's current
|
|
118
|
+
state, and patches the page with the new count. `python app.py --dev`
|
|
119
|
+
rebuilds the app as you save, and keeps serving the last good build when a
|
|
120
|
+
save breaks it.
|
|
121
|
+
|
|
122
|
+
To start from a complete app (a page, a layout, a test, and optionally a
|
|
123
|
+
database, sign-in and an island), use the `vuka` command:
|
|
124
|
+
`vuka new shop --lang=python` ([The vuka Command](https://vuka-lang.github.io/python/guide/cli)).
|
|
125
|
+
|
|
126
|
+
## Platform notes
|
|
127
|
+
|
|
128
|
+
The SDK runs two Go binaries: the engine (`vuka-engine`) and the compiler
|
|
129
|
+
(`vuka`). The platform wheels bundle both, so installing the wheel is the
|
|
130
|
+
whole setup.
|
|
131
|
+
|
|
132
|
+
- Wheels: macOS (arm64, x86_64; macOS 12 or newer), Linux (x86_64,
|
|
133
|
+
arm64; glibc and musl) and Windows (amd64). Python 3.11 or newer.
|
|
134
|
+
- **Windows:** the wheel installs and compiles pages, but `vuka.run()`
|
|
135
|
+
doesn't serve there yet: the SDK reaches the engine over a unix socket,
|
|
136
|
+
which CPython doesn't offer on Windows.
|
|
137
|
+
- **Anywhere else** pip installs the sdist, which carries no binaries:
|
|
138
|
+
`vuka.run()` then stops with a message naming the wheels and these
|
|
139
|
+
commands, which install both binaries with Go:
|
|
140
|
+
|
|
141
|
+
```console
|
|
142
|
+
$ go install github.com/vuka-lang/web/v2/cmd/vuka-engine@v2.27.0
|
|
143
|
+
$ go install github.com/vuka-lang/vuka/cmd/vuka/v2@v2.27.0
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Each binary is looked up in this order: `VUKA_ENGINE_BIN` / `VUKA_BIN`,
|
|
147
|
+
then the wheel's own copy, then `PATH`, then `$GOBIN` / `$GOPATH/bin` /
|
|
148
|
+
`~/go/bin`.
|
|
149
|
+
|
|
150
|
+
## The guide
|
|
151
|
+
|
|
152
|
+
- [Getting Started](https://vuka-lang.github.io/python/guide/getting-started) — install, a first app, the dev loop
|
|
153
|
+
- [How It Works](https://vuka-lang.github.io/python/guide/how-it-works) — what the engine runs and what Python runs; workers and async handlers
|
|
154
|
+
- [Pages and Live State](https://vuka-lang.github.io/python/guide/pages) — fields, URL state, events, signals, bound inputs, titles, links
|
|
155
|
+
- [Layouts and Template Variables](https://vuka-lang.github.io/python/guide/layouts) · [Forms](https://vuka-lang.github.io/python/guide/forms) · [Components and the ui Kit](https://vuka-lang.github.io/python/guide/components) · [Deferred Loading](https://vuka-lang.github.io/python/guide/deferred) · [Streams, Presence and Uploads](https://vuka-lang.github.io/python/guide/streams) · [Styles and Static Files](https://vuka-lang.github.io/python/guide/assets)
|
|
156
|
+
- [Services](https://vuka-lang.github.io/python/guide/services) · [Databases](https://vuka-lang.github.io/python/guide/databases) · [Sessions, Users and Sign-in](https://vuka-lang.github.io/python/guide/users) · [APIs](https://vuka-lang.github.io/python/guide/apis) · [Crons](https://vuka-lang.github.io/python/guide/crons)
|
|
157
|
+
- [Performance](https://vuka-lang.github.io/python/guide/performance) — the page cache, the shared cache, engine-run reads, processes, with their numbers
|
|
158
|
+
- [Configuration](https://vuka-lang.github.io/python/guide/configuration) · [Errors and Debugging](https://vuka-lang.github.io/python/guide/errors) · [Testing](https://vuka-lang.github.io/python/guide/testing) · [Building and Deploying](https://vuka-lang.github.io/python/guide/deploying) · [The vuka Command](https://vuka-lang.github.io/python/guide/cli)
|
|
159
|
+
- [Reference](https://vuka-lang.github.io/python/reference/) — every `vuka.*` name, one line each · [Limits of This Version](https://vuka-lang.github.io/python/reference/limits)
|
|
160
|
+
|
|
161
|
+
The site's sources are in [`docs/`](https://github.com/vuka-lang/python/tree/main/docs);
|
|
162
|
+
every code sample on it is compiled, and built as an app, by
|
|
163
|
+
`tests/test_docs.py`. The examples in
|
|
164
|
+
[`examples/`](https://github.com/vuka-lang/python/tree/main/examples) run
|
|
165
|
+
with `python app.py`. The design is the host engine RFC, vuka-lang/vuka
|
|
166
|
+
[`docs/design/host-engine.md`](https://github.com/vuka-lang/vuka/blob/main/docs/design/host-engine.md).
|
|
167
|
+
|
|
168
|
+
## Developing the SDK
|
|
169
|
+
|
|
170
|
+
```console
|
|
171
|
+
$ pip install -e '.[test]'
|
|
172
|
+
$ pytest
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The unit tests need no Go binaries; the end-to-end tests run when the
|
|
176
|
+
engine and compiler are found and are skipped otherwise. The docs site
|
|
177
|
+
builds with `npm ci && npm run build` in `docs/`. Building the platform
|
|
178
|
+
wheels and the conformance suite are covered in
|
|
179
|
+
[Building and Deploying](https://vuka-lang.github.io/python/guide/deploying#building-the-wheels-from-source)
|
|
180
|
+
and [Testing](https://vuka-lang.github.io/python/guide/testing#the-conformance-suite);
|
|
181
|
+
RELEASING.md is the maintainer's checklist.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|