Skip to main content

setuptools-proto

setuptools plugin to compile .proto files using python-betterproto.

Prerequisite

  • Protobuf compiler protoc
  • Python 3.6+

Enable setuptools-proto

In either of the following scenarios, setuptools-proto will take effects.

  • Option 1, install setuptools-proto using pip or other tools:
$ pip install setuptools-proto
  • Option 2, require setuptools-proto in setup_requires keyword of setuptools.

So, add it either

setuptools.setup(
    setup_requires=['setuptools-proto'],
)

in setup.py in a imperative fashion or

[options]
setup_requires =
    setuptools-proto

in seutp.cfg in a declarative manner.

Configuration

Protobuf modules

To let setuptools-proto know what to compile, define prot_modules as a ProtoModule list.

from setuptools import setup
from setuptools_proto import ProtoModule

module1 = ProtoModule(
    ['proto/sample/**/*.proto'],
    cwd='proto/sample',
)
module2 = ProtoModule(
    ['demo/grpc/echo.proto', 'demo/grpc/hello.proto'],
    cwd='demo/grpc',
    out_dir='proto',
    include_dirs=['demo/schema'],
)


setup(
    proto_modules=[module1, module2],
)

protoc compiler

By default, setuptools-proto will use the system protoc compiler. If there's a custom install of protoc, which is not in the PATH, You can point environment variable PROTOC to it, or command line argument --protoc to it.

For example,

$ python setup.py --protoc /path/to/protoc build_proto

Execute

An extra command build_proto is added, to compile .proto to python code. This command will be automatically run before command build_py.

Release files for setuptools-proto 1.0.0

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-proto 1.0.0
File Size Uploaded
setuptools-proto-1.0.0.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-proto 1.0.0
File Interpreter ABI Platform
setuptools_proto-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / setuptools-proto-1.0.0.tar.gz

Download URL setuptools-proto-1.0.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a7f6839c186fcc53e6d19806971acb6c6c244eecf61d8d24edd2a39af05dd6ae
BLAKE2b-256 checksum
How to use checksums
1c693fcf0cfa9027be92b4cc4f0c27a9c2847d156844c6f84ab4a1f550c659da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

Release files / setuptools_proto-1.0.0-py3-none-any.whl

Download URL setuptools_proto-1.0.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75623e2c45f120262a814a9a841da363ae6574d544c925886cc05da611bae53d
BLAKE2b-256 checksum
How to use checksums
1020f1e0082973939e590e5d98162098ed1a1d97c5815fc7fa6167ed89fa7c28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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