Generate a draft snapcraft.yaml by pointing a tool at your project — not by filling in a template.
snapcraft init gives you a static template full of placeholders. draftcraft
inspects your project instead: it reads your pyproject.toml, finds your
name, version, entry points and dependencies, maps known dependencies to the
snap interfaces and stage packages they need, and writes a snapcraft.yaml
that is already mostly correct.
A generator can't know everything, so draftcraft never presents a guess as a fact. Every value in the generated file carries its confidence:
- values read directly from your project's own metadata render as clean YAML;
- heuristic inferences are marked
# verify: ...with the evidence they came from; - placeholders you must fill in are marked
# TODO: ....
name: hello-cli # verify: normalized from 'hello_cli' in pyproject.toml [project] name
version: '1.2.0'
summary: Say hello from the command line
base: core24 # verify: defaulted to the current LTS base
apps:
hello:
command: bin/hello # verify: console script 'hello' in pyproject.toml, installed by the python plugin
plugs:
- network # verify: from dependency 'requests'
parts:
hello-cli:
plugin: python # verify: Python project detected via pyproject.toml
source: . # verify: assumed the project root
stage-packages:
- libpq5 # verify: runtime library for 'psycopg2'draftcraft init # generate snapcraft.yaml for the current directory
draftcraft init path/to/proj # ... or for another directory
draftcraft detect # show detected facts, confidence and evidence, write nothingsudo snap install draftcraftdraftcraft is live on the Snap Store
Fittingly, snap/snapcraft.yaml started life as
draftcraft's own output — draftcraft init run on this repository — with
hand-tuning on top (longer description, license, interface plugs, staged
Python runtime).
| Ecosystem | Manifest | Extracted |
|---|---|---|
| Python (PEP 621) | pyproject.toml [project] |
name, version, summary, console scripts, dependencies |
| Python (Poetry) | pyproject.toml [tool.poetry] |
name, version, summary, scripts, dependencies |
| Node.js | package.json |
name (scopes stripped), version, summary, bin commands, runtime dependencies |
| Go | go.mod |
name and binary from the module path, direct (non-indirect) requirements |
| Rust | Cargo.toml |
name, version, summary, [[bin]] targets, dependencies |
In a polyglot repository, detectors are tried in the order above and the first match wins.
Dependency knowledge — which snap interfaces, build packages and stage
packages a dependency implies (e.g. psycopg2 → libpq-dev at build time,
libpq5 staged, network plugged) — lives in plain YAML data files under
src/draftcraft/data/, namespaced per ecosystem.
Extending coverage is a data change, not a code change.
Requires uv.
make setup # install project + dev dependencies
make test # run the test suite
make lint # ruff format check, ruff lint, mypy (strict)
make format # auto-format and auto-fixGenerated output is locked down by golden-file tests
(tests/goldens/) against fixture projects
(tests/fixtures/), and every golden file is verified
to parse cleanly through real snapcraft's project schema.
- Growing the dependency knowledge base (contributions are data-only:
edit the YAML under
src/draftcraft/data/) - Build-testing generated files end-to-end with
snapcraft packin CI
GPL-3.0, matching the craft ecosystem it serves.