Skip to content

v0.30.0

Choose a tag to compare

@michaelaye michaelaye released this 23 Nov 20:50
· 8 commits to main since this release

0.30 cleaned up the command line. Renamed verbs (list → show, metakernels/mk → ls, resolve/aliases → which, duplicates → stats, verify → check, prune → clean; the old names still run with a note until 1.0), update walks every tracked metakernel and downloads only with --execute, a kernel_dirs list in the config (one root is the normal case) with no configured download target, exit codes a script can read (check bits 1/2/4, untracked 1, ambiguous 2, broken config 78), a quiet library with spice_kernel_db.__all__ as its public API, and docs generated from the code. The README on GitHub carries the same note.

The version jumps from 0.22.3 to 0.30.0 to mark the CLI redesign: there are
no 0.23 to 0.29 releases. Everything below landed between 2026-11-19 and
2026-11-23 from the CLI review (#41, #43, #45 to #49, #53, #55).

Changed

  • The documentation is built with great-docs (#53). The API reference is
    generated from the docstrings of the public names (great-docs.yml
    reference:, kept equal to spice_kernel_db.__all__ by a test); the
    hand-written api.qmd is gone and what it said now lives in those
    docstrings. The guides (motivation, design, usage, CLI, coverage, tutorial,
    troubleshooting) are unchanged in content, and make docs / make serve
    build and preview the site.

Added

  • A quiet library and a declared public API (#49, closes #6). Nothing
    under spice_kernel_db prints unless it is handed a rich.console.Console:
    KernelDB(console=...) is where tables, notes, progress bars and the
    download question go, and without one (the default) get_metakernel
    answers its own question with no and reports aborted. The CLI passes its
    console. Warnings go through the spice_kernel_db logger, which the CLI
    routes to stderr (INFO under --verbose). spice_kernel_db.__all__ is
    the public API, listed in docs/index.qmd § Public API and held stable
    within a major version, with module-level get, check, scan,
    register_metakernel, resolve_metakernel and metakernels_covering
    that open the configured database per call. config.py neither prints
    nor prompts: a corrupt file raises ConfigError (the CLI prints the message
    and exits 78, the configuration-error code, instead of falling back to
    setup, which would have overwritten the file), ensure_config() with no file
    and no seed_root raises it too, and the first-run questions live in the
    CLI. fetch_metakernel, list_remote_metakernels and
    resolve_kernel_urls are no longer exported from the package (they stay
    in spice_kernel_db.remote). For a program that mounts the command tree
    under its own CLI, spice_kernel_db.cli.app,
    spice_kernel_db.cli.exit_code(exc) and
    spice_kernel_db.cli.logging_to_stderr() are the host contract
    (planetarypy's plp spice).

  • check answers three questions, each with its own exit bit (#46).
    present (every listed kernel on disk, bit 1), resolves (every entry
    resolves through PATH_VALUES to the file the database knows, bit 2) and
    matches remote (sizes, with --hash also SHA-256, against the server,
    bit 4, only with --remote). The exit code is the sum, so a script can
    tell a missing kernel from a corrupt one, and the output never collapses
    into one tick. --json emits the verdicts and their evidence.

  • doctor reports database health with no metakernel argument: poisoned
    supersession rows, kernel locations whose file is gone, tracked metakernels
    whose file is gone, and the table counts. It exits 1 only on poisoned rows
    (#46).

  • One resolver for every metakernel argument (#45). KernelDB.resolve_metakernel()
    turns a path, a registry filename, a versionless base name (with or without
    .tm) or the source URL into the tracked file, case-insensitively, and every
    command (check, list, verify, coverage, update, rewrite,
    metakernels, resolve --metakernel) goes through it. A name that matches
    nothing exits 1 with the get hint; a name that matches several tracked
    metakernels raises the new AmbiguousMetakernel, and the CLI lists them and
    exits 2. The first match is never picked silently. rewrite now accepts the
    same forms and offers the picker when the argument is omitted.

  • Pickers know whether they have a terminal (#45). With no argument at a
    terminal every picker behaves as before. In a script, a notebook or a pipe
    (stdin not a terminal) the candidates are printed on stderr and the command
    exits 2 instead of blocking on input; stdout stays clean for the caller.

  • Poisoned supersession rows are reported (#31). #29 made the state
    repairable but nothing said it existed: a user saw the same kernels
    re-download on every update with no hint why. KernelDB.poisoned_superseded()
    lists kernels present on disk yet flagged as superseded by content that
    exists in no location. check names them and exits 1 when any are found;
    stats shows the count, highlighted when non-zero. Both point at
    scan <kernel_dir> as the repair.

  • import <mk-file> tracks a metakernel that is already on disk (#47).
    It indexes the entries, registers the kernels the file resolves to that
    exist on disk, and adds the registry row with no source URL. It makes no
    network request. --mission overrides the mission guessed from the path.
    The Python entry point is KernelDB.import_metakernel().

  • update walks every tracked metakernel (#47). It re-fetches each one
    from its source and shows what is missing. It is a dry run by default;
    --execute downloads and is the confirmation, so there is no
    per-metakernel prompt. Alias rows (symlinks) are skipped. A source that
    answers 403, 404 or 410, or one that cannot be reached, is noted in the
    summary table and the walk goes on. The Python entry point is
    KernelDB.update_all(); get_metakernel() and update_metakernel() gained
    a dry_run parameter for it.

  • clean removes what points at nothing, in three named classes (#47):
    --locations (kernel locations whose file is gone, then kernel rows left
    with no location), --symlinks (dangling symlinks under each mission's
    download tree) and --registry (tracked metakernels whose source URL
    answers 403, 404 or 410, the only class that contacts the server;
    --delete-files also unlinks the .tm). Dry run by default, --execute
    removes. With no class flag the two local classes run, so a plain clean
    now also sweeps dangling symlinks.

  • get <name> re-fetches a tracked metakernel (#47). When the argument
    names a tracked metakernel, get fetches it from its stored source URL,
    downloads what is missing and re-indexes, which is what update <name> did.
    A filename that is not tracked is still looked up on the configured mission's
    server.

  • Several kernel roots (#48). [storage] in config.toml now holds
    kernel_dirs, a list in which no root is special. Every root is scanned,
    resolved against (which, check) and deduplicated across, so dedup
    links a kernel in one root to its identical twin in another. A file with only kernel_dir loads as
    a one-root list and is rewritten as kernel_dirs on the next save.

  • config add-root <dir> and config remove-root <dir> edit the list
    (#48). add-root creates the directory and does not add a root twice;
    remove-root refuses the last root and leaves files and database rows alone.
    skd config lists the roots.

  • scan takes an optional directory (#48). With none it scans every
    configured kernel root.

  • Where a download lands is derived, never configured. get re-fetches
    a tracked metakernel into the root that holds it, puts a new metakernel
    into the one root that already holds its mission, and with one root uses
    that root. Only when several roots could take a new mission does it list
    them and ask at a terminal (exit 2 in a script); --download-dir names
    the root explicitly. scan --archive moves each file into its own root or
    its mission's root, settling every file before anything moves. update
    (the all-metakernels walk) and update_all() lose --download-dir, which
    would have forced metakernels from every root into one directory.
    KernelDB.root_for(mission, mk_path) is the one resolver and
    AmbiguousKernelRoot the exception. Before this, the first configured
    root was a "download target", which would have written a re-fetched
    second-root metakernel into the first root.

  • import --unofficial and the official column (#48). A metakernel
    assembled locally, such as a subsetter's output or planetarypy's
    archived_kernels.py, can be marked as not published by an archive.
    metakernel_registry gains official BOOLEAN DEFAULT TRUE, added when an
    older database is first opened for writing; opened read-only before that
    (ls, show, doctor, check), every row reads as official. ls appends unofficial to the name and show
    prints Official: no. RegistryRow, list_metakernels() and
    info_metakernel() carry official, and
    import_metakernel(path, mission=None, official=True) sets it.

  • Python functions for the roots (#48): kernel_roots(),
    add_root(dir) and remove_root(dir), exported from the
    package, and ensure_config(seed_root=...), which writes a first
    configuration with that root instead of prompting. An existing configuration
    is never changed by the seed. Config(db_path, kernel_dirs) holds the
    list; the single-root kernel_dir parameter and property are gone.
    KernelDB(kernel_roots=...) and db.kernel_roots carry the roots used to
    guess a mission, and db.scan_roots() scans every one.

Changed

  • verify folded into check (#46). verify stays as a hidden alias
    (--deep is --hash, --strict is ignored with a note) and its --json
    document now has the three-verdict shape. check --full is gone; the
    server comparison is check --remote, and --hash no longer needs it. The
    poisoned-row report moved from check to doctor, so check exits 1 for
    a missing kernel and nothing else. KernelDB.check_metakernel() prints
    nothing and no longer contacts the server; the newer-version notice is part
    of --remote, and KernelDB.check_report() returns the three verdicts as
    data.

  • KernelDB.info_metakernel() and update_metakernel() raise MetakernelNotTracked
    for an unknown name instead of printing "not found" or raising a bare
    LookupError; the CLI maps that to exit 1 in one place (#45).

  • mk --remove no longer matches a bare prefix; it takes the same forms as
    every other command, so a prefix matching several rows is reported instead of
    removing the first one (#45).

  • skd --version and --help start faster (#26). requests, duckdb,
    importlib.metadata and Typer's rich error formatter are now imported
    where they are used instead of at module level, so invocations that open
    no database and touch no network no longer pay for them. On the
    reference machine --version went from 184 ms to 123 ms and --help
    from 187 ms to 141 ms. spice_kernel_db.__version__ is resolved on
    first access; everything else in the public API is unchanged.

  • The verbs were renamed and regrouped (#47). --help now shows four
    panels in order: acquire (browse, get, update), inspect (ls, show,
    which, coverage, stats, check, doctor), maintain (scan,
    import, rewrite, rm, clean, dedup, reset) and configure
    (mission, config). browse, coverage, rewrite, dedup, mission
    and config keep their names.

    • metakernels and mk became ls [mission], the listing of tracked
      metakernels. The --mission option is now the optional argument.
    • list and metakernels <name> became show <mk>: the registry row
      (mission, source, acquired, local path) plus the kernels with type, size
      and status. --type filters the table. On a .tm that is not tracked it
      lists the kernels and says skd import tracks it.
    • resolve and aliases became which <kernel>. The first line is the
      local path. When the content is known under several filenames, the alias
      table and the on-disk locations follow. It accepts a filename or a SHA-256
      prefix. --metakernel <mk> resolves every kernel of a metakernel. With no
      argument at a terminal it offers a picker over the deduplicated kernels.
    • duplicates was folded into stats: the database statistics come
      first, then the duplicate kernels section.
    • metakernels --remove became rm <mk>. It removes the registry row
      and its entries; the file stays. With no argument at a terminal it offers
      a picker.
    • prune became clean with the classes named --locations,
      --symlinks (was --orphan-symlinks) and --registry (was
      --metakernels). The three classes can now be combined in one run.
    • update <name> became get <name>, and update with no argument
      became the walk over all tracked metakernels, a dry run unless
      --execute is given. update with an argument prints
      note: 'update <name>' is now 'get <name>' and runs get.
    • reset moved from the configure panel to the maintain panel. The
      command is unchanged.
    • scan never prompts (#47). A mission that is not configured and has
      no .spice-server marker no longer starts a setup dialog. scan prints
      the skd mission add <NAME> --server-url <URL> command instead, so it is
      safe in a script.
    • KernelDB.info_metakernel() takes kernel_type=None to limit the
      printed kernel table to one type (#47).

Deprecated

  • The old verb names remain as hidden aliases and are removed in 1.0
    (#47). Each prints note: 'old' is now 'new' on stderr, then runs the new
    command with the new command's options: list is show; metakernels
    and mk are ls, and with a name show, and with --remove rm;
    resolve and aliases are which; duplicates is stats; prune is
    clean (--metakernels and --mk are --registry, --orphan-symlinks
    is --symlinks, and a plain prune keeps its old meaning of locations
    only); verify is check (--deep is --hash); update <name> is
    get <name>.

Fixed

  • A re-scan of a directory holding a metakernel that get had fetched
    replaced its registry row, dropping the source URL and the acquisition
    time, so a later update reported it as added by scan with no source. A
    scan now writes a registry row only for a metakernel it sees for the first
    time; get and import still replace the row (found while removing the
    download target, 2026-11-21).

  • A tracked metakernel's mission comes from the registry, and guess_mission
    knows the kernel roots
    (#43, #48). A metakernel in the default store
    (~/.local/share/spice-kernel-db/kernels/JUICE/mk/x.tm) got the mission
    SPICE-KERNEL-DB, the directory that holds the store, and check then
    reported Cross-mission: 102 kernels. check, rewrite, coverage and the
    server comparison now read a tracked metakernel's mission from its registry
    row. guess_mission(filepath, roots=None) takes the first directory below a
    configured root as the mission, classifies a file under a root but in no
    mission directory from its filename alone, and applies the old heuristic only
    outside every root. scan and import pass the configured roots. A scan
    that meets an already tracked metakernel keeps the mission and official
    flag of its row; get and import state them.

  • doctor lists a path registered under more than one hash, and scan
    repairs it
    (#48). One file could carry two locations rows, such as a
    0-byte row from an interrupted download beside the real one, and check
    then reported SIZE_MISMATCH against the wrong row (!= expected 0).
    KernelDB.doctor() returns the paths as conflicting_locations and the CLI
    prints them; the exit code is unchanged. register_file used to supersede
    one stale row at a path. It now supersedes all of them, so a scan of the
    directory keeps the row that matches the file on disk.

  • check no longer reports AMBIGUOUS for a registered path whose filename
    exists elsewhere with other content
    (#48). When an entry resolves to a path
    (or to the file its symlink leads to) that is a registered location, that
    row's size and hash are the expectation. Only an unregistered path falls back
    to the filename, where several active kernels rows are still AMBIGUOUS.
    Three different naif0012.tls across two stores no longer fail the check.

  • verify and list crashed on a registry filename that check accepted
    (#41). Both handed the bare name to the parser and died with
    FileNotFoundError; they now resolve it like check does.

  • get -v no longer crashes (#39). The verbose "Resolved URLs" listing
    in get_metakernel() read a name that did not exist, so every verbose
    get ended in a NameError after the kernel table. Found by ruff's
    undefined-name check; a test now exercises the branch.

  • Broad except Exception handlers no longer hide defects (#33). 21
    handlers caught everything and reported something plausible; one had
    already turned a TypeError in verify_against_server() into "could not
    fetch". Each now names what the call site raises: duckdb.IOException for
    the connect retry, duckdb.CatalogException for the startup
    case-duplicate check, OSError / http.client.HTTPException on network
    paths, requests.RequestException for the size HEAD, SpiceyError around
    spiceypy. Two dead except Exception: raise lines are gone. The four that
    stay broad (two atomic-write cleanups, two transaction rollbacks) all
    re-raise and say so in a comment.

    Narrowing exposed what the issue predicted: 25 unit tests had been
    reaching the real network through the size lookup and check's
    staleness probe, and the offline guard's exception was being swallowed.
    Those tests now mock both, the remote_sizes fixture patches the binding
    db.py actually uses, and the guard exception is a BaseException so no
    handler can hide it again.

  • The test suite can no longer overwrite the user's config.toml (#28).
    test_config_set kept the real save_config away only by patching it by
    name; when the Typer port moved the import site the patch missed and
    ~/.config/spice-kernel-db/config.toml was replaced with a test's tmp
    paths, breaking every later skd call. An autouse fixture now points
    HOME, CONFIG_DIR and CONFIG_FILE at an empty directory for every
    test, and a session guard fails the run if the real config changed anyway.