Vidulividuli

Python

Comprehensive information about Python app configuration.

Common Settings

The section outlines common settings and behaviours for Python projects.

Python Version

The Python version is automatically detected from .python-version file in the root directory of your project and the appropriate image is selected according to it.

To use a different version of Python other than the default, create a .python-version file and add the version to it. Example,

3.11

Ensure you use a version supported by docker python image.

Package Manager

Currently, Viduli build system supports pip, pipenv and poetry package managers. Package managers are detected according to the following algorithm in the following order of precedence.

  1. If a requirements.txt file is detected - pip is used.
  2. If a Pipfile file is detected - pipenv is used.
  3. If a pyproject.toml file is detected - poetry is used.

Dependency Installation

Depending on the detected package manager, dependencies are installed using the following commands,

  • pip: pip install -r requirements.txt
  • pipenv: pipenv install --deploy --system
  • poetry: poetry install --no-root --only main

Django

Django builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Python version: 3.14.2
  • Default image: python:3.14.2-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8000

Build dependencies

Dependencies are installed based on the detected package manager (see Common Settings above).

Static Files

During the build process, Django's collectstatic command is automatically run to collect static files for production deployment.

Run command

The default uses an entrypoint script that automatically detects and starts your Django application. The entrypoint script:

  • Automatically detects your Django project module
  • Supports both WSGI and ASGI applications
  • Automatically selects the best available server (Gunicorn, uWSGI, Uvicorn, Hypercorn, or Daphne)
  • Configures optimal worker and thread counts based on available CPU cores
  • Falls back to Django's development server if no production server is available

You can override this by providing a custom run command in the resource build configuration.

Environment

The following Python environment variables are set:

  • PYTHONDONTWRITEBYTECODE=1 - Prevents Python from writing .pyc files
  • PYTHONUNBUFFERED=1 - Ensures Python output is sent straight to terminal
  • PYTHONFAULTHANDLER=1 - Enables faulthandler to dump Python traceback
  • PYTHONHASHSEED=random - Randomizes hash seed for security

By default, PORT is set to 8000. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Flask

Flask builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Python version: 3.14.2
  • Default image: python:3.14.2-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 5000

Build dependencies

Dependencies are installed based on the detected package manager (see Common Settings above).

Run command

The default uses an entrypoint script that automatically detects and starts your Flask application. The entrypoint script:

  • Automatically detects your Flask app file (looks for main.py, app.py, or application.py)
  • Supports both WSGI and ASGI applications (detects asgi_app definition)
  • Automatically selects the best available server (Gunicorn, uWSGI, Waitress, Uvicorn, Hypercorn, or Daphne)
  • Configures optimal worker and thread counts based on available CPU cores
  • Falls back to Flask's development server if no production server is available

You can override this by providing a custom run command in the resource build configuration.

Environment

The following Python environment variables are set:

  • PYTHONDONTWRITEBYTECODE=1
  • PYTHONUNBUFFERED=1
  • PYTHONFAULTHANDLER=1
  • PYTHONHASHSEED=random

By default, PORT is set to 5000 (Flask's default). If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

FastAPI

FastAPI builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Python version: 3.14.2
  • Default image: python:3.14.2-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8000

Build dependencies

Dependencies are installed based on the detected package manager (see Common Settings above). Additionally, fastapi-cli[standard] is installed globally for running FastAPI applications.

Run command

The default uses an entrypoint script that automatically detects and starts your FastAPI application using the FastAPI CLI. The entrypoint script:

  • Automatically detects your FastAPI app file (looks for main.py, app.py, or application.py)
  • Uses fastapi run command to start the application
  • Supports custom app file via APP_FILE environment variable

You can override this by providing a custom run command in the resource build configuration.

Environment

The following Python environment variables are set:

  • PYTHONDONTWRITEBYTECODE=1
  • PYTHONUNBUFFERED=1
  • PYTHONFAULTHANDLER=1
  • PYTHONHASHSEED=random

By default, PORT is set to 8000. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Tornado

Tornado builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Python version: 3.14.2
  • Default image: python:3.14.2-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8888

Build dependencies

Dependencies are installed based on the detected package manager (see Common Settings above).

Run command

The default uses an entrypoint script that automatically detects and starts your Tornado application. The entrypoint script:

  • Automatically detects your Tornado app file (looks for main.py, app.py, or application.py)
  • Sets the PORT environment variable for your application to use
  • Executes the Python file directly

You can override this by providing a custom run command in the resource build configuration.

Environment

The following Python environment variables are set:

  • PYTHONDONTWRITEBYTECODE=1
  • PYTHONUNBUFFERED=1
  • PYTHONFAULTHANDLER=1
  • PYTHONHASHSEED=random

By default, PORT is set to 8888. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Python (Generic)

The generic Python build option is suitable for deploying projects that are not built using a supported Python framework. If your project uses a supported framework such as Django or Flask, please select that option when deploying your project. By selecting the appropriate framework build, you get optimal settings that are not available when selecting the generic python option.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Python version: 3.14.2
  • Default image: python:3.14.2-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8000

Build dependencies

Dependencies are installed based on the detected package manager (see Common Settings above).

Run command

The default uses an entrypoint script that automatically detects and starts your Python application. The entrypoint script:

  • Automatically detects your Python app file (looks for main.py, app.py, or application.py)
  • Sets the PORT environment variable for your application to use
  • Executes the Python file directly

You can override this by providing a custom run command in the resource build configuration.

Environment

The following Python environment variables are set:

  • PYTHONDONTWRITEBYTECODE=1
  • PYTHONUNBUFFERED=1
  • PYTHONFAULTHANDLER=1
  • PYTHONHASHSEED=random

By default, PORT is set to 8000. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.