Artefact Formats: What a Registry Actually Hands to the Installer
When someone installs your package, they do not download your repository. They download an artefact that a build step produced and a registry stored. Knowing what each format contains, and what it leaves out, explains a large share of "works on my machine" bug reports. This page is a set of short reference entries, one per format.
JavaScript: the npm tarball
A gzipped tar archive whose files sit under a top-level package/ directory. Its contents are decided by the files field in package.json, any .npmignore, and a handful of files npm always includes, such as package.json itself, the README and the licence file. Lifecycle scripts declared in the manifest can run on install, which is why reviewers look at them closely.
{
"name": "example-lib",
"version": "2.1.0",
"files": ["dist", "README.md"]
}
The lockfile of the consuming project records an integrity value, a Subresource Integrity style hash of the tarball, so a changed file under the same version would be detected.
Python: wheel and sdist
| Format | What it is | When the installer uses it |
|---|---|---|
Wheel (.whl) | A zip archive of ready-to-install files plus a .dist-info metadata directory. The filename encodes Python version, ABI and platform tags. | Preferred whenever a compatible tag exists, because nothing has to be built. |
Source distribution (.tar.gz) | The source plus pyproject.toml and a PKG-INFO metadata file. | Fallback when no wheel matches; the installer runs the build backend locally. |
A pure-Python project usually ships one universal wheel tagged py3-none-any. A project with compiled extensions ships one wheel per platform it supports, and anyone outside that set builds from the sdist, which needs a compiler.
Go: the module zip
Go modules are fetched as zip files from a module proxy, by default proxy.golang.org, or directly from version control. The zip holds the module tree at a tagged version. Each consuming project's go.sum records hashes for the module zip and its go.mod, and the Go command checks new entries against the public checksum database. Because the content is tied to a tag, retagging a version after release does not change what users get; it produces checksum errors instead.
Rust: the .crate file
A gzipped tarball created by cargo package. Cargo verifies that it builds before cargo publish uploads it. A normalised copy of Cargo.toml is included, and the consumer's Cargo.lock stores a checksum per crate.
Quick checks before you ship any format
- List the artefact's contents and compare them with what your import paths expect.
- Look for things that should not be there: credentials, large fixtures, editor folders.
- Confirm the licence file is present, not just declared in metadata.
- Install the artefact in an empty directory, never from the source tree.
The full routine for that last check is in how to test the packed artefact before publishing. Terms such as sdist and integrity hash are defined in the glossary.