跳转到主要内容

Setuptools protobuf扩展插件

项目描述

protobuf对setuptools的支持

setuptools添加编译protobuf文件支持的插件。

依赖项

该插件需要外部protoc可执行文件,该文件是protobuf项目的一部分。在Debian系统中,此可执行文件包含在protobuf-compiler包中。

如果指定了protoc_version选项,将从github下载指定的protoc版本。如果没有指定,则期望环境中存在protoc二进制文件。您可以使用PROTOC环境变量覆盖该二进制文件。

可选地,如果选择了mypy附加组件,它还可以生成类型提示。

没有单独的install_proto命令;生成的文件(例如,_pb2.py文件)放置在源树中,并期望其他安装命令安装它们。

用法

您可以在setup.pysetup.cfgpyproject.toml中配置setuptools-protobuf

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操作

要安装protoc的GitHub操作,您可以使用setup-protoc操作

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

项目详情


下载文件

下载适合您平台文件的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

setuptools_protobuf-0.1.13.tar.gz (10.4 kB 查看哈希值)

上传时间

构建分发

setuptools_protobuf-0.1.13-py3-none-any.whl (9.5 kB 查看哈希值)

上传时间 Python 3

支持

AWSAWS云计算和安全赞助商DatadogDatadog监控FastlyFastlyCDNGoogleGoogle下载分析MicrosoftMicrosoftPSF赞助商PingdomPingdom监控SentrySentry错误日志StatusPageStatusPage状态页面