Skip to content

First project and local packages

Source: docs/guides/first-project.md · revision 42e1817227fbc96e8e4a4a85fac78b3fec0a0e0f · blob 541f14bd446fee2df6c2bcc525a44b8f3550365d · MIT license.

This is a static reading copy. Ori and its full documentation remain canonical in the source repository.

Português: Primeiro projeto e pacotes locais

Status: practical guide for Ori S3 + inference B / workspace 0.3.8-dev. Root-first layout (ori.proj + main.orl); see spec 17 in the canonical repository.

Janela do terminal
ori new demo
cd demo
ori check main.orl
ori run main.orl

ori new creates:

demo/
ori.proj # entry = "main.orl"
main.orl

There is no required src/ folder. docs/ is optional for .oridoc sidecars. Put more modules in domain folders if you want (board/, api/, …).

Janela do terminal
ori check main.orl
ori run main.orl
ori compile main.orl --out demo
ori fmt main.orl
ori doctor
ori summary .

Tests — mark functions with @test:

module demo.main
import ori.test as test
@test
math_is_stable()
test.assert(1 + 1 == 2, "math should work")
end
Janela do terminal
ori test main.orl
workspace/
app/
ori.proj
ori.pkg.toml
main.orl
math/
ori.pkg.toml
lib.orl

math/ori.pkg.toml:

[package]
name = "demo.math"
version = "0.1.0"
entry = "lib.orl"
ori_version = "0.3.8"

math/lib.orl:

module demo.math
public double(value: int) -> int
return value * 2
end

app/ori.proj:

manifest = 1
name = "demo.app"
version = "0.1.0"
kind = "app"
entry = "main.orl"
[source]
root_namespace = "demo.app"
[dependencies]
demo.math = { path = "../math", version = "0.1.0" }

app/main.orl:

module demo.app
import demo.math (double)
import ori.io as io
main()
io.println(string(double(21)))
end
Janela do terminal
cd workspace/app
ori check main.orl
ori run main.orl
Janela do terminal
ori install demo.app --path .
# cache: ~/.ori/packages/<name>/<version>/
ORI_PACKAGE_CACHE=./cache ori install demo.app --path .

The local installer validates manifests, copies files, does not execute package code, and rejects symlinks during copy.

An optional registry can be local or HTTP through ORI_REGISTRY:

Janela do terminal
ori publish . --registry /path/to/registry
ori install other.pkg@0.1.0

See the canonical registry planning document; this is not a marketplace product push.

  1. Read the canonical changelog.
  2. Run ori check and ori test.
  3. For pre-S3 syntax, use ori migrate-syntax ..

Next: Cookbook · Language tour · Install · Examples