Everything deckifyr actually does – schema validation, unit parsing,
deep-merge precedence, plan/shell expansion, and .pptx
composition – lives in inst/python/deckifyr/, a real,
independently-installable Python package – the same source tree is
bundled unmodified inside the R package and built as a standalone wheel
(where it’s published is still an open question, spec section 21). The R
package is a thin facade over it via pyro, never a
second implementation of the same logic. This article covers using it
directly, with no R involved at all – everything below also works the
same way whether it’s driven by the R facade or by hand.
git clone https://github.com/jprybylski/deckifyr && cd deckifyr
uv sync --extra dev # provisions .venv/ from pyproject.toml
uv run deckifyr --helpuv run manages its own ephemeral venv from
pyproject.toml; no manual venv activation is needed for any
command below.
The CLI
--json emits structured JSON instead of human-readable
text on success; every command’s exit code is stable and independent of
message wording (0 success, 1
schema/validation failure, 2 argparse usage error,
3 I/O failure, 4 feature not implemented yet).
No subcommand makes network calls.
The --json output is a versioned contract. Every success
payload (on stdout) and every error payload (on stderr) carries
"result_version" (currently 1); it changes
only for a break an existing consumer couldn’t ignore, and adding a key
is not one, so tolerate unknown keys (the published schemas allow them
and carry a versioned $id). A failure that is not a
deckifyr error – say the output .pptx is open in another
program – is still one JSON object on stderr: E_IO for an
OS error, E_INTERNAL otherwise (add the global
--debug flag to include a traceback).
validate, build and preview have
published JSON Schemas under
inst/python/deckifyr/schemas/results/
(validate, build, preview,
error, plus ok for what every other command
promises). Notably build and preview return
the full list of warnings –
{code, message, slide, element} each, whether or not a
manifest is written – and an artifacts list of
{kind, path, sha256} for the .pptx, manifest,
previews and preview PDF; warning_count and the original
keys are unchanged.
init: scaffold a new project
Copies the bundled
design.yaml/layouts.yaml/presentation.yaml
trio from inst/examples/minimal-deck/ into
my-deck/. Errors if the target directory isn’t empty unless
--force is given.
validate: schema + geometry validation
Loads and pydantic-validates the presentation, design, and layouts
documents together – cross-checking layout references and box unit
strings – without composing anything. --strict (the
default) fails on any problem; --warn-only downgrades
non-fatal issues to warnings.
build: compile a .pptx
Validates the same way as validate, then runs the
two-pass pipeline (below) to write a real .pptx and a JSON
manifest next to it, per presentation.yaml’s
build.output/build.manifest settings.
schema: dump a document type’s JSON Schema
Prints the pydantic model’s model_json_schema() for the
given document type – useful for editor autocomplete/validation on the
YAML files themselves.
preview: render slide PNGs
Renders each slide to a standalone PNG via LibreOffice
(soffice --headless --convert-to pdf) + PyMuPDF
rasterization – requires soffice on PATH;
fails with a structured E_MISSING_DEPENDENCY error naming
where to get it (https://www.libreoffice.org/download/download/) if it
isn’t found. --slides restricts rendering to specific
1-indexed slide numbers (default: every slide).
presentation.yaml’s build.previews: true also
renders previews as part of an ordinary build.
inspect: look inside a presentation or a built
.pptx
uv run deckifyr inspect my-deck/presentation.yaml
uv run deckifyr inspect my-deck/build/my-deck.pptxDetects the target by file extension. Given a
presentation.yaml, it plans the deck (the same Pass 1
build/validate already use) and reports the
resolved slide list – element counts/types, notes presence – without
composing or writing anything. Given a .pptx, it opens the
file for real with python-pptx and reports what actually
landed in it (slide/shape counts, shape names, rotation, notes
presence), plus a summary of a sibling
<stem>.manifest.json if one exists.
get/set: read and write a single config
value
uv run deckifyr get my-deck/design.yaml colors.primary
uv run deckifyr set my-deck/design.yaml colors.primary "#123456"Dotted-path (./[N]) access into any of the
three document types, e.g. colors.primary or
slides[0].notes. set’s value is
parsed as JSON (numbers/bools/null/arrays/objects) when it’s valid JSON,
otherwise used as a literal string – so a bare hex color or font name
needs no quoting, while --string forces the literal-string
branch for a value that would otherwise parse as JSON (e.g. the literal
text "true"). Every edit is schema-validated (and, for a
changed slide.layout, cross-checked against
layouts.yaml) before it’s written – a rejected
edit never touches the file.
slide: manage presentation.yaml’s slide
list
uv run deckifyr slide list my-deck/presentation.yaml
uv run deckifyr slide add my-deck/presentation.yaml --id new-slide --layout title-slide
uv run deckifyr slide update my-deck/presentation.yaml new-slide --notes "..."
uv run deckifyr slide move my-deck/presentation.yaml new-slide --after intro
uv run deckifyr slide remove my-deck/presentation.yaml new-slidelist/add/update/move/remove,
id-keyed throughout – array indices are never the primary way to address
a slide. add/move accept at most one of
--index/--after/--before.
skills: export bundled coding-agent skill files
Exports two bundled Claude Skills-format SKILL.md files
(deckifyr-org-config for
design.yaml/layouts.yaml,
deckifyr-presentation for presentation.yaml)
to a directory of your choice – works with Claude Code or any other
coding agent that reads SKILL.md files.
serve: the local web editor
Requires the optional web extra
(uv sync --extra web, or the release wheel with the
[web] extra, see “Installing the Python engine from a
release” below) for fastapi/uvicorn. Runs a
local FastAPI backend plus a React/Konva editor over one project
directory for the life of the process – drag/resize/rotate elements on a
slide canvas, edit
design/layouts/presentation.yaml
through a schema-driven form (or raw JSON), trigger builds, and download
artifacts. See vignette("web-app") for the full
walkthrough.
Running serve under a supervisor or a reverse
proxy
serve can also run as a managed child of a launcher (a
local workspace app, a process supervisor) and be mounted under a URL
prefix:
-
Path prefix. The editor only ever emits
page-relative URLs, so a proxy that strips a prefix
(
/apps/deckifyr/->/) needs no configuration – browse to the mount URL with its trailing slash. For a proxy that forwards the prefix without stripping it, pass--root-path /apps/deckifyr. (uvicorn’s ownroot_pathis not used: it prepends the prefix, which is the opposite of what that case needs.) -
--launcher workspacetells the editor a workspace launcher started it (its “no project found” screen then shows workspace guidance instead of CLI/R commands) and implies--no-frontend-rebuild, so it never shells out tonpm, whatever the checkout layout. -
Readiness and state.
GET /api/healthreturning 200 means the server is ready to accept project requests; it never depends on the project loading. It also reportsproject_loaded/project_error(is the project usable?),dirty(unsaved in-memory edits) andactive_jobs(queued/running build or preview jobs), so a supervisor can tell whether stopping is safe without making an edit to find out. -
Guidance highlights. A host page on the editor’s
own origin that frames it can point a walkthrough at the Save button,
the Build tab and the Build button. It posts
{type: "guidance", v: 1, op: "highlight", id, seq}to the frame (op: "clear"removes the outline), withidone ofdeckifyr.session.save,deckifyr.nav.buildordeckifyr.build.run, and the editor replies{type: "guidance-reply", v: 1, op, id, seq, state}withstateshown,absentorunknown. Only messages from the parent window on the same origin are read, and a highlight never moves focus, switches tabs or clicks.GET /api/healthlists the ids underguidance. -
Orderly stop.
POST /api/shutdownwith an optional JSON body{"if_dirty": "refuse" | "save", "active_jobs": "refuse" | "cancel"}(both default to"refuse"). A refusal is a409withE_SHUTDOWN_REFUSEDand thereasons; it decides before saving or cancelling anything, so a refused stop leaves the server and its edits untouched.savewrites the edits first;cancelkills running jobs’ process trees. The process then exits0. A plainSIGTERM/SIGINTcannot ask, so it writes a warning to stderr if edits were left unsaved (and cancels leftover jobs) rather than losing work silently. -
Protection from other browser tabs. The server only
answers a
Hostof127.0.0.1/localhost/[::1]on its own port (plus the--hostit bound and any--allowed-host, repeatable – give a reverse proxy’s public name here); anything else is421, which blocks DNS rebinding. A state-changing request markedSec-Fetch-Site: cross-site/same-site, or with a foreignOrigin, is403.--api-token-env VARmakes every/api/*request exceptGET /api/healthrequire the secret in$VARas anX-Deckifyr-Api-Tokenheader; the proxy injects it, the editor’s bundle never sees it, and static assets stay open. -
Project files as untrusted data.
--rscript-bin,--quarto-binand--soffice-bin(orDECKIFYR_*_BIN) run the launcher’s own executables instead of a project file’sbuild.*.binary.--trusted-binaries-onlyrejects a project whosebinarydiffers from the default (E_UNTRUSTED_BINARY) and requiresdesign.base,layouts,build.output,build.manifestandbuild.reportifyrpaths to stay inside the project (E_PATH_OUTSIDE_PROJECT;--allow-outside-projectrelaxes the paths). Off by default. These flags work onvalidate,build,preview,inspectandserve, and reach the editor’s saves and every build it runs. -
Bounded jobs.
--job-timeout SECONDS(default 600,0for no limit) bounds every background build/preview; an overrun is killed with its whole process tree and reported asE_TIMEOUT. Jobs can be cancelled withPOST /api/jobs/{id}/cancel.
Architecture: two decoupled passes
flowchart LR
Y["design.yaml / layouts.yaml / presentation.yaml"] --> S["deckifyr.schema\n(units, merge, pydantic models)"]
S --> P["deckifyr.plan\nPass 1: shell expansion"]
P --> R["deckifyr.resolvers\nlocal / inline / table / reportifyr / quarto"]
R --> C["deckifyr.pptx.compose\nPass 2: python-pptx composition"]
C --> O[".pptx + manifest.json"]
deckifyr.plan (Pass 1) has zero
python-pptx import. It resolves design.yaml
style tokens to literal values and expands each slide’s elements –
including document furniture (background/status/branding/ page-number)
and {rpfy}: magic-string resolution via
deckifyr.resolvers – into
ResolvedElement/ResolvedSlide dataclasses: a
shell that’s inspectable or cacheable on its own, with no second pass
required to make sense of it. deckifyr.pptx.compose (Pass
2) is the only place that touches python-pptx, turning that
shell into real shapes on real slides. If you’re extending deckifyr
rather than just using it, this split is the first thing to understand –
a new element type’s zone/required semantics belong in
plan.py; only actual shape construction belongs in
pptx/compose.py.
deckifyr.renderers.quarto executes a
type: quarto element’s .qmd fragment (via a
real quarto binary) and turns it into either normalized
text or a rasterized PNG, resolved into the plan by
deckifyr.resolvers.quarto.QuartoResolver like any other
element source – never through Quarto’s own PPTX writer.
deckifyr.renderers.preview shells out to LibreOffice +
PyMuPDF to render slide PNGs (the preview command above).
deckifyr.web is the FastAPI backend + React/Konva frontend
behind serve above – it calls straight into the same
deckifyr.plan/deckifyr.pptx.compose/
deckifyr.editor pipeline this section describes, not a
second implementation of it.
Installing the Python engine from a release
Every GitHub release attaches a pure-Python wheel and an sdist next
to the R source tarball, plus a SHA256SUMS file covering
all of them. Their version always equals the release tag
(VERSION), so a consumer can pin by version
and by hash instead of tracking a moving git ref:
VERSION=0.3.4 # the release you want
BASE=https://github.com/jprybylski/deckifyr/releases/download/v$VERSION
# Add it to a project (uv records the wheel's hash in uv.lock) ...
uv add "deckifyr[web,preview] @ $BASE/deckifyr-$VERSION-py3-none-any.whl"
# ... or verify a download yourself before installing it:
curl -LO $BASE/deckifyr-$VERSION-py3-none-any.whl
curl -LO $BASE/SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS # `shasum -a 256 -c` on macOS
uv pip install "./deckifyr-$VERSION-py3-none-any.whl[web,preview]"The wheel bundles the built web editor, the JSON Schemas (including
the --json result schemas), the coding-agent skills and the
example project deckifyr init scaffolds from, so
deckifyr init, validate, build
and serve all work straight after install. External tools
(LibreOffice for previews, Quarto, R for .rds tables) are
still separate installs; see the extras below.
Optional extras
Extras are selected with the usual [extra] suffix on the
wheel (or, in a repo checkout,
uv sync --extra <name>):
uv sync --extra tables # Parquet table sources (pyarrow)
uv sync --extra web # the `serve` command's web editor (fastapi/uvicorn)
uv sync --extra preview # `preview`/`build.previews` rasterization (pymupdf)
uv sync --extra dev # test suite (pytest, pyarrow, ...)CSV table sources work with no extra; a project using only CSV
table elements never pays for pyarrow.
Offline use
Nothing in deckifyr reaches the network unless you ask it to, but
uv does by default: uv run re-locks and syncs
a project whose lock is stale, and can download a Python. For a
firewalled machine, turn on offline mode with
options(deckifyr.offline = TRUE),
DECKIFYR_OFFLINE=1 or UV_OFFLINE=1. The R
wrappers then run uv run --no-sync with
UV_OFFLINE, UV_NO_INDEX and
UV_PYTHON_DOWNLOADS=never, so the environment that is
already there is used as it is. The Python CLI honours
DECKIFYR_OFFLINE/UV_OFFLINE as well:
init --from-repo is refused (it needs a
git clone); clone the repository while you have access and
use --from-dir.
To skip uv entirely, point deckifyr at an environment you already
have (a venv, or a project directory holding a .venv) with
python-pptx, pydantic, pyyaml and
pillow; add fastapi/uvicorn for
deck_serve() and pymupdf for previews:
options(deckifyr.python_env = "/opt/envs/deckifyr") # or DECKIFYR_PYTHON_ENVinitialize_deck_project() writes fastapi,
uvicorn and pymupdf to the project’s
deckifyr dependency group along with the core packages, so
serve and previews work after a plain initialization.
Tests
Unit-level coverage of units/merge/schema loading/CLI exit codes/plan
expansion/PPTX composition, plus test_demo_deck.py, an
end-to-end build of examples/demo-deck/ (see Examples).
