# Reference: runtime type python

URL: https://scalws.com/docs/reference/runtime-python/
Source: `docs/reference/schema` in the ScalWS repository

<h3 id="tenants-.applications-.routes-.runtime.python.app"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.app</code></h3>

| | |
|---|---|
| Syntax | `app: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

`module:callable`, e.g. `app:app` or `mysite.wsgi:application`.


<h3 id="tenants-.applications-.routes-.runtime.python.command"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.command</code></h3>

| | |
|---|---|
| Syntax | `command: [<string>, ...]` |
| Default | `[]` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Explicit argv. Bind arguments are appended for uvicorn/hypercorn/gunicorn unless the argv already contains `{socket}` or `{port}`.


<h3 id="tenants-.applications-.routes-.runtime.python.env"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.env</code></h3>

| | |
|---|---|
| Syntax | `env: {<key>: <string>, ...}` |
| Default | `empty` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Environment variables for the processes.


<h3 id="tenants-.applications-.routes-.runtime.python.health_path"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.health_path</code></h3>

| | |
|---|---|
| Syntax | `health_path: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Path requested to decide that a worker is ready and healthy.


<h3 id="tenants-.applications-.routes-.runtime.python.listen"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.listen</code></h3>

| | |
|---|---|
| Syntax | `listen: unix \| tcp` |
| Default | `unix` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

`unix`: a socket under `runtime_dir`; `tcp`: a free loopback port.


<h3 id="tenants-.applications-.routes-.runtime.python.mode"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.mode</code></h3>

| | |
|---|---|
| Syntax | `mode: asgi \| wsgi` |
| Default | `required` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

`asgi` (uvicorn) or `wsgi` (gunicorn).


<h3 id="tenants-.applications-.routes-.runtime.python.process_pool"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.process_pool</code></h3>

| | |
|---|---|
| Syntax | `process_pool: true \| false` |
| Default | `false` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

scalws runs `workers.min..max` single-worker server processes itself instead of one server with `--workers`, so the pool can be scaled and restarted live (ADR-0014). Trades the server's copy-on-write sharing for scaling.


<h3 id="tenants-.applications-.routes-.runtime.python.response_timeout"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.response_timeout</code></h3>

| | |
|---|---|
| Syntax | `response_timeout: <duration> (e.g. 30s)` |
| Default | `60s` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Time to wait for the response headers of the application.


<h3 id="tenants-.applications-.routes-.runtime.python.server"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.server</code></h3>

| | |
|---|---|
| Syntax | `server: uvicorn \| hypercorn \| gunicorn` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Default: uvicorn for ASGI, gunicorn for WSGI.


<h3 id="tenants-.applications-.routes-.runtime.python.startup_timeout"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.startup_timeout</code></h3>

| | |
|---|---|
| Syntax | `startup_timeout: <duration> (e.g. 30s)` |
| Default | `30s` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Time the processes get to become ready.


<h3 id="tenants-.applications-.routes-.runtime.python.stop_timeout"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.stop_timeout</code></h3>

| | |
|---|---|
| Syntax | `stop_timeout: <duration> (e.g. 30s)` |
| Default | `10s` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Time the processes get to exit after SIGTERM before they are killed.


<h3 id="tenants-.applications-.routes-.runtime.python.upstream"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.upstream</code></h3>

| | |
|---|---|
| Syntax | `upstream: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Proxy to a Python server managed elsewhere instead of starting one.


<h3 id="tenants-.applications-.routes-.runtime.python.virtualenv"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.virtualenv</code></h3>

| | |
|---|---|
| Syntax | `virtualenv: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Virtual environment whose server binary and packages are used.


<h3 id="tenants-.applications-.routes-.runtime.python.workers"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.workers</code></h3>

