Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Packages and Nyssa

A package is a Zuri project other projects can use. Zuri installs, publishes and serves them itself: the commands ship with the runtime, and so does Nyssa, the repository they talk to. There is nothing else to install.

$ zuri install http-extra
Resolving dependencies
Installing http-extra 1.5.0
Installing json-schema 1.2.0
  + http-extra 1.5.0
  + json-schema 1.2.0
Installed 2 packages.
import http_extra

This chapter covers the whole of it:

  1. Projects and Versions: what project.toml says, how packages are named, and how version ranges read.
  2. Installing Packages: adding, updating and removing dependencies, the lockfile, and where packages can come from.
  3. Publishing Packages: accounts, tokens, and putting a version on a registry.
  4. Commands From Packages: packages that add zuri commands, and installing tools for your user.
  5. Bundles and Upgrades: shipping a program to machines without Zuri, and keeping Zuri itself up to date.
  6. Running Nyssa: hosting a repository for a team, a company, or the public.

The Commands

CommandWhat it does
zuri initstarts a project
zuri installadds packages, or installs everything a project declares
zuri uninstallremoves packages and whatever only they needed
zuri updatemoves packages to newer versions
zuri restoreinstalls exactly what the lockfile names
zuri infodescribes the project’s packages, or one on a registry
zuri searchfinds packages on a registry
zuri accountsigns in, and manages tokens
zuri publishpublishes a version
zuri yankstops a version from being chosen
zuri ownermanages who may publish a package
zuri cleanfrees the space downloads and installs take
zuri bundlepackages a program with a runtime
zuri upgradereplaces this Zuri with a newer release
zuri serveruns a Nyssa repository

Every one of them answers --help, and every one that changes a project answers --dry-run with exactly what it would do.

What Holds It Together

  • A project is a directory with a project.toml. Every command works on the project around the directory it runs in, found by looking upwards, the same way imports find it.
  • Packages install into the project. They land in .zuri/libs, which import searches before the standard library. Two projects on one machine never share, or fight over, an installed package.
  • One version of each package. Every requirement in the project is satisfied at once or the install stops and says which requirements clash. Nothing is installed twice at two versions.
  • The lockfile is the record. project.lock pins every package to an exact version and the checksum of what was downloaded, and zuri restore reproduces it anywhere.
  • Nothing half done. An install is staged beside .zuri/libs and swapped in whole, so a failure or an interrupted command leaves the project as it was.