Skip to main content

QualPipe-Webapp

The QualPipe-webapp project uses FastAPI as backend and frontend, plus D3.js for dynamic frontend visualizations, separated into clean services using Kubernetes (Kind).

Prerequisites

Make sure these software are already installed on your system:

If you are on a Mac, these dependencies can be quickly installed via homebrew executing:

brew install docker pixi

and verify the installation

docker version
pixi -V

🚀 Quick Start

Developer setup (first time only)

1. Clone the repo:

git clone <repository-url>
cd qualpipe-webapp

2. Setup environment

To setup the development environment execute:

pixi run dev-setup

This will:

  • ✅ Create an isolate Python environment with pixi
  • ✅ Install all dependencies from pyproject.toml (frontend, test, doc, dev)
  • ✅ Install the ctao-qualpipe-webapp package in editable mode
  • ✅ Generate data models
  • ✅ Compile backend and frontend requirements
  • ✅ Generate javascript schema
  • ✅ Install node dependencies

3. Configure host

To add the qualpipe.test.example hostname to the /etc/hosts file execute:

echo "127.0.0.1 qualpipe.test.example" | sudo tee -a /etc/hosts

This is only needed to reach the application by its domain name (see step 5).

4. Start the local development environment

To deploy the app and start the local development environment execute:

pixi run dev-up

This will:

  • ✅ Create a kind cluster with port mappings
  • ✅ Build Docker images (backend + frontend)
  • ✅ Install NGINX Ingress Controller
  • ✅ Deploy the application via Helm

⏳ Wait for all pods to be ready (can take 2-3 minutes).

5. Access the application

Via localhost (no port-forward needed): the kind cluster exposes the ingress on host port 8080 through extraPortMappings:

  • Frontend: http://localhost:8080/v1/frontend/home
  • Backend API: http://localhost:8080/api/docs (dev profile only)

Via the domain name qualpipe.test.example: the cluster does not listen on the standard ports 80/443, so the ingress controller ports must be forwarded. In a separate terminal inside a pixi shell (which provides kubectl), run (and keep it running):

sudo kubectl port-forward -n haproxy-controller svc/haproxy-kubernetes-ingress 443:443 80:80

Then open:

The JavaScript end-to-end tests always use the domain name, so they require this port-forward.


Developer Workflow (after the first time)

Pre-requisite: the local kubernetes cluster should be running already, if not execute pixi run dev-up. If you changed any dependency or modified code that requires model regeneration re-execute pixi run dev-setup.

If only images are changed:

Rebuild images and restart services

pixi run dev-restart

If images are NOT changed:

Upgrade only Helm chart

pixi run helm-dev-upgrade

View logs

To display logs from both backend and frontend containers execute:

pixi run kind-logs

To stop logs, you can soft-kill them with CTRL-C.


Verify installation

To check that the app is correctly deployed and properly set up, execute this command:

pixi run dev-health

If something is not ✅ OK check the cluster status with:

pixi run kind-status

or see Troubleshooting.


🧪 How to run tests

Here below are listed the commands to run all the various possible tests. To get more dertailled information visit also gitlab pages.

Backend unit tests

pixi run test-backend

Frontend python unit tests

pixi run test-frontend-py

Frontend javascript unit tests

pixi run test-frontend-js

Frontend end-to-end tests

By default the installed test browser are chromium, firefox, and webkit (Safari). Other browsers can be installed modifying the file playwright.config.ts.

The end-to-end tests reach the cluster through https://qualpipe.test.example, which requires forwarding the ingress controller ports. In a separate terminal inside a pixi shell (which provides kubectl), run (and keep it running while the tests execute):

sudo kubectl port-forward -n haproxy-controller svc/haproxy-kubernetes-ingress 443:443 80:80

This is only needed for the javascript end-to-end tests (test-frontend-e2e and all-tests).

To execute the tests run:

pixi run test-frontend-e2e