| | |
|---|---|
| Syntax | `workers: {...}` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime (type: python)` |
| Reload | applies on reload |

Worker processes of the application server (`min`).


<h3 id="tenants-.applications-.routes-.runtime.python.workers.autoscale"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.workers.autoscale</code></h3>

| | |
|---|---|
| Syntax | `autoscale: off \| auto \| recommend` |
| Default | `recommend` |
| Context | `tenants[].applications[].routes[].runtime<python>.workers` |
| Reload | applies on reload |

`off`, `recommend` (default) or `auto` (ADR-0014).


<h3 id="tenants-.applications-.routes-.runtime.python.workers.max"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.workers.max</code></h3>

| | |
|---|---|
| Syntax | `max: <integer>` |
| Default | `required` |
| Context | `tenants[].applications[].routes[].runtime<python>.workers` |
| Reload | applies on reload |

Upper bound when the pool is scaled.


<h3 id="tenants-.applications-.routes-.runtime.python.workers.min"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.workers.min</code></h3>

| | |
|---|---|
| Syntax | `min: <integer>` |
| Default | `required` |
| Context | `tenants[].applications[].routes[].runtime<python>.workers` |
| Reload | applies on reload |

Processes started at the beginning and kept at least.


<h3 id="tenants-.applications-.routes-.runtime.python.workers.target_concurrency"><code>tenants[].applications[].routes[].runtime&lt;python&gt;.workers.target_concurrency</code></h3>

| | |
|---|---|
| Syntax | `target_concurrency: <integer>` |
| Default | `none` |
| Context | `tenants[].applications[].routes[].runtime<python>.workers` |
| Reload | applies on reload |

Concurrent requests one worker is expected to handle well (utilisation basis).


<h3 id="tenants-.applications-.runtime.python.app"><code>tenants[].applications[].runtime&lt;python&gt;.app</code></h3>

| | |
|---|---|
| Syntax | `app: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

`module:callable`, e.g. `app:app` or `mysite.wsgi:application`.


<h3 id="tenants-.applications-.runtime.python.command"><code>tenants[].applications[].runtime&lt;python&gt;.command</code></h3>

| | |
|---|---|
| Syntax | `command: [<string>, ...]` |
| Default | `[]` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Explicit argv. Bind arguments are appended for uvicorn/hypercorn/gunicorn unless the argv already contains `{socket}` or `{port}`.


<h3 id="tenants-.applications-.runtime.python.env"><code>tenants[].applications[].runtime&lt;python&gt;.env</code></h3>

| | |
|---|---|
| Syntax | `env: {<key>: <string>, ...}` |
| Default | `empty` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Environment variables for the processes.


<h3 id="tenants-.applications-.runtime.python.health_path"><code>tenants[].applications[].runtime&lt;python&gt;.health_path</code></h3>

