Skip to main content

Add your description here

Project description

itar

itar builds constant-time indexes for one or more TAR shards so you can seek directly to a member without extracting the archive. The project ships a small CLI (itar) and a Python helper (IndexedTarFile) plus a module-level itar.open() convenience that mirrors tarfile.open().

Quickstart (single tarball)

echo "Hello world!" > hello.txt
tar cf hello.tar hello.txt       # regular tarball
itar index build 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 build 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 build .itar [--single TAR --shards shard0.tar shard1.tar ...]`
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.

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.2.0.tar.gz (7.6 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.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for itar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f9f76ab7b06c4fd083348dfbddcfa6cf63b8a52ccfbf305b29586605d871c042
MD5 81a39b1f914d74595a013488a4ae55c0
BLAKE2b-256 e30227cb22d0d9f805c0dfe1c01e91188649ab2a97ac1ddafe96fdc41ea22c48

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for itar-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49e188dfce2328b9e6a682e36b9ff3c905319493e810b1ead673abd5d62c33c0
MD5 8ca59ed6b32767bc255b955cc3dcd2f6
BLAKE2b-256 56162d117d26e550f66bcbe8c6b65f973d61b6e157ec725035f3a84a564e1fad

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