Skip to main content

Setuptools protobuf extension plugin

Project description

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'

GitHub actions

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools_protobuf-0.1.13.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

setuptools_protobuf-0.1.13-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file setuptools_protobuf-0.1.13.tar.gz.

File metadata

  • Download URL: setuptools_protobuf-0.1.13.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for setuptools_protobuf-0.1.13.tar.gz
Algorithm Hash digest
SHA256 f224c2f751baf1e5620aeb904b8b6e1a54ef18fc217e9f36398b70d35cb6e716
MD5 5f048b6ef2ab119d5f7301cea8a9e37b
BLAKE2b-256 c9736884cd49335fafad24014199c0d2717f7e7731f29f84d681ea7a07c5f41f

See more details on using hashes here.

File details

Details for the file setuptools_protobuf-0.1.13-py3-none-any.whl.

File metadata

File hashes

Hashes for setuptools_protobuf-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 33bd45efc152eb38a7cb02e2e6d88488d3a8ccea654e9e06e5d17db891e990ec
MD5 54977324933969f16e4360f8b5e2ce07
BLAKE2b-256 7047709c75e41299e65b3a7e27a898001af4b82e543a33b35c258d8e6dd953ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page