spice-kernel-db 0.20.1__tar.gz → 0.22.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/.github/workflows/ci.yml +2 -2
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/.github/workflows/publish.yml +3 -3
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/.gitignore +1 -0
- spice_kernel_db-0.22.2/.zenodo.json +33 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/CHANGELOG.md +180 -0
- spice_kernel_db-0.22.2/CITATION.cff +26 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/CLAUDE.md +1 -1
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/PKG-INFO +3 -2
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/conda/meta.yaml +3 -2
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/api.qmd +6 -2
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/cli.qmd +5 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/troubleshooting.qmd +7 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/pyproject.toml +3 -2
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/__init__.py +2 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/__init__.py +118 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/_app.py +77 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/browse.py +261 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/configure.py +409 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/inspect_cmds.py +497 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/prompts.py +386 -0
- spice_kernel_db-0.22.2/src/spice_kernel_db/cli/transform.py +176 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/config.py +19 -16
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/db.py +262 -3
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/remote.py +97 -27
- spice_kernel_db-0.22.2/tests/_netguard.py +9 -0
- spice_kernel_db-0.22.2/tests/conftest.py +277 -0
- spice_kernel_db-0.22.2/tests/helpers.py +100 -0
- spice_kernel_db-0.22.2/tests/test_cli.py +1078 -0
- spice_kernel_db-0.22.2/tests/test_db.py +1109 -0
- spice_kernel_db-0.22.2/tests/test_metakernel.py +1700 -0
- spice_kernel_db-0.22.2/tests/test_network.py +154 -0
- spice_kernel_db-0.22.2/tests/test_regressions.py +1623 -0
- spice_kernel_db-0.22.2/tests/test_remote.py +666 -0
- spice_kernel_db-0.20.1/src/spice_kernel_db/cli.py +0 -1854
- spice_kernel_db-0.20.1/tests/test_kernel_db.py +0 -5629
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/LICENSE +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/README.md +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/_quarto.yml +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/coverage.qmd +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/custom.scss +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/design.qmd +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/images/hero.svg +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/index.qmd +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/motivation.qmd +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/review.qmd +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/tutorial-mission-discovery.ipynb +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/docs/usage.qmd +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/coverage.py +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/hashing.py +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/mission_registry.toml +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/parser.py +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/src/spice_kernel_db/registry.py +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/tests/__init__.py +0 -0
- {spice_kernel_db-0.20.1 → spice_kernel_db-0.22.2}/tests/fixtures/mission_registry_min.toml +0 -0
|
@@ -13,10 +13,10 @@ jobs:
|
|
|
13
13
|
matrix:
|
|
14
14
|
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
17
|
|
|
18
18
|
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
-
uses: actions/setup-python@
|
|
19
|
+
uses: actions/setup-python@v7
|
|
20
20
|
with:
|
|
21
21
|
python-version: ${{ matrix.python-version }}
|
|
22
22
|
|
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
|
|
23
23
|
steps:
|
|
24
24
|
- name: Checkout
|
|
25
|
-
uses: actions/checkout@
|
|
25
|
+
uses: actions/checkout@v7
|
|
26
26
|
|
|
27
27
|
- name: Setup Quarto
|
|
28
28
|
uses: quarto-dev/quarto-actions/setup@v2
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
path: docs
|
|
34
34
|
|
|
35
35
|
- name: Upload artifact
|
|
36
|
-
uses: actions/upload-pages-artifact@
|
|
36
|
+
uses: actions/upload-pages-artifact@v5
|
|
37
37
|
with:
|
|
38
38
|
path: docs/_site
|
|
39
39
|
|
|
@@ -46,4 +46,4 @@ jobs:
|
|
|
46
46
|
steps:
|
|
47
47
|
- name: Deploy to GitHub Pages
|
|
48
48
|
id: deployment
|
|
49
|
-
uses: actions/deploy-pages@
|
|
49
|
+
uses: actions/deploy-pages@v5
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "spice-kernel-db: browse, get, and manage SPICE kernels across NASA and ESA mission archives",
|
|
3
|
+
"description": "<p>A content-addressed database and command-line tool for SPICE kernels and metakernels. It indexes local kernel trees by SHA-256, resolves metakernels against the NAIF and ESA archives, verifies local copies against the server, and finds duplicates across mission directories.</p>",
|
|
4
|
+
"upload_type": "software",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"creators": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Aye, K.-Michael",
|
|
9
|
+
"affiliation": "Freie Universität Berlin",
|
|
10
|
+
"orcid": "0000-0002-4088-1928"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"SPICE",
|
|
15
|
+
"NAIF",
|
|
16
|
+
"kernels",
|
|
17
|
+
"metakernel",
|
|
18
|
+
"planetary science",
|
|
19
|
+
"ESA"
|
|
20
|
+
],
|
|
21
|
+
"related_identifiers": [
|
|
22
|
+
{
|
|
23
|
+
"identifier": "https://github.com/michaelaye/spice-kernel-db",
|
|
24
|
+
"relation": "isSupplementTo",
|
|
25
|
+
"scheme": "url"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"identifier": "https://pypi.org/project/spice-kernel-db/",
|
|
29
|
+
"relation": "isIdenticalTo",
|
|
30
|
+
"scheme": "url"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -5,6 +5,182 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.22.2] - 2026-10-26
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **The 0.22.1 sdist contained the 0.21.0 wheel and sdist.** A `git add -A` in
|
|
15
|
+
the 0.22.1 bump swept in a scratch build directory named `dist_0210/`;
|
|
16
|
+
`.gitignore` covered `dist/` but not a differently-named one, so 272 KB of a
|
|
17
|
+
previous release's artefacts entered the repository, the `v0.22.1` tag and
|
|
18
|
+
the sdist built from it. The files are gone and the ignore rule is now
|
|
19
|
+
`dist*/`. 0.22.1 was never published to PyPI.
|
|
20
|
+
|
|
21
|
+
No code changes. Everything 0.22.1 described is in this release.
|
|
22
|
+
|
|
23
|
+
## [0.22.1] - 2026-10-26
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Packaging and citation metadata only; no code changes.
|
|
28
|
+
|
|
29
|
+
- `pyproject.toml`'s `authors` field said just `Michael`, which is what PyPI
|
|
30
|
+
would have shown as the author. It now names K.-Michael Aye.
|
|
31
|
+
|
|
32
|
+
- New `CITATION.cff`, which drives GitHub's "Cite this repository" button, and
|
|
33
|
+
new `.zenodo.json`, which overrides the creators Zenodo otherwise infers from
|
|
34
|
+
the repository's contributor statistics. Both carry ORCID
|
|
35
|
+
0000-0002-4088-1928 in the form each format requires: CFF takes the full
|
|
36
|
+
`https://orcid.org/` URL, Zenodo's API takes the bare identifier.
|
|
37
|
+
|
|
38
|
+
## [0.22.0] - 2026-10-26
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **The CLI is built on Typer instead of argparse.** Every command, flag,
|
|
43
|
+
default and exit code is unchanged (one exception below); what changed is
|
|
44
|
+
the shape of the code and of `--help`. `cli.py` (2014 lines: one argparse definition block and a
|
|
45
|
+
490-line `if args.command == ...` chain) is now the `cli/` package with one
|
|
46
|
+
module per help panel: `browse.py` (browse, get, update), `inspect_cmds.py`
|
|
47
|
+
(list, check, verify, coverage, metakernels, resolve, aliases, stats,
|
|
48
|
+
duplicates), `transform.py` (scan, rewrite, dedup, prune) and
|
|
49
|
+
`configure.py` (mission, config, reset), plus `prompts.py` for the shared
|
|
50
|
+
interactive pickers. Each command is one typed function; adding a flag is
|
|
51
|
+
adding a parameter.
|
|
52
|
+
|
|
53
|
+
`--help` groups the commands into the same four panels the hand-written
|
|
54
|
+
epilog listed, generated from the registrations rather than maintained by
|
|
55
|
+
hand (the epilog had already missed `verify`). `-h` still works. New:
|
|
56
|
+
`--install-completion` and `--show-completion` for shell completion.
|
|
57
|
+
|
|
58
|
+
Usage errors (unknown command, bad option value) are worded by Click now
|
|
59
|
+
rather than argparse; they still exit 2.
|
|
60
|
+
|
|
61
|
+
- **Abbreviated long options are no longer accepted.** argparse completed
|
|
62
|
+
any unambiguous prefix, so `--miss JUICE`, `--exec` and `--arch` worked.
|
|
63
|
+
Click does not; they now fail with exit 2 and name the full option
|
|
64
|
+
(`No such option: --miss (Possible options: --mission)`). Spell options
|
|
65
|
+
out in scripts and shell aliases.
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- **"No locally acquired metakernels" crashed instead of printing.** Eleven
|
|
70
|
+
call sites passed `stderr=True` to `rich.Console.print()`, which has no such
|
|
71
|
+
argument, so every interactive picker that found nothing to pick (`check`,
|
|
72
|
+
`list`, `verify`, `coverage`, `update`, `resolve`, `aliases`, `get` with no
|
|
73
|
+
argument on an empty registry) died with a `TypeError`. They now write the
|
|
74
|
+
hint to stderr as intended.
|
|
75
|
+
|
|
76
|
+
- The Keep a Changelog header and the `[Unreleased]` section, dropped by the
|
|
77
|
+
0.21.0 release commit, are back.
|
|
78
|
+
|
|
79
|
+
## [0.21.0] - 2026-10-23
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
- **`check --full` compares each local kernel against the server** (#15).
|
|
84
|
+
`check` only asked whether a file of each name existed, so a file holding
|
|
85
|
+
the wrong content counted as present: on
|
|
86
|
+
`juice_crema_5_2_v473_20260819_001.tm` it reported "Found locally: 102/102"
|
|
87
|
+
while 10 differed from the server, one a 245 MB DSK present as 11 MB.
|
|
88
|
+
|
|
89
|
+
Size is compared first, via one HEAD per kernel — a size mismatch already
|
|
90
|
+
proves the files differ, which catches every case in the issue. `--hash`
|
|
91
|
+
additionally compares sha256 for kernels whose size matched, downloading
|
|
92
|
+
each, and `--spice` furnshes every local kernel and reports what SPICE
|
|
93
|
+
cannot read. The command exits 1 when anything is wrong.
|
|
94
|
+
|
|
95
|
+
New: `KernelDB.verify_against_server()`.
|
|
96
|
+
|
|
97
|
+
Remote URLs are derived from the *remote* metakernel rather than the local
|
|
98
|
+
one. `rewrite_metakernel()` replaces `PATH_VALUES` with absolute local
|
|
99
|
+
paths, and `resolve_kernel_urls()` interprets them relative to the
|
|
100
|
+
metakernel URL, so a rewritten `.tm` would otherwise produce URLs like
|
|
101
|
+
`https://server/tmp/kernels/lsk/naif0012.tls`.
|
|
102
|
+
|
|
103
|
+
### Changed
|
|
104
|
+
|
|
105
|
+
- **The unit test suite no longer touches the network.** It already intended
|
|
106
|
+
not to — the fixtures patch `urlopen` — but `query_remote_sizes` goes
|
|
107
|
+
through a `requests` session, which that patch never covered, so a single
|
|
108
|
+
test opened six real TLS connections to `naif.jpl.nasa.gov`. They failed,
|
|
109
|
+
the failures were swallowed, and the test passed regardless. Blocking the
|
|
110
|
+
sockets changed no assertion, so the connections carried no coverage, only
|
|
111
|
+
~0.66 s of handshake each and a dependency on JPL being reachable from CI.
|
|
112
|
+
|
|
113
|
+
`tests/conftest.py` now blocks non-loopback connections for any test not
|
|
114
|
+
marked `network`, and names the test that tried. Suite runtime 23.1 s to
|
|
115
|
+
9.4 s.
|
|
116
|
+
|
|
117
|
+
- **Real network tests added** (`tests/test_network.py`), covering what was
|
|
118
|
+
previously only mocked: `probe_url` against a genuine 404 and an unroutable
|
|
119
|
+
address, the NASA and ESA directory listings against live `mod_autoindex`
|
|
120
|
+
output, `query_remote_sizes`, and the ESA handshake fitting inside
|
|
121
|
+
`PROBE_TIMEOUT`. Deselected by default; run with `pytest -m network`.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
- The single-probe HEAD timeout rises from 5.0 s to 15.0 s. The old value sat
|
|
125
|
+
below the p90 TLS handshake (5.44 s) that this project measured against ESA,
|
|
126
|
+
so roughly one probe in ten could fail against a healthy server.
|
|
127
|
+
|
|
128
|
+
### Fixed
|
|
129
|
+
|
|
130
|
+
- **Every HTTP request now carries a timeout** (#12). `list_remote_metakernels`,
|
|
131
|
+
`list_remote_missions`, `_fetch_metakernel` and `download_kernel` called
|
|
132
|
+
`urlopen()` with none at all, so a stalled ESA socket could hang `browse`,
|
|
133
|
+
`get` and `update` indefinitely. 0.20.0 had bounded only the size queries.
|
|
134
|
+
|
|
135
|
+
- **A slow server is no longer reported as a missing metakernel** (#10).
|
|
136
|
+
`_head_ok` caught every exception and returned `False`, so a 404, a timeout
|
|
137
|
+
and a connection failure were indistinguishable and `get` printed
|
|
138
|
+
"Metakernel not found" for files that existed. `probe_url()` now classifies:
|
|
139
|
+
an HTTP status is an answer (absent), anything that prevents getting a status
|
|
140
|
+
is unreachable, and `get` says so and names the timeout instead.
|
|
141
|
+
|
|
142
|
+
- **`mission add <name>` no longer picks a server silently when the mission is
|
|
143
|
+
on several** (#13). It returned the first match in `SPICE_SERVERS`, so
|
|
144
|
+
`mission add JUICE` configured NASA's NAIF mirror although ESA publishes
|
|
145
|
+
JUICE first and the mirror can lag. It now lists the candidates and exits 2,
|
|
146
|
+
which is what the `--server-url` help text already promised.
|
|
147
|
+
|
|
148
|
+
- **Interactive prompts no longer traceback when stdin is not a terminal**
|
|
149
|
+
(#14). `mission add` raised `EOFError` under CI, redirection or
|
|
150
|
+
`ssh host skd mission add`. It now explains and exits 2, and every prompt
|
|
151
|
+
goes through a wrapper: menus report EOF and exit, `[y/N]` confirmations
|
|
152
|
+
treat EOF as no. The `db --delete` and `dedup --execute` confirmations were
|
|
153
|
+
affected too, contrary to what #14 assumed, and are fixed here.
|
|
154
|
+
- **`check <name>.tm` no longer tracebacks for a metakernel that was never
|
|
155
|
+
downloaded** (#11). The name went straight to the parser, which raised
|
|
156
|
+
`FileNotFoundError`. A bare name is now resolved through
|
|
157
|
+
`metakernel_registry` first, as `resolve` and `info` already did, and an
|
|
158
|
+
unknown one prints one line naming the `get` command to run, then exits 1.
|
|
159
|
+
New: `KernelDB.resolve_metakernel_path()` and `MetakernelNotTracked`.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
- **`get` and `update` now honour `-v/--verbose`** (#4). The flag was parsed
|
|
163
|
+
globally and forwarded by `scan` and `check`, but neither `get_metakernel()`
|
|
164
|
+
nor `update_metakernel()` had the parameter, so it was silently dropped.
|
|
165
|
+
Following `check`'s convention, verbose adds detail rather than removing it:
|
|
166
|
+
`get` lists each resolved URL under the status table, `update` names each
|
|
167
|
+
directory it re-scans. The status table stays unconditional because it
|
|
168
|
+
precedes the download prompt.
|
|
169
|
+
|
|
170
|
+
- **`update --mission` help text matches the other verbs** (#3): "Override
|
|
171
|
+
auto-detected mission name".
|
|
172
|
+
|
|
173
|
+
### Removed
|
|
174
|
+
|
|
175
|
+
- **The pre-0.19 database path is no longer opened automatically.** 0.19.x and
|
|
176
|
+
0.20.x still used a database found only at `~/.spice_kernels.duckdb`, with a
|
|
177
|
+
`FutureWarning` naming 0.21.0 as the cut-off. This is that release.
|
|
178
|
+
|
|
179
|
+
Rather than silently creating an empty database beside a populated legacy
|
|
180
|
+
one, which would look like data loss, `default_db_path()` now raises
|
|
181
|
+
`LegacyDatabaseFound` naming both fixes: move the file, or run
|
|
182
|
+
`spice-kernel-db config --setup`.
|
|
183
|
+
|
|
8
184
|
## [0.20.1] - 2026-09-19
|
|
9
185
|
|
|
10
186
|
### Fixed
|
|
@@ -932,6 +1108,10 @@ spice-kernel-db check <your-metakernel.tm>
|
|
|
932
1108
|
reference)
|
|
933
1109
|
- Comprehensive test suite (30 tests)
|
|
934
1110
|
|
|
1111
|
+
[0.22.2]: https://github.com/michaelaye/spice-kernel-db/compare/v0.22.1...v0.22.2
|
|
1112
|
+
[0.22.1]: https://github.com/michaelaye/spice-kernel-db/compare/v0.22.0...v0.22.1
|
|
1113
|
+
[0.22.0]: https://github.com/michaelaye/spice-kernel-db/compare/v0.21.0...v0.22.0
|
|
1114
|
+
[0.21.0]: https://github.com/michaelaye/spice-kernel-db/compare/v0.20.1...v0.21.0
|
|
935
1115
|
[0.20.1]: https://github.com/michaelaye/spice-kernel-db/compare/v0.20.0...v0.20.1
|
|
936
1116
|
[0.20.0]: https://github.com/michaelaye/spice-kernel-db/compare/v0.19.0...v0.20.0
|
|
937
1117
|
[0.19.1]: https://github.com/michaelaye/spice-kernel-db/compare/v0.19.0...v0.19.1
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: If you use this software, please cite it using these metadata.
|
|
3
|
+
title: "spice-kernel-db: browse, get, and manage SPICE kernels across NASA and ESA mission archives"
|
|
4
|
+
abstract: >-
|
|
5
|
+
A content-addressed database and command-line tool for SPICE kernels and
|
|
6
|
+
metakernels. It indexes local kernel trees by SHA-256, resolves metakernels
|
|
7
|
+
against the NAIF and ESA archives, verifies local copies against the server,
|
|
8
|
+
and finds duplicates across mission directories.
|
|
9
|
+
type: software
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: Aye
|
|
12
|
+
given-names: K.-Michael
|
|
13
|
+
orcid: https://orcid.org/0000-0002-4088-1928
|
|
14
|
+
affiliation: Freie Universität Berlin
|
|
15
|
+
repository-code: https://github.com/michaelaye/spice-kernel-db
|
|
16
|
+
url: https://michaelaye.github.io/spice-kernel-db
|
|
17
|
+
license: MIT
|
|
18
|
+
version: 0.22.2
|
|
19
|
+
date-released: "2026-10-26"
|
|
20
|
+
keywords:
|
|
21
|
+
- SPICE
|
|
22
|
+
- NAIF
|
|
23
|
+
- kernels
|
|
24
|
+
- metakernel
|
|
25
|
+
- planetary science
|
|
26
|
+
- ESA
|
|
@@ -43,7 +43,7 @@ Content-addressed SPICE kernel database. Every kernel file is identified by its
|
|
|
43
43
|
| `hashing.py` | `sha256_file()`, `classify_kernel()` (extension→type), `guess_mission()` (path heuristic) |
|
|
44
44
|
| `remote.py` | Network operations: fetch metakernels, resolve URLs, parallel HEAD/download with rich.progress |
|
|
45
45
|
| `config.py` | `Config` dataclass, TOML persistence at `~/.config/spice-kernel-db/config.toml` |
|
|
46
|
-
| `cli.py`
|
|
46
|
+
| `cli/` | Typer CLI, one module per help panel: `browse.py` (browse, get, update), `inspect_cmds.py` (list, check, verify, coverage, metakernels, resolve, aliases, stats, duplicates), `transform.py` (scan, rewrite, dedup, prune), `configure.py` (mission, config, reset); `prompts.py` holds the shared interactive pickers, `_app.py` the `app` object and per-invocation state, `__init__.py` the root options and `main()` |
|
|
47
47
|
|
|
48
48
|
### Key Design Decisions
|
|
49
49
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: spice-kernel-db
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.2
|
|
4
4
|
Summary: Browse, get, and manage SPICE kernels and metakernels across NASA and ESA mission archives
|
|
5
5
|
Project-URL: Homepage, https://github.com/michaelaye/spice-kernel-db
|
|
6
6
|
Project-URL: Repository, https://github.com/michaelaye/spice-kernel-db
|
|
7
7
|
Project-URL: Issues, https://github.com/michaelaye/spice-kernel-db/issues
|
|
8
|
-
Author: Michael
|
|
8
|
+
Author-email: "K.-Michael Aye" <69774+michaelaye@users.noreply.github.com>
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Keywords: esa,kernels,metakernel,naif,planetary-science,spice
|
|
@@ -18,6 +18,7 @@ Requires-Python: >=3.11
|
|
|
18
18
|
Requires-Dist: duckdb>=1.0
|
|
19
19
|
Requires-Dist: requests>=2.31
|
|
20
20
|
Requires-Dist: rich>=13.0
|
|
21
|
+
Requires-Dist: typer>=0.27
|
|
21
22
|
Provides-Extra: dev
|
|
22
23
|
Requires-Dist: pytest-tmp-files>=0.0.2; extra == 'dev'
|
|
23
24
|
Requires-Dist: pytest>=7; extra == 'dev'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{% set version = "0.
|
|
1
|
+
{% set version = "0.22.2" %}
|
|
2
2
|
|
|
3
3
|
package:
|
|
4
4
|
name: spice-kernel-db
|
|
@@ -6,7 +6,7 @@ package:
|
|
|
6
6
|
|
|
7
7
|
source:
|
|
8
8
|
url: https://pypi.org/packages/source/s/spice-kernel-db/spice_kernel_db-{{ version }}.tar.gz
|
|
9
|
-
sha256:
|
|
9
|
+
sha256: 6989e401560012f95a767aa77552c57ac531557dbf5cd525e9bfac346c3e1a6d
|
|
10
10
|
|
|
11
11
|
build:
|
|
12
12
|
entry_points:
|
|
@@ -26,6 +26,7 @@ requirements:
|
|
|
26
26
|
- python-duckdb >=1.0
|
|
27
27
|
- requests >=2.31
|
|
28
28
|
- rich >=13.0
|
|
29
|
+
- typer >=0.27
|
|
29
30
|
|
|
30
31
|
test:
|
|
31
32
|
imports:
|
|
@@ -19,7 +19,7 @@ KernelDB(db_path: str | Path | None = None, read_only: bool = False)
|
|
|
19
19
|
|
|
20
20
|
Opens (or creates) the database at the given path. When `db_path` is `None` (the default), the path is loaded from `~/.config/spice-kernel-db/config.toml`; without a config file it is `~/.local/share/spice-kernel-db/kernels.duckdb`. The schema is initialized automatically (unless `read_only=True`).
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Before 0.21.0, a database found only at the pre-0.19 default `~/.spice_kernels.duckdb` was opened when no config file existed, with a `FutureWarning`. Since 0.21.0 it is not: if one is there and the new default is not, `spice-kernel-db` raises `LegacyDatabaseFound` naming the move command, rather than quietly starting an empty database beside it.
|
|
23
23
|
|
|
24
24
|
Set `read_only=True` for commands that only query the database. Several read-only connections can be open at once, but DuckDB's file lock means none can open while another process has the database open for writing (for example during `get`); that raises `duckdb.IOException`.
|
|
25
25
|
|
|
@@ -231,6 +231,7 @@ db.get_metakernel(
|
|
|
231
231
|
mission: str | None = None,
|
|
232
232
|
yes: bool = False,
|
|
233
233
|
force: bool = False,
|
|
234
|
+
verbose: bool = False,
|
|
234
235
|
) -> dict
|
|
235
236
|
```
|
|
236
237
|
|
|
@@ -247,6 +248,8 @@ Fetch a remote metakernel, display a status table, and download missing kernels.
|
|
|
247
248
|
|
|
248
249
|
`download_dir` defaults to the configured `kernel_dir` from `~/.config/spice-kernel-db/config.toml`. Downloaded files are placed under `<download_dir>/<mission>/<relpath>`.
|
|
249
250
|
|
|
251
|
+
`verbose=True` additionally lists each kernel's resolved URL beneath the status table. The table itself is always shown — it precedes the download prompt, so it is what you decide on.
|
|
252
|
+
|
|
250
253
|
Returns a dict with keys: `found`, `missing`, `downloaded`, `warnings`.
|
|
251
254
|
|
|
252
255
|
#### `update_metakernel`
|
|
@@ -258,6 +261,7 @@ db.update_metakernel(
|
|
|
258
261
|
download_dir: str | Path | None = None,
|
|
259
262
|
yes: bool = False,
|
|
260
263
|
force: bool = False,
|
|
264
|
+
verbose: bool = False,
|
|
261
265
|
) -> dict
|
|
262
266
|
```
|
|
263
267
|
|
|
@@ -265,7 +269,7 @@ Re-fetch a metakernel from its source URL and download new or missing kernels. L
|
|
|
265
269
|
|
|
266
270
|
Raises `LookupError` if the metakernel is not found in the registry or was added via scan without a source URL. Raises `MetakernelUnreachableError` (a `LookupError` subclass) when the remote returns 403/404/410 — typically because NAIF rotated the file into `former_versions/`; use `prune_metakernels()` to clean up the stale registry row.
|
|
267
271
|
|
|
268
|
-
After downloading, automatically rescans the kernel directories referenced by the metakernel so newly downloaded files are immediately indexed.
|
|
272
|
+
After downloading, automatically rescans the kernel directories referenced by the metakernel so newly downloaded files are immediately indexed. `verbose=True` names each directory as it is re-scanned; otherwise the count is reported in one line.
|
|
269
273
|
|
|
270
274
|
Returns the same dict as `get_metakernel`.
|
|
271
275
|
|
|
@@ -5,6 +5,11 @@ subtitle: "Command-line interface"
|
|
|
5
5
|
|
|
6
6
|
On first run, the tool prompts for configuration (database path and kernel storage directory). These are saved to `~/.config/spice-kernel-db/config.toml`. All commands share a `--db` option to override the configured database path.
|
|
7
7
|
|
|
8
|
+
The root options come before the command: `spice-kernel-db [--db PATH] [-v] COMMAND ...`.
|
|
9
|
+
`spice-kernel-db --help` (or `-h`) lists the commands in four groups: browse & acquire,
|
|
10
|
+
inspect, transform and configure. `spice-kernel-db --install-completion` installs shell
|
|
11
|
+
completion for the current shell; `--show-completion` prints it instead.
|
|
12
|
+
|
|
8
13
|
## `scan`
|
|
9
14
|
|
|
10
15
|
Recursively scan a directory and register all kernel files.
|
|
@@ -224,3 +224,10 @@ candidates = [
|
|
|
224
224
|
```
|
|
225
225
|
|
|
226
226
|
Registry entries can use absolute URLs (PDS nodes, mission websites) — the `{server}`/`{m}` placeholders are convenient but not required.
|
|
227
|
+
|
|
228
|
+
## `Error: No such option: --miss`
|
|
229
|
+
|
|
230
|
+
Since 0.22 the CLI no longer accepts abbreviated long options. Earlier
|
|
231
|
+
versions completed any unambiguous prefix, so `--miss JUICE` meant
|
|
232
|
+
`--mission JUICE` and `--exec` meant `--execute`. Spell the option out; the
|
|
233
|
+
error message names the full option.
|
|
@@ -4,13 +4,13 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "spice-kernel-db"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.22.2"
|
|
8
8
|
description = "Browse, get, and manage SPICE kernels and metakernels across NASA and ESA mission archives"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
11
11
|
requires-python = ">=3.11"
|
|
12
12
|
authors = [
|
|
13
|
-
{ name = "Michael" },
|
|
13
|
+
{ name = "K.-Michael Aye", email = "69774+michaelaye@users.noreply.github.com" },
|
|
14
14
|
]
|
|
15
15
|
keywords = ["spice", "naif", "kernels", "planetary-science", "metakernel", "esa"]
|
|
16
16
|
classifiers = [
|
|
@@ -24,6 +24,7 @@ dependencies = [
|
|
|
24
24
|
"duckdb>=1.0",
|
|
25
25
|
"requests>=2.31",
|
|
26
26
|
"rich>=13.0",
|
|
27
|
+
"typer>=0.27",
|
|
27
28
|
]
|
|
28
29
|
|
|
29
30
|
[project.optional-dependencies]
|
|
@@ -6,6 +6,7 @@ from spice_kernel_db.config import Config, ensure_config
|
|
|
6
6
|
from spice_kernel_db.db import (
|
|
7
7
|
ConcurrentModificationError,
|
|
8
8
|
KernelDB,
|
|
9
|
+
MetakernelNotTracked,
|
|
9
10
|
MetakernelUnreachableError,
|
|
10
11
|
)
|
|
11
12
|
from spice_kernel_db.parser import parse_metakernel, parse_metakernel_text
|
|
@@ -19,6 +20,7 @@ __all__ = [
|
|
|
19
20
|
"ConcurrentModificationError",
|
|
20
21
|
"Config",
|
|
21
22
|
"KernelDB",
|
|
23
|
+
"MetakernelNotTracked",
|
|
22
24
|
"MetakernelUnreachableError",
|
|
23
25
|
"ensure_config",
|
|
24
26
|
"fetch_metakernel",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""Command-line interface for spice-kernel-db.
|
|
2
|
+
|
|
3
|
+
The commands live in one module per help panel; importing them here
|
|
4
|
+
registers them on ``app``. ``main()`` is the console-script entry point.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from importlib.metadata import version as pkg_version
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Annotated, Optional
|
|
13
|
+
|
|
14
|
+
import typer
|
|
15
|
+
from typer import rich_utils
|
|
16
|
+
|
|
17
|
+
from spice_kernel_db.config import ensure_config
|
|
18
|
+
from spice_kernel_db.db import KernelDB
|
|
19
|
+
|
|
20
|
+
from ._app import State, app
|
|
21
|
+
from .prompts import _metakernel_table, _registry_rows, console
|
|
22
|
+
|
|
23
|
+
# Register the commands, in the order the help panels should appear.
|
|
24
|
+
from . import browse, inspect_cmds, transform, configure # noqa: E402, F401, I001
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _version(flag: bool) -> None:
|
|
28
|
+
if flag:
|
|
29
|
+
print(f"spice-kernel-db {pkg_version('spice-kernel-db')}")
|
|
30
|
+
raise typer.Exit()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@app.callback(invoke_without_command=True)
|
|
34
|
+
def _root(
|
|
35
|
+
ctx: typer.Context,
|
|
36
|
+
db: Annotated[Optional[str], typer.Option(
|
|
37
|
+
"--db", help="Path to DuckDB database file (default: from config)")] = None,
|
|
38
|
+
verbose: Annotated[bool, typer.Option(
|
|
39
|
+
"-v", "--verbose", help="Show detailed output (per-file warnings, etc.)")] = False,
|
|
40
|
+
version: Annotated[bool, typer.Option(
|
|
41
|
+
"--version", help="Show program's version number and exit",
|
|
42
|
+
callback=_version, is_eager=True)] = False,
|
|
43
|
+
) -> None:
|
|
44
|
+
if ctx.invoked_subcommand is None:
|
|
45
|
+
# No subcommand — show a useful summary if possible, else help.
|
|
46
|
+
_show_default_summary()
|
|
47
|
+
return
|
|
48
|
+
# ensure_config is handed over, not called: a command loads the config
|
|
49
|
+
# the first time it needs it, so `<command> --help` never prompts.
|
|
50
|
+
ctx.obj = State(db_override=db, verbose=verbose, load_config=ensure_config)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _show_default_summary() -> None:
|
|
54
|
+
"""Show a useful summary when invoked with no subcommand.
|
|
55
|
+
|
|
56
|
+
Lists locally acquired metakernels if any exist, otherwise prints
|
|
57
|
+
a quick-start guide.
|
|
58
|
+
"""
|
|
59
|
+
from spice_kernel_db.config import load_config
|
|
60
|
+
|
|
61
|
+
console.print(
|
|
62
|
+
f"[bold]spice-kernel-db[/bold] {pkg_version('spice-kernel-db')}\n"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
config = load_config()
|
|
66
|
+
if not config:
|
|
67
|
+
console.print(
|
|
68
|
+
"No configuration found. Run [bold]spice-kernel-db config --setup[/bold] to get started.\n"
|
|
69
|
+
)
|
|
70
|
+
return
|
|
71
|
+
|
|
72
|
+
db_path = Path(config.db_path).expanduser()
|
|
73
|
+
if not db_path.is_file():
|
|
74
|
+
console.print(
|
|
75
|
+
"No database yet. Quick start:\n"
|
|
76
|
+
" [bold]spice-kernel-db mission add[/bold] # configure a mission\n"
|
|
77
|
+
" [bold]spice-kernel-db browse[/bold] MISSION # see available metakernels\n"
|
|
78
|
+
" [bold]spice-kernel-db get[/bold] # download one interactively\n"
|
|
79
|
+
)
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
with KernelDB(db_path, read_only=True) as db:
|
|
83
|
+
rows = _registry_rows(db)
|
|
84
|
+
|
|
85
|
+
if rows:
|
|
86
|
+
console.print(_metakernel_table(rows, index_style="dim"))
|
|
87
|
+
console.print(
|
|
88
|
+
"\n[dim]Use 'spice-kernel-db check <filename>' to verify kernel availability.\n"
|
|
89
|
+
"Use 'spice-kernel-db resolve <kernel>' to get a kernel's local path.\n"
|
|
90
|
+
"Use 'spice-kernel-db update <filename>' to fetch the latest version.\n"
|
|
91
|
+
"Run 'spice-kernel-db --help' for all commands.[/dim]\n"
|
|
92
|
+
)
|
|
93
|
+
else:
|
|
94
|
+
console.print(
|
|
95
|
+
"Database exists but no metakernels acquired yet.\n\n"
|
|
96
|
+
" [bold]spice-kernel-db browse[/bold] MISSION # see available metakernels\n"
|
|
97
|
+
" [bold]spice-kernel-db get[/bold] # download one interactively\n"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def main(argv: list[str] | None = None) -> None:
|
|
102
|
+
"""Console-script entry point.
|
|
103
|
+
|
|
104
|
+
Runs the app without Click's standalone mode so that a successful command
|
|
105
|
+
returns normally (the tests call ``main([...])`` directly), then exits
|
|
106
|
+
the way the argparse CLI did: 0 for ``--help`` and ``--version``, 2 for a
|
|
107
|
+
usage error, 130 for Ctrl-C (Typer turns it into ``Exit(130)``).
|
|
108
|
+
"""
|
|
109
|
+
try:
|
|
110
|
+
rc = app(args=argv, prog_name="spice-kernel-db", standalone_mode=False)
|
|
111
|
+
except typer.Abort:
|
|
112
|
+
print("Aborted.", file=sys.stderr)
|
|
113
|
+
sys.exit(1)
|
|
114
|
+
except typer.TyperException as exc:
|
|
115
|
+
rich_utils.rich_format_error(exc)
|
|
116
|
+
sys.exit(exc.exit_code)
|
|
117
|
+
if isinstance(rc, int): # Exit codes only; a command's return value is not one
|
|
118
|
+
sys.exit(rc)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""The Typer application object and the per-invocation state it carries.
|
|
2
|
+
|
|
3
|
+
Command modules import ``app`` from here and register themselves with
|
|
4
|
+
``@app.command(...)``; ``cli/__init__.py`` imports those modules so the
|
|
5
|
+
registration happens, then defines the root callback and ``main()``.
|
|
6
|
+
Keeping ``app`` in its own module avoids a circular import.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from collections.abc import Callable, Iterator
|
|
12
|
+
from contextlib import contextmanager
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
|
|
15
|
+
import typer
|
|
16
|
+
|
|
17
|
+
from spice_kernel_db.config import Config
|
|
18
|
+
from spice_kernel_db.db import KernelDB
|
|
19
|
+
|
|
20
|
+
# Help panels, in the order they appear in ``--help``.
|
|
21
|
+
BROWSE = "browse & acquire"
|
|
22
|
+
INSPECT = "inspect"
|
|
23
|
+
TRANSFORM = "transform"
|
|
24
|
+
CONFIGURE = "configure"
|
|
25
|
+
|
|
26
|
+
app = typer.Typer(
|
|
27
|
+
name="spice-kernel-db",
|
|
28
|
+
help="Browse, get, and manage SPICE kernels and metakernels",
|
|
29
|
+
epilog="Quick start: mission add → browse MISSION → get → check",
|
|
30
|
+
rich_markup_mode="rich",
|
|
31
|
+
pretty_exceptions_enable=False,
|
|
32
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class State:
|
|
38
|
+
"""Root options plus the config, shared by every command.
|
|
39
|
+
|
|
40
|
+
The config is loaded on first use, not when the root callback runs:
|
|
41
|
+
Click invokes the root callback before a subcommand parses ``--help``,
|
|
42
|
+
so eager loading made ``skd get --help`` start first-time setup on a
|
|
43
|
+
machine without a config file.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
db_override: str | None
|
|
47
|
+
verbose: bool
|
|
48
|
+
load_config: Callable[[], Config]
|
|
49
|
+
_config: Config | None = field(default=None, init=False, repr=False)
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def config(self) -> Config:
|
|
53
|
+
if self._config is None:
|
|
54
|
+
self._config = self.load_config()
|
|
55
|
+
return self._config
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def db(self) -> str:
|
|
59
|
+
return self.db_override or self.config.db_path
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def state(ctx: typer.Context) -> State:
|
|
63
|
+
return ctx.obj
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@contextmanager
|
|
67
|
+
def open_db(ctx: typer.Context, *, read_only: bool = False) -> Iterator[KernelDB]:
|
|
68
|
+
"""Open the configured database for the duration of one command.
|
|
69
|
+
|
|
70
|
+
Read-only commands can share the DB with a running writer, so each
|
|
71
|
+
command says which kind of connection it needs.
|
|
72
|
+
"""
|
|
73
|
+
db = KernelDB(state(ctx).db, read_only=read_only)
|
|
74
|
+
try:
|
|
75
|
+
yield db
|
|
76
|
+
finally:
|
|
77
|
+
db.close()
|