- Your language isn’t Python, Rust, or Go, the languages Sift’s official clients support.
- Your environment requires a different protobuf version than Sift’s packaged client uses, for example because your firmware or software is pinned to an older version.
- You need raw generated stubs for a custom ingestion pipeline instead of a full SDK.
Before you begin
- Install the Buf CLI.
- Have access to clone the Sift GitHub repository.
- Identify the Buf plugin for your target language. This guide uses Python as an example, but the process applies to any language Buf supports.
How Buf-based client generation works
Buf compiles Sift’s Protocol Buffers into client code using plugins you specify in a configuration file. Each plugin targets a language and can be pinned to a specific version, independent of the protobuf version used inside Sift’s own client libraries. This is what makes Buf useful when the official client doesn’t fit: you control the exact language, protobuf version, and generated output, rather than taking Sift’s packaged SDK as-is.Generate a client with Buf
-
Create a new directory for your client, and navigate into it. This directory holds your Buf configuration and the generated code.
-
Authenticate to the Buf Schema Registry. The plugins in this workflow run remotely on Buf’s registry, so an unauthenticated CLI will fail with an invalid token error.
-
Clone the Sift GitHub repository to access the Protocol Buffer definitions locally.
Location: The
.protofiles are located in the sift subdirectory insideprotos/in the repository. -
In your client directory, create a file named
buf.gen.yaml. This file specifies the plugins Buf should use, the versions to pin, and where the generated code should be written.This configuration generates Python message classes, gRPC client and server stubs, and type hint files to thegen/directory.Version pinning: To match a protobuf version required by your environment, pin the plugin version, for examplebuf.build/protocolbuffers/python:v3.19.5.Other languages: To generate a client for another language, use a different plugin here. Only the plugin selection and version pinning change; the rest of this workflow stays the same. -
From inside your client directory, export the
.protofiles from the Sift repository into a local directory.sift_protosis the output directory in this example, andsift/protos/buf.yamlis thebuf.yamlfile in the protos subdirectory of the cloned repository. -
In the directory containing
buf.gen.yaml, generate the client code from the exported.protofiles.Dependencies: Generated code often requires additional runtime dependencies to work. Check the documentation for each plugin you use to identify what to install.
Verify the generated client
Check the output directories specified inbuf.gen.yaml. For the example configuration above, the gen/ directory should contain:
- Python message classes
- gRPC client and server stubs
.pyitype hint files
buf.gen.yaml and that buf generate completed without errors.