Skip to main content

gs-chunked-io: Streams for Google Storage

gs-chunked-io provides transparently chunked io streams for google storage objects. Writable streams are managed as multipart objects, composed when the stream is closed.

IO opperations are concurrent by default. The number of concurrent threads can be adjusted using the threads parameter, or disabled entirely with threads=None.

import gs_chunked_io as gscio
from google.cloud.storage import Client

client = Client()
bucket = client.bucket("my-bucket")
blob = bucket.get_blob("my-key")

# Readable stream:
with gscio.Reader(blob) as fh:
    fh.read(size)

# Writable stream:
with gscio.Writer("my_new_key", bucket) as fh:
    fh.write(data)

# Process blob in chunks:
for chunk in gscio.for_each_chunk(blob):
    my_chunk_processor(chunk)

# Multipart copy with processing:
dst_bucket = client.bucket("my_dest_bucket")
with gscio.Writer("my_dest_key", dst_bucket) as writer:
    for chunk in gscio.for_each_chunk(blob)
	    process_my_chunk(chunk)
	    writer(chunk)

# Extract .tar.gz on the fly:
import gzip
import tarfile
with gscio.Reader(blob) as fh:
    gzip_reader = gzip.GzipFile(fileobj=fh)
    tf = tarfile.TarFile(fileobj=gzip_reader)
    for tarinfo in tf:
        process_my_tarinfo(tarinfo)

Installation

pip install gs-chunked-io

Project home page GitHub
Package distribution PyPI

Bugs

Please report bugs, issues, feature requests, etc. on GitHub.

Metadata

Release files for gs-chunked-io 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gs-chunked-io 0.5.2
File Size Uploaded Provenance Actions
gs-chunked-io-0.5.2.tar.gz 8.1 kB Without provenance Details for gs-chunked-io-0.5.2.tar.gz

Release files / gs-chunked-io-0.5.2.tar.gz

Download URL gs-chunked-io-0.5.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
722e5ff718d9c91f4ac5e4d285ace599642e7c7c31188c025f3d07216c8e61e6
BLAKE2b-256 checksum
How to use checksums
aa765f86e2c4cc5d09c74e39f633a01bb75c3ad78d59e00b90105bb51e611288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.5

Security for gs-chunked-io 0.5.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page