Skip to content

Contributing

Contributions are welcome. QuOptuna is Apache 2.0 licensed. This page covers the dev environment, the Make targets, the quality checks, and the PR flow.

  • Python 3.11–3.12
  • Node 18+ — only needed for frontend development

Install the package and its dependencies (pytest, pytest-cov, ruff, and mypy are regular project dependencies, so no extra is needed):

Terminal window
uv sync

Backend and frontend dependencies can also be installed via Make:

Terminal window
make install_backend
make install_frontend
TargetWhat it does
make dev / make run_cliRun backend + frontend together
make run_backendRun the FastAPI server
make run_frontendRun the Next.js dev server
make run_streamlitLaunch the legacy Streamlit UI
make buildBuild wheel / sdist
make build_packageBuild frontend, bundle into package, then build the wheel (needed for uvx)
make formatFormat the code
make lintLint with ruff + mypy
make lint-fixAuto-fix lint issues
make testsRun the pytest suite
make coverageRun tests with coverage
make pre-commitRun pre-commit hooks

The Makefile needs bash, pkill, and lsof, so it does not run on a stock Windows install. scripts/run.mjs reimplements every target in Node (no extra dependencies — Node 18+ is all you need), exposed as npm scripts in the root package.json. These also work on macOS and Linux.

Make targetnpm equivalent
make dev / make run_clinpm run dev
make run_backendnpm run dev:backend
make run_frontendnpm run dev:frontend
make run_streamlitnpm run dev:streamlit
make install_backendnpm run install:backend
make install_frontendnpm run install:frontend
—npm run install:all (both of the above)
make initnpm run init (clears caches, then uv sync)
make buildnpm run build
make build_packagenpm run build:package
make formatnpm run format
make lintnpm run lint
make lint-fixnpm run lint:fix
make testsnpm run test
make coveragenpm run coverage
make pre-commitnpm run precommit
make cleannpm run clean (frees ports 8000/3000 via netstat + taskkill)
make clean_python_cachenpm run clean:cache
make clean_allnpm run clean:all
make helpnpm run help
—npm run gpu:check (report whether the GPU path is usable)
—npm run gpu:setup (create the CUDA environment, one-off)
—npm run dev:gpu (backend on GPU + frontend)

npm run dev starts both servers and stops both on Ctrl+C, killing the whole process tree so ports 8000 and 3000 are released. It also creates frontend/.env.local from .env.example when missing, so the UI on :3000 calls the API on :8000 rather than 404-ing against itself.

The GPU scripts (scripts/gpu.mjs) exist because JAX ships CUDA wheels for Linux only: on Windows the GPU backend runs inside WSL2 (distro chosen by QUOPTUNA_WSL_DISTRO, else the default) while the frontend stays on Windows. macOS has no CUDA backend for this stack.

Run these before opening a PR:

Terminal window
uv run pytest # coverage fail-under 35
uv run ruff check .
uv run mypy .
  • src/quoptuna/ — the canonical shipped package: backend engine, server, CLI, web/ (built UI), and the legacy frontend/.
  • frontend/ — Next.js dev source.
  • backend/ — legacy dev sub-project (its server code now lives in src/quoptuna/server).
  • db/ — SQLite stores.
  • infra/ — Terraform, deployment scripts, and runtime files for the AWS deployment (see Deploy the AWS infrastructure).
  • docs-site/ — this Astro docs site.
  • tests/ — the pytest suite.

Documentation is Markdown under docs-site/src/content/docs/. To preview locally:

Terminal window
cd docs-site
npm install
npm run dev
  1. Fork the repository.
  2. Create a feature branch.
  3. Make your change and ensure tests pass and ruff + mypy are clean.
  4. Open a PR against main.

QuOptuna is released under the Apache 2.0 license.