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())

# If you just need the index dictionary without opening handles:
index = itar.index.build("hello.tar")
# Write the index file to disk:
itar.index.save("hello.itar", num_shards=None, index=index)

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()

index = itar.index.build(["photos-0.tar", "photos-1.tar"])
itar.index.create("photos.itar", ["photos-0.tar", "photos-1.tar"])

num_shards, stored_index = itar.index.load("photos.itar")

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.save(path, num_shards, index): serialize an index you built elsewhere.
  • itar.index.load(path) -> (num_shards, index): load the msgpack index without opening shards.
  • itar.open(path, *, shards=None, open_fn=None) -> IndexedTarFile: attach shard handles using an existing index file.

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.3.0.tar.gz (8.0 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.3.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for itar-0.3.0.tar.gz
Algorithm Hash digest
SHA256 53689526473c8aea2d219706089f7862ff7fe561774a93615356c63819c85fdb
MD5 5846d6a3dc1a0a3dc4d18c654edb3a16
BLAKE2b-256 12b26fe555a71515788dd1248d2d537ecb7438d79921a195e9f08f2e416c0d8d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for itar-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6954640c795308db73f45e8f017036ede3ab371e94ba63d63541e6fd67d286f6
MD5 2e66356d30061743df91f9a38688ebe9
BLAKE2b-256 c601105e863da9928c37092472d4487b371786a47446a0e9785817133c9676fe

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