molt build

Build the distribution artifacts -- an sdist and a wheel per package -- for the packages a publish plan will ship.

This is the pack stage of the publish pipeline. The command you type is molt build; the artifacts it produces are what molt publish --from-pack-dir uploads.

Synopsis

molt build [OPTIONS]

Description

On PyPI, building is mandatory and produces two artifacts -- a source distribution (.tar.gz) and a wheel (.whl) -- for every package. There is no implicit build at upload time. molt build runs the ecosystem's build (for example uv build / python -m build) for each package a plan will publish, writes the artifacts to an output directory, and records an enriched publish plan that adds each artifact's path and a sha256 integrity hash to the plan entries.

molt build can compute the plan itself, or take a precomputed one from molt publish-plan via --from-publish-plan. Splitting build from upload lets CI build once and upload from a separate, credentialed job.

If a build fails, molt surfaces the error and writes no plan file -- there is no half-built output to clean up.

Options

OptionTypeDefaultDescription
--out-dir <dir>pathdistDirectory to write artifacts and the enriched publish-plan.json into.
--from-publish-plan <file>string--Build from a precomputed publish plan instead of computing one.
--dry-runflagoffPrint what would be built; build nothing.
--cwd <path>pathcurrent directoryDirectory to run in; root discovery starts here.
-h, --helpflag--Show help and exit.

The publish plan is a versioned envelope ({ "version": 1, "plan": [...] }); a plan file with an unrecognized version is rejected.

Exit codes

SituationExit code
Artifacts built and plan written (or --dry-run printed)0
A build failed (no plan written)1
Plan file has an unsupported version1

Examples

Build everything in the current plan into dist/:

molt build

Build from a precomputed plan, into a chosen directory:

molt publish-plan --output publish-plan.json
molt build --from-publish-plan publish-plan.json --out-dir artifacts

Then upload the built artifacts from another job:

molt publish --from-pack-dir artifacts

See also