Setuptools protobuf扩展插件
项目描述
protobuf对setuptools的支持
为setuptools
添加编译protobuf文件支持的插件。
依赖项
该插件需要外部protoc
可执行文件,该文件是protobuf项目的一部分。在Debian系统中,此可执行文件包含在protobuf-compiler
包中。
如果指定了protoc_version
选项,将从github下载指定的protoc版本。如果没有指定,则期望环境中存在protoc
二进制文件。您可以使用PROTOC环境变量覆盖该二进制文件。
可选地,如果选择了mypy
附加组件,它还可以生成类型提示。
没有单独的install_proto
命令;生成的文件(例如,_pb2.py文件)放置在源树中,并期望其他安装命令安装它们。
用法
您可以在setup.py
、setup.cfg
或pyproject.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 查看哈希值)
构建分发
关闭
哈希值 for setuptools_protobuf-0.1.13-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 33bd45efc152eb38a7cb02e2e6d88488d3a8ccea654e9e06e5d17db891e990ec |
|
MD5 | 54977324933969f16e4360f8b5e2ce07 |
|
BLAKE2b-256 | 7047709c75e41299e65b3a7e27a898001af4b82e543a33b35c258d8e6dd953ab |