Skip to contents

Git hooks

git config core.hooksPath .githooks

One-time, per clone. Currently just .githooks/pre-commit: a reminder (not a hard requirement, mirroring ../quartifyr’s own hook) that warns when a commit touches a source that feeds man/figures/demo-deck-*.png or the downloadable man/figures/demo-deck.pptx – e.g. examples/demo-deck/presentation.yaml or the PPTX compositor in inst/python/deckifyr/pptx/ – without also touching that asset group. See the hook script itself for the exact trigger list and the regeneration recipe. Skip a false positive (a comment or refactor with identical composed output, say) with SKIP_DOCS_ASSET_CHECK=1 git commit or git commit --no-verify. man/figures/demo-deck-corner-tr-example.png is a supplementary asset in that same glob, rendered from a throwaway status_indicator: corner-tr copy of the project rather than presentation.yaml’s own tracked build – see the hook script’s own comment for why, and examples/demo-deck/README.md for how to regenerate it.

Python setup

uv run --extra dev pytest tests/python -v
# single file
uv run --extra dev pytest tests/python/test_units.py -v

uv run manages its own ephemeral venv from pyproject.toml – no manual venv activation needed.

Rebuilding the web frontend

cd web && npm install && npm run build

web/ (spec section 12) is a Vite/React/TypeScript app; its build output lands in inst/python/deckifyr/web/static/ and is committed to git, the same “generated output ships in the repo” precedent man/figures/*.png already sets (see this file’s own git-hooks section above) – neither the Python wheel nor an R package install can run a Node build at install time. The command above is for interactive use (npm install once, then npm run build as you iterate); you don’t need to run it by hand before committing – see below.

The pre-commit hook does the enforcement for you: staging any web/src/ or web/package(-lock).json change runs web/’s vitest suite, then (if uv is on PATH) a real Playwright e2e run against a live deckifyr serve, then npm run build, auto-staging whatever changed under inst/python/deckifyr/web/static/ – so the commit always carries the actual output of a build that just passed, not a promise that one was run by hand (issue #41). A failure at any step blocks the commit with the command that failed. This needs npm (and, for the e2e step, uv) on PATH; bypass with SKIP_WEB_CHECKS=1 git commit ... only if inst/python/deckifyr/web/static/ was already rebuilt and tested by hand, or git commit --no-verify for a change that provably can’t affect build output (e.g. a *.test.ts* file, which the build already excludes).

man/figures/web-app-editor.png/web-app-no-project.png/ web-app-furniture.png/web-app-layout-tab.png/web-app-add-slide.png/ web-app-add-element.png/web-app-build-preview.png/ web-app-color-swatch.png (real screenshots of a running editor, used in vignettes/articles/web-app.Rmd) are a second, separate rendered-doc-asset group from the demo-deck-* one above – the pre-commit hook flags a web/src/ change that doesn’t also touch at least one of these files; see .githooks/pre-commit’s own header comment for the exact Playwright-based regeneration recipe.

Regenerating the JSON Schema files

inst/python/deckifyr/schemas/{design,layouts,presentation}.schema.json are static JSON Schema files IDE YAML tooling (e.g. VS Code’s YAML extension, via the # yaml-language-server: $schema=... comment at the top of inst/examples/minimal-deck/*.yaml/examples/demo-deck/*.yaml) points at for autocomplete and inline validation – generated from the same deckifyr.schema.{design,layouts,presentation} pydantic models deckifyr schema [design|layouts|presentation]/R’s deck_schema() already dump on demand (issue #49). After changing any pydantic field in inst/python/deckifyr/schema/, regenerate them with:

uv run python scripts/generate_json_schemas.py

and commit the result – tests/python/test_json_schema_files.py fails if they’re out of date with the live models, the same “regenerate, don’t hand-edit” enforcement roxygen2::roxygenise() has for NAMESPACE/man/*.Rd below.

R setup

Rscript -e 'devtools::load_all(".")'          # load the package for interactive use
Rscript -e 'devtools::load_all("."); testthat::test_dir("tests/testthat")'

R tests that exercise the real R -> pyro -> Python bridge (as opposed to just checking function signatures) need uv on PATH and the pyro package installed; they skip() cleanly when either is missing rather than failing the suite.

NAMESPACE/man/*.Rd are roxygen2-generated. After changing any #' doc comment or @export in R/*.R, regenerate both with:

Rscript -e 'roxygen2::roxygenise()'

and commit the result – CI’s R-CMD-check.yaml workflow (R CMD check) fails if they’re out of date with R/*.R.

Every new @exported R function must also be added to _pkgdown.yml’s reference: index (or given @keywords internal to deliberately drop it from the reference page) – pkgdown::build_site() hard-errors, not just warns, on an exported topic missing from that index (“N topics missing from index”), and .github/workflows/pages.yml runs it on every push to main with no dry-run step, so a missed entry breaks the live docs deploy immediately after merge. Verify locally before opening a PR:

R CMD INSTALL --no-multiarch --with-keep.source .
Rscript -e 'pkgdown::build_site(new_process = FALSE, install = FALSE, preview = FALSE)'

(the package must actually be installed first, not just devtools::load_all()-ed – pkgdown loads it fresh via library() to build the reference index and run @examples.)

Running a real R CMD check/coverage locally

Rscript -e 'devtools::check()'
Rscript -e 'covr::package_coverage()'

Both install a fresh copy of the package into a temp location and run tests/testthat.R against that copy, not your checkout – so tests/testthat/test-wiring.R’s pyro-dependent tests will report as skipped (R CMD check) or show as 0% coverage (covr) here even though they pass for real under testthat::test_dir("tests/testthat") above. That’s expected, not a bug to chase: this repo deliberately doesn’t engineer around it (see CLAUDE.md’s architecture notes) – ci.yml’s full-pipeline job is the actual integration proof, run directly against the checkout instead.

Releases are immutable

A version is released by bumping the repo-root VERSION (never DESCRIPTION’s Version:; the release workflow syncs that). Once a version is published, release.yaml never touches it again: a push to main that does not bump VERSION releases nothing (it emits a notice), so a pinned deckifyr X.Y.Z plus the SHA-256 of its wheel or SHA256SUMS always names the same bytes. To ship a change, bump VERSION – do not re-tag.

For belt and braces, enable GitHub’s immutable releases setting for the repository (Settings -> General -> Releases). It needs admin rights, so the workflow cannot turn it on for itself; the workflow’s guard works without it.

Before opening a PR

  • uv run --extra dev pytest tests/python -v passes.
  • R tests pass or skip cleanly (see above).
  • If you touched a pydantic field in inst/python/deckifyr/schema/, uv run python scripts/generate_json_schemas.py produces no unexpected diff (see above).
  • Rscript -e 'roxygen2::roxygenise()' produces no unexpected diff if you touched any R/*.R doc comment.
  • Any new @exported R function is added to _pkgdown.yml’s reference: index (see above) – confirm with a local pkgdown::build_site() run, not just by eyeballing the YAML.
  • If you touched R/run-python.R or inst/python/deckifyr/cli.py‘s stdout/stderr handling, re-read both files’ comments about the stdout/stderr handshake between them before changing either side – see CLAUDE.md’s architecture notes for why it’s load-bearing.