GithubHelp home page GithubHelp logo

setuptools-proto's Introduction

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 in setup.py in a imperative fashion,

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

or in seutp.cfg in a declarative manner.

[options]
setup_requires =
    setuptools-proto

Configuration

Protobuf modules

To let setuptools-proto know what to compile, define proto_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 setuptools command build_proto is added, to compile .proto to python code. This command will be automatically run before setuptools command build_py.

setuptools-proto's People

Contributors

jameslan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.