Skip to main content

ducats

A DuckDB catalog of the files in a directory or bucket: one row per file, with its group columns and start/end time, synced from a glob.

pip install ducats

Usage

Register a product in a module:

from ducats import ProductConfig, RegexExtractor, register_product

register_product(ProductConfig(
    name="my_files",
    base_dir="/data/my_product",
    glob="**/*.nc",
    extractor=RegexExtractor(r"my_product_(?P<start>\d{14})_(?P<end>\d{14})\.nc$"),
))

Each registered product becomes a table in the catalog with columns file, the extractor's group columns (here none), start_ts and end_ts.

sync

ducats sync --products-module myproject.products --catalog-path catalog.duckdb

Imports the given modules (repeat --products-module for several), globs each registered product's files and rebuilds its table. Files that are gone from disk drop out. --product NAME syncs only one. ducats status shows when each table was last synced and how many rows it has.

Without --catalog-path the catalog is in memory and lost when the command exits.

query

ducats query --catalog-path catalog.duckdb --sql \
  "SELECT file FROM my_files WHERE start_ts <= '2026-03-24 10:00' AND end_ts >= '2026-03-24 10:00'"

Runs any SQL against the catalog and prints up to --max-rows rows (default 100). The catalog is a plain DuckDB file, so duckdb catalog.duckdb or duckdb.connect("catalog.duckdb") work as well.

gaps

Two checks, per group in --group-cols (e.g. sat), or over the whole table:

ducats gaps --catalog-path catalog.duckdb --table my_files --mode coverage --bucket 1h --tolerance 5s

coverage splits time into --bucket-sized buckets (aligned to 1970-01-01) from the first file to the last and checks each against the union of the files' [start_ts, end_ts]. A bucket is covered if the files span all of it, missing if no file overlaps it, and partial otherwise; it reports the missing and partial ones. --tolerance (default 0s) ignores breaks between files and shortfalls at a bucket's edges up to that length; time stamps like 10:00:00–10:59:59 need at least 1s. A file without end_ts covers the bucket it starts in.

ducats gaps --catalog-path catalog.duckdb --table my_files --group-cols sat \
  --mode contiguity --min-gap 0s --max-gap 1s

contiguity is for files that should follow each other end to start (e.g. orbit segments): it reports each pair of consecutive files where the next start_ts minus this end_ts is below --min-gap (overlap) or above --max-gap (gap). Files without an end_ts are skipped.

From Python: ducats.queries.find_coverage_gaps and find_contiguity_gaps return dataclasses (CoverageReport.covered() lists the covered buckets); ducats.report formats them as text.

Extractors

  • RegexExtractor(pattern, ts_format="%Y%m%d%H%M%S"): fields from the file name. start is required, end is optional, other named groups become columns.
  • PythonExtractor(fn, fields, cache_path=None): fn(path) returns a dict of fields (including start_ts, end_ts). With cache_path, results are kept between runs.

Development

uv sync
uv run pytest

Metadata

Release files for ducats 0.3.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 ducats 0.3.0
File Size Uploaded Provenance Actions
ducats-0.3.0.tar.gz 22.0 kB With provenance Details for ducats-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ducats 0.3.0
File Interpreter ABI Platform Actions
ducats-0.3.0-py3-none-any.whl Python 3 none any Details for ducats-0.3.0-py3-none-any.whl

Total release size: 34.9 kB

Release files / ducats-0.3.0.tar.gz

Download URL ducats-0.3.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
386160997cc0356caca27c4e34b6591e0da8e4affdd11414304f278d078707d7
BLAKE2b-256 checksum
How to use checksums
430a88025d22443512318b7912d10043800e8b7bda011ecd1e8783428716a303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ducats-0.3.0-py3-none-any.whl

Download URL ducats-0.3.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b6b1f5225c3a333ab24cce9a3099e23dd454f4af14852750fdd80a1457e4d51
BLAKE2b-256 checksum
How to use checksums
7231cad124130c796994098e68ceb89f83ef8a17ca1ede2dd8d0d588b9bfc5a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for ducats 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ducats-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

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.3.0 This release

2 release files Full 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