diff --git a/.dockerignore b/.dockerignore index 8dfe3fd..7eee866 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,5 @@ __pycache__ .pytest_cache .codebuild .gihub +frontend/node_modules +frontend/src/.observablehq diff --git a/.gitignore b/.gitignore index 5021e6a..5cf1ecb 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ _build docs/design app/docs app/examples -app/frontend/node_modules -app/frontend/src/.observablehq +frontend/node_modules +frontend/src/.observablehq docs/assets/examples docs/examples/output diff --git a/Makefile b/Makefile index 8f2b1f1..8ee4fe6 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ docs-serve: ## serve docs, examples, and API with auto-reload .PHONY: frontend-build frontend-build: ## build Observable frontend examples @rm -rf app/examples - @npm --prefix app/frontend run build + @npm --prefix frontend run build .PHONY: frontend-serve frontend-serve: ## serve Observable frontend with auto-reload diff --git a/dev/docs-serve b/dev/docs-serve index 4e44b39..e3fd757 100755 --- a/dev/docs-serve +++ b/dev/docs-serve @@ -7,7 +7,7 @@ API_PORT=${API_PORT:-8001} FRONTEND_ORIGIN=${FRONTEND_ORIGIN:-http://127.0.0.1:${OBSERVABLE_PORT}} QUANTFLOW_API_ORIGIN=${QUANTFLOW_API_ORIGIN:-http://127.0.0.1:${API_PORT}} -npm --prefix app/frontend exec concurrently -- \ +npm --prefix frontend exec concurrently -- \ --kill-others \ --names docs,examples,api \ --prefix "[{name}]" \ diff --git a/dev/frontend-serve b/dev/frontend-serve index a18a367..fb70afa 100755 --- a/dev/frontend-serve +++ b/dev/frontend-serve @@ -5,4 +5,4 @@ OBSERVABLE_PORT=${OBSERVABLE_PORT:-3001} echo "Examples: http://127.0.0.1:${OBSERVABLE_PORT}" -npm --prefix app/frontend run dev -- --host 127.0.0.1 --port ${OBSERVABLE_PORT} +npm --prefix frontend run dev -- --host 127.0.0.1 --port ${OBSERVABLE_PORT} diff --git a/dev/quantflow.dockerfile b/dev/quantflow.dockerfile index 7c52811..fbc3d49 100644 --- a/dev/quantflow.dockerfile +++ b/dev/quantflow.dockerfile @@ -5,8 +5,11 @@ FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim AS builder WORKDIR /build # Install Chromium for kaleido (Plotly static image export used by docs examples) +# Install Node.js for Observable Framework frontend build RUN apt-get update && apt-get install -y --no-install-recommends \ chromium \ + nodejs \ + npm \ && rm -rf /var/lib/apt/lists/* # Copy dependency files @@ -20,7 +23,10 @@ COPY mkdocs.yml ./ COPY dev/ ./dev/ COPY docs/ ./docs/ COPY quantflow/ ./quantflow/ +COPY frontend/ ./frontend/ COPY app/ ./app/ +RUN npm --prefix frontend install +RUN npm --prefix frontend run build RUN uv run ./dev/build-examples RUN uv run mkdocs build diff --git a/app/frontend/observablehq.config.js b/frontend/observablehq.config.js similarity index 99% rename from app/frontend/observablehq.config.js rename to frontend/observablehq.config.js index d7e7f16..70f294a 100644 --- a/app/frontend/observablehq.config.js +++ b/frontend/observablehq.config.js @@ -11,7 +11,7 @@ const headSnippet = readFileSync(resolve(__dirname, "../../docs/assets/logos/hea export default { title: "Quantflow Examples", root: "src", - output: "../examples", + output: "../app/examples", base: "/examples", head: `\n${headSnippet}`, style: "style.css", diff --git a/app/frontend/package-lock.json b/frontend/package-lock.json similarity index 100% rename from app/frontend/package-lock.json rename to frontend/package-lock.json diff --git a/app/frontend/package.json b/frontend/package.json similarity index 100% rename from app/frontend/package.json rename to frontend/package.json diff --git a/app/frontend/src/cointegration.md b/frontend/src/cointegration.md similarity index 100% rename from app/frontend/src/cointegration.md rename to frontend/src/cointegration.md diff --git a/app/frontend/src/heston-vol-surface.md b/frontend/src/heston-vol-surface.md similarity index 100% rename from app/frontend/src/heston-vol-surface.md rename to frontend/src/heston-vol-surface.md diff --git a/app/frontend/src/hurst.md b/frontend/src/hurst.md similarity index 100% rename from app/frontend/src/hurst.md rename to frontend/src/hurst.md diff --git a/app/frontend/src/index.md b/frontend/src/index.md similarity index 100% rename from app/frontend/src/index.md rename to frontend/src/index.md diff --git a/app/frontend/src/lib/api.ts b/frontend/src/lib/api.ts similarity index 100% rename from app/frontend/src/lib/api.ts rename to frontend/src/lib/api.ts diff --git a/app/frontend/src/lib/palette.ts b/frontend/src/lib/palette.ts similarity index 100% rename from app/frontend/src/lib/palette.ts rename to frontend/src/lib/palette.ts diff --git a/app/frontend/src/sampling.md b/frontend/src/sampling.md similarity index 100% rename from app/frontend/src/sampling.md rename to frontend/src/sampling.md diff --git a/app/frontend/src/style.css b/frontend/src/style.css similarity index 100% rename from app/frontend/src/style.css rename to frontend/src/style.css diff --git a/app/frontend/src/supersmoother.md b/frontend/src/supersmoother.md similarity index 100% rename from app/frontend/src/supersmoother.md rename to frontend/src/supersmoother.md diff --git a/app/frontend/src/volatility-surface.md b/frontend/src/volatility-surface.md similarity index 100% rename from app/frontend/src/volatility-surface.md rename to frontend/src/volatility-surface.md diff --git a/app/frontend/src/yield-curve.md b/frontend/src/yield-curve.md similarity index 100% rename from app/frontend/src/yield-curve.md rename to frontend/src/yield-curve.md diff --git a/pyproject.toml b/pyproject.toml index 2d822a0..048d7b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,17 +134,10 @@ exclude_also = [ [tool.isort] profile = "black" -skip_glob = [ - "app/frontend/*", -] [tool.black] -extend-exclude = "/app/frontend/" [tool.ruff] -exclude = [ - "app/frontend", -] lint.select = [ "E", "F", @@ -158,9 +151,6 @@ path = "quantflow/__init__.py" # strict = true disallow_untyped_calls = true disallow_untyped_defs = true -exclude = [ - "^app/frontend/", -] warn_no_return = true disable_error_code = [ "prop-decorator",