Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: quantflow-instructions
description: 'Instructions for quantflow'
applyTo: '/**'
---


# Quantflow Instructions


## Docker

* The Dockerfile is at `dev/quantflow.dockerfile`
* Uses `ghcr.io/astral-sh/uv:python3.14-bookworm-slim` as the base image (uv + Python bundled, no separate install needed)
* Multi-stage build: builder installs deps and builds docs, runtime copies the `.venv` and app code
* Package manager is `uv` — do not use Poetry or pip directly

## Documentation

* The documentation for quantflow is available at `https://quantflow.quantmid.com`
* Documentation is built using [mkdocs](https://www.mkdocs.org/) and stored in the `docs/` directory. The documentation source files are written in markdown format.

10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: pip install -U pip poetry
- name: Install dependencies no book
run: poetry install --all-extras
- name: run tests no book
- name: Install uv
run: pip install -U pip uv
- name: Install dependencies
run: make install-dev
- name: run tests
run: make tests
- name: Install dependencies
run: make install-dev
Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@readme.md
@.github/copilot-instructions.md
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ help:

.PHONY: lint
lint: ## Lint and fix
@poetry run ./dev/lint fix
@uv run ./dev/lint fix


.PHONY: lint-check
lint-check: ## Lint check only
@poetry run ./dev/lint
@uv run ./dev/lint


.PHONY: install-dev
Expand All @@ -27,15 +27,15 @@ marimo: ## Run marimo for editing notebooks
.PHONY: docs
docs: ## build documentation
@cp docs/index.md readme.md
@poetry run mkdocs build
@uv run mkdocs build

.PHONY: docs-serve
docs-serve: ## serve documentation
@poetry run mkdocs serve --livereload --watch quantflow --watch docs
@uv run mkdocs serve --livereload --watch quantflow --watch docs

.PHONY: publish
publish: ## Release to pypi
@poetry publish --build -u __token__ -p $(PYPI_TOKEN)
@uv publish --token $(PYPI_TOKEN)

.PHONY: tests
tests: ## Unit tests
Expand All @@ -44,4 +44,4 @@ tests: ## Unit tests

.PHONY: outdated
outdated: ## Show outdated packages
poetry show -o -a
uv tree --outdated
3 changes: 1 addition & 2 deletions dev/install
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash

pip install -U pip poetry
poetry install --all-extras --with book --with docs
uv sync --all-extras
10 changes: 5 additions & 5 deletions dev/lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ fi

taplo ${TAPLO_ARG}
echo isort
isort quantflow quantflow_tests ${ISORT_ARGS}
uv run isort quantflow quantflow_tests ${ISORT_ARGS}
echo black
black quantflow quantflow_tests ${BLACK_ARG}
uv run black quantflow quantflow_tests ${BLACK_ARG}
echo ruff
ruff check quantflow quantflow_tests ${RUFF_ARG}
uv run ruff check quantflow quantflow_tests ${RUFF_ARG}
echo mypy
mypy quantflow
uv run mypy quantflow
echo mypy tests
mypy quantflow_tests --explicit-package-bases
uv run mypy quantflow_tests --explicit-package-bases
36 changes: 12 additions & 24 deletions dev/quantflow.dockerfile
Original file line number Diff line number Diff line change
@@ -1,53 +1,41 @@
# Multi-stage build for quantflow app
# Stage 1: Build stage
FROM python:3.14-slim AS builder
FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim AS builder

# Set working directory
WORKDIR /build

# Install poetry
RUN pip install poetry
# Copy dependency files
COPY pyproject.toml uv.lock readme.md ./

# Copy dependency files including lock file
COPY pyproject.toml poetry.lock readme.md ./
# Install dependencies (no root package, with needed extras)
RUN uv sync --frozen --no-install-project --extra book --extra docs --extra data

# Configure poetry to not create virtual environments and install dependencies
RUN poetry config virtualenvs.create false && \
poetry install --no-root --with book \
--with docs --extras data --no-interaction --no-ansi

# Copy additional files needed for docs build
# Copy source and build docs
COPY mkdocs.yml ./
COPY docs/ ./docs/
COPY quantflow/ ./quantflow/

# Build static documentation
RUN mkdocs build
RUN uv run mkdocs build

# Stage 2: Runtime stage
FROM python:3.14-slim
FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim

# Set working directory
WORKDIR /app

# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy virtualenv from builder
COPY --from=builder /build/.venv /app/.venv

# Copy application code
COPY quantflow/ ./quantflow/
COPY app/ ./app/
COPY pyproject.toml ./

# Copy built documentation from builder
# Copy built documentation
COPY --from=builder /build/app/docs ./app/docs

# Set Python path
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV PATH="/app/.venv/bin:$PATH"

# Expose port
EXPOSE 8001

# Run the application
CMD ["python", "-m", "app"]
3 changes: 1 addition & 2 deletions dev/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env sh

poetry run \
uv run \
pytest -x -vv \
--log-cli-level error \
--cov --cov-report xml --cov-report html "$@"

Loading
Loading