If the tests are failing for some browsers you can restrict the tests to a specific browser, e.g. Chromium, adding the flag --project=chromium to the above command. See also the troubleshooting.

To inspect the interactive html generated report simply execute:

npx playwright show-report

This will serve the interactvie html report at http://localhost:9323. Press Ctrl+C to quit.

All tests

To run all kinds of tests execute:

pixi run all-tests

You can always add the flag --project=chromium (or firefox or webkit) at the end of the previous command.


Cleanup

When you have done with your development you can execute a soft clean or a full clean

Soft clean

To stop only the pods, preserving the cluster, simply execute:

pixi run stop

To restart your development workflow then execute one of the following command, upon your case:

# With images rebuilding
pixi run dev-restart
# Without images rebuilding
pixi run dev-restart-no-build

Full clean

To stop the pods and remove the cluster execute:

pixi run stop-and-delete

To restart you development workflow, if you did not change the image, then execute:

pixi run dev-up-no-build

Otherwise if you need also to rebuild the image restart it with:

pixi run dev-up

Docker clean

You can remove the unused Docker container with:

pixi run prune

If you instead you want to clean everything (stop pods, remove cluster, remove docker images) you can execute:

pixi run clean-all

To restart your development workflow you can execute:

pixi run dev-up

📂 Project Structure

/qualpipe-webapp
│
├── kind-dev-config.yml              # Kind configuration file for local development
├── chart/                           # Helm chart instructions for deployment
├── Makefile                         # Makefile to build Backend and Frontend
│
├── docs/                            # Document folder
│
├── src/
│   └── qualpipe_webapp/
│       ├── backend/                 # FastAPI backend
│       │   ├── main.py              # Main FastAPI app for backend
│       │   ├── backends/            # JSON data sources
│       │   ├── codegen/             # Code generation templates and scripts
│       │   ├── quality_reports/     # Quality report generation templates and scripts
│       │   ├── requirements.txt     # Backend dependencies
│       │   ├── requirements-dev.txt # Backend dependencies for developer
│       │   └── Dockerfile           # Backend container
│       │
│       ├── frontend/                # FastAPI frontend
│       │   ├── /templates/          # Template pages
│       │   ├── /static/             # Static files (css, js, lib)
│       │   ├── main.py              # Main FastAPI app for frontend
│       │   ├── requirements.txt     # Frontend dependencies
│       │   ├── requirements-dev.txt # Frontend dependencies for developer
│       │   └── Dockerfile           # Frontend container
│       │
│       ├── nginx/
│       │   ├── nginx.conf
│       │   └── ssl/                 # (optional later)
│      ...
└── .gitignore

Pixi command

All the available Pixi tasks are listed and described in the table below.

