Sand Package Manager
Sand is the package manager for Praia. Written in Praia itself, it installs grains from Git repositories. Sand is bundled with Praia and installed automatically via make install.
Requirements
Section titled “Requirements”Requires git on your PATH.
Commands
Section titled “Commands”sand init Create a grain.yaml in the current directorysand init --plugin Create a grain with a native C++ pluginsand install Install grains from sand-lock.yamlsand install <url> Install a grain locally (into ext_grains/)sand install --global <url> Install a grain globally (into ~/.praia/ext_grains/)sand remove <name> Remove a locally installed grainsand remove --global <name> Remove a globally installed grainsand list List locally installed grainssand list --global List globally installed grainssand info <name> Show info about an installed grainsand --version Print versionsand help Show helpInstalling grains
Section titled “Installing grains”# Install locally (into ext_grains/)sand install github.com/user/mygrain
# Pinned to a version (git tag)sand install github.com/user/mygrain@0.2.0
# From any git URLsand install https://gitlab.com/user/mygrain.git
# Install globally (shared across all projects)sand install --global github.com/user/mygrainThen use it in your code:
use "mygrain"mygrain.doSomething()Installing from lock file
Section titled “Installing from lock file”Running sand install with no arguments reads sand-lock.yaml and installs any missing grains. Grains pinned to latest are re-fetched for updates.
git clone https://github.com/user/myproject.gitcd myprojectsand installLocal vs global
Section titled “Local vs global”By default, grains install locally into ext_grains/, tracked in sand-lock.yaml. Each project has isolated dependencies.
Use --global (or -g) to install into ~/.praia/ext_grains/, making the grain available to all projects.
Praia resolves grains in this order:
ext_grains/(local project dependencies)grains/(bundled with your project)~/.praia/ext_grains/(user global)<libdir>/grains/(system, installed with Praia)
Project manifest
Section titled “Project manifest”Run sand init to create a grain.yaml and main.praia:
name: my-projectversion: 0.1.0description: A short descriptionauthor: usernamelicense: MITmain: main.praiadependencies: db: github.com/user/praia-db dotenv: github.com/user/praia-dotenvWhen you sand install <url>, the dependency is automatically added to grain.yaml if one exists. Transitive dependencies listed in a grain’s own grain.yaml are installed automatically.
Publishing a grain
Section titled “Publishing a grain”A grain is a Git repository with a grain.yaml and Praia source files:
my-grain-repo/ grain.yaml # name: mygrain main.praia # entry point helpers.praia # internal module (use "./helpers")name: mygrainversion: 0.1.0main: main.praiadependencies:Tag releases with git tags for versioned installs:
git tag 0.1.0git push origin 0.1.0How it works
Section titled “How it works”sand install <url>clones the repo, reads the grain’sgrain.yamlfor its name, and copies it intoext_grains/<name>/- Installed grains are tracked in
sand-lock.yaml(local) or~/.praia/ext_grains/.sand-lock.yaml(global) sand installwith no arguments restores fromsand-lock.yaml- Multi-file grains work because relative imports (
use "./helpers") resolve from the grain’s own directory
See also: Module System for how grain resolution works.