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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genropy_asgi-0.3.0.tar.gz (370.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genropy_asgi-0.3.0-py3-none-any.whl (60.3 kB view details)

Uploaded Python 3

File details

Details for the file genropy_asgi-0.3.0.tar.gz.

File metadata

  • Download URL: genropy_asgi-0.3.0.tar.gz
  • Upload date:
  • Size: 370.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for genropy_asgi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4e49cdab2da2093a35a059971057f73bbc0b74de85aded66b9ad580469370699
MD5 5efcbddf6c2e72f9daef575beb0cd0ce
BLAKE2b-256 c40c9763755d25d338ff38ce73347eff2757a7e3a0637f91c2ebdc5a26b9b951

See more details on using hashes here.

Provenance

The following attestation bundles were made for genropy_asgi-0.3.0.tar.gz:

Publisher: publish.yml on genropy/genropy-asgi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file genropy_asgi-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: genropy_asgi-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 60.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for genropy_asgi-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c2e2ced1d9ca6c64f97e771d6ccb178b0aa4962a7295f743ee07cf81ee4fca4
MD5 d1e71c317b0c98e041e27d5e20864afd
BLAKE2b-256 5752b52e03f52824b2df9d4a1bb879b61048d6bec692584dc0546813961e31a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for genropy_asgi-0.3.0-py3-none-any.whl:

Publisher: publish.yml on genropy/genropy-asgi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 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