---
schema_version: "1"
id: 7adec9b648376e020aeaede0bdbedc047a0e0f0be2d739ac2dc2ad42223ffbac
title: "Step 1: Generate the Stub Files"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/event-bus/pub-sub-api/guides/qs-generate-stub.md
canonical_url: https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-generate-stub.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fff9c7bdb8d5d349f78017c1590e67a8526f1db2f5e4cb87e01f1bb889052310
products:
  - Pub/Sub API
  - Event Bus Docs
---
# Step 1: Generate the Stub Files

**Prerequisites**

- Python 3.10 or later. Install Python from [https://www.python.org/downloads/](https://www.python.org/downloads/).

1. Install the Python package manager by running this command in the terminal.

   ```
   pip3 install grpcio grpcio-tools avro requests
   ```

   You can use a different package manager.

2. Clone the GitHub repository for Pub/Sub API from [_https://github.com/forcedotcom/pub-sub-api_](https://github.com/forcedotcom/pub-sub-api). The proto file name is `pubsub_api.proto`.
3. Switch to the python directory.

   ```
   cd python
   ```

4. Generate the stubs for the Pub/Sub API by running this command from the cloned directory.

   ```
   python3 -m grpc_tools.protoc --proto_path=../ pubsub_api.proto --python_out=. --grpc_python_out=.
   ```

   This command generates two files in your current directory: `pubsub_api_pb2.py` and `pubsub_api_pb2_grpc.py`. It also generates client and server code and protocol buffer code for populating, serializing, and retrieving message types.
