Deployment#

This page gives an overview of how to run and deploy ngapp applications, and how compute environments fit into the picture.

Running locally#

During development you typically run your app locally in development mode:

python -m <module_name> --dev

This starts a local server, enables hot reloading, and opens a browser page (or prints a link) to your app.

For simple use cases you can also run your app without the --dev flag, which disables some development features.

GitHub Pages and static hosting#

The project template generated by python -m ngapp.create_app includes a GitHub Actions workflow file .github/workflows/deploy.yml. This workflow can build your app and publish it as a static web application on GitHub Pages.

For a step-by-step guide, see the Deploy App to Github Pages

tutorial. This tutorial explains how to:

  • enable GitHub Pages for your repository,

  • configure secrets if needed, and

  • trigger deployments from pushes or tags.

Dependencies of compute environments#

python -m ngapp.cli.deploy uploads the app wheel and a layer of packages that the runner puts on the PYTHONPATH of every job. The image of a compute environment comes from its dockerfile (or FROM python:<python> for env_type="venv") plus pip_dependencies from PyPI.

  • frontend_dependencies: local packages zipped from the current installation, for the browser and for the compute environments.

  • compute_dependencies: packages only the compute environments need. A plain name is zipped from the local installation if it is pure python. "name @ git+ssh://host/repo.git@<commit>" or "name @ /path/to/checkout" is built from source in a venv with the python and pip_dependencies of the compute environments (use this for compiled packages). The backend keeps the built wheel; it is only rebuilt when the commit, the local changes, python or pip_dependencies change.

  • --wheels DIR: uploads prebuilt wheels as they are.

config = AppConfig(
    ...,
    frontend_dependencies=["mymodel"],
    compute_dependencies=["mysolver @ git+ssh://git@host/mysolver.git@v1.2"],
    compute_environments=[
        ComputeEnvironment(
            env_type="docker",
            dockerfile=DOCKERFILE,
            python="3.14",
            pip_dependencies=["ngsolve==6.2.2608", "scipy"],
        )
    ],
)

python is checked when the image is built. Wheels must put their package at the root of the archive, the runner extracts them without pip.

Where to go next#

  • See the Tutorials for concrete deployment and compute examples.

  • Consult Utils for details on the environment and backend helper functions.

  • For front-end focused work continue with Components and Visualization.