xds-protos
Package `xds-protos` is a collection of ProtoBuf generated Python files for xDS protos (or the data-plane-api). It provides Python bindings for the xDS (eXtensible Discovery Service) APIs, which enable dynamic configuration of proxies and load balancers, primarily used within the gRPC and Envoy ecosystems. The current version is 1.80.0, released on March 30, 2026, and it is actively maintained as part of the gRPC project, with frequent updates that often align with gRPC releases.
Warnings
- breaking Some xDS proto types, notably `TypedStruct`, have migrated from the `udpa.type.v1` package to `xds.type.v3`. This changes their Python import paths (e.g., from `udpa.type.v1.typed_struct_pb2` to `xds.type.v3.typed_struct_pb2`). Consumers of specific xDS types should verify their imports, especially when upgrading.
- gotcha The xDS APIs are constantly evolving, and some features, or even entire protos, are marked as 'work-in-progress'. These entities are subject to breaking changes without prior notice.
- gotcha xDS utilizes two primary transport protocols: State-of-the-World (SotW) and Delta xDS. These protocols use different request/response protos (`DiscoveryRequest`/`DiscoveryResponse` for SotW vs. `DeltaDiscoveryRequest`/`DeltaDiscoveryResponse` for Delta xDS) and are fundamentally incompatible. Mixing them will lead to failures.
- gotcha Protoc-Gen-Validate (PGV) annotations on xDS protos can evolve, making validation rules less strict over time without being considered a breaking API change. This can lead to situations where a control plane expects stricter validation than a client built with older protos, or vice-versa, causing resource rejection mismatches.
- gotcha This package consists of generated Python protobuf code. It has a runtime dependency on the `protobuf` Python package. Incompatibilities can arise if the `xds-protos` package is generated with a `protoc` version that is significantly newer or older than the `protobuf` runtime library installed in the environment.
Install
-
pip install xds-protos
Imports
- DiscoveryRequest
from envoy.service.discovery.v3 import discovery_pb2
- Cluster
from envoy.config.cluster.v3 import cluster_pb2
- TypedStruct
from xds.type.v3 import typed_struct_pb2
Quickstart
from envoy.service.discovery.v3 import discovery_pb2
# Create a simple DiscoveryRequest message
request = discovery_pb2.DiscoveryRequest(
version_info='1.0.0',
node=None, # In a real scenario, this would be a Node message
resource_names=['my-cluster'],
type_url='type.googleapis.com/envoy.config.cluster.v3.Cluster',
response_nonce='some-nonce'
)
print(f"Created DiscoveryRequest: {request}")
# Accessing fields
print(f"Requested resource names: {request.resource_names}")