Daemon-less commander/worker model serving GenroPy legacy sites on top of genro-asgi
Project description
genropy-asgi
Serve legacy (synchronous) GenroPy sites on an ASGI server — no register
daemon. genropy-asgi is the GenroPy-specific bridge on top of
genro-asgi: it hosts an unmodified
GnrWsgiSite behind uvicorn and, on demand, spreads the load over a supervised
pool of worker processes.
- GitHub: https://github.com/genropy/genropy-asgi
- Status: Alpha
- Package:
genropy-asgi(PyPI) · import:genropy_asgi - Python: >= 3.11 · License: Apache-2.0
What it replaces
gnrwsgiserve(werkzeug/WSGI) →gnrasgiserve(uvicorn/ASGI). Same site, same options, unmodified code — plus native WebSocket support.- The register daemon (Pyro4, then
genro-nodaemon) → an in-process register. There is no daemon to start or connect to.
Installation
pip install genropy-asgi
Latest development version, straight from GitHub:
pip install git+https://github.com/genropy/genropy-asgi.git
genro-asgi is installed automatically. GenroPy must be present at runtime
(the worker runs a GnrWsgiSite) and configured as usual (~/.gnr/environment.xml
plus an existing site). genropy-asgi imports gnr.* only at runtime.
Usage
Single process — the drop-in for gnrwsgiserve:
gnrasgiserve mysite -p 8080
# site on http://0.0.0.0:8080/index
Pool — one commander supervising N workers, sticky per user:
gnrasgiserve mysite --workers 2 -p 8080
mysite is the GenroPy instance name (or a site path). With --workers N the
same command runs the commander/worker model: each user is routed to a stable
worker and the pool grows under load.
Watch the pool:
curl -s http://127.0.0.1:8080/_server/monitor_state | python3 -m json.tool
How it works
A GenroPy site is synchronous WSGI. genropy-asgi converts each ASGI request to a PEP 3333 environ and runs the site in a thread executor, so uvicorn is never blocked. The site's register — connections, pages, sessions, datachanges, stores — is served in-process, not by a daemon.
- Single (
GenropySpaApplication): one process hosts the site and is the commander of itself. - Pool: a commander (
GenropyCommanderApplication, the genro-asgi core commander plus the site-wide/metricsendpoint) supervises N workers (GenropyWorkerApplication), forwards every request to the right worker by an opaquesticky_cidcookie, and grows the pool when every worker crosses 80% of its user cap. Datachanges live locally on the page's own worker (the switch model); cross-worker changes arrive via the commander. The legacyglobalStore()is eventually coherent via the framework's global-store rail — a write on one worker reaches the others after one channel round-trip.
The commander serves a Prometheus /metrics endpoint exposing the pool's
site-wide counters (users, pages, connections). Watch the pool with:
curl -s http://127.0.0.1:8080/metrics
See docs/ for the full architecture, single-vs-multi guide,
configuration, CLI reference, FAQ and troubleshooting.
Documentation
The documentation is built with Sphinx:
pip install -e .[docs]
cd docs && make html
# open docs/_build/html/index.html
Development
pip install -e .[dev]
pytest tests/
ruff check src/
License
Apache License 2.0 — Copyright 2025 Softwell S.r.l. See LICENSE and NOTICE.
Project details
Release history Release notifications | RSS feed
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 genropy_asgi-0.2.0.tar.gz.
File metadata
- Download URL: genropy_asgi-0.2.0.tar.gz
- Upload date:
- Size: 101.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f6dc164714daadd1586aae15c24077c86547d43d6a40790ff17e9a081a673b9
|
|
| MD5 |
ad98af6f286c9239e290c1305defb2b8
|
|
| BLAKE2b-256 |
83ec1ccb9ea201e7a46dfd2efa14e635144e3fd522ca76b8bf0abff6399ffaa8
|
Provenance
The following attestation bundles were made for genropy_asgi-0.2.0.tar.gz:
Publisher:
publish.yml on genropy/genropy-asgi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genropy_asgi-0.2.0.tar.gz -
Subject digest:
5f6dc164714daadd1586aae15c24077c86547d43d6a40790ff17e9a081a673b9 - Sigstore transparency entry: 2149185283
- Sigstore integration time:
-
Permalink:
genropy/genropy-asgi@2f6a4d7ce143812323a4fb3a8530bdd1b0bcf19c -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/genropy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2f6a4d7ce143812323a4fb3a8530bdd1b0bcf19c -
Trigger Event:
release
-
Statement type:
File details
Details for the file genropy_asgi-0.2.0-py3-none-any.whl.
File metadata
- Download URL: genropy_asgi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 42.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26578805773659c270db22b53a3f00b9efa4fc10cddea1412da0bda86899d3de
|
|
| MD5 |
c9dc4d254a0b3676c1f1f66c8839eb1d
|
|
| BLAKE2b-256 |
3168a85cd8dae7b5cd980b2afebb772699f1654a0747075e07b0842e38608c6a
|
Provenance
The following attestation bundles were made for genropy_asgi-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on genropy/genropy-asgi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genropy_asgi-0.2.0-py3-none-any.whl -
Subject digest:
26578805773659c270db22b53a3f00b9efa4fc10cddea1412da0bda86899d3de - Sigstore transparency entry: 2149185500
- Sigstore integration time:
-
Permalink:
genropy/genropy-asgi@2f6a4d7ce143812323a4fb3a8530bdd1b0bcf19c -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/genropy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2f6a4d7ce143812323a4fb3a8530bdd1b0bcf19c -
Trigger Event:
release
-
Statement type: