Skip to content
Halyard
Project
Source code on Codeberg (opens in new tab)

Search

Menu

Package Manager

Note: This feature is planned but not yet implemented. This page describes the intended design.

Halyard will include a built-in package manager for dependency management.

Adding Dependencies

Add packages with halyard add:

bash
halyard add json           # Latest version
halyard add http@2.0       # Specific version
halyard add --dev test     # Development dependency

This updates halyard.toml:

toml
[dependencies]
json = "1.2"
http = "2.0"

[dev-dependencies]
test = "1.0"

Version Syntax

SyntaxMeaning
1.2.3Exact version
^1.2Compatible (1.2.0 <= v < 2.0.0)
~1.2Patch updates (1.2.0 <= v < 1.3.0)
>=1.0Minimum version
*Any version

Lock File

halyard.lock records exact resolved versions:

toml
[[package]]
name = "json"
version = "1.2.3"
checksum = "sha256:abc123..."

[[package]]
name = "http"
version = "2.0.1"
checksum = "sha256:def456..."
dependencies = ["json"]

Commit halyard.lock for reproducible builds.

Updating Dependencies

bash
halyard update           # Update all packages
halyard update json      # Update specific package
halyard update --major   # Allow major version bumps

Removing Dependencies

bash
halyard remove json

Viewing Dependencies

bash
halyard deps             # List direct dependencies
halyard deps --tree      # Show dependency tree
halyard deps --outdated  # Show available updates

Private Registries

Configure in ~/.hly/config.toml:

toml
[[registries]]
name = "company"
url = "https://packages.company.com"
token = "..."

Use in halyard.toml:

toml
[dependencies]
internal-lib = { version = "1.0", registry = "company" }

Git Dependencies

Reference packages directly from git:

toml
[dependencies]
my-lib = { git = "https://github.com/user/repo", branch = "main" }
my-lib = { git = "https://github.com/user/repo", tag = "v1.0" }
my-lib = { git = "https://github.com/user/repo", rev = "abc123" }

Local Dependencies

For development:

toml
[dependencies]
my-lib = { path = "../my-lib" }

Publishing Packages

  1. Update version in halyard.toml
  2. Run halyard publish --dry-run to verify
  3. Run halyard publish to publish

Requirements:

  • Valid halyard.toml with name, version, license
  • README.md in project root
  • Authenticated with registry (halyard login)

Creating a Library

bash
halyard new my-lib --lib

Structure:

my-lib/
├── halyard.toml
├── src/
│   └── lib.hly    # Library entry point
└── tests/
    └── lib_test.hly

Export public API in src/lib.hly:

halyard
module MyLib
  export (parse, format, Config)

-- Public functions and types