Skip to main content

spice-kernel-db

CI

Browse, get, and manage SPICE kernels and metakernels across NASA and ESA mission archives.

⚠️ 0.30 cleaned up the command line. If you used spice-kernel-db before 0.30, these are the changes you will meet (the version jumped from 0.22 to mark them):

  • Verbs were renamed: list → show, metakernels/mk → ls, resolve and aliases → which, duplicates → stats, verify → check, prune → clean. The old names still run, print a one-line note, and go away in 1.0.
  • update walks every tracked metakernel and reports; it downloads only with --execute. get <name> re-fetches one.
  • Kernel roots: the config key is kernel_dirs = [...]; one entry is the normal case, more are allowed (config add-root), and a file with the old kernel_dir still loads. Where a download lands is derived from what is already on disk; there is no download target to configure.
  • Scripts can read the exit code: check returns a sum of bits (1 a kernel missing, 2 an entry does not resolve, 4 differs from the server), an untracked name is 1, an ambiguous name or root is 2, a broken config file is 78; a missing argument shows a picker at a terminal and exits 2 without one.
  • The library is quiet and spice_kernel_db.__all__ is its public API: KernelDB(console=None) prints nothing and downloads only with yes=True.

The CHANGELOG has the full list; the docs are now generated from the code.

⚠️ CRITICAL: Update to v0.10.0 or later. Versions before 0.10.0 contained a fuzzy filename matching bug that could silently create symlinks between completely different SPICE kernel files, causing silent scientific data corruption — SPICE loads valid but wrong data with no errors. All users who used spice-kernel-db get or spice-kernel-db update are affected, regardless of the dedup setting — the symlink creation code did not honor the per-mission dedup flag (also fixed in 0.10.0). Users who only used scan and single-kernel lookup (which today) are not affected. After updating, remove all symlinks in your kernel directories and re-run spice-kernel-db update --execute. See CHANGELOG.md for recovery steps.

What this tool does

  1. Mission setup: Configure missions from NASA NAIF or ESA SPICE servers with an interactive dialog.

  2. Browse & get: Browse available metakernels for a mission, then get one — the tool downloads all missing kernels automatically and makes the metakernel ready to use locally.

  3. Metakernel rewriting: Rewrites .tm files for local use with minimal edits — only PATH_VALUES is changed, everything else stays identical to the original. A symlink tree bridges the gap between where the metakernel expects files and where they actually live on disk.

  4. Deduplication (optional): Identifies identical kernel files across missions using SHA-256 hashing and replaces duplicates with symlinks. Per-mission opt-in — you can deduplicate some missions while keeping others untouched.

Documentation

Full documentation is at michaelaye.github.io/spice-kernel-db: a user guide (usage, CLI, coverage, troubleshooting, a tutorial) and an API reference generated from the docstrings with great-docs. The site also publishes llms.txt and an agent skill for AI assistants.

Installation

pip install spice-kernel-db

Or with conda:

conda install -c michaelaye spice-kernel-db

Or from source:

git clone https://github.com/michaelaye/spice-kernel-db
cd spice-kernel-db
pip install -e ".[dev]"

Quick start

Set up a mission

spice-kernel-db mission add

Interactive dialog: choose a server (NASA NAIF / ESA SPICE) → pick a mission from the list → configure deduplication preference.

Browse available metakernels

spice-kernel-db browse JUICE

Shows all .tm files in the mission's remote mk/ directory, grouped by base name with version counts. This works on a fresh install too: a mission that is not configured yet is looked up on NAIF and ESA and added (ESA when both list it), so mission add is only needed to choose a server yourself.

Get a metakernel

spice-kernel-db get juice_ops.tm

Downloads the metakernel, checks which kernels you already have, downloads the missing ones in parallel, and creates symlinks so the .tm file works immediately.

Use with spiceypy

import spiceypy as spice
from spice_kernel_db import resolve_metakernel

spice.furnsh(str(resolve_metakernel("juice_ops")))

skd manages the kernel files and loads nothing; resolve_metakernel turns a tracked name (filename, base name, path or URL) into the path to hand to furnsh.

Python API

The library is quiet: nothing prints unless you hand it a console, and a download happens only with yes=True. spice_kernel_db.__all__ is the public API, documented in the reference.

from spice_kernel_db import KernelDB, check, get, resolve_metakernel

# One call against the configured database
get("https://naif.jpl.nasa.gov/pub/naif/JUICE/kernels/mk/juice_ops.tm", yes=True)
report = check("juice_ops")          # verdicts and evidence; exit_code is a sum of bits
path = resolve_metakernel("juice_ops")

# Several operations in a row: keep a KernelDB; a console makes it print like the CLI
from rich.console import Console

with KernelDB(console=Console()) as db:
    db.browse_remote_metakernels(
        "https://naif.jpl.nasa.gov/pub/naif/JUICE/kernels/mk/", mission="JUICE",
    )
    db.deduplicate_with_symlinks(dry_run=True)   # preview
    db.deduplicate_with_symlinks(dry_run=False)  # execute

Supported servers

Server URL
NASA NAIF https://naif.jpl.nasa.gov/pub/naif/
ESA SPICE https://spiftp.esac.esa.int/data/SPICE/

Both use the same <server>/<MISSION>/kernels/mk/ directory structure.

Dependencies

License

MIT

Metadata

Release files for spice-kernel-db 0.31.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spice-kernel-db 0.31.0
File Size Uploaded Provenance Actions
spice_kernel_db-0.31.0.tar.gz 276.1 kB Without provenance Details for spice_kernel_db-0.31.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spice-kernel-db 0.31.0
File Interpreter ABI Platform Actions
spice_kernel_db-0.31.0-py3-none-any.whl Python 3 none any Details for spice_kernel_db-0.31.0-py3-none-any.whl

Total release size: 399.5 kB

Release files / spice_kernel_db-0.31.0.tar.gz

Download URL spice_kernel_db-0.31.0.tar.gz
Size 276.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b9dfd9cd6319a14de408fc9bcfbc652a3f5c6db0c26c55e8354aaeeabcec9400
BLAKE2b-256 checksum
How to use checksums
f44051ee5cc66f82be978777fdef8f205b76c64cf51a5ded97fbb7bc0dfeca99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / spice_kernel_db-0.31.0-py3-none-any.whl

Download URL spice_kernel_db-0.31.0-py3-none-any.whl
Size 123.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9833c67c94bc16f55cfa426cfe5426d48fecd58d7c987f3490e2c3332dc66c6d
BLAKE2b-256 checksum
How to use checksums
43f0fae52a5cf0fe325ca8733a024702475a6af2dfb03a6946804c4338bf46c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for spice-kernel-db 0.31.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.31.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page