---
title: "30.3 Needs and sources"
url: https://una-lang.org/en/docs/spec/30-packages/3-needs-and-sources/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/docs/spec/30-packages.md
---

# 30.3 Needs and sources

1. **`needs`** names the packages the package depends on.
   - **The requirement** is a version of two or three parts, the least version that the need admits: `json 2.1` admits `2.1.0` and later on the line `json 2`, `json 0.3` admits `0.3.0` and later on the line `json 0.3`. A pre-release follows a full version. It is required, except with `from path` and `from workspace`, where it MUST NOT be written: the dependency's own `version` is used.
   - **The local name** is the `as` name, or the last segment of the package's name. Two needs with one local name are U7008. A local name, and the last segment of the name of any package, MUST NOT be a reserved name or have the skeleton of one (U7008).
     - The reserved names are the keywords and reserved words of `spec/01 §5` of every edition, `std`, `prelude`, `una`, `ita`, `itaty`, `itaoca`, `itauna`, `path`, `git`, `workspace`, and the host capabilities' names in lower case: `console`, `clock`, `env`, `files`, `keys`, `http`.
     - A name's skeleton removes `_`, maps `0` to `o`; `1` and `i` to `l`; `2` to `z`; `3` to `e`; `4` to `a`; `5` to `s`; `7` to `t`; `8` to `b`; `9` to `g`; then `rn` to `m` and `vv` to `w`, and collapses each run of one letter. So `std_` and `s7d` are refused as `std` is.
   - **`from`** gives the origin: `itaty`, the default, predeclared; a source of `sources`; `path "<dir>"`, a directory relative to the package; or `workspace`. Any other source is U7008, and there are no git dependencies.
   - **`may`** lines write the ceiling that the package grants the dependency at its calls (ADR 0093 rule 1). An operation named twice, or a capability named twice in one ceiling, is U7008.
   - **`avoid`** lines name full versions that resolution never selects.
   - **`accept name`** is written only under a path need (U7008 otherwise).
   - **One identity once.** A package needed twice on one major line from one source is U7008.
2. **`sources`** declares a registry other than `itaty`: its name, its `https://` base URL, the digest of its root metadata, `sha256:` and 64 lowercase hexadecimal digits, and the owners it serves. A source's name is not `itaty`, `path`, `git` or `workspace`; two sources with one name, or two sources that list one owner, are U7008. A need of a name whose owner a source lists names that source with `from` (U7008 otherwise), so a private owner's package never resolves at another registry.
3. **`replace`** takes every package of a name at a full version from another origin; `trust` consents to a dependency's trusted modules by identity: its name, its major line (`2`, or `0.3` for the line `0.3`), and its source. The major line and the source may be left out only for a package the root needs directly (U7008 otherwise); they are then those of that need (§13).
4. **What this release loads.** Path dependencies, by §12, and the releases of the sources of `sources` that the lock pins and that load verified, by §14 rule 10. A need of `itaty`, whose root metadata is not built into this release, or of a workspace member is refused, U7008 at the need, so no import reaches a package that is not checked with the program. `una ita` reports a need of `itaty` as U7013 (§10 rule 7).
