Kits
A kit, short for embedded calkit (calculation kit), is the part of a project that makes one figure or document, packed inside that file. Someone you send a figure to on Slack, or a reader who downloads your paper, can see what made it, check the file hasn't changed since, and open it as a project they can rerun.
Creating one
This writes plot.calkit.png in the current folder:
a copy of the figure with its kit inside.
The original is left alone.
The copy opens like any other PNG.
Add --to-clipboard to copy it, as a file, to paste into a chat or email.
Each kit is recorded as a Git tag, e.g.,
kit/figures/plot.png/2026-11-27-1a2b3c4,
at the commit it came from, and the tag is pushed,
so the project keeps track of what's been shared
without any of its files changing,
and the commit stays available to whoever has the calkit.
calkit list kits lists them.
Use --no-record to skip that.
The kit holds the stage that makes the figure,
every stage upstream of it,
the scripts and environment specs they use,
and as much of their data as fits.
Data is added smallest first, inputs before intermediate outputs,
until the kit is as big as the figure itself or 1 MB,
whichever is bigger.
Use --max-size to change that, e.g., --max-size 20MB,
or --no-data to leave out all data.
Whatever is left out is still listed, with its hash,
so an unpacked copy can fetch it from the project's storage
or remake it by running the pipeline.
The calkit's part of the pipeline must be up to date and committed,
since a kit records how the file was made.
Changes elsewhere in the project, even to other stages in calkit.yaml,
don't matter.
Use --force to create one anyway;
the kit says it was out of date and lists uncommitted changes,
and one with uncommitted changes isn't recorded.
Kits leave out what describes your machine or isn't needed to run the pipeline, e.g., Overleaf sync state and comments, and credentials in Git remote URLs. Everything else in the kit is visible to anyone with the file, so check what's listed before sharing from a private project.
Releases can carry a kit too:
Reading one
This says which project and commit the file came from,
which stage made it,
whether the file is unchanged since the kit was created,
whether the pipeline was up to date,
which inputs have no recorded origin (see provenance),
and lists every file, marking those left out.
Add --json for tools.
In the project the kit came from,
calkit describe file also says how far behind its commit is,
whether the file has been remade since, and in which commits,
and which commits changed its pipeline,
e.g., to check whether something a colleague spotted in a shared figure
is already fixed.
calkit describe file works on files in a project without a kit too,
saying what kind of artifact it is, which stage makes it,
whether that's up to date, and where its inputs came from.
Opening and rerunning one
This unpacks the kit into a project in the folder given,
here plot-project, and opens it in your editor.
Run it again with the same folder to reopen it.
The project has the figure in place, committed to a new Git repo,
and the original project's Git remote as upstream.
calkit pull --no-git fetches data left out of the kit, if you have
access to the original project's storage, and calkit run remakes outputs.
Use --unpack-only to unpack it without opening an editor.
A kit carries no Git history,
so with --clone, it opens the project the kit came from instead,
wherever it is on your machine,
or cloned into ~/calkit if you have access to it,
and says what's changed there since.
With --hub, it opens the original project on the hub instead,
at the commit the kit came from.
This unpacks the kit into a temporary folder, lists the commands its stages run and asks before running them, pulls inputs left out of the kit, reruns every stage, and checks the figure comes out identical. The folder is removed if it is, and kept to look at if not. Give a folder after the file to unpack it there instead, and to reuse it next time.
Warning
A calkit's pipeline is code. Look at what an unpacked project runs before running it, as you would with any project you clone.
Format
Calkits are an open format, so other tools can read and write them.
A kit is a ZIP file with:
calkit-kit.jsonat the root, the manifestREADME.mdat the root, saying what the kit is and how to use it- the project files, under
project/
The manifest follows a JSON schema,
whose URL it gives as $schema.
It records:
kit_version: currently1artifact: the file's path in the project, its size and SHA-256 without the kit, and the stage that makes itsource: the project's name and title, Git remotes, commit, files with uncommitted changes, and whether the pipeline was up to datefiles: every file the pipeline uses, whether it's in the kit, where the project keeps it (gitordvc), its SHA-256 if it's in the kit, and DVC's MD5 if it's kept with DVCprovenance_gaps: inputs with no recorded origin
The ZIP's entries have fixed timestamps, so the same project state makes the same calkit.
Readers should treat a kit from someone else as untrusted:
- Every path, in the ZIP and the manifest, is relative, uses
/, has no empty,., or..parts, and has no part named.gitin any case..dvc/config.local,.dvc/tmp/, and the DVC cache, besides directory listings, are left out. - Every file under
project/must be listed infilesas included, once, with the same SHA-256, and every file listed as included must be there. - A reader that finds a
kit_versionnewer than it knows should refuse the calkit. - Matching hashes show the file and the kit agree with each other, not who made them, since both came in the same file.
A file carries its kit in a way that leaves the rest of the file as it
was, so removing the kit gives back the original bytes,
which must match the manifest's artifact.sha256:
- PNG: a chunk of type
caLKholding the ZIP, just beforeIEND. - PDF: an attached file named
calkit.zip, added in one incremental update, so the original is the firstartifact.sizebytes. A file with more than one%%EOFafter those bytes was saved again after the kit was added, so it no longer matches. - SVG: the ZIP as base64 inside a
<metadata id="calkit">element, right before the last</svg>. - HTML: the ZIP as base64 inside a
<script type="application/vnd.calkit+zip;base64" id="calkit">element, right before the last</body>, in any case, or at the end of a fragment without one.
In SVG and HTML, the block is byte for byte the opening bytes,
a newline, the base64 with a newline every 76 characters,
then the closing bytes, with a comment linking here among the opening
bytes.
A file's own kit is the block that ends right before that closing tag,
so a nested figure's kit, earlier in the file, isn't mistaken for it.
Removing the kit removes the whole block.
See MARKUP_BLOCKS in
calkit/kits.py
for the exact bytes.
The PNG chunk type marks it as ancillary, private, and unsafe to copy, so image editors drop it when they change the image, rather than keep a kit that no longer matches. A PDF viewer lists the kit with the document's attachments.
Apps and websites that rewrite files, e.g., by compressing images,
may remove the calkit.
A file's md5 is DVC's: the MD5 of its contents,
stored in DVC's cache under files/md5/ with the first two characters as
a folder.