Skip to content

Local Project Development

This page covers development of Triton Control itself. For the user-facing Development feature backed by code-server on Kubernetes, see Development Workspaces.

Use local Python for the backend and npm for the frontend.

Prerequisites

  • Python 3.12.
  • Node.js and npm.
  • Java, Bash, curl, and Python for npm run generate:api; the script downloads and runs swagger-codegen-cli.jar.

Backend

cd triton-backend
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
python main.py

Windows PowerShell:

cd triton-backend
python -m venv .venv
.\.venv\Scripts\activate
pip install -e ".[dev]"
python main.py

Backend environment is loaded from:

triton-backend/.env

Create it from:

triton-backend/.env.example

Frontend

cd triton-frontend
npm ci
npm run generate:api
npm run start:http

HTTPS mode:

npm run start:https

VS Code

The repo includes .vscode/launch.json with a generic Python current-file debug configuration. Open triton-backend/main.py and start the Python debugger for backend debugging.

Run the Angular dev server from a terminal:

cd triton-frontend
npm run start:http

Backend Checks

docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/gitleaks/gitleaks:latest detect --no-git --source . --redact --verbose
cd triton-backend
pip install -e ".[dev]"
pip install pip-audit
pip-audit
coverage run -m unittest discover -s tests -p "test_*.py" -v
coverage report --fail-under=75
mypy app/ tests/ scripts/ main.py
ruff check app/ main.py
lint-imports
bandit -r app/ main.py

Frontend Checks

cd triton-frontend
npm ci
npm audit --audit-level=moderate
npm run generate:api
npm run lint
npm run format:check
npm test -- --watch=false --browsers=ChromeHeadless --code-coverage

Smoke Tests

cd triton-frontend
npm run test:smoke

Workspace Connections to MLflow and Argo

The Backend CI → workspace-connections-smoke job runs automatically on backend, extension, and chart changes. It creates an isolated Kind cluster, installs Triton Control and Argo, creates MLflow and a code-server workspace through the API, and tests both connections with the injected credentials. Missing or incorrect credentials must be rejected. The cluster is deleted after the test; failures fail the CI job. The real Argo CLI also lists, submits, reads, and deletes a test workflow through the workspace proxy, and verifies rejection of an incorrect credential.

To reproduce the complete CI test locally, run from the repository root with Docker, Kind, Helm, kubectl, and Python 3 installed:

bash triton-backend/scripts/ci_workspace_connections.sh

To check an existing workspace instead:

kubectl exec -i -n triton-control <workspace-pod> -c code-server -- python3 - \
  < triton-backend/scripts/smoke_workspace_connections.py

Replace <workspace-pod> with your code-server pod name. The test runs inside the workspace using its injected credentials. It lists experiments and workflows, checks that missing or incorrect credentials are rejected, and exits nonzero on failure. It creates no resources and prints no tokens.