deckz
deckz is a tool to manage a large number of slide decks (Markdown compiled with Typst), shared by several
people, with slides ("sections") shared across decks. It is not meant to be
usable out of the box by people who stumble upon this repository: it enforces
strong conventions on the layout of the repository it operates on. Please
open an issue if you want more details or want to discuss this approach.
Installation
With pip:
pip install deckz
The side commands deckz upload and deckz extras issue/random need
optional dependencies (Google Drive, GitHub and SendGrid clients):
pip install "deckz[extras]"
deckz labs outputs' image recompression needs Pillow
(pip install "deckz[labs]", lazily required only when a notebook has a
large image output to shrink); deckz check parity needs Playwright and
pypdfium2 (pip install "deckz[parity]", then playwright install chromium); deckz labs gpu needs the vastai CLI (pip install "deckz[gpu]", then vastai set api-key); deckz videos render needs
Manim and ffmpeg
(pip install "deckz[videos]"; ffmpeg itself isn't pip-installable,
install it with your system's package manager).
Whatever your templates/assets_builders.py imports (e.g. matplotlib or
plotly) is your repository's own dependency: install it alongside deckz.
Shell completion
Run deckz --help and look for the --install-completion /
--show-completion flags to set up completion for your shell
interactively, or run deckz generate-completion {bash,zsh,fish} to print
the completion script yourself (e.g. to source from your own dotfiles).
Repository layout
deckz expects to run inside a git repository organized like this:
root (git repository)
├── deckz.yml
├── variables.yml
├── templates
│ ├── assets_builders.py
│ ├── checks.py
│ └── jinja2
│ ├── main.typ
│ ├── main.html
│ └── env.py
├── content
│ └── some-section
│ ├── some-section.yml
│ ├── intro.md
│ └── advanced.md
├── assets
│ ├── img
│ ├── plt
│ └── pltly
├── company1
│ ├── variables.yml
│ └── deck1
│ ├── deck.yml
│ ├── variables.yml
│ └── content
└── company2
└── deck2
├── deck.yml
└── content
content: reusable sections (Markdown content files), shared across decks.assets: everything else shared across decks (images, generated figures, or any other kind of asset your owntemplates/assets_builders.pyproduces).deckzdoesn't know or care what subdirectories live underassets-- it symlinks every one of them into each build directory, sointro.mdcan referenceplt/some-figure.svgthe same way regardless of what else is in there. Theplt/pltlynames above are just this repo's own convention, set up by itstemplates/assets_builders.py-- see Assets builders.templates/jinja2/main.typ: the Jinja2 template used to render every deck's main Typst file.templates/jinja2/main.html: optional, the Jinja2 template of every deck's HTML page, for--htmlbuilds -- see HTML output.templates/jinja2/env.py: the Python module that configures the Jinja2 environment(s) used to render content files -- see Content files and the Jinja2 environment.templates/assets_builders.py: the Python module that builds this repo's assets (generated figures, or anything else) -- see Assets builders.templates/checks.py: optional, the Python module adding this repo's owndeckz checkchecks -- see Content checks plugin.- Each deck is a directory containing a
deck.yml(its definition) and optionally acontentdirectory for files local to that deck. variables.ymlfiles can be placed at any level of the directory hierarchy between the git root and a deck to avoid repeating values (e.g. one per client/company, shared by all of that client's decks).
Configuration
deckz.yml, deck.yml and section definition files all accept an
optional schema_version key, the version of their format (currently and
by default 1). A future incompatible format change will bump it, so an
older deckz rejects a newer file with a clear message instead of
misreading it.
deckz.yml
At the root of the repository, deckz.yml holds settings, not content, e.g.:
pandoc_command:
- pandoc
- -f
- markdown-auto_identifiers
- -t
- typst
- --lua-filter={templates_dir}/pandoc/filters/boxes.lua
typst_parallel_compilations: 1
typst_memory_max: 5GiB
typst_font_paths:
- assets/fonts
typst_ignore_system_fonts: true
-
typst_parallel_compilations: how many PDFs compile at once (default 1).deckzcompiles the main Typst file (paths.jinja2_main_template) with thetypstPython bindings, each PDF in its own child process, which gives its memory back when done (Typst can take a few GB on a large deck, and already uses every core within one compilation). Underdeckz run --watch, each PDF's process stays alive instead, so rebuilds are incremental: on a 145-page deck, an edit re-renders every PDF in about a second. -
typst_machine_compilations: how many Typst compilations may run at once on the machine, across every deckz process of the user (unset by default: no such limit).typst_parallel_compilationsonly bounds one process, so two builds (two checkouts or worktrees, a--watchnext to an agent's build) each believe they own the machine. Each compilation holds one of these slots while it runs (flocked files in$XDG_RUNTIME_DIR/deckz/, freed by the kernel if a process dies), and waits for one, saying so, while they're all taken. Machine-specific, so the user's owndeckz.ymlis the natural place for it. -
typst_memory_max: stop a compilation whose process uses more memory than this (e.g.5GiB; unset by default: no limit). Its PDF then fails with a message naming the limit, instead of the machine running out of memory, which is what adeckz run decksover a repository with large decks needs. Checked every half second, on Linux only. -
typst_font_paths: directories where Typst looks for fonts, on top of its embedded ones (Libertinus Serif, New Computer Modern, DejaVu Sans Mono). Relative to the git root;{git_dir},{assets_dir}and{templates_dir}are substituted too. Defaults to none. -
typst_ignore_system_fonts: when true, Typst doesn't use the fonts installed on the machine (default false). Together with fonts committed undertypst_font_paths, every author's PDFs then come out identical whatever fonts they have installed, and each PDF also skips scanning the system's fonts (about 0.2s per PDF with a thousand fonts installed). -
pandoc_command: howdeckzinvokespandocto convert a rendered Markdown content file to the.typfragment that gets#included, including any--lua-filter=...your own conventions need (fenced divs for admonition boxes, external code-file inclusion, etc.) -- entirely up to you,deckzhas no opinion here.pandocis invoked with a working directory matching the content fragment's own (possibly nested) position under the build directory, so any path an argument needs (e.g. a--lua-filter) should be written as{git_dir}or{templates_dir}, substituted with the resolved absolute path -- a bare relative path would not resolve consistently. -
html_pandoc_command: the same aspandoc_command, for--htmlbuilds: converts each content file to an.htmlfragment instead (see HTML output). Defaults to none, and--htmlthen fails. -
html_static_dirs: directories ofassetscopied whole into every HTML output, on top of the files its page references, for files only scripts load (e.g. a math renderer's fonts). Defaults to none. -
overflow_marker_label: the Typst metadata label (defaultformation-overflow)deckz check overflowqueries for shrunk-to-fit frames (ratio/pagekeys) -- only the label's name, the shrinking mechanism itself stays your theme's. -
table_marker_label: the Typst metadata label (defaultformation-table)deckz check overflow --tablesqueries for tables (page,wrap: the table's height over its height with no cell wrapped, as a percentage, andoverflow: whether its longest words alone are wider than the frame) -- the table layout stays your theme's. -
file_extensions: the extensions tried, in order, when resolving a file include. Defaults to[".md"]. -
labs: settings for thedeckz labscommands, e.g.:labs: id_metadata_key: shuuchuu.id id_pattern: '[a-z0-9]+(-[a-z0-9]+)*' publish_remote: labs publish_branch: main solution_heading: Solution
-
id_metadata_key: dotted path, under a notebook's ownmetadata, of its published ID (defaultshuuchuu.id). -
id_pattern: regex a notebook's published ID must fully match (default[a-z0-9]+(-[a-z0-9]+)*). -
publish_remote/publish_branch: the git remote and branchdeckz labs publishforce-pushes the published notebooks to (defaultlabs/main). -
solution_heading: the markdown heading text (case-insensitive) marking a notebook's collapsed answer cells (defaultSolution). -
link_snippet: how a content file links a lab, printed bydeckz labs newwith{lab}and{kind}filled in (default none). -
not_secrets: values thelab-secretscheck (anddeckz labs publish, which refuses a notebook holding a credential) would take for one but aren't, e.g. a public dataset's read-only key. -
gpu: the machinesdeckz labs gpurents:image(default Colab's runtime image),gpus(names in order of preference, default[Tesla_T4, RTX_A4000]),offer_filter(a Vast.ai offer query),disk_gb,boot_minutes,cpus(each notebook's CPUs, default 2 as on Colab's T4 runtime),ssh_key(the private key whose public key Vast.ai has, default~/.ssh/id_ed25519),fresh_dirs(directoriesupsnapshots and the queue restores before each notebook, so each one starts from the image's state as on a fresh Colab VM, default[/usr/local], where pip installs),metadata_key(where a notebook's own metadata says what its runs need, defaultshuuchuu.gpu) andhooks(shell commands by name, run from the repository's root before and after the run of a notebook naming one).What a notebook's runs need, in its metadata:
"shuuchuu": { "gpu": { "variables": {"username": "DAGSHUB_USERNAME"}, "secrets": {"token": "DAGSHUB_TOKEN"}, "hook": "reset-server" } }
variablesandsecretsmap a variable the notebook assigns""on a line of its own to the environment variable (or.enventry) whose valuedeckz labs gpu queueputs there, in the copy it sends only; a secret's value is then redacted from every file kept locally, anddeckz labs outputsstores no output that showed it.hookruns before the notebook is sent and once its run is done; notebooks naming the same hook run one at a time, even on different machines.
The notebooks directory itself (default
{git_dir}/labs/notebooks) ispaths.labs_notebooks_dir, set like any other path underpaths:.deckz labs publishalso publishes the files committed underpaths.labs_published_dir(default{git_dir}/labs/published), at the same paths: next to the notebooks, or, whenlabs.published_files_remoteis set, as a commit of their own that replaces that remote'slabs.published_files_branch(defaultmain). That's how a repository with only a README and a.devcontainer/gets a GitHub Codespace for the notebooks without holding them;deckz labs check --containerruns notebooks in that dev container, in that repository's workspace. -
-
videos: settings for thedeckz videoscommands, e.g.:videos: publish_remote: videos publish_branch: main published_quality: h max_publish_size_mb: 100 warn_publish_size_mb: 50
publish_remote/publish_branch: the git remote and branchdeckz videos publishforce-pushes the published renders to (defaultvideos/main).published_quality: the Manim quality flag (ltok) a render must be at to publish, anddeckz videos render's default--quality(defaulth).max_publish_size_mb/warn_publish_size_mb: refuse, or just warn about, publishing a render over this size in MB (defaults100/50, GitHub's own limits).
The scenes and videos directories (default
{git_dir}/figures/scenesand{assets_dir}/videos) arepaths.scenes_dir/paths.videos_dir, set like any other path underpaths:. -
setup: whatdeckz setupchecks and runs for a fresh clone, on top of deckz's own needs (git, pandoc):setup: requires: - command: pdftocairo why: the SVG versions of the PDF figures, for HTML decks install: apt install poppler-utils steps: - name: reveal.js for HTML decks run: [npm, ci] creates: node_modules
requires: executables that must be on thePATH, each with what needs it (why) and how to install it (install), both shown when it's missing.steps: commands run from the git root, without a shell, in order. A step whosecreatespath exists is done and skipped (deckz setup --forceruns it anyway); one withoutcreatesruns every time.
-
worktree: whatdeckz worktree addcopies into a new worktree, on top of the checkout:worktree: seed: [assets/typ, assets/svg, assets/web/vendor, assets/videos]
seed: paths whose ignored files (the builds a fresh checkout lacks) are copied from the main checkout, file times kept, so that content stamps decide what to rebuild (see Assets builders). Nothing is shared by a link: each worktree gets its own environment fromsetup.steps(e.g.uv sync, a second from uv's cache), and what every checkout shares goes in the user's.env(see Usage).
deckz.yml files are merged, in order, from the git root, from the user's
config directory (XDG-compliant, e.g.
$HOME/.config/deckz/deckz.yml on GNU/Linux), and from the current
directory (and its ancestors up to the git root). Run
deckz show settings to inspect the resolved result.
variables.yml
variables.yml files hold the values injected into the Jinja2 templates,
merged the same way (git root → user config directory → current directory
and its ancestors), so a value set closer to a deck overrides one set
higher up. Run deckz show variables to inspect the resolved result for
the current deck.
Example:
company_name: Company
company_logo: img/logo.png
company_logo_height: 1cm
deck_title: Machine Learning and COVID-19
presentation_size: 10pt
These variables are passed to templates/jinja2/main.typ, and to every
content file, as a variables mapping; what the templates do with them is up to
your own template and Jinja2 environment, not something deckz imposes --
see Content files and the Jinja2 environment.
deck.yml
Defines a deck's parts and, for each part, the sections and files it includes:
name: ABC
parts:
- name: p1
title: Part 1
sections:
- $first-section@standard
- about
- name: p2
title:
fr: Partie 2
en: Part 2
sections:
- $first-section@light
Includes can point to a file (path/to/file) or to a shared section with a
given flavor ($path/to/section@flavor); either form can be given a custom
title with path: My title / $path@flavor: My title (or, as with p2's
title above, a {fr: ..., en: ...} map instead of a plain string, when the
text actually differs by language -- see Titles, variables and
--lang).
Shared sections
A shared section lives under content (or a deck's local content
directory) and has a sibling .yml file describing its flavors, e.g.
content/first-section/first-section.yml:
title: First section
default_titles:
intro: Introduction
advanced:
fr: Approfondissement
en: Advanced
flavors:
- name: standard
includes:
- intro
- advanced
- name: light
includes:
- intro
Two flavors that differ by a few frames give each variant its own file,
listed only by the flavor that shows it, and list the files they share in
both: the section's .yml then says exactly what each flavor shows. A
flavor has no variables of its own: every file of a deck renders with the
same variables.yml values.
Titles, variables and --lang
There is only ever one deck.yml/section .yml -- English is never a
separate deck or a duplicated section, only a --lang en option on deckz run. --lang fr en (or --lang fr --lang en) handles both languages in
one pass, and so do deckz check variables, deckz check overflow and
deckz search-sections, which tag each finding with its language. deckz show/show paths/show variables and deckz section-files show a single
resolved view, so they take a single --lang en to inspect the English
variant. Commands that act on the whole repository -- deckz clean content, deckz asset search, deckz asset deps -- always cover both
languages, so an en/ file counts as used whenever a deckz run --lang en
would pick it:
- Any title (
deck.ymlpart/include titles, a section'stitle,default_titlesvalues, a flavor's title) and anyvariables.ymlvalue can be a plain string, used as-is in every language -- the right choice whenever the text is language-neutral (a proper noun, a number, code, or simply not translated yet) -- or an explicit{fr: ..., en: ...}map when it actually needs to differ by language, as inintro/advancedabove. - A translated body file lives at
<parent-dir>/en/<filename>, a sibling of the French file, whateverparent-diris -- a shared section directory, a deck's localcontentdirectory, or any nested subdirectory of either. Section/flavor structure itself is never duplicated for English. - English never silently falls back to French for a
{fr: ..., en: ...}map that's missing itsenkey, or for a resolved file with noen/sibling: both fail the build immediately, so a translation that was started but left incomplete can't accidentally ship untranslated. A plain string, on the other hand, is never a gap -- it means "the same in every language" by design.deckz i18n missing-enaudits a deck for the blocking gaps (and, with--untranslated, the merely informational plain strings) without needing to actually compile it. - fr and en builds write to separate output paths (an
en/subdirectory under.build/pdf/html), so both can be built from the same checkout without clobbering each other.
Content files and the Jinja2 environment
Content files (a section's or a deck's included files) are plain text,
templated with Jinja2, using whatever delimiters and filters
templates/jinja2/env.py configures -- deckz itself has no opinion on
this beyond providing the mechanism. That module must expose:
from jinja2 import Environment
def environment_for(suffix: str) -> Environment:
...
called once per content-file suffix deckz renders (typically once for
the .typ main template, once for .md content), so different sources can
use different delimiters/filters. This is also where you define any
macro/filter your content relies on, e.g. an image filter emitting
.
Whatever filter you use to reference an asset file (an image, a generated
plot, ...) should call the assets_metadata_retriever context
variable deckz injects into every render, e.g. from a filter function:
from jinja2 import pass_context
from jinja2.runtime import Context
@pass_context
def image(context: Context, path: str) -> str:
metadata = context["assets_metadata_retriever"](path)
...
This is the hook that keeps deckz asset search/deckz asset deps (and
the i18n tooling) accurate: skip it, and asset usage/licensing detection
silently misses whatever your filter references.
Assets builders
deckz itself has no opinion on what assets a deck needs (generated
figures, or anything else) or how to build them. Your repo supplies a
Python module (templates/assets_builders.py) exposing:
from collections.abc import Iterable
from pathlib import Path
from deckz.components.protocols import AssetsBuilderProtocol, CompilerProtocol
def assets_builders(
assets_dir: Path, compiler: CompilerProtocol
) -> Iterable[AssetsBuilderProtocol]:
...
called once (by deckz run/deckz run shared/deckz run all/deckz run assets) to obtain every builder to run. Each
builder implements AssetsBuilderProtocol:
from collections.abc import Iterable
from pathlib import Path
class MyAssetsBuilder:
def build_assets(self) -> None:
... # write output files somewhere under assets_dir
def watched_dirs(self) -> Iterable[Path]:
... # source directories `deckz run assets --watch` should watch
build_assets should write its output somewhere under assets_dir --
deckz symlinks every top-level directory found there into every build
directory, without needing to know their names (see Repository
layout). watched_dirs only matters for deckz run assets --watch: it tells the watch loop which source directories should
trigger a rebuild.
build_assets runs before every build, so it should only rebuild what
changed. Don't decide that from file times: a git checkout gives every file
it writes the current time, so after a clone or a branch switch, sources look
newer than their outputs (and committed outputs older than their sources).
deckz.stamps decides from contents instead: digest the inputs, rebuild
unless is_fresh(output, stamp, inputs), then write_stamp(output, stamp),
which writes <output>.stamp. Commit the stamps of committed outputs, so a
fresh clone rebuilds none of them. python_sources lists a Python module and
the repo's modules it imports, the inputs of an output a module builds.
Digest the very bytes you build from, read before building: a source edited
in between then leaves a stamp it no longer matches, and the next build redoes
the output, where a digest taken after building would stamp a stale output as
up to date. write_stamp writes atomically, and so does
deckz.utils.write_atomic(path, data): a deck compiling meanwhile never reads
a truncated output.
Builders run one checkout's assets build at a time: every command building
assets (run, run section, run assets, --watch...) holds a lock
(.run/assets.lock) while they run, and says so when it waits for another
one.
deckz ships one ready-made builder, TypstFiguresAssetsBuilder
(deckz.components.typst_figures_builder), for a Typst-themed repo whose
figures are Typst sources compiled to SVG: wire it into your own
assets_builders() alongside any other builder you need.
Content checks plugin
deckz check (alias for deckz check content) runs a few generic content
checks of its own (lab notebook IDs and fr/en pairs, asset credit lines
free of LaTeX, no raw LaTeX in content -- see Usage). A repo can
add its own, theme- or content-specific checks (e.g. a slide frame
pattern your Markdown conventions enforce) from an optional
templates/checks.py module exposing:
from collections.abc import Callable, Mapping
from deckz.configuring.settings import GlobalSettings
def checks(settings: GlobalSettings) -> Mapping[str, Callable[[], list[str]]]:
...
called once, with the repository's settings, to obtain every extra check to run, each a zero-argument callable returning its problems (empty if none) the same way deckz's built-in checks do. A name colliding with a built-in check's is rejected.
Checks too slow, networked or not yet passing to run on every commit can
be listed in deckz.yml, by name, under checks.opt_in: deckz check
(hence the pre-commit hook) and the post-edit Claude Code hook skip them,
and deckz check <name> still runs them:
checks:
opt_in: [lab-outputs, published-videos]
Claude Code hooks
deckz hooks install also adds deckz's own Claude Code hooks to
.claude/settings.json (Claude Code is treated as a requirement of a
deckz-managed repository, like git): deckz hooks pre-bash/post-edit/
session-start/stop, backed by deckz.agent_hooks. The generic rules
they enforce need no repo-specific knowledge:
- PreToolUse/Bash: deny staging everything (
git add -A/./-u),git commit -a,git cleanwithout--dry-run, and anything that would discard uncommitted changes (git checkout/restoreon a changed file,git reset --hard, a baregit stash) -- several Claude Code sessions may share one checkout. Also deny skipping the git hooks (--no-verify,git commit -n,git -c core.hooksPath=...): they run the repository's checks. - PostToolUse/Edit,Write,MultiEdit: convert an edited content file
with this repo's own
pandoc_commandand run deckz's content checks (built-ins plustemplates/checks.py's) against it, reporting any problem back to the agent right away. - SessionStart/Stop: snapshot the repo's fr/en content and lab
notebook pairs (and its uncommitted content files) when the session
starts. At
Stop, flag any pair changed on one language side only since then (same pairing asdeckz i18n stale, but for the live session, not git history), and run the PostToolUse checks on every content file the session changed that they haven't passed as it is now: one a shell command wrote, which no PostToolUse hook sees. Each finding is reported once.
A repo can add its own Bash denials (e.g. never publish, never push to a
themed remote) from an optional templates/hooks.py module exposing:
from collections.abc import Sequence
from pathlib import Path
from deckz.configuring.settings import GlobalSettings
def deny_bash(
words: Sequence[str], cwd: Path, settings: GlobalSettings
) -> str | None:
...
called once per simple command of a Bash tool call, after deckz's own
built-in denials; returning a reason denies the call, None lets it
through (deckz's own reason wins if both would deny).
Python hooks: contract and trust
templates/jinja2/env.py, templates/assets_builders.py and
templates/checks.py are plain
Python modules that deckz imports and runs: running deckz on a
repository executes its code with your permissions, like any build script,
so only use it on repositories you trust. Whatever they import is your
repository's own dependency, to install alongside deckz.
deckz checks each hook when loading it: the module must import cleanly
and define the expected function, environment_for must return a
jinja2.Environment, each object assets_builders returns must have
build_assets and watched_dirs methods, and checks must return a
{str: callable} mapping. A module may declare which
version of this contract it targets:
DECKZ_HOOKS_VERSION = 1 # the default when left out
A future incompatible change to the contract will bump that version, so a hook written for another one fails to load with a clear message.
Markdown content and pandoc
Content files are authored in Markdown: deckz renders each one through
its own Jinja2 environment (see above) and then converts the result to the
.typ fragment the main template #includes, by shelling out to
pandoc_command. Slide conventions your content relies on
(admonition boxes, external code-file inclusion, columns, math, ...) are
entirely up to how you write your Markdown and configure pandoc_command
(typically pandoc's own built-ins plus one or more --lua-filter=...
pointing at Lua filters you maintain in this repository, e.g. under
templates/pandoc/) -- deckz only orchestrates the conversion.
HTML output
deckz run --html (off by default, on every run command) also produces
each deck as an HTML page, e.g. a reveal.js presentation: one per deck,
covering every part, like the full handout. deckz has no opinion on what
the page looks like: like a PDF, it's the repository's own main template,
templates/jinja2/main.html (paths.jinja2_html_main_template), rendered
with the same context as main.typ, fed with content files converted by
html_pandoc_command instead of pandoc_command. Since HTML has no
#include, the template inlines each converted fragment itself, with the
fragment function it's given:
{% for part in parts %}
{% for item in part.sections %}
{% if item is string %}{{ fragment(item) }}{% else %}<h2>{{ item.title }}</h2>{% endif %}
{% endfor %}
{% endfor %}
The page is rendered in the deck's build directory, where every assets
subdirectory is linked, so it references assets relatively
(img/logo.png, fonts/...). deckz then packages it into
html/<deck>-html/ (html/en/... for --lang en): the page as index.html,
plus every local file it references (src, href, poster, data-src,
srcset, ..., CSS url()/@import, recursively) and the
html_static_dirs, ready to serve or copy anywhere. A reference to a
missing file, a root-absolute one (/img/...) or one outside the build
directory fails the build; URLs (https:, data:, ...) and anchors are
left alone.
Filters can tell the two conversions apart with pandoc's FORMAT (e.g.
typst vs revealjs), so one Lua filter can handle a construct for both.
Upgrading from 30.x (--lang)
--en is gone: use --lang en instead, or --lang fr en to handle both
languages in one pass where a command accepts several (see Titles,
variables and --lang). The text and JSON
outputs of deckz check variables, deckz check overflow and deckz search-sections now carry each finding's language (a <lang> column, or
a "lang" field).
Upgrading from 28.x (LaTeX removal)
deckz no longer compiles LaTeX. In a repository still laid out for 28.x:
git mv latex contentat the root, and in every deck directory.- Remove
compilerandbuild_commandfromdeckz.yml(they're now ignored), andfile_extensionsif it only lists.md. - The default main template is now
templates/jinja2/main.typ: apaths.jinja2_main_templateoverride pointing there can go. deckz clean latexis nowdeckz clean content.
Usage
Run deckz --help for the full list of commands, or deckz <command> --help for a specific command. Global options go before the command:
--quiet/-q only logs warnings and errors, --verbose/-v adds details
such as per-PDF timings and which fragments get re-rendered, and --debug
also shows the traceback of a deckz error (as does DECKZ_DEBUG=1).
Logs and progress bars go to stderr, so stdout only carries a command's
results.
Option defaults can come from the environment, from the closest .env
file above the current directory, or from the .env in the user's config
directory (e.g. ~/.config/deckz/.env, next to the user's deckz.yml),
which every checkout of every repository reads: the place for one's own
defaults and credentials. The environment wins over the checkout's
.env, which wins over the user's, and an option given on the command
line wins over all of them:
DECKZ_LANG: the languagesdeckz run,deckz check variables,deckz check overflowanddeckz search-sectionsprocess when--langisn't given, space-separated, e.g.DECKZ_LANG="fr en".DECKZ_RUN_<OPTION>: any option of everydeckz runcommand, e.g.DECKZ_RUN_PRINT=falseorDECKZ_RUN_OPEN=false. The same variable applies to everyrunsubcommand, whose own defaults differ (run decks/shared/allonly build presentations): setHANDOUT,PRESENTATIONandPRINTtogether to get the same outputs from all of them.
deckz <command> --help lists the variables each option reads. For
instance, a .env (typically git-ignored) building only each deck's whole
handout, in both languages, by default:
DECKZ_LANG="fr en"
DECKZ_RUN_HANDOUT=true
DECKZ_RUN_PART_HANDOUTS=false
DECKZ_RUN_PRESENTATION=false
DECKZ_RUN_PRINT=false
Exit codes: 0 on success, 1 on a deckz error (e.g. a missing flavor or a
failed compile), on deckz check variables/deckz check content findings,
on blocking deckz i18n missing-en gaps, or when a deckz hooks-installed
git hook refuses a commit, 2 on a command-line
usage error, 130 when interrupted with Ctrl-C (which stops the compilations
under way at once).
deckz check variables, deckz search-sections and deckz i18n missing-en print one tab-separated finding per line; deckz check content
does too with --plain. With --json, deckz check content and the
above, as well as deckz show tree/paths/settings/variables, deckz deps and deckz asset deps/search, print a single JSON document
instead (see each command's --help for its fields).
The main commands:
deckz status: where your work stands, and what's left before committing, teaching or publishing. Your changes are the working tree's plus the commits not on the upstream branch yet (--since REVto count from elsewhere). It lists the content checks' problems (--no-checksskips them), what your changes leave to translate and the repository's backlog, lab notebooks and videos not published as committed or rendered (compared with their remotes as last fetched;--fetchfetches them first), and the built PDFs of the decks your changes reach that don't match them (--no-decksskips them). Each item says how to resolve it;--jsonfor scripts, each section with a stablekey.deckz show affected PATH...prints the decks a change to PATHs reaches.deckz new deck DIR --name NAME --title TITLE,deckz new section PATH [--title TITLE],deckz labs new LAB hands-on|demo: create the files of a new deck, shared section (its.ymlwith afullflavor, a first file and itsen/twin; existing sections sharing a word with it are listed first) or lab notebook pair (same cells in both languages, in deckz's format, with their IDs), refusing to overwrite anything. A repository's own starting files go undertemplates/scaffold/:deck/(every file, rendered with Jinja's{{ name }}/{{ title }}, minus a.jinjasuffix: name the template'sdeck.yml.jinja, or deckz takes it for a deck) andlab/hands-on.ipynb/lab/demo.ipynb.labs.link_snippet(e.g.'{{ "{lab}" | lab("{kind}") }}') is printed afterlabs new, filled in, for the content file linking the lab.deckz setup: set up a clone, and run it again after pulling. It checks the executables deckz and the repository need (setup.requiresabove), saying how to install a missing one; installs the git hooks; runs the repository'ssetup.stepsnot done yet; and reports the videos never rendered (--videosrenders them).--checkonly reports,--claudealso installs the Claude Code hooks. It exits 1 while something is missing or failed, and is safe to run any number of times.deckz worktree add NAME [--base REV]: create a second checkout of the repository,../<repo>--NAME, on a new branchws/NAME(from the main checkout'sHEADunless--base), to work on something without disturbing the main checkout's builds and uncommitted edits. It copies the buildsworktree.seedlists (see above), then runsdeckz setupthere.deckz worktree list [--json]lists the worktrees with their uncommitted changes and their commits no other branch has;deckz worktree remove NAMEremoves one, and its branch, refusing while it holds either (--forceloses the uncommitted changes and keeps the branch).deckz run(alias fordeckz run deck, optionally restricted with--parts) /deckz run file PATH/deckz run section SECTION FLAVOR/deckz run assets: compile the deck in the current directory, a single content file, a specific section flavor, or the project's assets. Add--lang ento compile the English variant, or--lang fr enfor both (see Titles, variables and--lang),--htmlto also produce the HTML deck (see HTML output), or--watchto recompile on file changes instead of once. With--dry-run, everydeckz runcommand exceptrun assetsonly prints the outputs it would compile and, for each, the content fragments it would re-render (new or changed since that output's last build), without building anything. A deck's handout comes whole and, unless--no-part-handouts, one per part; its presentations come one per part only.--partsrestricts every output to the parts listed, the whole deck's handout included.--sync(the default;--no-syncturns it off) removes the PDFs no build of the deck produces anymore, once everything compiled: a removed or renamed part's, a renamed deck's, a stray file. It only looks at the languages the run built, and keeps what the run merely skipped (part handouts after--no-part-handouts, presentations after--no-presentation, other parts' PDFs under--parts). A failed build removes nothing, nor does a run producing no PDF at all;--dry-runlists what would go.run file/run sectionwrite their output under<git_dir>/.run/, not the current deck's ownpdf/.build, and open it once done (add--no-openfor agentic/headless use, where only the printed path matters).deckz run decks/deckz run shared/deckz run all: validate the repository by compiling.run deckscompiles every real deck end to end (by far the slowest for a repo with many decks, since every shared section gets recompiled once per deck that includes it).run sharedcompiles one throwaway deck containing every shared section expanded to every file in its directory (not just the ones some named flavor lists) -- fast enough to run while editing shared content.run alldoes the same plus one extra copy of a section for every deck that locally overrides one of its files. English is strict: the first gap in translation coverage aborts the run, before anything is compiled.run shared/run allwrite their throwaway output under<git_dir>/.run/.deckz check variables: statically survey every shared section's every named flavor (not just the ones some deck currently uses), with the repository-widevariables.yml, plus every real deck, with its ownvariables.ymlfiles, as a real build would. Reports a fragment reading avariables.xxx/variables['xxx']name nothing sets (UNDEFINED), a fragment that fails to parse (UNPARSABLE), and a flavor/deck that fails to parse at all (STRUCTURAL). A shared flavor whose only failures are includes of deck-local files (one some deck's owncontent/has) is skipped: the decks using it cover it. Nothing is compiled.deckz check(alias fordeckz check content): run deckz's generic content checks -- lab notebook IDs valid and unique (lab-ids), fr/en lab notebook pairs present and in sync (lab-pairs), hands-on notebooks with no stored outputs and demos with code with some, shown by Colab (noprivate_outputs) (lab-outputs), nothing that looks like a credential in a notebook's cells or stored text outputs (lab-secrets; the labs are public), notebooks in deckz's canonical JSON (lab-format, fixed bydeckz labs fmt), asset credit lines (title/author/license, and their_en) free of LaTeX (asset-credits), no raw LaTeX in content (raw-latex), no hand-written link to the configured lab-publishing remote (lab-urls) -- plus, iftemplates/checks.pydefines achecks(settings)function, the target repo's own, merged in under their own names (seeGlobalPaths.checks_module).--stagedchecks the git index's staged version of every tracked file (exported to a scratch directory under<git_dir>/.check/staged/) instead of the working tree, so another session's unfinished edits neither block nor hide a check; a check needing the repository's git history or remotes does nothing under--staged.--plainfor a script or an agent.deckz check overflow [DECK_DIR]: report a built handout's shrunk-to-fit frames (theoverflow_marker_labelTypst metadata marker, matchingformation.typ's<formation-overflow>by default), worst first, with the content file and line of each one's# Title. Needs the handout already built (deckz run --handout, or adeckz run file/deckz run sectionpreview), and reads what its compilation recorded (a build by an older deckz is queried again and matched by title with the PDF's text, from poppler'spdftotext). Exits 1 if any frame was shrunk.--lang enchecks the English build (deckz run --lang en, kept underen/in the build and PDF directories),--lang fr enboth, each frame tagged with its language.--tablesreports the tables instead (thetable_marker_labelmarker), most wrapped first, flagging those whose longest words alone are wider than the frame; exits 1 if any is.deckz check parity [DECK_DIR] [SLIDES...] [--lang LANG...](extra:deckz[parity], thenplaywright install chromium): compare a built deck's PDF and HTML slide by slide (deckz run --handout --html), reporting each pair's mean grayscale difference, the frames a reveal.js theme shrank to fit (a slide element carryingdataset.ratio/dataset.overflow), and anything the page logged, failed to load or tried to fetch from the network (a deck must work offline). French builds by default (orDECKZ_LANG's),--lang enthe English ones (underen/),--lang fr enboth, one after the other. By default writes an HTML report per language (.build/parity/report.html,.build/en/parity/report.html, sortable by gap, shrunk frames flagged), opened with--open, and prints a summary whose lines start with their language;--plaininstead prints a worst-first text report per language (agent-friendly) and writes contact sheets (PDF left, HTML right);--jsonprints an array, one object per language with its"lang".deckz hooks install: install deckz'spre-commit(deckz check --staged) andcommit-msggit hooks into the current repository's hooks directory (git'score.hooksPathwhen set, so a repo can commit them, else.git/hooks/). Each hook, like each Claude Code hook command, runsdeckzfrom thePATH, elseuv run --quiet deckz. Thecommit-msghook refuses a commit that changes one side of a fr/en content or lab notebook pair with noLang-synctrailer (fr-only (<reason>)/en-only (<reason>)/pending, seedeckz i18n staleabove). Refuses to overwrite a hook file it didn't itself write, unless--forceis passed. Also adds deckz's generic Claude Code hooks to.claude/settings.json(safe to call repeatedly; every other key of the file is left untouched) -- see Claude Code hooks. With--ci, also writes.github/workflows/deckz.yml, a GitHub Actions workflow giving every contributor's commits the hooks' checks, installed or not:deckz checkanddeckz hooks check-commits(theLang-syncrule, on the pushed or proposed commits) on every push and pull request, anddeckz.yml'sci.nightly_checksevery night. Itscisettings:deckz_repositoryanddeckz_ref(a deckz checked out next to the repository, for one installing it from../deckz),apt_packages(system packages its dependencies need to build),nightly_checks.deckz show(alias fordeckz show tree): show the resolved tree of sections and files for the current deck.deckz show settings/deckz show variables/deckz show paths: print the resolved settings/variables/file paths for the current directory.deckz show frames [PDF] [--lang] [--json]: each page of a built deck PDF (default: the deck's whole handout) with the content file and line of its frame's# Title, and its title; title, outline and divider pages aren't listed. A deck build adds an invisible<deckz-frame>Typst marker after each frame heading for it (on the converted copy, never the content file), and each compilation records where they landed next to its PDF (<pdf>.markers.jsonin the build directory, with the theme's shrunk-frame and table markers), which this reads at once (it queries the build, a whole compilation, after a build by an older deckz): it builds nothing itself.deckz deps [SECTION] [FLAVOR]: show shared sections/flavors usage across the repository, including unused ones.deckz search-sections KEYWORDS...: search shared sections by title or Markdown heading.deckz section-flavors SECTION: list a section's flavor names.deckz section-files SECTION FLAVOR: list the files a section+flavor resolves to.deckz flavor rename SECTION OLD NEW: rename a flavor and rewrite all its usages.deckz flavor deduplicate: deduplicate section flavors that are identical up to their name.deckz asset search ASSET/deckz asset deps: find where an asset is used, or find assets missing license metadata.deckz clean/deckz clean all/deckz clean content: remove build directories, or unused shared/local content files (fr oren/).deckz clean allalso removes the whole<git_dir>/.run/scratch tree (run shared/run all/run file/run section), and<git_dir>/.check/(check variables).deckz i18n missing-en [--all] [--untranslated]: report fr content/titles/variables with no English counterpart, i.e. what adeckz run --lang enwould currently fail on (and, with--untranslated, titles that are a plain string).deckz i18n stale [PATHS...]: report content files and lab notebooks with changes not yet ported to their other-language sibling, computed from git history alone (aLang-synccommit trailer, not a stored marker, exempts a one-sided change).--plainfor a script or an agent. A file leaves it when a commit changes its sibling, or names either side in aLang-synced: <path>trailer. A repository moving to trailers from markers of its own (or with one-sided commits it already settled) setsi18n.synced_atindeckz.ymlto the commit up to which every pair is in sync: that commit and its ancestors are ignored.deckz i18n mark-synced PATHS... --reason TEXT: record that whatdeckz i18n stalelists for these files needs no port after all (a case fix committed without aLang-synctrailer): an empty commit with the reason and aLang-synced: <path>trailer per file. Nothing staged goes into it.deckz generate-agent-notes: print onboarding notes for an AI coding agent working in the repo (conventions not already covered by--help, e.g. the section/flavor syntax and local-override resolution). Prints to stdout, e.g.deckz generate-agent-notes > CLAUDE.md.deckz generate-completion {bash,zsh,fish}: print a shell completion script (see Shell completion).deckz upload: upload built PDFs to Google Drive. It refuses, naming them, when a PDF doesn't match the deck's content anymore: a content fragment changed since it was built, the Markdown conversion changed, or no build produces it. Rebuild or delete those, or pass--include-stale.deckz extras issue TITLE [BODY]: create a GitHub issue.deckz extras random REASON: roll a dice and email the result (handy for arbitrary decision-making, e.g. picking who does a task).deckz labs normalize NOTEBOOKS...: normalize Jupyter notebooks (files, or directories searched recursively for*.ipynb) to their Colab conventions -- collapse every solution markdown heading cell by default (labs.solution_heading, "Solution" by default), and disable Colab's generative AI features.--dry-runlists what would change without writing.deckz labs fmt [NOTEBOOKS...] [--check]: rewrite every notebook (default: the configured notebooks directory) in deckz's canonical JSON style, so every notebook diffs the same way regardless of what last saved it.--checkreports what would change without writing, and exits nonzero if anything would.deckz labs ids [--dry-run]: assign a published ID to every lab notebook that doesn't have one yet, refusing a duplicate.deckz labs outputs EXECUTED NOTEBOOK [--max-image-kb KB] [--no-recompress]: write an executed copy's cell outputs (and nothing else) back into a notebook, merging consecutive stream outputs and resolving carriage returns. A largeimage/pngoutput (above--max-image-kb, default 200) is re-encoded as JPEG when that's at least twice smaller (the common case for photos), or re-saved as an optimized PNG otherwise (charts and line art);--no-recompressdisables this and needs no extra dependency, unlike the default, which needs Pillow (deckz[labs]) only when an image actually needs recompressing.deckz labs check [--smoke] [--python INTERPRETER] [--container] [--timeout SECONDS] NOTEBOOKS...: structural checks (uncollapsed/empty solution sections, stored error outputs) plus an execution of every code cell, in a throwaway directory, reporting which cells raise. Shell commands other than data fetches are skipped (a lab maypip installorgit push);--containerruns everything, with a real kernel, in the published repository's dev container (paths.labs_published_dir/.devcontainer/devcontainer.json, built with Docker): what a Run all does in GitHub Codespaces, and in Colab for a notebook that needs no GPU. A prebuiltimageis pulled, unlesscustomizations.deckz.dockerfilenames the Dockerfile it's built from: that one is then built locally under the image's name, so a change is checked before the image is published. The container is thrown away after each notebook, and nothing is mounted into it. When the kernel dies (a setup cell that kills it for Colab to restart it on what it installed), the notebook runs once more from the start, as a trainee would run it again. A failing shell command (!cmd,%pip) never raises, in Colab as here: the cell goes on, and the report gives it a line of its own,[i] shell command exited with code N: cmd, before "no code cell raised" (in a real kernel, a guard deckz starts it with wraps IPython's, ipykernel's and Colab's shell runners;labs gpu reportreads the same lines from<notebook>.shell). A command expected to fail (!nvidia-smion a CPU) shows there too.deckz labs compare [LAB_DIRS...]: structural differences between fr/en notebook pairs beyond what a translation changes.deckz labs missing: every notebook present in only one language.deckz labs dump NOTEBOOKS...: a compact, readable view of one or more notebooks.deckz labs publish [--break-published-links]: replace the labs remote's branch with one commit of HEAD's lab notebooks, named by ID, and publish the files committed underpaths.labs_published_dir(with them, or tolabs.published_files_remote).deckz labs gpu up|queue|run|status|fetch|report|down(extra:deckz[gpu]): run notebooks on a rented GPU machine the way Colab runs them -- Colab's runtime image,labs.gpu.cpusCPUs per run, peak RAM recorded (Colab's T4 runtime has 12.7 GB).uprents the cheapest reliable offer (a machine that fails to boot is destroyed and avoided from then on);queue [--short] NOTEBOOKS...sends notebooks (--shortsets theirSHORT_RUN = Falseline toTrue; a notebook's metadata can ask for variables, secrets and a hook, seelabs.gpuabove; queueing a notebook again reruns it);runstarts the queue, detached, each notebook saved after every cell,labs.gpu.fresh_dirsrestored before each one;status [--watch]follows it, fetching, appending each finished run's report tonotes.md, running the hooks of finished runs and sending the notebooks held for them, until done under--watch;fetchcopies the executed notebooks;report [--plain]gives each one's exit code, run time, peak RAM, the cells that raised and the slowest ones;downdestroys the machine, which bills until then.--machine NAME(defaultmain) runs several machines at once;status,reportanddownwithout it act on every one. Each machine's state and files live in.run/gpu/<name>/(paths.labs_gpu_dir). Thendeckz labs outputswrites a demo's outputs back.deckz videos render [SCENE] [--quality] [--force](extra:deckz[videos], Manim, plusffmpeg): render every@register_sceneclass undervideos.scenes_dirthat's missing, stale, or at another quality than--quality(defaultvideos.published_quality), in parallel. A render is stale when its scene's module, or a module underscenes_dir's parent it imports, has changed since (a.stampnext to the render, seedeckz.stamps). A scene is marked withdeckz.videos.register_scene(optionallylanguages=("fr", "en")for one with on-screen text, rendered once per language). SCENE restricts to one video (its path, asdeckz videos listprints it, or its class name);--forcere-renders even what looks up to date (after editing a data file a scene reads, say).deckz videos list: list every registered scene's renders, one per line (quality stamp or-, path undervideos.videos_dir, class name).deckz videos publish [--break-published-links]: replace the videos remote's branch with one commit of every scene's current renders, refusing one missing, stale, at the wrong quality, or over the publish size limit, or that would drop an already-published render's path.
Documentation
Built with mkdocs (see mkdocs.yml and the docs directory): a guide for
the people running a deckz-managed repository, one page per task
(docs/guide/), and a partial code reference generated from the
docstrings.
Metadata
Release files for deckz 31.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deckz-31.3.4.tar.gz | 256.1 kB | Without provenance | Details for deckz-31.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deckz-31.3.4-py3-none-any.whl | Python 3 | none | any | Details for deckz-31.3.4-py3-none-any.whl |
Total release size: 560.4 kB
Release files / deckz-31.3.4.tar.gz
| Download URL | deckz-31.3.4.tar.gz |
|---|---|
| Size | 256.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
957476a13f6ed3eb8a7d321662a9099927a16b8b25c658459aaca96d2743c000
|
|
BLAKE2b-256 checksum How to use checksums |
524eb8b24631dad95fdd4eddce77b1f4f427abcccb7bf8bb5489c0cfbe6e6be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / deckz-31.3.4-py3-none-any.whl
| Download URL | deckz-31.3.4-py3-none-any.whl |
|---|---|
| Size | 304.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d95d206e41bb4f898e39b99e3d81a9660d9bcafe205a4c8f3b408483cf16e47b
|
|
BLAKE2b-256 checksum How to use checksums |
b354bb3250aee30c27c9c688a5e97d4deba11644b809917e313fad9f0fe5966e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for deckz 31.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.