Published October 22, 2026 | Version v0.4.0

queelius/arkiv: arkiv 0.4.0

Authors/Creators

  • 1. @metafunctor

Description

A bundle I/O layer for tools that write and read arkiv archives, so the *-memex archives can stop carrying their own copies of the zip/tar plumbing (six near-identical copies, with divergent bugs).

Added

  • write_bundle(path, members): write named in-memory members as a directory, .zip, or .tar.gz (by extension), creating parent directories. Byte-reproducible: sorted members, fixed timestamps and modes, no owner identity, and no output file name in the gzip header. Member names that are absolute or climb out of the archive are rejected.
  • records_to_jsonl(records): UTF-8 JSONL bytes (ensure_ascii=False, non-JSON values via str).
  • open_member(path, member), iter_jsonl(path, member), peek_jsonl(path, member): stream one member out of a directory, zip, tar.gz, or bare .jsonl / .jsonl.gz without extracting. A missing member raises FileNotFoundError uniformly (tar link members are refused the same way); blank, malformed, and non-object lines are skipped; peek_jsonl returns None for absent or unreadable input.
  • Streaming reads treat bundles as untrusted: open_member / iter_jsonl cap the decompressed bytes read (max_bytes, default 8 GiB, refusing zip/tar members whose declared size is over it upfront and bounding gzip streams as they decompress) and the length of one JSONL line (max_line_chars, default 64 Mi characters), raising ValueError instead of buffering. peek_jsonl reads within a 64 MiB budget. A directory-bundle member that is a symlink, or resolves outside the archive, is refused, and write_bundle will not write through one. Finding a tar.gz member streams the archive (stopping at the first match, with an entry cap and every header and skipped byte charged to max_bytes) instead of getmember(), which parses all headers first.
  • bundle_format(path): classify a path as dir, zip, tar.gz, jsonl, or jsonl.gz.
  • All of the above, plus pack_bundle, unpack_bundle, and is_bundle, are exported from the package root.

Fixed

  • pack_bundle and the source fingerprint dropped every .db / .sqlite / .sqlite3 file at any depth, so a database file that is content (an EHR export's media/viewer.db) silently vanished from bundles. Only the derived database at the archive root is skipped now; both paths share one rule, arkiv.bundle.is_source_path.

Changed

  • The package ships a py.typed marker, so type checkers use its annotations instead of treating it as untyped.
  • The sdist is built from an explicit allowlist; earlier sdists included untracked local tool configuration (.claude/settings.local.json).
  • pack_bundle output is now byte-reproducible as well (it previously stamped on-disk mtimes, the packer's uid/gid, and the wall clock into the gzip header).

Files

queelius/arkiv-v0.4.0.zip

Files (165.3 kB)

Name Size
md5:e2675b44e7a79081cb9bb7a591ef23d6
165.3 kB Preview Download

Additional details

Related works

Is supplement to
Software: https://github.com/queelius/arkiv/tree/v0.4.0 (URL)

Software