Skip to content
English

Packages and modules

Current documentationSupport & limitations ↗

The standard library ships with Ku. Use imports for your own modules and third-party packages. There is no officially hosted public package directory; the repository provides a self-hosted registry implementation.

hello/
ku.mod
src/
main.ku
util.ku

ku.mod:

name = "hello"
version = "0.1.0"
root = "src"
main = "main.ku"

src/util.ku:

fn Greeting(): str {
return "Hello Ku"
}

src/main.ku:

import { Greeting } from "util"
fn main() {
println(Greeting())
}

Run ku check and ku run from the project directory. The output is Hello Ku. Exported user names start with an ASCII uppercase letter; lowercase names remain private to their file.

Syntax Resolution
"std.json" Bundled standard library
"util" Current package’s root directory
"./util.ku" Relative to the current source file
"@math/vector" A module inside the declared math dependency

Local development dependencies use dep.name.source = "file://absolute/path". Cross-package dependencies must be declared in ku.mod; imports cannot escape package roots.

Registry dependencies need an explicit HTTPS URL and pinned Ed25519 public key. ku package resolve updates resolution and the lock; --locked uses the existing lock and --offline uses cached packages only. ku package pack creates an artifact. publish and yank write to the configured registry and require credentials.

See the repository’s package reference for all fields, version ranges and self-hosted setup. This local example does not imply a deployed public package service.