Registry / gcp / gcloud-aio-storage

gcloud-aio-storage

JSON →
library9.6.4pypypi✓ verified 35d ago

gcloud-aio-storage is an asyncio-compatible Python client library for Google Cloud Storage. It provides full CRUD operations for buckets and blobs, including streaming support for large files, parallel upload capabilities, and built-in session management. Designed for high-performance cloud storage operations with modern async/await patterns, it is currently at version 9.6.4 and follows an active release cadence.

gcphttp-networkingdataaws
Install & Compatibility
Where this runs
tested against v9.6.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.918s · 63.4MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 6.2s · import 0.811s · 65MB
65MB installed
● package 65MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from gcloud.aio.storage import Storage
from gcloud.aio.storage import Bucket
from gcloud.aio.storage import Blob
from gcloud.aio.storage import StreamResponse

This quickstart demonstrates how to initialize the Storage client, upload a byte string, download it, and then delete the object. Ensure that Google Cloud authentication (e.g., via `GOOGLE_APPLICATION_CREDENTIALS` environment variable) and the `GCLOUD_PROJECT` environment variable are set, or provide them as arguments to the `Storage` client.

import asyncio import os from gcloud.aio.storage import Storage async def main(): # GCLOUD_PROJECT, GOOGLE_APPLICATION_CREDENTIALS, or similar env vars # should be set for authentication. project_id = os.environ.get('GCLOUD_PROJECT', 'your-gcp-project-id') bucket_name = 'your-gcs-bucket-name' file_name = 'hello_gcloud_aio.txt' content = b'Hello, gcloud-aio-storage!' async with Storage(project=project_id) as storage: print(f"Uploading '{file_name}' to bucket '{bucket_name}'...") await storage.upload(bucket_name, file_name, content, content_type='text/plain') print(f"'{file_name}' uploaded successfully.") print(f"Downloading '{file_name}' from bucket '{bucket_name}'...") downloaded_content = await storage.download(bucket_name, file_name) print(f"Downloaded content: {downloaded_content.decode()}") print(f"Deleting '{file_name}' from bucket '{bucket_name}'...") await storage.delete(bucket_name, file_name) print(f"'{file_name}' deleted successfully.") if __name__ == '__main__': asyncio.run(main())
Debug
Known footguns
gotchaWhen downloading large files and using `response.text()`, `aiohttp` (which `gcloud-aio-storage` uses) may default to `chardet` for character encoding detection, which can be very slow. Explicitly setting the `Content-Type` with a `charset` (e.g., `text/plain; charset=utf-8`) when uploading can significantly improve performance for text-based files.
breakingSupport for Python 3.9 was dropped in the `gcloud-aio-auth` component (version 5.4.4) of the `gcloud-aio` ecosystem. While this specifically refers to `gcloud-aio-auth`, it's generally indicative of the overall library's compatibility, so users on Python 3.9 attempting to upgrade other `gcloud-aio` components might encounter issues.
gotchaRecent releases include fixes related to `auto_decompress` handling in `download_stream` and `ClientSession` settings. Ensure you are not inadvertently overwriting or misconfiguring `auto_decompress` if you have custom `aiohttp.ClientSession` settings.
gotchaWhen passing custom metadata during an `upload()` operation, ensure it's nested under a 'metadata' key in the dictionary. Incorrectly structured metadata (e.g., top-level key-value pairs) will not be stored as custom metadata.
gotchaUsers have reported issues uploading files larger than 2GB, particularly when running on 32-bit Python installations. This is a common limitation for 32-bit systems regarding file sizes and memory addressing.
breakingThe `Storage` class constructor no longer accepts a `project` keyword argument. The library is designed to infer the project ID from the environment (e.g., `GOOGLE_CLOUD_PROJECT` environment variable) or from default credentials configured in the execution environment.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
20 hits · last 30 days
gptbot
4
claudebot
4
ahrefsbot
3
dotbot
1
chatgpt-user
1
Resources