Skip to main content

Add your description here

Project description

itar

image

itar builds constant‑time indexes over one or more tar file shards, enabling direct, random access to members without extracting the archives. It ships a lightweight CLI (itar) and a Python API.

Designed for large datasets and deep‑learning pipelines, it supports single or sharded tar archives with thread‑safe access for concurrent reads.

Quickstart (single tarball)

echo "Hello world!" > hello.txt
tar cf hello.tar hello.txt       # regular tarball

itar index create hello.itar     # indexes hello.tar
itar index list hello.itar       # list indexed members
import itar

with itar.open("hello.itar") as archive:
    print(archive["hello.txt"].read())

Quickstart (sharded tarballs)

Give each shard a zero-padded suffix before building the index:

tar cf photos-0.tar wedding/   # shard 0
tar cf photos-1.tar vacation/  # shard 1

itar index create photos.itar  # discovers photos-0.tar, photos-1.tar, ...
itar index list -l photos.itar # shard index, offsets, byte sizes
import itar

with itar.open("photos.itar") as photos:
    assert "wedding/cake.jpg" in photos
    img_bytes = photos["vacation/sunrise.jpg"].read()

CLI reference

Command Purpose
itar index create <archive>.itar [--single TAR | --shards shard0.tar shard1.tar ...] Indexes a single archive or an explicit set of shards. With no flags, shards are auto-discovered next to <archive>.itar.
itar index list <archive>.itar Lists members. Use -l for shard/offset info and -H for human-readable sizes.
itar index check <archive>.itar Validates recorded entries; add --member NAME to focus on specific files.
itar cat <archive>.itar <member> Streams a member’s bytes to stdout.

Python helpers

  • itar.index.build(shards, progress_bar=False) -> dict: construct an index mapping for paths, file objects, or buffers.
  • itar.index.create("archive.itar", shards): convenience wrapper that builds + saves an index file.
  • itar.index.dump(index, path): serialize an index you built elsewhere.
  • itar.index.load(path) -> dict: load the msgpack index without opening shards.
  • itar.open(path, *, shards=None, open_fn=None) -> IndexedTarFile: attach shard handles using an existing index file.

itar File Format

An itar index file is a simple MessagePack dictionary mapping member paths to metadata:

{
    "path/to/member1.jpg": [  # file name
        null,                 # either null or shard index (0-based)
        [
            2048,             # metadata byte offset
            2560,             # data byte offset
            1048576,          # file length in bytes
        ],
    ],
    ...
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itar-0.4.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itar-0.4.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file itar-0.4.0.tar.gz.

File metadata

  • Download URL: itar-0.4.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for itar-0.4.0.tar.gz
Algorithm Hash digest
SHA256 132eb1cc099cbe5ddb7f1b0ba4d967bb9e4761e5f05a16606c6b633ff5b7b041
MD5 4cab83a6af685c19de9ad2d0db78b41a
BLAKE2b-256 631ec169a51b11b3878a0a3da500f8eaa1a2a6740f9f7584af6193000a828bdf

See more details on using hashes here.

File details

Details for the file itar-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: itar-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for itar-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c03e692136f9b7427784b7d63e59aba5ba0b888d371b6dab1497e1a64d7b1511
MD5 51c998272b759d33e5d4718d6497bedc
BLAKE2b-256 70f6f40e9cbf99c38250b7cf4804f6b8fc4a1b9cc920716109dd1a3daaf9a477

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page