Defining a public API
Before publishing a library, declare its public API insrc/__init__.sifr. Any top-level class, function, or type alias defined or re-exported there becomes part of your package’s public surface. Implementation files like src/client.sifr are private across package boundaries unless you explicitly re-export their names.
__init__.sifr. Files not reachable through a public __init__.sifr are private and cannot be imported by packages that depend on yours.
Controlling archive contents with include/exclude
Cargo owns the archive rules. Add aninclude list to your Cargo.toml to specify exactly which files ship in the published archive. The standard Sifr include pattern covers the manifest, all Sifr source files, and the Rust marker:
Assembling an archive with sifr package
sifr package runs Sifr’s preflight validation and then delegates to Cargo to assemble the release archive. Run it from your package directory:
--allow-dirty:
- A valid
sifr.tomlat the expected location - All
.sifrsource files present and within the source root - No Cargo include/exclude omissions for required files
- No archive traversal paths
- Valid exports with no dangling re-exports
- No backend trust policy violations
Publishing with sifr publish
Once your archive validates cleanly, publish to the registry:
Dry run
Always run a dry run first to catch any remaining issues without uploading anything:--dry-run tells Cargo not to upload the crate. --no-verify skips Cargo’s local build verification step, which is useful when you have already verified with sifr check. The same Sifr preflight runs regardless of --no-verify.
Publishing credentials belong entirely to Cargo. They must never appear in
sifr.toml, Sifr-generated files, package metadata, or Sifr diagnostic output. Configure credentials with cargo login or your registry’s preferred Cargo credential provider.Vendoring dependencies with sifr vendor
Vendoring downloads all dependencies into a local directory so your project can build without network access. This is useful for air-gapped environments, reproducible builds, and auditing your full dependency tree.
vendor/ directory, with each dependency in its own versioned sub-directory. After vendoring, all sifr commands can run with --offline against the vendored copies.