Packages¶
quivers.packages reads package manifests, resolves builds, pins them in lockfiles, computes
versions from interface diffs, and migrates dependents along dependency lenses. The surface is in
packages, lockfiles, and versions and the rules in
packages and dependency lenses.
| Page | Contents |
|---|---|
| Manifests and versions | qvr.toml, semantic versions, compatibility lines |
| Resolution | package sources, minimal version selection, explanations |
| Lockfiles and indexes | qvr.lock, index repositories, the git cache |
| Workspaces | building packages, pins, and the package boundary |
| Interfaces and versions | semantic interfaces, interface diffs, releases |
| Dependency lenses | lenses and the migration of dependents and run records |
packages
¶
Packages: manifests, resolution, lockfiles, interface versioning, and dependency lenses.
A package is a directory with a qvr.toml manifest
(quivers.packages.manifest). Its dependencies resolve by minimal version
selection (quivers.packages.resolve) from directories, git repositories,
and package indexes (quivers.packages.index), and qvr lock pins every
module of the build by content hash (quivers.packages.lockfile,
quivers.packages.workspace). qvr bump classifies a version's interface
change (quivers.packages.interface, quivers.packages.bump), and the
dependency lens of a change (quivers.packages.lenses) migrates dependents
and stored runs (quivers.packages.migration).
CHANGE_LEVELS
module-attribute
¶
CHANGE_LEVELS: tuple[ChangeLevel, ...] = ('none', 'patch', 'minor', 'major')
The change levels from least to most.
LOCKFILE_NAME
module-attribute
¶
The lockfile's file name, beside the manifest.
CACHE_DIRECTORY
module-attribute
¶
Where a project's package cache lives, relative to its root package.
DATA_ROLES
module-attribute
¶
Program parameter roles a dependent binds to data rather than passes.
SIGNATURE_KINDS
module-attribute
¶
Declaration kinds with a signature apart from their body: a change to the body alone keeps their interface. Any change to a declaration of another kind changes its shape, which dependents see.
INVENTORY_PROTOCOL
module-attribute
¶
The panproto protocol inventories and usages are written in.
LENS_DIRECTORY
module-attribute
¶
Where a package keeps the lenses its breaking releases emit.
ChangeLevel
¶
How much a change to a package moves its version: major breaks
dependents, minor adds to the interface (or changes the meaning of a
program fit to data), patch changes bodies only, none changes
nothing.
TomlValue
¶
A value of a parsed TOML document.
SourceKind
¶
How a locked package was found.
PackageErrorCode
¶
PackageErrorCode = Literal['package-module-private', 'package-not-a-dependency', 'package-module-outside', 'package-hole-unlisted', 'package-hole-unknown', 'package-link-conflict', 'package-pin-mismatch', 'package-lock-stale', 'package-module-missing']
The codes a package diagnostic carries.
ChangeCategory
¶
ChangeCategory = Literal['removed', 'renamed', 'added', 'added-site', 'kind', 'type', 'effects', 'support', 'index', 'fitted-body', 'body']
What kind of change one InterfaceChange is.
Version
didactic-model
¶
Bases: Model
A semantic version MAJOR.MINOR.PATCH.
| ATTRIBUTE | DESCRIPTION |
|---|---|
major, minor, patch |
The components.
TYPE:
|
parse
classmethod
¶
parse(text: str) -> Version
Read a version.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Version
|
The version. |
| RAISES | DESCRIPTION |
|---|---|
VersionError
|
If the text is not a version. |
Source code in src/quivers/packages/versions.py
key
¶
The version as a sortable key.
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, int, int]
|
|
render
¶
line
¶
The compatibility line: components up to the leftmost nonzero one.
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, ...]
|
|
Source code in src/quivers/packages/versions.py
render_line
¶
The compatibility line as text.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/packages/versions.py
compatible
¶
compatible(other: Version) -> bool
Whether two versions share a compatibility line.
| PARAMETER | DESCRIPTION |
|---|---|
other
|
Another version.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether one may stand in for the other. |
Source code in src/quivers/packages/versions.py
bumped
¶
bumped(level: ChangeLevel) -> Version
The next version after a change of a given level.
The leftmost nonzero component is the one a breaking change moves,
so on line 0.y a breaking change bumps y and any other change
bumps the patch; on line 0.0.z every change bumps z.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The change.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Version
|
The version that publishes it (this version for |
Source code in src/quivers/packages/versions.py
level_to
¶
level_to(later: Version) -> ChangeLevel
The largest change a later version may publish over this one.
| PARAMETER | DESCRIPTION |
|---|---|
later
|
A version greater than this one.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChangeLevel
|
|
| RAISES | DESCRIPTION |
|---|---|
VersionError
|
If |
Source code in src/quivers/packages/versions.py
VersionError
¶
Bases: ValueError
A version or a requirement that does not parse.
Its message says what is malformed, quoting the text.
Dependency
didactic-model
¶
Dependency(*, name: str, source: DependencySource)
Bases: Model
One dependency of a package.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The depended-on package's name.
TYPE:
|
source |
Where it comes from.
TYPE:
|
DependencySource
didactic-model
¶
Bases: TaggedUnion
Where a dependency comes from.
GitSource
didactic-model
¶
Bases: DependencySource
A dependency found in a git repository.
| ATTRIBUTE | DESCRIPTION |
|---|---|
url |
The repository, as
TYPE:
|
rev |
A commit, tag, or branch; the repository's default branch when empty.
TYPE:
|
HoleSpec
didactic-model
¶
Bases: Model
A hole a package exposes.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The hole's module path.
TYPE:
|
default |
The module that fills it when no link does; empty for none.
TYPE:
|
IndexSource
didactic-model
¶
IndexSource(*, index: str, minimum: Version, kind: Literal['index'] = 'index')
Bases: DependencySource
A dependency looked up in a package index.
| ATTRIBUTE | DESCRIPTION |
|---|---|
index |
The index's name in the depending package's
TYPE:
|
minimum |
The version the dependent was built against; any later version on its compatibility line satisfies it.
TYPE:
|
IndexSpec
didactic-model
¶
Bases: Model
A package index a manifest may look dependencies up in.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The name dependencies refer to it by.
TYPE:
|
url |
The index's git repository.
TYPE:
|
LinkSpec
didactic-model
¶
Bases: Model
A hole a package fills for its own builds.
| ATTRIBUTE | DESCRIPTION |
|---|---|
hole |
The hole's module path.
TYPE:
|
module |
The filling module's path.
TYPE:
|
Manifest
didactic-model
¶
Manifest(*, name: str, version: Version, modules: tuple[str, ...] = (), source: str = '.', holes: tuple[HoleSpec, ...] = (), links: tuple[LinkSpec, ...] = (), dependencies: tuple[Dependency, ...] = (), indexes: tuple[IndexSpec, ...] = ())
Bases: Model
A parsed qvr.toml.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The package's name, the first segment of its module paths.
TYPE:
|
version |
The package's version.
TYPE:
|
modules |
The modules dependents may import, sorted.
TYPE:
|
source |
The directory below the package's directory that module paths are
relative to (
TYPE:
|
holes |
The holes the package exposes, by path.
TYPE:
|
links |
The links, by hole path.
TYPE:
|
dependencies |
The dependencies, by name.
TYPE:
|
indexes |
The indexes, by name.
TYPE:
|
dependency
¶
dependency(name: str) -> Dependency | None
The dependency on a package.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The package's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dependency | None
|
The dependency, or |
Source code in src/quivers/packages/manifest.py
index_url
¶
The repository of a named index.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The index's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Its repository. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the manifest declares no such index. |
Source code in src/quivers/packages/manifest.py
provides
¶
Whether a module path is in this package's namespace.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
A module path's segments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether its first segment is the package's name. |
Source code in src/quivers/packages/manifest.py
ManifestError
¶
Bases: ValueError
A manifest that does not describe a package.
Its message says what is wrong, naming the file and the key.
PathSource
didactic-model
¶
Bases: DependencySource
A dependency found in a directory.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The directory, relative to the depending package's directory, in POSIX spelling.
TYPE:
|
LockedIndex
didactic-model
¶
Bases: Model
An index a locked build looked dependencies up in.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The index's name in the root manifest.
TYPE:
|
url |
Its repository.
TYPE:
|
commit |
The commit of the index the build was resolved against.
TYPE:
|
LockedModule
didactic-model
¶
Bases: Model
The content hashes a lockfile pins for one module.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The module's path.
TYPE:
|
core |
The hash of its checked declarations.
TYPE:
|
interface |
The digest of its public interface.
TYPE:
|
LockedPackage
didactic-model
¶
LockedPackage(*, name: str, version: Version, source: SourceKind, location: str = '', commit: str = '', revision: str = '', dependencies: tuple[str, ...] = (), modules: tuple[LockedModule, ...] = ())
Bases: Model
One package of a locked build.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The package's name.
TYPE:
|
version |
Its version.
TYPE:
|
source |
How it was found.
TYPE:
|
location |
The directory relative to the root package (
TYPE:
|
commit |
The git commit of its source, for
TYPE:
|
revision |
For
TYPE:
|
dependencies |
The names of the packages it depends on, sorted.
TYPE:
|
modules |
Its modules' hashes, by path.
TYPE:
|
module
¶
module(path: str) -> LockedModule | None
The pin of one module.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The module's path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LockedModule | None
|
Its pin, or |
Source code in src/quivers/packages/lockfile.py
Lockfile
didactic-model
¶
Lockfile(*, root: str, dependencies: tuple[str, ...] = (), indexes: tuple[LockedIndex, ...] = (), packages: tuple[LockedPackage, ...] = ())
Bases: Model
A resolved, pinned build.
| ATTRIBUTE | DESCRIPTION |
|---|---|
root |
The root package's name.
TYPE:
|
dependencies |
The root's direct dependencies, sorted.
TYPE:
|
indexes |
The indexes resolution read, by name.
TYPE:
|
packages |
Every package of the build except the root, by name.
TYPE:
|
package
¶
package(name: str) -> LockedPackage | None
The locked package of a name.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A package name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LockedPackage | None
|
The package, or |
Source code in src/quivers/packages/lockfile.py
index
¶
index(name: str) -> LockedIndex | None
The locked commit of a named index.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The index's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LockedIndex | None
|
The index, or |
Source code in src/quivers/packages/lockfile.py
LockfileError
¶
Bases: ValueError
A lockfile that cannot be read, or a build that disagrees with it.
Its message says what is wrong, naming the package and module.
GitCache
¶
The git repositories and extracted commits of one project.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The cache directory,
TYPE:
|
Source code in src/quivers/packages/git.py
for_package
classmethod
¶
for_package(root: Path) -> GitCache
The cache of the project whose root package is a directory.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
The root package's directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
GitCache
|
Its cache. |
Source code in src/quivers/packages/git.py
mirror_path
¶
Where the mirror of a repository lives.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
Its bare mirror's directory. |
Source code in src/quivers/packages/git.py
has_commit
¶
Whether the mirror of a repository holds a commit.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
commit
|
A full commit id.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether the commit is present without fetching. |
Source code in src/quivers/packages/git.py
fetch
¶
Bring a repository's mirror up to date, cloning it when absent.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
The mirror. |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the repository cannot be cloned or fetched. |
Source code in src/quivers/packages/git.py
resolve
¶
The commit a revision of a repository names.
A full commit id already in the mirror resolves without the
network; any other revision (a tag, a branch, a short id, or the
default branch for "") fetches first.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
revision
|
A commit, tag, or branch; empty for the default branch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The full commit id. |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the repository cannot be fetched or the revision names no commit. |
Source code in src/quivers/packages/git.py
read
¶
A file's text at a commit.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
commit
|
A commit in its mirror.
TYPE:
|
path
|
The file's path in the repository, POSIX spelling.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str | None
|
The file's text, or |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the commit is not in the mirror. |
Source code in src/quivers/packages/git.py
files
¶
Every file of a commit.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
commit
|
A commit in its mirror.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
The files' paths, sorted. |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the commit is not in the mirror. |
Source code in src/quivers/packages/git.py
checkout
¶
A directory holding a commit's files, extracted once.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
commit
|
A full commit id.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
The extracted tree, |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the commit is not in the repository. |
Source code in src/quivers/packages/git.py
GitError
¶
Bases: OSError
A git command that failed, or a revision that names no commit.
Its message says the command and what git reported.
IndexEntry
didactic-model
¶
IndexEntry(*, name: str, version: Version, url: str, commit: str, dependencies: tuple[IndexRequirement, ...] = (), modules: tuple[LockedModule, ...] = ())
Bases: Model
One published version of a package.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The package.
TYPE:
|
version |
The version.
TYPE:
|
url |
The repository holding its source.
TYPE:
|
commit |
The commit of that repository.
TYPE:
|
dependencies |
Its dependencies, by name.
TYPE:
|
modules |
The content hashes of the modules it provides, by path.
TYPE:
|
IndexRequirement
didactic-model
¶
IndexRequirement(*, name: str, minimum: Version)
Bases: Model
A dependency of an indexed version on another package of its index.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The package.
TYPE:
|
minimum |
The version it was built against.
TYPE:
|
PackageIndex
¶
PackageIndex(name: str, url: str, commit: str, cache: GitCache)
An index repository read at one commit.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The index's name in the root manifest.
TYPE:
|
url
|
The repository.
TYPE:
|
commit
|
The commit read.
TYPE:
|
cache
|
The project cache holding its mirror.
TYPE:
|
Source code in src/quivers/packages/index.py
open
classmethod
¶
open(name: str, url: str, cache: GitCache, *, commit: str = '') -> PackageIndex
Open an index at a commit, or at its default branch's head.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The index's name.
TYPE:
|
url
|
Its repository.
TYPE:
|
cache
|
The project cache.
TYPE:
|
commit
|
The commit to read, as a lockfile pins it; the newest commit of the default branch when empty.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PackageIndex
|
The index. |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the repository or the commit cannot be read. |
Source code in src/quivers/packages/index.py
versions
¶
versions(package: str) -> tuple[Version, ...]
Every published version of a package.
| PARAMETER | DESCRIPTION |
|---|---|
package
|
The package.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Version, ...]
|
Its versions, ascending. |
Source code in src/quivers/packages/index.py
packages
¶
Every package the index lists.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
Their names, sorted. |
Source code in src/quivers/packages/index.py
entry
¶
entry(package: str, version: Version) -> IndexEntry
The entry of one published version.
| PARAMETER | DESCRIPTION |
|---|---|
package
|
The package.
TYPE:
|
version
|
The version.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IndexEntry
|
Its entry. |
| RAISES | DESCRIPTION |
|---|---|
PackageIndexError
|
If the index does not list that version, or its entry disagrees with its path. |
Source code in src/quivers/packages/index.py
PackageIndexError
¶
Bases: ValueError
An index entry that is malformed or missing.
Its message says what is wrong, naming the index and the entry.
Package
didactic-model
¶
Package(*, manifest: Manifest, directory: str, source: SourceKind, location: str = '', commit: str = '', revision: str = '', implicit: bool = False, published: tuple[LockedModule, ...] = ())
Bases: Model
A package's manifest and the place its modules are.
| ATTRIBUTE | DESCRIPTION |
|---|---|
manifest |
Its manifest.
TYPE:
|
directory |
Its directory, absolute.
TYPE:
|
source |
How it was found.
TYPE:
|
location |
For a path dependency, the directory relative to the root package; for a git dependency, the repository; for an indexed one, the index's repository; empty for the root and the standard library.
TYPE:
|
commit |
The commit of its source, for
TYPE:
|
revision |
For
TYPE:
|
implicit |
Whether every package depends on it without saying so (the standard library).
TYPE:
|
published |
For an indexed version, the module hashes its index entry publishes.
TYPE:
|
version
property
¶
version: Version
The package's version.
| RETURNS | DESCRIPTION |
|---|---|
Version
|
|
module_root
¶
The directory module paths of this package are relative to.
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
module_paths
¶
Every module of the package: each .qvr file in its namespace.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
The dotted module paths, sorted. |
Source code in src/quivers/packages/sources.py
describe
¶
The package as diagnostics name it.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/packages/sources.py
PackageSources
¶
PackageSources(root: Path, cache: GitCache)
Materialize packages from their sources.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
The root package's directory, which path dependencies are recorded relative to.
TYPE:
|
cache
|
The project's git cache.
TYPE:
|
Source code in src/quivers/packages/sources.py
root_package
¶
root_package() -> Package
The root package.
| RETURNS | DESCRIPTION |
|---|---|
Package
|
The package whose manifest is in the root directory. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If its manifest is missing or malformed. |
Source code in src/quivers/packages/sources.py
directory
¶
directory(directory: Path) -> Package
The package in a directory, as a path dependency.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The package's directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Package
|
The package, located relative to the root package. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the directory has no manifest or it is malformed. |
Source code in src/quivers/packages/sources.py
git_manifest
¶
git_manifest(url: str, commit: str) -> Manifest
The manifest at a commit of a repository, without extracting it.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
commit
|
The commit.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Manifest
|
The manifest at the repository's top. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the commit has no manifest or it is malformed. |
GitError
|
If the commit cannot be read. |
Source code in src/quivers/packages/sources.py
git
¶
git(url: str, commit: str, *, source: SourceKind = 'git', revision: str = '') -> Package
The package at a commit of a repository, extracted into the cache.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The repository.
TYPE:
|
commit
|
The commit.
TYPE:
|
source
|
TYPE:
|
revision
|
The revision the depending manifest names.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Package
|
The package. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the commit has no manifest or it is malformed. |
GitError
|
If the commit cannot be read. |
Source code in src/quivers/packages/sources.py
Edge
didactic-model
¶
Bases: Model
The dependencies of one package of a resolved build.
| ATTRIBUTE | DESCRIPTION |
|---|---|
package |
The package.
TYPE:
|
dependencies |
The packages it depends on, sorted.
TYPE:
|
Node
didactic-model
¶
Origin
didactic-model
¶
Bases: Model
Where one requirement says a package comes from.
| ATTRIBUTE | DESCRIPTION |
|---|---|
kind |
TYPE:
|
location |
The absolute directory, the repository, or the index's repository.
TYPE:
|
commit |
The git commit, for
TYPE:
|
pinned
¶
Whether this origin fixes one version.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True for a directory, a git commit, and the standard library. |
Requirement
didactic-model
¶
Requirement(*, dependent: Node | None = None, name: str, origin: Origin, minimum: Version | None = None, written: str)
Bases: Model
One dependency edge of the requirement graph.
| ATTRIBUTE | DESCRIPTION |
|---|---|
dependent |
The package that requires;
TYPE:
|
name |
The package required.
TYPE:
|
origin |
Where the dependent says it comes from.
TYPE:
|
minimum |
For an indexed requirement, the minimum version.
TYPE:
|
written |
The requirement as explanations name it (
TYPE:
|
Resolution
didactic-model
¶
Resolution(*, root: Package, packages: tuple[Package, ...] = (), edges: tuple[Edge, ...] = (), indexes: tuple[LockedIndex, ...] = ())
Bases: Model
A resolved build.
| ATTRIBUTE | DESCRIPTION |
|---|---|
root |
The root package.
TYPE:
|
packages |
Every other package of the build, by name.
TYPE:
|
edges |
Each package's dependencies after selection.
TYPE:
|
indexes |
The index commits read, by name.
TYPE:
|
package
¶
package(name: str) -> Package | None
The selected package of a name, the root included.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A package name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Package | None
|
The package, or |
Source code in src/quivers/packages/resolve.py
dependencies_of
¶
The packages one package depends on, the implicit ones included.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A package of the build.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
Their names, sorted. |
Source code in src/quivers/packages/resolve.py
ResolutionError
¶
Bases: ValueError
Requirements no build satisfies.
Its message says the explanation, one derivation step per line.
Resolver
¶
Resolver(sources: PackageSources, *, locked: Lockfile | None = None, standard_library_root: Path = STANDARD_LIBRARY_ROOT)
Resolve a root package's requirements by minimal version selection.
| PARAMETER | DESCRIPTION |
|---|---|
sources
|
Materializes packages.
TYPE:
|
locked
|
A lockfile whose index and git commits to read instead of the newest ones, so a locked build resolves offline to the same build.
TYPE:
|
standard_library_root
|
Where the standard library's modules are.
TYPE:
|
Source code in src/quivers/packages/resolve.py
resolve
¶
resolve() -> Resolution
Resolve the root package's build.
| RETURNS | DESCRIPTION |
|---|---|
Resolution
|
Every selected package, its dependencies, and the index commits read. |
| RAISES | DESCRIPTION |
|---|---|
ResolutionError
|
If no build satisfies the requirements, with the explanation. |
ManifestError
|
If a manifest is malformed. |
GitError
|
If a repository cannot be read. |
Source code in src/quivers/packages/resolve.py
BuiltModule
didactic-model
¶
BuiltModule(*, path: str, package: str, interface: ModuleInterface, core: str, holes: tuple[str, ...] = (), qiec: QiecModule | None = field(opaque=True, extras=OPAQUE_BY_VALUE), flat: FlatProgram = field(opaque=True, extras=OPAQUE_BY_VALUE))
Bases: ValueModel
One module of a package, checked.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The module's path.
TYPE:
|
package |
Its package's name.
TYPE:
|
interface |
Its public interface.
TYPE:
|
core |
The hash of its checked declarations.
TYPE:
|
qiec |
The checked core of its flat program (or, for a module that needs
unfilled holes, of its checking program);
TYPE:
|
flat |
Its flat program.
TYPE:
|
holes |
The holes its graph has that modules of its own package declare.
TYPE:
|
PackageError
¶
PackageError(code: PackageErrorCode, message: str, location: SourceLocation | None = None)
Bases: ValueError
A build that violates a package rule or disagrees with its pins.
| PARAMETER | DESCRIPTION |
|---|---|
code
|
The stable code.
TYPE:
|
message
|
What is wrong.
TYPE:
|
location
|
Where, when the refusal points at source.
TYPE:
|
Source code in src/quivers/packages/workspace.py
PackageLoader
¶
PackageLoader(packages: Iterable[Package])
Find a module in the package its path's first segment names.
| PARAMETER | DESCRIPTION |
|---|---|
packages
|
Every package of the build.
TYPE:
|
Source code in src/quivers/packages/workspace.py
find
¶
find(path: tuple[str, ...]) -> tuple[ModuleSource, ...]
The source of a module path, from its package.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The module path's segments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[ModuleSource, ...]
|
The module's source, or nothing when no package of the build provides it. |
Source code in src/quivers/packages/workspace.py
available
¶
Every module the build's packages provide.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
The dotted paths, sorted. |
Source code in src/quivers/packages/workspace.py
package_of
¶
package_of(path: tuple[str, ...]) -> Package | None
The package providing a module path.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The module path's segments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Package | None
|
The package named by its first segment, if the build has one. |
Source code in src/quivers/packages/workspace.py
Workspace
¶
Workspace(root: Path, *, cache: GitCache | None = None, standard_library_root: Path = STANDARD_LIBRARY_ROOT)
A root package and its build.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
The root package's directory.
TYPE:
|
cache
|
The git cache; the project's own (
TYPE:
|
standard_library_root
|
Where the standard library's modules are.
TYPE:
|
Source code in src/quivers/packages/workspace.py
discover
classmethod
¶
discover(start: Path, *, cache: GitCache | None = None, standard_library_root: Path = STANDARD_LIBRARY_ROOT) -> Workspace
The workspace of the package containing a path.
| PARAMETER | DESCRIPTION |
|---|---|
start
|
A file or directory inside the package.
TYPE:
|
cache
|
The git cache, as for the constructor.
TYPE:
|
standard_library_root
|
Where the standard library's modules are.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Workspace
|
The workspace. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If no directory at or above |
Source code in src/quivers/packages/workspace.py
resolve
¶
resolve(*, locked: Lockfile | None = None) -> Resolution
Resolve the root manifest.
| PARAMETER | DESCRIPTION |
|---|---|
locked
|
A lockfile whose index and git commits to read; the newest ones when omitted.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Resolution
|
The build. |
| RAISES | DESCRIPTION |
|---|---|
ResolutionError
|
If no build satisfies the requirements. |
Source code in src/quivers/packages/workspace.py
locked_build
¶
locked_build(locked: Lockfile) -> Resolution
The build a lockfile records, read from the lockfile alone.
The manifest is not consulted beyond the root package itself: each package is materialized from its pinned source (a directory, a git commit, the index entry at the locked index commit, or the standard library), so the build migrated from stays reachable after the manifest has moved on.
| PARAMETER | DESCRIPTION |
|---|---|
locked
|
The lockfile.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Resolution
|
The locked build. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If a locked package no longer has the version the lockfile records. |
GitError
|
If a pinned commit cannot be read. |
Source code in src/quivers/packages/workspace.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | |
loader
¶
loader(resolution: Resolution) -> PackageLoader
The loader of a resolved build.
| PARAMETER | DESCRIPTION |
|---|---|
resolution
|
The build.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PackageLoader
|
Finds every module of every package. |
Source code in src/quivers/packages/workspace.py
links
¶
links(resolution: Resolution) -> dict[str, str]
The links of a build: default links, then the root's own.
| PARAMETER | DESCRIPTION |
|---|---|
resolution
|
The build.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, str]
|
Hole path to filling module. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If two packages give one hole different defaults and the root does not link it. |
Source code in src/quivers/packages/workspace.py
load
¶
load(module: str, resolution: Resolution, *, extra_links: Mapping[str, str] | None = None, overlay: Mapping[str, str] | None = None) -> ModuleGraph
Load the module graph rooted at one module of the build.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The root module's path.
TYPE:
|
resolution
|
The build.
TYPE:
|
extra_links
|
Links beyond the build's (an experiment's), which win.
TYPE:
|
overlay
|
Module texts, by path, read instead of the packages' files (an editor's buffers, a migration's output).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModuleGraph
|
The checked graph, linked with the build's links for the holes it has. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If no package provides the module, or an import or link crosses a package boundary the rules forbid. |
ModuleError
|
If the graph does not load or resolve. |
Source code in src/quivers/packages/workspace.py
build_module
¶
build_module(module: str, resolution: Resolution, *, extra_links: Mapping[str, str] | None = None, overlay: Mapping[str, str] | None = None) -> BuiltModule
Check one module of the build as a root.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The module's path.
TYPE:
|
resolution
|
The build.
TYPE:
|
extra_links
|
Links beyond the build's.
TYPE:
|
overlay
|
Module texts read instead of the packages' files.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BuiltModule
|
The checked module and its hashes. A module that needs holes no link fills is hashed by its checking program, which checks it against the holes' signatures. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If an import crosses a package boundary the rules forbid. |
ModuleError
|
If the graph does not load or resolve. |
CompileError
|
If the module does not compile. |
Source code in src/quivers/packages/workspace.py
build_package
¶
build_package(package: Package, resolution: Resolution) -> tuple[BuiltModule, ...]
Check the modules of one package that the build pins.
The root package's every module is checked; a dependency's exposed modules are (its private modules are checked through them).
| PARAMETER | DESCRIPTION |
|---|---|
package
|
A package of the build.
TYPE:
|
resolution
|
The build.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[BuiltModule, ...]
|
The checked modules, by path. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If an exposed module does not exist or a hole is unlisted. |
ModuleError
|
If a module does not load or resolve. |
CompileError
|
If a module does not compile. |
Source code in src/quivers/packages/workspace.py
pinned_modules
¶
pinned_modules(package: Package, resolution: Resolution) -> tuple[BuiltModule, ...]
The checked modules a lockfile pins for one dependency.
The standard library ships with quivers, so its version (the release it ships with) identifies its content: it is not checked or pinned module by module. Every other dependency's exposed modules are.
| PARAMETER | DESCRIPTION |
|---|---|
package
|
A dependency of the build.
TYPE:
|
resolution
|
The build.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[BuiltModule, ...]
|
Its pinned modules, by path. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If a module violates a package rule. |
ModuleError
|
If a module does not load or resolve. |
CompileError
|
If a module does not compile. |
Source code in src/quivers/packages/workspace.py
lock
¶
lock() -> Lockfile
Resolve the manifest afresh, check every package, and pin it.
| RETURNS | DESCRIPTION |
|---|---|
Lockfile
|
The lockfile, also written beside the manifest. |
| RAISES | DESCRIPTION |
|---|---|
ResolutionError
|
If no build satisfies the requirements. |
PackageError
|
If a module violates a package rule, or an indexed version's modules differ from the hashes its index entry publishes. |
ModuleError
|
If a module does not load or resolve. |
CompileError
|
If a module does not compile. |
Source code in src/quivers/packages/workspace.py
build
¶
build() -> tuple[Lockfile, tuple[BuiltModule, ...]]
Build the root package against its lockfile.
| RETURNS | DESCRIPTION |
|---|---|
tuple[Lockfile, tuple[BuiltModule, ...]]
|
The lockfile and the root package's checked modules. |
| RAISES | DESCRIPTION |
|---|---|
PackageError
|
If the package has no lockfile, the manifest has moved away
from it ( |
ResolutionError
|
If no build satisfies the requirements. |
ModuleError
|
If a module does not load or resolve. |
CompileError
|
If a module does not compile. |
Source code in src/quivers/packages/workspace.py
InterfaceSymbol
didactic-model
¶
InterfaceSymbol(*, path: str, kind: str, module: str, identity: str, origin: str = '', type: str = '', effects: str = '', support: str = '', index: str = '', body: str = '', fitted: bool = False, display: str = '')
Bases: Model
One thing a dependent of a package can name or rely on.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
How dependents spell it: the exposing module's path, then the name, then (for a site or data parameter) its label.
TYPE:
|
kind |
TYPE:
|
module |
The exposing module.
TYPE:
|
origin |
The declaring module's path and the name there, as name resolution reports it (empty for a site or data parameter).
TYPE:
|
identity |
The rename-stable identity.
TYPE:
|
type |
The digest of its type or shape.
TYPE:
|
effects |
The digest of its effect row (computations).
TYPE:
|
support |
What fixes a site's support: its family, plate, and axes.
TYPE:
|
index |
The digest of a data parameter's index type and axes.
TYPE:
|
body |
The declaration's whole content hash.
TYPE:
|
fitted |
For a program: whether it is fit to data (it observes, or takes data parameters).
TYPE:
|
display |
How messages show it: the declaring line, or a site's family.
TYPE:
|
PackageInterface
didactic-model
¶
PackageInterface(*, package: str, version: Version, symbols: tuple[InterfaceSymbol, ...] = ())
Bases: Model
The semantic interface of one package version.
| ATTRIBUTE | DESCRIPTION |
|---|---|
package |
The package.
TYPE:
|
version |
The version.
TYPE:
|
symbols |
Every symbol, by path.
TYPE:
|
symbol
¶
symbol(path: str) -> InterfaceSymbol | None
The symbol at a path.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
A symbol path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
InterfaceSymbol | None
|
The symbol, or |
Source code in src/quivers/packages/interface.py
to_data
¶
The interface as JSON-compatible data.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
The package, version, and symbols. |
Source code in src/quivers/packages/interface.py
DependencyLens
didactic-model
¶
DependencyLens(*, package: str, old_version: Version, new_version: Version, renames: tuple[Rename, ...] = (), removed: tuple[str, ...] = (), added: tuple[str, ...] = (), old_paths: tuple[str, ...] = (), chain: str = '', morphism: str = '')
Bases: Model
The lens from one version of a package's interface to another.
| ATTRIBUTE | DESCRIPTION |
|---|---|
package |
The package.
TYPE:
|
old_version, new_version |
The versions.
TYPE:
|
renames |
The symbols kept under new paths, by old path.
TYPE:
|
removed |
The old paths with no image.
TYPE:
|
added |
The new paths no old symbol maps to.
TYPE:
|
old_paths |
Every old path.
TYPE:
|
chain |
The residual protolens chain, as panproto's JSON.
TYPE:
|
morphism |
The renaming theory morphism, as panproto's JSON.
TYPE:
|
between
classmethod
¶
between(old: PackageInterface, new: PackageInterface) -> DependencyLens
The lens from an old interface to a new one.
| PARAMETER | DESCRIPTION |
|---|---|
old
|
The interfaces.
TYPE:
|
new
|
The interfaces.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DependencyLens
|
The renames, the residual chain, and the renaming morphism. |
| RAISES | DESCRIPTION |
|---|---|
LensError
|
If panproto cannot derive the residual chain. |
Source code in src/quivers/packages/lenses.py
image
¶
Where an old symbol is in the new interface.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
An old symbol path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str | None
|
Its new path, or |
Source code in src/quivers/packages/lenses.py
is_identity
¶
Whether the lens renames, removes, and adds nothing.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether dependents need no change. |
apply
¶
apply(fleet: Mapping[str, tuple[Use, ...]]) -> tuple[MemberOutcome, ...]
Apply the lens to the usages of every dependent at once.
The residual chain is fused, lifted along the renaming morphism, and applied to each dependent's usage schema; each usage is read through the lens it instantiates, and the places its complement holds are the ones no lens reaches. With no residual change, the morphism alone maps every place.
| PARAMETER | DESCRIPTION |
|---|---|
fleet
|
Each dependent's places, by name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[MemberOutcome, ...]
|
Each dependent's renamed and unmigratable places, by name. |
| RAISES | DESCRIPTION |
|---|---|
LensError
|
If a use names a symbol the old interface does not have. |
Source code in src/quivers/packages/lenses.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
to_json
¶
The lens as the JSON document qvr bump emits.
| RETURNS | DESCRIPTION |
|---|---|
str
|
Canonical JSON. |
from_json
classmethod
¶
from_json(text: str) -> DependencyLens
Read an emitted lens.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
What
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DependencyLens
|
The lens. |
Source code in src/quivers/packages/lenses.py
LensError
¶
Bases: ValueError
A lens that cannot be built or applied.
Its message says what failed.
MemberOutcome
didactic-model
¶
MemberOutcome(*, member: str, renames: tuple[RenamedUse, ...] = (), unmigratable: tuple[Unmigratable, ...] = ())
Bases: Model
What a lens does to one dependent.
| ATTRIBUTE | DESCRIPTION |
|---|---|
member |
The dependent.
TYPE:
|
renames |
Each kept place with its symbol's new path.
TYPE:
|
unmigratable |
Each place no lens reaches.
TYPE:
|
Rename
didactic-model
¶
Bases: Model
A symbol the new interface keeps under another path.
| ATTRIBUTE | DESCRIPTION |
|---|---|
old |
Its old path.
TYPE:
|
new |
Its new path.
TYPE:
|
kind |
Its kind.
TYPE:
|
RenamedUse
didactic-model
¶
RenamedUse(*, use: Use, new: str)
Bases: Model
A kept place and its symbol's new path.
| ATTRIBUTE | DESCRIPTION |
|---|---|
use |
The place.
TYPE:
|
new |
The symbol's path in the new interface.
TYPE:
|
Unmigratable
didactic-model
¶
Unmigratable(*, use: Use, reason: str)
Bases: Model
A place no lens reaches.
| ATTRIBUTE | DESCRIPTION |
|---|---|
use |
The place.
TYPE:
|
reason |
Why: the symbol was removed with no replacement, or the dependent's usage did not satisfy the lens.
TYPE:
|
Use
didactic-model
¶
Bases: Model
One place a dependent names a symbol.
| ATTRIBUTE | DESCRIPTION |
|---|---|
symbol |
The symbol's old path.
TYPE:
|
place |
Where (a key the dependent understands: a byte span of a module, or a site key of a run record).
TYPE:
|
BumpError
¶
Bases: ValueError
A proposed version that understates its interface change.
Its message says the proposed and required versions, and the changes that require more.
InterfaceChange
didactic-model
¶
InterfaceChange(*, level: ChangeLevel, category: ChangeCategory, symbol: str, renamed_to: str = '', detail: str)
Bases: Model
One change between two interfaces.
| ATTRIBUTE | DESCRIPTION |
|---|---|
level |
How much it moves the version.
TYPE:
|
category |
What changed.
TYPE:
|
symbol |
The symbol's old path (its new path for an addition).
TYPE:
|
renamed_to |
For a rename, the new path.
TYPE:
|
detail |
A sentence describing the change.
TYPE:
|
render
¶
InterfaceDiff
didactic-model
¶
InterfaceDiff(*, package: str, old_version: Version, changes: tuple[InterfaceChange, ...] = (), lens: DependencyLens)
Bases: Model
The changes from one version of a package's interface to another.
| ATTRIBUTE | DESCRIPTION |
|---|---|
package |
The package.
TYPE:
|
old_version |
The version compared against.
TYPE:
|
changes |
Every change, by symbol.
TYPE:
|
lens |
The lens dependents migrate along.
TYPE:
|
level
property
¶
level: ChangeLevel
The largest change.
| RETURNS | DESCRIPTION |
|---|---|
ChangeLevel
|
|
required
¶
required() -> Version
The smallest version that publishes the change.
| RETURNS | DESCRIPTION |
|---|---|
Version
|
The old version bumped at the largest change's level. |
check
¶
check(proposed: Version) -> None
Refuse a version that understates the change.
| PARAMETER | DESCRIPTION |
|---|---|
proposed
|
The version to publish.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
BumpError
|
If |
Source code in src/quivers/packages/bump.py
ReleaseError
¶
Bases: ValueError
A release that cannot be made.
Its message says what prevents it.
VersionInterface
didactic-model
¶
VersionInterface(*, interface: PackageInterface, modules: tuple[BuiltModule, ...] = ())
Bases: Model
A package version's interface and the modules it was computed from.
| ATTRIBUTE | DESCRIPTION |
|---|---|
interface |
The interface.
TYPE:
|
modules |
Its exposed modules, checked.
TYPE:
|
DependencyMigration
didactic-model
¶
DependencyMigration(*, lens: DependencyLens, files: tuple[MigratedFile, ...] = (), unmigratable: tuple[SiteReport, ...] = ())
Bases: Model
The outcome of migrating a package's dependents of one dependency.
| ATTRIBUTE | DESCRIPTION |
|---|---|
lens |
The lens applied.
TYPE:
|
files |
Every module and run record that migrated, by path.
TYPE:
|
unmigratable |
Every place no lens reaches, by file and position; a file with such a place is not rewritten.
TYPE:
|
write
¶
Write every migrated file that changed.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
The paths written. |
Source code in src/quivers/packages/migration.py
DependencyMigrationError
¶
Bases: ValueError
A dependency migration that cannot start.
Its message says why.
DependencyMigrator
¶
Migrate one package's modules and run records across a dependency change.
| PARAMETER | DESCRIPTION |
|---|---|
workspace
|
The dependent package.
TYPE:
|
dependency
|
The dependency's name.
TYPE:
|
old
|
The version the package is locked to.
TYPE:
|
new
|
The version its manifest now resolves to.
TYPE:
|
Source code in src/quivers/packages/migration.py
modules
¶
The package's own modules, which the migration covers.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
Their paths. |
migrate
¶
migrate(records: Iterable[Path] = ()) -> DependencyMigration
Migrate every module of the package and the given run records.
| PARAMETER | DESCRIPTION |
|---|---|
records
|
Run records (
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DependencyMigration
|
The migrated texts and every unmigratable place. |
| RAISES | DESCRIPTION |
|---|---|
DependencyMigrationError
|
If the migration cannot start. |
MigrationError
|
If a rewritten module does not parse. |
Source code in src/quivers/packages/migration.py
migrate_record
¶
migrate_record(record: Path, migrated: Mapping[str, str]) -> tuple[MigratedFile | None, tuple[SiteReport, ...]]
Migrate one run record of one of the package's programs.
| PARAMETER | DESCRIPTION |
|---|---|
record
|
The record, as
TYPE:
|
migrated
|
The package's migrated module texts, by path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[MigratedFile | None, tuple[SiteReport, ...]]
|
The migrated record ( |
| RAISES | DESCRIPTION |
|---|---|
DependencyMigrationError
|
If the record is not a run record of one of the package's programs. |
Source code in src/quivers/packages/migration.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
MigratedFile
didactic-model
¶
Bases: Model
One file a dependency migration rewrites.
| ATTRIBUTE | DESCRIPTION |
|---|---|
path |
The file.
TYPE:
|
text |
Its migrated text.
TYPE:
|
changed |
Whether the text differs from the file's.
TYPE:
|
SiteReport
didactic-model
¶
Bases: Model
A place a dependency migration could not migrate.
| ATTRIBUTE | DESCRIPTION |
|---|---|
file |
The module file or run record.
TYPE:
|
line, column |
Where (0 for a run record's site).
TYPE:
|
symbol |
The dependency's symbol the place names.
TYPE:
|
reason |
Why no lens reaches it.
TYPE:
|
render
¶
The report as one diagnostic line.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/packages/migration.py
level_at_least
¶
level_at_least(level: ChangeLevel, floor: ChangeLevel) -> ChangeLevel
The larger of two change levels.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
Two levels.
TYPE:
|
floor
|
Two levels.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChangeLevel
|
The one further along |
Source code in src/quivers/packages/versions.py
parse_requirement
¶
parse_requirement(text: str) -> Version
Read a dependency's version requirement: the minimum version it needs.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
A version such as
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Version
|
The minimum; any later version on its compatibility line satisfies the requirement. |
| RAISES | DESCRIPTION |
|---|---|
VersionError
|
If the text is a range or not a version: minimal version selection reads a requirement as the version the dependent was built against. |
Source code in src/quivers/packages/versions.py
find_package_root
¶
The nearest directory at or above a path that holds a manifest.
| PARAMETER | DESCRIPTION |
|---|---|
start
|
A file or directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path | None
|
The package's directory, or |
Source code in src/quivers/packages/manifest.py
parse_manifest
¶
parse_manifest(text: str, *, where: str = MANIFEST_NAME) -> Manifest
Read a manifest from its text.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The TOML text.
TYPE:
|
where
|
The file name diagnostics name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Manifest
|
The manifest. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the text is not TOML, a key is unknown or mistyped, a name is not a package name, a module is outside the package's namespace, or a dependency names an undeclared index. |
Source code in src/quivers/packages/manifest.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
read_manifest
¶
read_manifest(directory: Path) -> Manifest
Read the manifest of a package directory.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The package's directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Manifest
|
Its manifest. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the directory has no manifest or the manifest is malformed. |
Source code in src/quivers/packages/manifest.py
parse_lockfile
¶
parse_lockfile(text: str, *, where: str = LOCKFILE_NAME) -> Lockfile
Read a lockfile from its text.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The TOML text
TYPE:
|
where
|
The file name diagnostics name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Lockfile
|
The lockfile. |
| RAISES | DESCRIPTION |
|---|---|
LockfileError
|
If the text is not a lockfile of this layout. |
Source code in src/quivers/packages/lockfile.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
read_lockfile
¶
read_lockfile(directory: Path) -> Lockfile | None
The lockfile beside a manifest, if there is one.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The root package's directory.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Lockfile | None
|
The lockfile, or |
| RAISES | DESCRIPTION |
|---|---|
LockfileError
|
If the lockfile exists and is malformed. |
Source code in src/quivers/packages/lockfile.py
render_lockfile
¶
render_lockfile(lock: Lockfile) -> str
The lockfile as TOML text.
| PARAMETER | DESCRIPTION |
|---|---|
lock
|
The lockfile.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Deterministic TOML: the same lockfile always renders to the same bytes. |
Source code in src/quivers/packages/lockfile.py
is_commit
¶
Whether a revision is spelled as a full commit id.
| PARAMETER | DESCRIPTION |
|---|---|
revision
|
A revision.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether it is forty lowercase hexadecimal digits. |
Source code in src/quivers/packages/git.py
run_git
¶
Run one git command and return its standard output.
| PARAMETER | DESCRIPTION |
|---|---|
arguments
|
The arguments after
TYPE:
|
cwd
|
The directory to run in.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes
|
What the command wrote to standard output. |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If git is not installed or the command exits with a failure. |
Source code in src/quivers/packages/git.py
same_repository
¶
Whether two spellings name one repository.
A local repository may be spelled as a path or as a file:// URL;
both name the same directory. Remote URLs are compared as written.
| PARAMETER | DESCRIPTION |
|---|---|
left
|
Two repository spellings.
TYPE:
|
right
|
Two repository spellings.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether they name the same repository. |
Source code in src/quivers/packages/git.py
entry_path
¶
entry_path(name: str, version: Version) -> str
Where an entry lives in an index repository.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The package.
TYPE:
|
version
|
The version.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/packages/index.py
parse_entry
¶
parse_entry(text: str, *, where: str) -> IndexEntry
Read an index entry.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The entry's TOML text.
TYPE:
|
where
|
The index and path diagnostics name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IndexEntry
|
The entry. |
| RAISES | DESCRIPTION |
|---|---|
PackageIndexError
|
If the text is not an index entry. |
Source code in src/quivers/packages/index.py
render_entry
¶
render_entry(entry: IndexEntry) -> str
An index entry as TOML text.
| PARAMETER | DESCRIPTION |
|---|---|
entry
|
The entry.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The file |
Source code in src/quivers/packages/index.py
standard_library
¶
standard_library(root: Path = STANDARD_LIBRARY_ROOT) -> Package
The standard library, the package every package depends on.
Its version is the version of quivers it ships with, and every module
below std/ is exposed.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
The directory its
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Package
|
The package. |
Source code in src/quivers/packages/sources.py
explain_conflict
¶
explain_conflict(left: Requirement, right: Requirement, reason: str, by_node: Mapping[str, Requirement], root: str) -> str
Explain two requirements no single version satisfies.
The explanation derives an incompatibility from the two requirements and lifts it, one dependency edge at a time, until both sides are the root, as PubGrub reports a failure.
| PARAMETER | DESCRIPTION |
|---|---|
left
|
The conflicting requirements.
TYPE:
|
right
|
The conflicting requirements.
TYPE:
|
reason
|
Why no version satisfies both.
TYPE:
|
by_node
|
The requirement that first reached each visited node.
TYPE:
|
root
|
The root package's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The explanation, one step per line. |
Source code in src/quivers/packages/resolve.py
explain_missing
¶
explain_missing(requirement: Requirement, reason: str, by_node: Mapping[str, Requirement], root: str) -> str
Explain a requirement nothing satisfies.
| PARAMETER | DESCRIPTION |
|---|---|
requirement
|
The requirement.
TYPE:
|
reason
|
Why nothing satisfies it.
TYPE:
|
by_node
|
The requirement that first reached each visited node.
TYPE:
|
root
|
The root package's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The explanation, one step per line. |
Source code in src/quivers/packages/resolve.py
load_package_file
¶
load_package_file(file: str | Path, *, links: Mapping[str, str] | None = None) -> ModuleGraph | None
The module graph rooted at a file, read in its package's build.
| PARAMETER | DESCRIPTION |
|---|---|
file
|
The root module's file.
TYPE:
|
links
|
Links beyond the build's (an experiment's), which win.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModuleGraph | None
|
The checked graph, or |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the package's manifest is malformed. |
PackageError
|
If an import or link crosses a package boundary the rules forbid, or the lockfile does not match the packages. |
ModuleError
|
If the graph does not load or resolve. |
Source code in src/quivers/packages/workspace.py
module_core_hash
¶
module_core_hash(module: QiecModule | None) -> str
The hash of a root module's own checked declarations.
The root's declarations are the ones with bare names in its flat program; each enters by its declaration kind and content hash, so renaming, reformatting, and comments leave the hash unchanged.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked core of a flat program;
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The digest. |
Source code in src/quivers/packages/workspace.py
package_build
¶
package_build(workspace: Workspace) -> Resolution
The build a package's modules are read in.
| PARAMETER | DESCRIPTION |
|---|---|
workspace
|
The package's workspace.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Resolution
|
The build its |
| RAISES | DESCRIPTION |
|---|---|
LockfileError
|
If the lockfile is malformed. |
PackageError
|
If a locked package no longer has the version the lockfile records. |
ResolutionError
|
If no build satisfies the manifest's requirements. |
Source code in src/quivers/packages/workspace.py
package_module_of
¶
package_module_of(file: str | Path) -> tuple[Workspace, str] | None
The package a module file belongs to, and the file's module path.
A .qvr file is a module of a package when the nearest qvr.toml
at or above it declares a package whose namespace holds the file below
the package's module root: coins/model.qvr below a package named
coins whose source is . is the module coins.model.
| PARAMETER | DESCRIPTION |
|---|---|
file
|
The file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Workspace, str] | None
|
The package's workspace and the module path, or |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the nearest manifest is malformed. |
Source code in src/quivers/packages/workspace.py
package_interface
¶
package_interface(package: str, version: Version, modules: Iterable[BuiltModule]) -> PackageInterface
The semantic interface of a package's exposed modules.
| PARAMETER | DESCRIPTION |
|---|---|
package
|
The package's name.
TYPE:
|
version
|
Its version.
TYPE:
|
modules
|
Its exposed modules, checked.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PackageInterface
|
Every symbol of every module, by path. |
Source code in src/quivers/packages/interface.py
inventory_schema
¶
inventory_schema(interface: PackageInterface) -> Schema
The inventory of an interface: one vertex per symbol.
| PARAMETER | DESCRIPTION |
|---|---|
interface
|
The interface.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Schema
|
A |
Source code in src/quivers/packages/lenses.py
diff_interfaces
¶
diff_interfaces(old: PackageInterface, new: PackageInterface) -> InterfaceDiff
Classify every change from one interface to another.
| PARAMETER | DESCRIPTION |
|---|---|
old
|
The interface compared against.
TYPE:
|
new
|
The new interface.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
InterfaceDiff
|
The changes and the lens dependents migrate along. |
| RAISES | DESCRIPTION |
|---|---|
LensError
|
If panproto cannot derive the lens. |
Source code in src/quivers/packages/bump.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
lens_file
¶
The file name a lens between two versions is emitted under.
| PARAMETER | DESCRIPTION |
|---|---|
package
|
The package.
TYPE:
|
old
|
The versions.
TYPE:
|
new
|
The versions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/packages/release.py
package_version_interface
¶
package_version_interface(directory: Path, cache: GitCache) -> VersionInterface
Check a package's exposed modules and compute its interface.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The package's directory.
TYPE:
|
cache
|
The cache its git and indexed dependencies are read through.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
VersionInterface
|
The interface and the checked modules. |
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the manifest is malformed. |
ResolutionError
|
If its dependencies do not resolve. |
PackageError
|
If a module violates a package rule. |
ModuleError
|
If a module does not load or resolve. |
CompileError
|
If a module does not compile. |
Source code in src/quivers/packages/release.py
previous_version
¶
previous_version(directory: Path, against: str, cache: GitCache) -> Path
The directory of the package version to compare against.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The package's current directory.
TYPE:
|
against
|
A directory holding the previous version, or a git revision (a tag
such as
TYPE:
|
cache
|
Where a revision is extracted.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
The previous version's package directory. |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If |
ReleaseError
|
If the revision has no manifest at the package's place. |
Source code in src/quivers/packages/release.py
publish
¶
publish(index_checkout: Path, url: str, revision: str, cache: GitCache) -> IndexEntry
Add a package version to an index.
The version is read from a commit of its repository, so what is published is exactly what dependents will fetch. Its modules are checked and pinned; its interface is compared with the newest version the index lists, and a version that understates the change, or that the index already lists, is refused. The entry is written into the index checkout and committed there; pushing it is left to the caller.
| PARAMETER | DESCRIPTION |
|---|---|
index_checkout
|
A git working tree of the index repository.
TYPE:
|
url
|
The package's repository.
TYPE:
|
revision
|
The commit, tag, or branch to publish.
TYPE:
|
cache
|
The project cache.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IndexEntry
|
The published entry. |
| RAISES | DESCRIPTION |
|---|---|
ReleaseError
|
If the package depends on anything but packages of this index, or the version is already published. |
BumpError
|
If the version understates its change. |
GitError
|
If a repository cannot be read or the commit cannot be made. |
Source code in src/quivers/packages/release.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |
read_emitted_lens
¶
read_emitted_lens(directory: Path, package: str, old: Version, new: Version) -> DependencyLens | None
The lens a package version emitted for its move from an older one.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The new version's package directory.
TYPE:
|
package
|
The package.
TYPE:
|
old
|
The versions.
TYPE:
|
new
|
The versions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DependencyLens | None
|
The emitted lens, or |
Source code in src/quivers/packages/release.py
repository_of
¶
The git repository holding a directory, and the directory's place in it.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
A directory inside a git working tree.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Path, str]
|
The working tree's top and the directory relative to it (POSIX). |
| RAISES | DESCRIPTION |
|---|---|
GitError
|
If the directory is in no git working tree. |
Source code in src/quivers/packages/release.py
set_manifest_version
¶
set_manifest_version(directory: Path, version: Version) -> None
Rewrite the version in a manifest, leaving the rest of it as written.
| PARAMETER | DESCRIPTION |
|---|---|
directory
|
The package's directory.
TYPE:
|
version
|
The new version.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ManifestError
|
If the manifest has no version line in its [package] table. |
Source code in src/quivers/packages/release.py
file_resolutions
¶
file_resolutions(graph: ModuleGraph) -> tuple[Resolution, ...]
Every name resolution of a graph's root file, module bodies included.
| PARAMETER | DESCRIPTION |
|---|---|
graph
|
A graph rooted at a file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Resolution, ...]
|
The root module's resolutions, then those of the modules, signatures, and templates declared in it. |