Command: pixi Description
shell Activate the pixi environment
run install Install editable pixi environment
run install-all Install editable pixi environment with all extra dependencies
run compile-requirements-backend Generate/update backend requirements.txt
run compile-requirements-frontend Generate/update frontend requirements.txt
run compile-requirements-backend-dev Generate/update backend requirements-dev.txt
run compile-requirements-frontend-dev Generate/update frontend requirements-dev.txt
run compile-requirements Generate/update backend and frontend requirements.txt
run compile-requirements-dev Generate/update backend and frontend requirements-dev.txt
run npm-install Install NodeJS dependencies
run generate-codegen Generate Pydantic models from qualpipe criteria
run generate-frontend-schema Generate yaml file for javascript frontend validation (combines those produced by generate-codegen)
run build-backend Build backend image
run build-backend-dev Build backend dev image
run build-frontend Build frontend image
run build-frontend-dev Build frontend dev image
run build-images Build backend- and frontend- images
run build-images-dev Build backend- and frontend- dev images
run kind-create Create local kind cluster
run kind-delete Delete local kind cluster
run kind-load-images Load docker images on the cluster
run kind-load-dev-images Load docker dev images on the cluster
run kind-status Show kubernetes cluster status
run kind-clean-failed Remove kubernetes resources left from previously failed installation
run helm-install Install Helm chart
run helm-dev-install Install Helm chart for local development
run helm-uninstall Uninstall Helm chart
run helm-upgrade Upgrade Helm chart
run helm-dev-upgrade Upgrade Helm chart for local development
run ingress-install Install NGINX ingress controller for kind
run setup Install dependencies, execute generate-codegen and generate-frontend-schema, and install nodejs dependencies
run dev-setup Install dev dependencies in editable mode, execute generate-codegen and generate-frontend-schema, and install nodejs dependencies
run up Production deployment
run dev-up Deploy the complete development environment (create a kubernetes cluster, build docker dev images, install NGINX ingress controller for kind, install dev helm chart)
run dev-up-no-build Deploy the complete development environment without rebuilding images
run restart Build images and reinstall Helm chart
run dev-restart Build dev images and reinstall Helm chart
run dev-restart-no-build Reinstall Helm chart
run stop Stop pods preserving cluster
run stop-and-delete Stop pods and delete the cluster
run prune Cleanup dangling Docker images
run clean-all Stop pods, delete cluster, and remove docker images
run browser-install Install Playwright browsers for e2e tests
run test-backend Run backend python unit tests
run test-frontend-py Run frontend python unit tests
run test-frontend-js Run frontend javascript unit tests with Mocha
run test-frontend-e2e Run frontend javascript end-to-end tests with Playwright
run all-tests Run all backend and frontend tests
run check-backend Check backend health
run check-frontend Check frontend health
run check Check backend and frontend health
run kind-logs-backend Show backend container logs
run kind-logs-frontend Show frontend container logs
run kind-logs Show backend and frontend container logs
run dev-health Check backend and frontend health, check API endpoint, check that pods are running
run format Run ruff formatting
run lint Run ruff linting
run lint-fix Run ruff linting and fix

Pixi dependency graph tasks

install ─┐
         │
generate-codegen ─┐
                  │
compile-requirements-backend ──┐
                               ├─→ compile-requirements
compile-requirements-frontend ─┘

compile-requirements-backend-dev ──┐
                                   ├─→ compile-requirements-dev
compile-requirements-frontend-dev ─┘

install-all ─┐
             │
generate-codegen ─┐
                  │
compile-requirements-backend-dev ──┐
                                   ├─→ compile-requirements-dev
compile-requirements-frontend-dev ─┘           │
                                               │
npm-install ───────────────────────────────────┤
                                               ├─→ dev-setup
generate-frontend-schema ──────────────────────┘


kind-create ───────────────────────────────────┐
build-backend-dev  ─────────────┐              │
                                ├─→ build-images-dev ─┐
build-frontend-dev ─────────────┘                     │
                                                      ├─→ dev-up
ingress-install ──────────────────────────────────────┤
helm-dev-install ─────────────────────────────────────┘

kind-create ───────┐
ingress-install ───├─→ dev-up-no-build
helm-dev-install ──┘

build-backend ──┐
                ├─→ build-images
build-frontend ─┘

kind-clean-failed ─┐
                   ├─→ helm-install
kind-load-images ──┘

kind-clean-failed ────┐
                      ├─→ helm-dev-install
kind-load-dev-images ─┘

kind-load-images ──→ helm-upgrade
kind-load-dev-images ──→ helm-dev-upgrade

helm-uninstall ───┐
build-images ─────┤─→ restart
helm-install ─────┘

helm-uninstall ───┐
build-images-dev ─┤─→ dev-restart
helm-install ─────┘

helm-uninstall ───┐
                  ├─→ dev-restart-no-build
helm-dev-install ─┘

helm-uninstall ──→ stop

kind-delete ─┐
             ├─→ stop-and-delete
             └─→ clean-all

test-backend ──────────────┐
test-frontend-py ──────────┤
test-frontend-js ──────────┤
browser-install ──→ test-frontend-e2e
                           └─→ all-tests

