Skip to main content

protobuf support for setuptools

Plugin for setuptools that adds support for compiling protobuf files.

Dependencies

The plugin requires the external protoc executable that is part of the protobuf project to be present. On Debian systems, this executable is shipped in the protobuf-compiler package.

If the protoc_version option is specified, the specified version of protoc will be downloaded from github. When it is not specified, a protoc binary is expected to be present in the environment. You can override the binary with the PROTOC environment variable.

Optionally, it can also generate typing hints if the mypy extra is selected.

There is no separate install_proto command; generated files (e.g. _pb2.py files) are placed in the source tree and expected to be installed by other install commands.

Usage

You can configure setuptools-protobuf in either setup.py, setup.cfg or pyproject.toml.

setup.py

from setuptools_protobuf import Protobuf

setup(
...
    setup_requires=['setuptools-protobuf'],
    protobufs=[Protobuf('example/foo.proto')],
)

setup.cfg

...

[options]
setup_requires =
    setuptools
    setuptools-protobuf

pyproject.toml

[build-system]
requires = ["setuptools", "setuptools-protobuf"]

[tool.setuptools-protobuf]
protobufs = ["example/foo.proto"]

# Require the generation of typing hints:
mypy = true

# Optionally, set the specific protoc version to use:
protoc_version = '25.1'

# Optionally, set a proto file search path (`--proto_path` or `-I` option to protoc)
proto_path = "src"

GitHub actions

To install protoc in a GitHub action, you can use the setup-protoc action:

- name: Install Protoc
  uses: arduino/setup-protoc@v2

Release files for setuptools-protobuf 0.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for setuptools-protobuf 0.1.16
File Size Uploaded
setuptools_protobuf-0.1.16.tar.gz 14.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-protobuf 0.1.16
File Interpreter ABI Platform
setuptools_protobuf-0.1.16-py3-none-any.whl Python 3 none any Details

Total release size: 25.5 kB

Release files / setuptools_protobuf-0.1.16.tar.gz

Download URL setuptools_protobuf-0.1.16.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
07f08b8cc49685169244c762cdd4f3375b115194ce2c5961907b360a4f47e510
BLAKE2b-256 checksum
How to use checksums
add672de3eb4eff299ad704156018888cfb67a8fc458245ac4c5dc8d2876e8fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2025.

Transparency log

Release files / setuptools_protobuf-0.1.16-py3-none-any.whl

Download URL setuptools_protobuf-0.1.16-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccdecaef75135ae86d15b05f1ec8264cb12e922121910a900d0dddcc07ed31b4
BLAKE2b-256 checksum
How to use checksums
22abd69f99056c24af77e0f4eb8a2af2ca39929f91415e27a6b26df6ad711c72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.16 This release

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

1 release file

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page