blobfile is a Python library that provides a unified interface for reading and writing files across local and remote blob storage systems, including Google Cloud Storage (GCS) and Azure Blob Storage (ABS). It offers an API similar to Python's built-in `open()` function, along with equivalents of common `os.path` and `shutil` operations. The current version is 3.2.0, released in April 2026, with a release cadence of approximately one major version per year.
pip install blobfileVerified import paths — ran on the pinned version, not inferred.
This example demonstrates writing to, checking the existence of, and reading from a file in Google Cloud Storage using blobfile.
Review and adjust your configuration settings if they differ from the new defaults.
Ensure that only one process writes to a blob at a time, or implement a mechanism to handle concurrent writes appropriately.
Set `streaming=False` if you need to append to files.
Avoid using character ranges in glob patterns; use explicit patterns instead.
Use the `version` parameter to handle version control during writes to Azure Blob Storage.
Ensure that the authentication credentials (e.g., via `GOOGLE_APPLICATION_CREDENTIALS` or `gcloud auth`) grant the required permissions (read/write/list) to the target resource, and verify that the cloud project's billing account is active and enabled.
Ensure that the Google Cloud project associated with the GCS bucket has an active billing account and that the credentials (e.g., `GOOGLE_APPLICATION_CREDENTIALS` environment variable or `gcloud auth application-default login`) grant the necessary write permissions to the target bucket.
Install the library using pip: `pip install blobfile`
Verify that the file path is correct and that the necessary read permissions are configured for the specified storage location.
Ensure that your cloud credentials are correctly set up and have the necessary permissions. For GCS, use `gcloud auth application-default login` or set `GOOGLE_APPLICATION_CREDENTIALS`. For Azure, set `AZURE_STORAGE_KEY` or configure `DefaultAzureCredential` by installing `azure-identity`.
Use `blobfile.BlobFile()` to open files, or one of the other specific functions like `blobfile.exists()`, `blobfile.copy()`, etc.: `import blobfile as bf` followed by `with bf.BlobFile('path/to/file', 'r') as f:`