check-backend ──┐
                ├─→ check
check-frontend ─┘

kind-logs-backend ──┐
                    ├─→ kind-logs
kind-logs-frontend ─┘

Makefile commands for advanced debug

We use the Makefile only for advanced debug pourposes

Makefile command Description
make dev-forward Manual port-forward (debug/fallback)
make dev-debug-network Debug network cluster/pod/ingress
make dev-trace-request Trace end-to-end request
make dev-debug-setup Advance diagnostic cluster setup
make kind-status-all Complete health check cluster/app

Code Generation Workflow

The project automatically generates Pydantic models from qualpipe criteria classes:

# Generate models manually
pixi run generate-codegen

# Or use the console script directly (after installation)
qualpipe-generate-models --module qualpipe.core.criterion \
    --out-generated src/qualpipe_webapp/backend/generated \
    --out-schemas src/qualpipe_webapp/frontend/static

The code generation creates:

  • Python Models: src/qualpipe_webapp/backend/generated/__init__.py

    • Pydantic models for each criterion type
    • Validation logic for telescope parameters
    • Type-safe configuration classes
  • JSON/YAML Schemas: src/qualpipe_webapp/frontend/static/

    • criteria_schema.json - JSON schema for frontend criteria report validation
    • criteria_schema.yaml - YAML schema for configuration

Such files are then implemented into metadata_schema.yaml with:

pixi run generate-frontend-schema

which is used for complete frontend validations, with all the correct references read from the configuration file config.js. The metadata_schema.yaml file is auto-generated from a template, so

Integration with CI/CD

The generated models are automatically created during:

  • Local development: pixi run dev-setup
  • CI/CD pipelines: Code generation runs before CI tests
  • Package installation: Post-install hooks generate models

🛠️ Troubleshooting


👩‍💻 Contributing

If you want to contribute in developing the code, be aware that we are using pre-commit, code-spell and ruff tools for automatic adherence to the code style. To enforce running these tools whenever you make a commit, setup the pre-commit hook executing:

pre-commit install

The pre-commit hook will then execute the tools with the same settings as when a merge request is checked on GitLab, and if any problems are reported the commit will be rejected. You then have to fix the reported issues before tying to commit again.

📄 License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.


Metadata

Release files for ctao-qualpipe-webapp 0.5.0

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

Source distribution (sdist)

Source distribution for ctao-qualpipe-webapp 0.5.0
File Size Uploaded Provenance Actions
ctao_qualpipe_webapp-0.5.0.tar.gz 7.3 MB Without provenance Details for ctao_qualpipe_webapp-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctao-qualpipe-webapp 0.5.0
File Interpreter ABI Platform Actions
ctao_qualpipe_webapp-0.5.0-py3-none-any.whl Python 3 none any Details for ctao_qualpipe_webapp-0.5.0-py3-none-any.whl

Total release size: 11.5 MB

Release files / ctao_qualpipe_webapp-0.5.0.tar.gz

Download URL ctao_qualpipe_webapp-0.5.0.tar.gz
Size 7.3 MB
Tags Source
SHA-256 checksum
How to use checksums
0cb9432f8edc4de949e429ff6670970df26604dfa87b765295fb87aeaa0c995d
BLAKE2b-256 checksum
How to use checksums
b1e6d8fbb4b7bcf73796374badb44f55e3ef0845c6f0225ca5dfcfa84237e79d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / ctao_qualpipe_webapp-0.5.0-py3-none-any.whl

Download URL ctao_qualpipe_webapp-0.5.0-py3-none-any.whl
Size 4.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
617b72fb5585d2df816f3d16b9081fb3264c9bfa96b40121111e074eeb8f5ba9
BLAKE2b-256 checksum
How to use checksums
50446a3e7f744934b21440931dcd223ae47625bd43612ac425f51ffe62dc6a42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.11

Security for ctao-qualpipe-webapp 0.5.0

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