{"id":1402,"library":"blobfile","title":"blobfile","description":"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.","status":"active","version":"3.2.0","language":"en","source_language":"en","source_url":"https://github.com/blobfile/blobfile","tags":["file-io","cloud-storage","gcs","azure-blob-storage","python"],"install":[{"cmd":"pip install blobfile","lang":"bash","label":"Install blobfile"}],"dependencies":[{"reason":"XML parsing for Azure Blob Storage operations","package":"lxml","optional":false},{"reason":"Cryptographic functions for secure operations","package":"pycryptodomex","optional":false},{"reason":"File locking mechanisms for concurrent access","package":"filelock","optional":false},{"reason":"HTTP client for making requests to storage services","package":"urllib3","optional":false}],"imports":[{"note":"The correct import is case-sensitive; 'BlobFile' is the class name.","wrong":"from blobfile import blobfile","symbol":"BlobFile","correct":"from blobfile import BlobFile"},{"note":"The function name is 'exists', not 'exist'.","wrong":"from blobfile import exist","symbol":"exists","correct":"from blobfile import exists"}],"quickstart":{"code":"import blobfile as bf\n\n# Write a file to Google Cloud Storage\nwith bf.BlobFile('gs://my-bucket-name/cats', 'wb') as f:\n    f.write(b'meow!')\n\n# Check if the file exists\nprint('exists:', bf.exists('gs://my-bucket-name/cats'))\n\n# Read the file back\nwith bf.BlobFile('gs://my-bucket-name/cats', 'rb') as f:\n    print('contents:', f.read())","lang":"python","description":"This example demonstrates writing to, checking the existence of, and reading from a file in Google Cloud Storage using blobfile."},"warnings":[{"fix":"Review and adjust your configuration settings if they differ from the new defaults.","message":"In version 2.0.0, the default values for `configure` were changed to `output_az_paths=True` and `save_access_token_to_disk=True`.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure that only one process writes to a blob at a time, or implement a mechanism to handle concurrent writes appropriately.","message":"Azure Blob Storage does not support multiple writers for the same blob; concurrent writes may lead to `ConcurrentWriteFailure` errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Set `streaming=False` if you need to append to files.","message":"When using `streaming=True` in `BlobFile`, appending to files is not implemented.","severity":"gotcha","affected_versions":"all"},{"fix":"Avoid using character ranges in glob patterns; use explicit patterns instead.","message":"The `glob` function supports glob-style patterns but does not support character ranges.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the `version` parameter to handle version control during writes to Azure Blob Storage.","message":"When writing to Azure Blob Storage, the `version` parameter can be used to ensure the remote version matches; mismatches raise a `VersionMismatch` error.","severity":"gotcha","affected_versions":">=2.0.2"}],"env_vars":null,"last_verified":"2026-04-08T00:00:00.000Z","next_check":"2026-07-07T00:00:00.000Z"}