ZRAN
Random read access for ZLIB, GZIP and DEFLATE file formats
Description
zran is a Python extension that wraps the zran library, which was created by Mark Adler (the creator of zlib). This utility will create an index that will allow you to begin decompressing DEFLATE-compressed data (ZLIB, GZIP, or DEFLATE format) from compression block boundaries on subsequent reads. This effectively allows you to randomly access DEFLATE-compressed data once the index is created.
Installation
zran can be installed in your preferred Python environment via pip:
python -m pip install zran
Currently, only macOS/Linux x86_64 and ARM64 architectures are supported. Please open an issue or submit a PR if you would like to see support for other platforms!
Usage
To use zran, you need to:
- Create an index for a compressed file
- Save this index
- Use this index to access the data on subsequent reads
To create and save the index:
import zran
with open('compressed.gz', 'rb') as f:
compressed_file = f.read()
index = zran.Index.create_index(compressed_file)
This Index can be written to a file (index.to_file('index.dflidx')), or directly passed to zran.deompress:
start = 1000
length = 2000
data = zran.decompress(compressed_file, index, start, length)
That's it!
Contributing
We use the standard GitHub flow to manage contributions to this project. Check out this documentation if you are unfamiliar with this process.
You can install a development version of zran via pip as well:
git clone https://github.com/forrestfwilliams/zran.git
cd zran
python -m pip install .
Then, run pytest to ensure that all tests are passing. We use black with line-length 120 for formatting and ruff for linting. Please ensure that your code is correctly formatted and linted before submitting a PR. As far as I can tell, pip installing with the --editable command is not valid when the code needs to be compiled, so you will need to re-install the package if you make any changes.
Similar Projects
If you prefer to work in the C programming language, you may want to work directly with the zran source C code in the zlib library. Paul McCarthy's indexed_gzip library was a huge inspiration for this project, and in particular was a huge help while creating our setup.py file. If you plan to work exclusively with gzip files, you may be better served by the indexed_gzip library. However, this project has some unique functionality that sets it apart:
- Use of the most up-to-date version of the
zranC library - Support for ZLIB, GZIP, and DEFLATE formatted data
- Greater visibility into the contents of indexes
- Compression of the indexes when written to a file, leading to smaller index file sizes
- The ability to modify the points contained within an index via the
Index.create_modified_index()method
Metadata
Release files for zran 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zran-0.1.0.tar.gz | 128.1 kB | Without provenance | Details for zran-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 6.3 MB
Release files / zran-0.1.0.tar.gz
| Download URL | zran-0.1.0.tar.gz |
|---|---|
| Size | 128.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12181a2363e0afb84b9651b3374d4e685970d6435a2afa4fe105bbbbda990f32
|
|
BLAKE2b-256 checksum How to use checksums |
385ac6650a3f35f33207885d2e1da21aa7eb2e4b1ac0b5dac6d9bcdf505fc5ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp311-cp311-musllinux_1_1_x86_64.whl
| Download URL | zran-0.1.0-cp311-cp311-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 585.3 kB |
| Tags | CPython 3.11 Linux musl 1.1+ x86-64 |
|
SHA-256 checksum How to use checksums |
73bee5391bdc1533a38a00765fed1acdb240a9dc688da05f6a3ae8dad2166b1d
|
|
BLAKE2b-256 checksum How to use checksums |
f4d3c6c73fb4c13ef6e6d2f7300d22a09edda49f07e7619aa886796c2a56a3a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zran-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 592.5 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8c08d2b74f84a8ada23aafda44aaccf1559e5e30def676b1334586fa8c8e3d46
|
|
BLAKE2b-256 checksum How to use checksums |
169588c6f2ab83ad9d642459ecc6d450685f7f3489d66d304298efc0038c6710
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | zran-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 198.5 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
188208f784388e4eacfff3fcdfe7138a049041d55dfe92d943c5499fad892eb1
|
|
BLAKE2b-256 checksum How to use checksums |
499a69b16c2194014ebbe5be4aa100a0299df79623d5d510fda2af6f6d3df7d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | zran-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 204.1 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
f8f7b58ef157abb9b0a0115567a583fb14a00e4ff78d74914432082f4d134022
|
|
BLAKE2b-256 checksum How to use checksums |
ce99d8ace30a2a52cb1b91606e0ceb534978e09d3c8752c05459637d91079354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp310-cp310-musllinux_1_1_x86_64.whl
| Download URL | zran-0.1.0-cp310-cp310-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 549.8 kB |
| Tags | CPython 3.10 Linux musl 1.1+ x86-64 |
|
SHA-256 checksum How to use checksums |
9d61c6575642c90a42a0afadf6097081426a748a1e0a0c3d5d64a003f07a504a
|
|
BLAKE2b-256 checksum How to use checksums |
c373aafc91e15995acd9b2e5a055ac471d722aa2a6a2705d04dd9af60991fbe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zran-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 549.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
39beee0212d639d8f15c706727717719d379c132fd0b316e9cb51dbe40eb8f74
|
|
BLAKE2b-256 checksum How to use checksums |
8c94a103bd9423faade4a3a8dc97ade8e64762e4c86a1b31b5131dfc49d6078b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | zran-0.1.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 197.9 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
aaafd9fe36a29496c1176a97242397b7807bd4211a9c0639ff9654679d22233a
|
|
BLAKE2b-256 checksum How to use checksums |
d1f343dc03234c9852d6b4e50ee8bd3486c0d1c49de37948d677578af1b67cc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | zran-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 203.3 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
16a20872afae20df16554e9df2ec0d17eecc18e454b30d4cdc44e5a303e36e7d
|
|
BLAKE2b-256 checksum How to use checksums |
b09b0395ba43bfa28ac43cc9b57749bba90411e2e856d285a1511622e4d02694
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp39-cp39-musllinux_1_1_x86_64.whl
| Download URL | zran-0.1.0-cp39-cp39-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 552.6 kB |
| Tags | CPython 3.9 Linux musl 1.1+ x86-64 |
|
SHA-256 checksum How to use checksums |
ae09a23cc5e090cf18257a40aedf97b2e54b675d9c8d131a5cedb94a2a1ddd58
|
|
BLAKE2b-256 checksum How to use checksums |
5a3e5d65a5fcc73208b58b6a77982d90661eebe04b1a6e333fa9ddbeb4492675
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zran-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 551.7 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
986ff5acba757f116e67c20b972628056f20d66a1a3cf0c51d42c2970e80ab4a
|
|
BLAKE2b-256 checksum How to use checksums |
c833e2e361f91cd61115d17dacf0ef4692cdee76b9cb50e406c4bf9b63d70e78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | zran-0.1.0-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 198.5 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
75a867ce3bce3ee084da629cbc636f631d6e2cf9832dec4586d83b855e72ab80
|
|
BLAKE2b-256 checksum How to use checksums |
3a8ac0d2dd45811af27b2651d4ee4a18e78cea4b735dddc223305448b066012a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | zran-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 203.7 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
c12d4b7cf5308588887b66ed0071574f894814b560c1151165a9e5da03081add
|
|
BLAKE2b-256 checksum How to use checksums |
103876925a6fa01188e758901edf2adcdcd09b99e31381809ad0b2f89f87f1a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp38-cp38-musllinux_1_1_x86_64.whl
| Download URL | zran-0.1.0-cp38-cp38-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 591.0 kB |
| Tags | CPython 3.8 Linux musl 1.1+ x86-64 |
|
SHA-256 checksum How to use checksums |
8da15eb85b112fdd9a7a4b23db70938abe60d059c44f4f9f1966c8ee697f3a6b
|
|
BLAKE2b-256 checksum How to use checksums |
2449302357b18b3e66e57a9f7aa2d2db30b91b1db949c72e1ecce74d31a259e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zran-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 566.0 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
416bfe9dcbe1505bf902705d1dbd10339aa0f88cdd6e6eb6525a36f4f23d9183
|
|
BLAKE2b-256 checksum How to use checksums |
e2741e6716641b2992c18971a199ca32e7060ae68c49c0943167b6cb54369251
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
| Download URL | zran-0.1.0-cp38-cp38-macosx_11_0_arm64.whl |
|---|---|
| Size | 198.7 kB |
| Tags | CPython 3.8 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
be83b2064062d5a872b9bd756a662571440426445ec0719ba4165acf8ac3bbf0
|
|
BLAKE2b-256 checksum How to use checksums |
ab4cb910bdbb81da5024e761228a2fdd56aed42e8a87113e89afcdd37a4e4911
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / zran-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | zran-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 203.5 kB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
c8263bf2c59516c58d1af9067e2faf3d201689495f7afea19745de991503312e
|
|
BLAKE2b-256 checksum How to use checksums |
e0675e270ee1b3c44162712cc28f055fa730162aac86cd77dfb875764548dbe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for zran 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.