This document provides instructions on how to use the Toit package manager (henceforth TPM) for common operations. See Packages for a full documentation.
The very first time, users might need to install a registry first (see below "Adding a Registry").
The following commands update the local registry, search for a package, and then install it.
toit pkg sync # Synchronize the installed registries. toit pkg search morse # Search for a package "morse". toit pkg install morse # Install package "morse".
Before being able to install any package, one must have a registry installed. Newer toit versions do this automatically, but it never hurts to check:
See which registries are installed:
You should have one or more registries:
If not, add a registry; for example the Toitware registry:
Create a new Git repository (for example
Add or move code into the
src folder of the new repository.
Optionally (but strongly recommended) add a LICENSE file. We recommend a permissive free software license, such as MIT.
Optionally (but strongly recommended) add a README.md. The title should be the package-name. The first paragraph should start as if prefixed with "This is a package containing". The first paragraph should have meaning on its own.
Optionally (but recommended) add a CHANGELOG.md.
Optional (but strongly recommended): polish the package, with an eye on
- examples, and
package.yaml in the root of the repository, with the following entries:
name: The name of the package. Don't add this entry if the README's title is the package-name.
description: A short description of the package. Don't add this entry if the README's first paragraph is a good description.
license: The license of the package. Don't add this entry if there is a LICENSE file. The license file or entry should follow github conventions.
dependencies: a map of dependencies. Each entry should look as follows:
Commit everything and tag it with the version number of the package. If you think that the package should be used by other developers, consider giving it a
v1.0.0 version number. (There is nothing gained by calling it
Version numbers must be prefixed with
v and follow semantic versioning.
Push your changes to the public repository (if not yet done), and inform a registry of its existence.
For the Toitware registry, file an issue here.