Step 1: Generate the Stub Files


  1. Install the Python package manager by running this command in the terminal.

    You can use a different package manager.

  2. Clone the GitHub repository for Pub/Sub API from The proto file name is pubsub_api.proto.

  3. Switch to the python directory.

  4. Generate the stubs for the Pub/Sub API by running this command from the cloned directory.

    This command generates two files in your current directory: and It also generates client and server code and protocol buffer code for populating, serializing, and retrieving message types.