Skip to main content

Engine Gateway

Engine Gateway is a lightweight orchestration layer that makes it easy to mount, compose, and run multiple FastAPI applications as a distributed service for easier deployment. It dynamically loads app modules based on configuration and exposes them under configurable subpaths — enabling modular service composition, clean boundaries between components, and centralized deployment.

Usage

Installation

pip install dsw-engine-gateway
# or specific version
pip install dsw-engine-gateway==0.1.0
# or from repository
pip install git+https://github.com/ds-wizard/engine-gateway.git#egg=engine-gateway

Configuration

Create a configuration file (e.g., config.yaml) to define the applications to be mounted:

mounts:
  /example1:
    module: example_app
    app: app
  /example2:
    module: another_app.app
    factory: create_app
    kwargs:
      debug: true

Naturally, the module should be importable in your Python environment (i.e. having installed Python package exporting that module). You can specify either an app variable (a FastAPI instance) or a factory function that returns a FastAPI instance. Additional keyword arguments can be passed to the factory function via kwargs.

If hosting on different subpath than root, you can configure the base path of the gateway:

gateway:
  root_path: /gateway

You can also configure /info endpoint that reports metadata about the mounted applications:

gateway:
  info:
    enabled: true
    token: secretToken

(See config.example.yaml for more details.)

You can also use the following environment variables to override configuration options:

  • CONFIG_FILE: Path to the configuration file (default: config.yaml).
  • GATEWAY_ROOT_PATH: Base path for the gateway (overrides gateway.root_path).
  • GATEWAY_INFO_ENABLED: Enable or disable the /info endpoint (overrides gateway.info.enabled).
  • GATEWAY_INFO_TOKEN: Token for accessing the /info endpoint (overrides gateway.info.token).
  • SENTRY_DSN: DSN for Sentry error tracking (enables Sentry integration if set).
  • SENTRY_TRACES_SAMPLE_RATE: Sample rate for Sentry performance tracing (default: 1.0).
  • SENTRY_PROFILES_SAMPLE_RATE: Sample rate for Sentry profiling (default: 1.0).
  • SENTRY_MAX_BREADCRUMBS: Maximum number of breadcrumbs to store in Sentry (default: 100).
  • SENTRY_ENVIRONMENT: Environment name for Sentry (default: production).
  • SENTRY_AWS_LAMBDA: Enable AWS Lambda integration for Sentry (default: false).

Usage

You can run the Engine Gateway using Uvicorn:

uvicorn engine_gateway:create_app --host

In typical use cases, you would use engine_gateway as a dependency and re-packing it together with your config files and environment setup into a Docker image for deployment:

FROM dsw-engine-gateway:latest

COPY requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt

COPY config.yaml /app/config.yaml

CMD ["uvicorn", "engine_gateway:create_app", "--host", "0.0.0.0", "--port", "80", "--proxy-headers"]

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.

Metadata

Release files for dsw-engine-gateway 1.0.1

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

Source distribution (sdist)

Source distribution for dsw-engine-gateway 1.0.1
File Size Uploaded Provenance
dsw_engine_gateway-1.0.1.tar.gz 10.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dsw-engine-gateway 1.0.1
File Interpreter ABI Platform
dsw_engine_gateway-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 21.8 kB

Release files / dsw_engine_gateway-1.0.1.tar.gz

Download URL dsw_engine_gateway-1.0.1.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cfe58d8e6e71bcfba24595ae7b5b1913803efeaccd4493ced6fc17ab41dba076
BLAKE2b-256 checksum
How to use checksums
bea6698e6cb33b910e6d1e99e4870450f7d40507d5af61af4b3d3c4a683142de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / dsw_engine_gateway-1.0.1-py2.py3-none-any.whl

Download URL dsw_engine_gateway-1.0.1-py2.py3-none-any.whl
Size 11.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4de0964000e1d4097a899dfeee1211333527ab9ed0b8514cdb19d654653dee6c
BLAKE2b-256 checksum
How to use checksums
adae1446af717bbbd09e21c909b42df1d2cd6831e7ee2ed0cab818a3c4bbff61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for dsw-engine-gateway 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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