| | |
|---|---|
| Syntax | `health_path: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Path requested to decide that a worker is ready and healthy.


<h3 id="tenants-.applications-.runtime.python.listen"><code>tenants[].applications[].runtime&lt;python&gt;.listen</code></h3>

| | |
|---|---|
| Syntax | `listen: unix \| tcp` |
| Default | `unix` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

`unix`: a socket under `runtime_dir`; `tcp`: a free loopback port.


<h3 id="tenants-.applications-.runtime.python.mode"><code>tenants[].applications[].runtime&lt;python&gt;.mode</code></h3>

| | |
|---|---|
| Syntax | `mode: asgi \| wsgi` |
| Default | `required` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

`asgi` (uvicorn) or `wsgi` (gunicorn).


<h3 id="tenants-.applications-.runtime.python.process_pool"><code>tenants[].applications[].runtime&lt;python&gt;.process_pool</code></h3>

| | |
|---|---|
| Syntax | `process_pool: true \| false` |
| Default | `false` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

scalws runs `workers.min..max` single-worker server processes itself instead of one server with `--workers`, so the pool can be scaled and restarted live (ADR-0014). Trades the server's copy-on-write sharing for scaling.


<h3 id="tenants-.applications-.runtime.python.response_timeout"><code>tenants[].applications[].runtime&lt;python&gt;.response_timeout</code></h3>

| | |
|---|---|
| Syntax | `response_timeout: <duration> (e.g. 30s)` |
| Default | `60s` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Time to wait for the response headers of the application.


<h3 id="tenants-.applications-.runtime.python.server"><code>tenants[].applications[].runtime&lt;python&gt;.server</code></h3>

| | |
|---|---|
| Syntax | `server: uvicorn \| hypercorn \| gunicorn` |
| Default | `none` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Default: uvicorn for ASGI, gunicorn for WSGI.


<h3 id="tenants-.applications-.runtime.python.startup_timeout"><code>tenants[].applications[].runtime&lt;python&gt;.startup_timeout</code></h3>

| | |
|---|---|
| Syntax | `startup_timeout: <duration> (e.g. 30s)` |
| Default | `30s` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Time the processes get to become ready.


<h3 id="tenants-.applications-.runtime.python.stop_timeout"><code>tenants[].applications[].runtime&lt;python&gt;.stop_timeout</code></h3>

| | |
|---|---|
| Syntax | `stop_timeout: <duration> (e.g. 30s)` |
| Default | `10s` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Time the processes get to exit after SIGTERM before they are killed.


<h3 id="tenants-.applications-.runtime.python.upstream"><code>tenants[].applications[].runtime&lt;python&gt;.upstream</code></h3>

| | |
|---|---|
| Syntax | `upstream: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Proxy to a Python server managed elsewhere instead of starting one.


<h3 id="tenants-.applications-.runtime.python.virtualenv"><code>tenants[].applications[].runtime&lt;python&gt;.virtualenv</code></h3>

| | |
|---|---|
| Syntax | `virtualenv: <string>` |
| Default | `none` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Virtual environment whose server binary and packages are used.


<h3 id="tenants-.applications-.runtime.python.workers"><code>tenants[].applications[].runtime&lt;python&gt;.workers</code></h3>

| | |
|---|---|
| Syntax | `workers: {...}` |
| Default | `none` |
| Context | `tenants[].applications[].runtime (type: python)` |
| Reload | applies on reload |

Worker processes of the application server (`min`).


<h3 id="tenants-.applications-.runtime.python.workers.autoscale"><code>tenants[].applications[].runtime&lt;python&gt;.workers.autoscale</code></h3>

| | |
|---|---|
| Syntax | `autoscale: off \| auto \| recommend` |
| Default | `recommend` |
| Context | `tenants[].applications[].runtime<python>.workers` |
| Reload | applies on reload |

`off`, `recommend` (default) or `auto` (ADR-0014).


<h3 id="tenants-.applications-.runtime.python.workers.max"><code>tenants[].applications[].runtime&lt;python&gt;.workers.max</code></h3>

| | |
|---|---|
| Syntax | `max: <integer>` |
| Default | `required` |
| Context | `tenants[].applications[].runtime<python>.workers` |
| Reload | applies on reload |

Upper bound when the pool is scaled.


<h3 id="tenants-.applications-.runtime.python.workers.min"><code>tenants[].applications[].runtime&lt;python&gt;.workers.min</code></h3>

| | |
|---|---|
| Syntax | `min: <integer>` |
| Default | `required` |
| Context | `tenants[].applications[].runtime<python>.workers` |
| Reload | applies on reload |

Processes started at the beginning and kept at least.


<h3 id="tenants-.applications-.runtime.python.workers.target_concurrency"><code>tenants[].applications[].runtime&lt;python&gt;.workers.target_concurrency</code></h3>

| | |
|---|---|
| Syntax | `target_concurrency: <integer>` |
| Default | `none` |
| Context | `tenants[].applications[].runtime<python>.workers` |
| Reload | applies on reload |

Concurrent requests one worker is expected to handle well (utilisation basis).
