grpc-google-pubsub-v1

raw JSON →
0.11.1 verified Fri May 01 auth: no python deprecated

Generated gRPC and protobuf definitions for the Google Cloud Pub/Sub V1 API. This library contains only the low-level gRPC stubs, not the higher-level google-cloud-pubsub client. Version 0.11.1 is the latest (as of early 2025) but this package is considered legacy; users should migrate to google-cloud-pubsub which bundles the proto stubs. Release cadence is irregular.

pip install grpc-google-pubsub-v1==0.11.1
error ModuleNotFoundError: No module named 'grpc_google_pubsub_v1'
cause The old snake_case import path has been removed; only namespaced imports under google.pubsub.v1 work.
fix
Use: from google.pubsub.v1 import publisher_pb2_grpc
error AttributeError: module 'google.pubsub.v1' has no attribute 'publisher_pb2_grpc'
cause The package is not installed or is outdated; the google.pubsub namespace may be provided by another package (e.g., google-cloud-pubsub) which bundles protos differently.
fix
Install grpc-google-pubsub-v1 and ensure googleapis-common-protos is also installed.
error ImportError: cannot import name 'PublisherClient' from 'google.pubsub.v1'
cause Confusion between low-level grpc layer and high-level client. This package only has gRPC stubs, not the client class.
fix
Use google-cloud-pubsub for the high-level client: from google.cloud import pubsub_v1 client = pubsub_v1.PublisherClient()
deprecated grpc-google-pubsub-v1 is deprecated. Use google-cloud-pubsub instead for a maintained, higher-level API.
fix Run: pip install google-cloud-pubsub and import from google.cloud import pubsub_v1.
gotcha Package name has no official 'google-' prefix on PyPI. Users often try 'google-grpc-pubsub-v1' which does not exist.
fix Install exactly: pip install grpc-google-pubsub-v1
gotcha This package does NOT contain the full Pub/Sub client; it only has gRPC stubs and protobuf message classes. You cannot call publish() or subscribe() directly.
fix Import protos from google.pubsub.v1 and create your own gRPC stubs. For convenience, upgrade to google-cloud-pubsub.

Minimal example to create a gRPC stub. Note: this package only provides protos; do not call gRPC methods without a running Pub/Sub emulator or service.

import grpc
from google.pubsub.v1 import publisher_pb2_grpc, publisher_pb2
# Create channel and stub
channel = grpc.insecure_channel('localhost:8080')
stub = publisher_pb2_grpc.PublisherStub(channel)
# Build request (requires project/topic set via env or code)
request = publisher_pb2.PublishRequest(topic='projects/my-project/topics/my-topic')
print('Stub created successfully')