Skip to content

Package Manager

Ferret includes a built-in package manager that handles dependency management, version resolution, and code sharing across projects.

Without a package manager, developers face:

  • Manual dependency tracking - Copy-pasting code between projects
  • Version conflicts - No systematic way to handle incompatible versions
  • No reproducibility - Different team members get different dependency versions
  • Update nightmares - Manually checking and updating each dependency
  • Broken builds - Missing dependencies cause compilation failures

Ferret’s package manager provides:

  • Automatic resolution - Fetches dependencies and their dependencies recursively
  • Version management - Semantic versioning with flexible constraints
  • Reproducible builds - Lock file ensures everyone gets the same versions
  • Multi-source support - GitHub, GitLab, Bitbucket, and local packages
  • Smart caching - Downloads once, reuses across projects
  • Clean workflows - Simple commands for common tasks

Create a fer.ret manifest file:

[package]
name = "myapp"
version = "v1.0.0"
compiler = "<=0.0.3"
[dependencies]
logger = "github.com/user/logger@^v1.0.0"
Terminal window
ferret get

The package manager:

  • Reads fer.ret
  • Resolves version constraints
  • Downloads packages from Git providers
  • Generates ferret.lock with exact versions
  • Caches packages in .ferret/modules/
import "github.com/user/logger";
fn main() {
logger::Info("Hello!");
}
  • Parallel downloads
  • Smart caching
  • Incremental updates
  • Lock file tracks exact versions
  • Deterministic resolution
  • Team consistency
  • GitHub (github.com)
  • GitLab (gitlab.com)
  • Bitbucket (bitbucket.org)
  • Local packages (../path)
  • Automatic recursive resolution
  • Conflict detection
  • Orphan cleanup
  • Semantic versioning (vX.Y.Z)
  • Constraint operators (^, ~, >=, >, <=, <)
  • Exact pinning
  • Latest tracking
  • Interactive project initialization
  • Colorful progress indicators
  • Clear error messages
  • Helpful suggestions

TOML file declaring:

  • Package metadata (name, version, author)
  • Dependencies with version constraints
  • Compiler compatibility
  • Development options

JSON file recording:

  • Exact resolved versions
  • Dependency tree
  • Generation timestamp

Always commit to version control.

Local directory storing:

  • Downloaded packages
  • Multiple versions
  • Extracted source code

Add to .gitignore.

Use the package manager when:

  • Importing external packages (non-stdlib)
  • Building multi-file projects
  • Sharing code across projects
  • Working in a team
  • Publishing libraries

Not needed for:

  • Single-file scripts with only stdlib imports
  • Quick prototypes
  • Learning exercises

Ready to use the package manager? Check out: