spicekit
spicekit is an independent, pure-Rust reader for the SPICE kernel formats
(DAF containers, SPK ephemeris files, binary PCK rotation files, and the
supported text-kernel subset used for body-name bindings, leapseconds,
and the Earth→ITRF93 frame association). It is not affiliated
with or endorsed by NAIF/JPL, and it is not a port of the CSpice
toolkit — all executable logic is an independent implementation
written from the published NAIF file-format specifications, with no
CSpice linkage and no translated CSpice source. The only CSpice-derived
artifact shipped in this crate is the 692-entry body-name table in
src/naif_builtin_table.rs, which is reproduced under NAIF's
distribution terms (see LICENSE-NOTICES).
Install
Rust
[]
= "0.2"
Python
Scope
spicekit implements a focused, embeddable subset of SPICE kernel I/O
and frame evaluation:
- DAF: memory-mapped container parser (shared by SPK and PCK)
- SPK: reader for Types 2, 3, 9, 13; writer for Types 3 and 9
- PCK: binary PCK reader producing J2000↔ITRF93 rotations and their time derivatives at machine precision
- Text kernels: parser for
NAIF_BODY_NAME/NAIF_BODY_CODEpaired arrays (custom name ↔ code bindings used by mission kernels), leapseconds-kernelDELTET/*values fromKPL/LSK, and the narrowOBJECT_EARTH_FRAME = 'ITRF93'FK association used with binary Earth PCKs. Other text-kernel assignments are skipped by the parser on a best-effort basis; furnsh-style loaders should reject otherwise-empty unsupported text kernels instead of silently dropping them. - Built-in NAIF body table: the 692-entry name ↔ ID map mirrored from
CSpice's
zzidmap.c, with case-insensitive whitespace-tolerant matching.
Non-goals
- No async I/O — sync memory-mapped reads only.
- No CSpice linkage and no FFI in the base crate. CSpice parity is
verified in the sibling
spicekit-benchcrate, which linkscspice-sysbehind a feature flag and compares every code path against CSpice at machine-epsilon tolerance. - No CLI tool.
- PCK support is read-only.
Python bindings
Python bindings are provided by the spicekit-py crate in this
workspace (shipped to PyPI as the spicekit package). Build and install
with maturin:
Then:
=
Parity testing and benchmarks
spicekit-bench keeps an FFI-based CSpice reference installation and
asserts that every spicekit numeric path and supported text-kernel
semantic matches CSpice at a science-grade tolerance. It also runs
side-by-side latency microbenchmarks on matched inputs; the latest
numbers (regenerated by CI on every push to main) live in
BENCHMARKS.md.
The base crate's MSRV is the workspace rust-version; local
--features cspice runs may require a newer stable toolchain because
transitive cspice-sys build dependencies can outpace the base MSRV, so
use cargo +stable ... --features cspice when needed.
See each module's rustdoc for details.
License and attribution
Licensed under the MIT License.
The file src/naif_builtin_table.rs contains data extracted from the
NAIF CSpice toolkit (specifically, the NPERM table in zzidmap.c). The
NAIF toolkit is distributed by the Jet Propulsion Laboratory under terms
that permit redistribution with attribution — see LICENSE-NOTICES for
the full attribution and the relevant NAIF distribution-terms excerpt.
Test layers
spicekit's own test suite verifies internal correctness (DAF round-trip,
Chebyshev polynomial exactness on coefficient tables, Lagrange exactness
at knot points, text-kernel parsing for body bindings, LSK DELTET/*,
and the Earth→ITRF93 FK association, etc.). CSpice-parity testing —
confirming that spicekit's numeric output and supported text-kernel
semantics match CSpice at a science-grade tolerance — lives in
crates/spicekit-bench, which links the CSpice toolkit and asserts
parity on every code path.