Skip to main content

get()

skd get: fetch a metakernel by URL, or re-fetch a tracked one by name.

Usage

Source

get(
    ref,
    *,
    mission=None,
    yes=False,
    download_dir=None,
    force=False,
    console=None
)

Opens the database named in the config, does one thing and closes it. For several operations in a row keep a KernelDB. A ref that starts with http:// or https:// is fetched with KernelDB.get_metakernel. Any other ref names a tracked metakernel and is re-fetched from its stored source with KernelDB.update_metakernel.

Without yes=True and without a console to ask on, nothing is downloaded and the result carries aborted: True. A name that is not tracked raises MetakernelNotTracked. Looking it up on the mission’s server is the CLI’s job (skd get <name> does that, with a picker).

Parameters

ref: str

A URL, or any reference to a tracked metakernel.

mission: str | None = None

Override the mission name.

yes: bool = False

Download without asking.

download_dir: str | Path | None = None

The kernel root to download into. By default KernelDB.root_for decides.

force: bool = False

Download everything again.

console: rich.console.Console | None = None
Where the status table and the download question go. Without one nothing is printed and the question is answered no.

Returns

dict
The dict KernelDB.get_metakernel returns, with the keys found, missing, downloaded and warnings, and aborted: True when nothing was downloaded because nobody was asked or the answer was no. A re-fetch by name also has scan_dirs.

Raises

MetakernelNotTracked

ref is not a URL and matches nothing tracked.

AmbiguousMetakernel

ref matches several registry rows.

AmbiguousKernelRoot

Several roots are configured, download_dir is not given and root_for cannot choose.

MetakernelUnreachableError
A re-fetch by name finds the source gone from the server (HTTP 403, 404 or 410).