Skip to main content

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 and spreads its users over a supervised pool of worker processes, each user pinned to one of them.

What it replaces

  • gnrwsgiserve (werkzeug/WSGI) → gnrasgiserve (uvicorn/ASGI). Same site, same options, unmodified code.
  • 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

gnrasgiserve mysite -p 8080
# site on http://127.0.0.1:8080/index

mysite is the GenroPy instance name — the same you pass to gnrwsgiserve — or a path to a site directory. That is the whole launch: there is no worker count to declare and no single/pool selector. The pool always runs, starts with one worker and adds another when the ones it has have no room for a newcomer.

On macOS export PGGSSENCMODE=disable: the workers are born by fork and libpq negotiating Kerberos inside a forked child crashes it.

Watch the site-wide counters, no authentication needed:

curl -s http://127.0.0.1:8080/metrics

How it works

A GenroPy site is synchronous WSGI. genropy-asgi converts each ASGI request to a PEP 3333 environ and runs the site on a thread pool, so the event loop is never blocked. The site's register — connections, pages, sessions, datachanges, stores — is served in-process, not by a daemon: the package declares the gnr.web:daemon entry point, and GenroPy resolves its daemon namespace to it only when GNR_DAEMON_PROVIDER names the provider, which the CLI does for its own process. The choice is per process, so the classic stack and this one can share one virtualenv.

  • Every user lives in one worker, with all his pages. Routing is by identity: the spa_connection_id cookie carries the connection id the site itself minted while serving, and the commander knows whose it is.
  • Workers are born by fork out of a template process that builds the GnrWsgiSite once for all of them, so starting one more costs a fork and not a cold start.
  • The pool sizes itself on measured occupancy — the number of processes is a reading, never a setting. GNR_ASGI_WORKER_MAX_USERS caps how many users one worker may hold.
  • A quiet user is frozen to disk and his worker gets the memory back; his next request wakes him. A restart parks everybody the same way, so nobody is logged out by it.
  • Changes travel addressed: what one page writes, or a table event, reaches the pages that subscribed it, wherever they sit. The legacy globalStore() is one master on the commander with no replicas — a worker reads it with a call and writes it through an all-or-nothing grant.

See docs/ for the pool, configuration, CLI reference, FAQ, troubleshooting — and docs/status.rst for what is built today.

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.

Metadata

Release files for genropy-asgi 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genropy-asgi 0.5.0
File Size Uploaded
genropy_asgi-0.5.0.tar.gz 372.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for genropy-asgi 0.5.0
File Interpreter ABI Platform
genropy_asgi-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 433.3 kB

Release files / genropy_asgi-0.5.0.tar.gz

Download URL genropy_asgi-0.5.0.tar.gz
Size 372.0 kB
Tags Source
SHA-256 checksum
How to use checksums
deac43978e101d951c12ca15864cad4ea70e85bb52a05b4cc0c75c0bd34fa4ba
BLAKE2b-256 checksum
How to use checksums
177c4f1ee8e4e86843ce5a96e9682c1231d12fbc2dfa31fbd62df34c027cbd2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 4, 2026.

Transparency log

Release files / genropy_asgi-0.5.0-py3-none-any.whl

Download URL genropy_asgi-0.5.0-py3-none-any.whl
Size 61.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3aae193bee02fe423105ca5d9dde612a2eb94c358e4b9307036dc673591b0eb
BLAKE2b-256 checksum
How to use checksums
4efcce14a4372876825ddc838c5c00470f258c667ac7a707e0393b1dca8bb76c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page