Registry / gcp / gcloud-storage-emulator

gcloud-storage-emulator

JSON →
library0.5.0pypypi✓ verified 84d ago

A stub emulator for the Google Cloud Storage API, useful for testing and development without connecting to real GCS. Current version 0.5.0, supports Python 3.6+. Release cadence is sporadic.

pip install gcloud-storage-emulator
INSTALL
IMPORT
SIG · GCLOUD-STORAGE-EMU
G
gcloud-storage-emulator
gcppythonv0.5.0
Install
5.1s avg
Import
—
Disk
57MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.5.0 · 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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 53.3MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 5.1s · import 0.000s · 54MB
57MB installed
● package 57MB
Code
Verified usage

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

Emulator
✓ import gcloud_storage_emulator
✗ from gcloud_storage_emulator import Emulator

Start the emulator, set environment variable, and use google-cloud-storage client.

from gcloud_storage_emulator import Emulator import os # Start the emulator on port 9023 emu = Emulator(port=9023) started = emu.start() # Point the client to the emulator os.environ['STORAGE_EMULATOR_HOST'] = 'http://localhost:9023' # Use google-cloud-storage client as usual from google.cloud import storage client = storage.Client() # List buckets (will be empty) buckets = list(client.list_buckets()) print(buckets) emu.stop()
gcloud-storage-emulator --version
Debug
Known issues
gotchaThe emulator does not persist data. All data is stored in memory and lost when the emulator stops.
fix
If you need persistence, consider using a different emulator (e.g., fake-gcs-server) or implement your own storage backend.
affects: all
gotchaThe environment variable STORAGE_EMULATOR_HOST must be set before creating the google-cloud-storage client. Otherwise, the client will connect to actual GCS.
fix
Set os.environ['STORAGE_EMULATOR_HOST'] = 'http://localhost:9023' before instantiating storage.Client().
affects: all
deprecatedThe Emulator class constructor signature changed in 0.4.0: the 'port' parameter replaced the old 'host' parameter.
fix
Use Emulator(port=9023) instead of Emulator(host='localhost:9023').
affects: 0.4.0+
Upgrade
Version history
0.5.0latest on PyPI · released Sep 29, 2021
Audit
Dependencies
google-cloud-storagerequiredThe emulator mimics the google-cloud-storage client; your code imports from google.cloud.storage.
Agent activity
35 hits · last 30 days
node
28
OpenAI (training)
1
Resources