Skip to main content

Protobuf code generator for gRPC

Project description

Package for gRPC Python tools.

Installation

The gRPC Python tools package is available for Linux, Mac OS X, and Windows running Python 2.7.

From PyPI

If you are installing locally…

$ pip install grpcio-tools

Else system wide (on Ubuntu)…

$ sudo pip install grpcio-tools

If you’re on Windows make sure that you installed the pip.exe component when you installed Python (if not go back and install it!) then invoke:

$ pip.exe install grpcio-tools

Windows users may need to invoke pip.exe from a command line ran as administrator.

n.b. On Windows and on Mac OS X one must have a recent release of pip to retrieve the proper wheel from PyPI. Be sure to upgrade to the latest version!

You might also need to install Cython to handle installation via the source distribution if gRPC Python’s system coverage with wheels does not happen to include your system.

From Source

Building from source requires that you have the Python headers (usually a package named python-dev) and Cython installed. It further requires a GCC-like compiler to go smoothly; you can probably get it to work without GCC-like stuff, but you may end up having a bad time.

$ export REPO_ROOT=grpc  # REPO_ROOT can be any directory of your choice
$ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc $REPO_ROOT
$ cd $REPO_ROOT
$ git submodule update --init

$ cd tools/distrib/python/grpcio_tools
$ python ../make_grpcio_tools.py

# For the next command do `sudo pip install` if you get permission-denied errors
$ pip install .

You cannot currently install Python from source on Windows. Things might work out for you in MSYS2 (follow the Linux instructions), but it isn’t officially supported at the moment.

Troubleshooting

Help, I …

  • … see a pkg_resources.VersionConflict when I try to install grpc

    This is likely because pip doesn’t own the offending dependency, which in turn is likely because your operating system’s package manager owns it. You’ll need to force the installation of the dependency:

    pip install --ignore-installed $OFFENDING_DEPENDENCY

    For example, if you get an error like the following:

    Traceback (most recent call last):
    File "<string>", line 17, in <module>
     ...
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 509, in find
      raise VersionConflict(dist, req)
    pkg_resources.VersionConflict: (six 1.8.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.10'))

    You can fix it by doing:

    sudo pip install --ignore-installed six
  • … see compiler errors on some platforms when either installing from source or from the source distribution

    If you see

    /tmp/pip-build-U8pSsr/cython/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory
    #include "Python.h"
                    ^
    compilation terminated.

    You can fix it by installing python-dev package. i.e

    sudo apt-get install python-dev

    If you see something similar to:

    third_party/protobuf/src/google/protobuf/stubs/mathlimits.h:173:31: note: in expansion of macro 'SIGNED_INT_MAX'
    static const Type kPosMax = SIGNED_INT_MAX(Type); \\
                               ^

    And your toolchain is GCC (at the time of this writing, up through at least GCC 6.0), this is probably a bug where GCC chokes on constant expressions when the -fwrapv flag is specified. You should consider setting your environment with CFLAGS=-fno-wrapv or using clang (CC=clang).

Usage

Given protobuf include directories $INCLUDE, an output directory $OUTPUT, and proto files $PROTO_FILES, invoke as:

$ python -m grpc.tools.protoc -I$INCLUDE --python_out=$OUTPUT --grpc_python_out=$OUTPUT $PROTO_FILES

To use as a build step in distutils-based projects, you may use the provided command class in your setup.py:

setuptools.setup(
  # ...
  cmdclass={
    'build_proto_modules': grpc.tools.command.BuildPackageProtos,
  }
  # ...
)

Invocation of the command will walk the project tree and transpile every .proto file into a _pb2.py file in the same directory.

Note that this particular approach requires grpcio-tools to be installed on the machine before the setup script is invoked (i.e. no combination of setup_requires or install_requires will provide access to grpc.tools.command.BuildPackageProtos if it isn’t already installed). One way to work around this can be found in our grpcio-health-checking package:

class BuildPackageProtos(setuptools.Command):
  """Command to generate project *_pb2.py modules from proto files."""
  # ...
  def run(self):
    from grpc.tools import command
    command.build_package_protos(self.distribution.package_dir[''])

Now including grpcio-tools in setup_requires will provide the command on-setup as desired.

For more information on command classes, consult distutils and setuptools documentation.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

grpcio-tools-1.2.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

grpcio_tools-1.2.0-cp36-cp36m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.6m Windows x86-64

grpcio_tools-1.2.0-cp36-cp36m-win32.whl (1.1 MB view details)

Uploaded CPython 3.6m Windows x86

grpcio_tools-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.6m

grpcio_tools-1.2.0-cp36-cp36m-manylinux1_i686.whl (18.5 MB view details)

Uploaded CPython 3.6m

grpcio_tools-1.2.0-cp36-cp36m-macosx_10_9_intel.whl (3.2 MB view details)

Uploaded CPython 3.6m macOS 10.9+ intel

grpcio_tools-1.2.0-cp35-cp35m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.5m Windows x86-64

grpcio_tools-1.2.0-cp35-cp35m-win32.whl (1.1 MB view details)

Uploaded CPython 3.5m Windows x86

grpcio_tools-1.2.0-cp35-cp35m-manylinux1_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.5m

grpcio_tools-1.2.0-cp35-cp35m-manylinux1_i686.whl (18.5 MB view details)

Uploaded CPython 3.5m

grpcio_tools-1.2.0-cp35-cp35m-macosx_10_9_intel.whl (3.2 MB view details)

Uploaded CPython 3.5m macOS 10.9+ intel

grpcio_tools-1.2.0-cp34-cp34m-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.4m Windows x86-64

grpcio_tools-1.2.0-cp34-cp34m-win32.whl (1.6 MB view details)

Uploaded CPython 3.4m Windows x86

grpcio_tools-1.2.0-cp34-cp34m-manylinux1_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.4m

grpcio_tools-1.2.0-cp34-cp34m-manylinux1_i686.whl (18.5 MB view details)

Uploaded CPython 3.4m

grpcio_tools-1.2.0-cp34-cp34m-macosx_10_9_intel.whl (3.2 MB view details)

Uploaded CPython 3.4m macOS 10.9+ intel

grpcio_tools-1.2.0-cp27-cp27mu-manylinux1_x86_64.whl (19.2 MB view details)

Uploaded CPython 2.7mu

grpcio_tools-1.2.0-cp27-cp27mu-manylinux1_i686.whl (18.5 MB view details)

Uploaded CPython 2.7mu

grpcio_tools-1.2.0-cp27-cp27m-win_amd64.whl (1.5 MB view details)

Uploaded CPython 2.7m Windows x86-64

grpcio_tools-1.2.0-cp27-cp27m-win32.whl (1.6 MB view details)

Uploaded CPython 2.7m Windows x86

grpcio_tools-1.2.0-cp27-cp27m-manylinux1_x86_64.whl (19.2 MB view details)

Uploaded CPython 2.7m

grpcio_tools-1.2.0-cp27-cp27m-manylinux1_i686.whl (18.5 MB view details)

Uploaded CPython 2.7m

grpcio_tools-1.2.0-cp27-cp27m-macosx_10_10_intel.whl (2.9 MB view details)

Uploaded CPython 2.7m macOS 10.10+ intel

File details

Details for the file grpcio-tools-1.2.0.tar.gz.

File metadata

File hashes

Hashes for grpcio-tools-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6fc83d6ad23d7750da1cd6d561ac3a1a7d5e3f8387b6cc964040fe433ea53d8d
MD5 6987107729dc50f1b6aa7fdc207643a9
BLAKE2b-256 5a7f8d070935a662bf03d01a4a3e3c90577362dae5e8b8b22909904a74ebb2ba

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 df352af84f74ef7587fb00f7e410f7a8237be280943c3ddf48c38151d92a57de
MD5 527ef81afcce9c93d057e9a261119292
BLAKE2b-256 a2d5122239edbcbc9790c1152973c84c108341fce05a5498afa53a67e40ef21c

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 bc3f81911d8fdcc29798a255f50d2b96ad02d3243943a207329a920094e779db
MD5 957133f0daf820ebc7f4a3a79a1b7771
BLAKE2b-256 318fc2a99ec5864ddcab0b132ff3c193f847fa508b0c56023a31adaed321155f

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e3ef785806ca37e1ba407f27b24599e5873f4cbfc9052b8b160cd5e5ecedea99
MD5 0ee1882b2a5dc60453b15aa087d7ae80
BLAKE2b-256 f804879a27a510656d255542826d0852b4b2ead0910d928f463456c4d5a3a0bb

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 effe7ddee6251ee3abe84a69cdb1fa345d345e27664b1836c5afdc7130c171db
MD5 f2b565d272d9fbb94f135272a7400a85
BLAKE2b-256 e081ea2f54044441bdd89e7ebc9ae188786666aeb322c392396b69472046ba11

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp36-cp36m-macosx_10_9_intel.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp36-cp36m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 0b517b47ab5c82863330f566b578f1c393300a99b797bdb5fe3dc2a417d83254
MD5 ad431cdce13d4746110c89840f55527e
BLAKE2b-256 d22d93c47188165c4d7dae94540c6ef2def5b34ca685143d83e3eda15f6faf26

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 f771a329ca2f010e562e3b704cfe1e9f6cacafe02225a542dfc796f1a1561b3e
MD5 ab8a56ef4f24924cfa56e9fce0cf0da2
BLAKE2b-256 57e0804ce2cbbe997728b72574b2349e40518774cb543d475a282110cf681e98

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 486a5bce47d5e17d55002b99a42265db27313c2ceb0878f72b1441b0a46c7761
MD5 6ba0429bb750471275a987c0a4097cd8
BLAKE2b-256 31d760b2530352c54e59e7ef34dc89a53f53ffa02a246548f3c7b820772957c6

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8d79a2793bd0d4f474e9b08c956d31a15720b4347d938d0300e04f6dda284658
MD5 6ed34b7d4cf8194b5f1627920dda69da
BLAKE2b-256 975ffda5570661caf252d7bed24a13ccb83ae5f622559689d8b556a3734273e0

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 c63f1a2715f51de2a2d0131da22f02ac30e0a4e3903f94a8bc3cc1614729894e
MD5 91d165ae1b8bc5c62f411be2b0ac4ddb
BLAKE2b-256 3ca0094ee00ef1a292eb3b36ee26b0b7da1055a7be9a6870c74c19caf37faff5

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp35-cp35m-macosx_10_9_intel.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp35-cp35m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 1cc5213e0a2e23f7890cfd1fefcd0519b7d17d822ecb1ca8dea5654595866f77
MD5 09e548e15f1bbd05d87719f98ef7fa62
BLAKE2b-256 4262bc32ff02dbda0551fc0151b3cd38a041ce61b0ae5e9be71a2e8643e7e7bd

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 1b4e682e2ceae14b0405081af7b00fbe8929aa7158a2e9b097196781e163d4f3
MD5 0447ad3db971c40d3923375a08033bf8
BLAKE2b-256 550f692b4638e3a588e60e3e88966e0ed60e143c80e987abd0b50fcb3bb556ff

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 65b336e0839dbd9166e6a7d71a9c0506df665c2f05040e84fa2f94342bd158a7
MD5 0918b30adae52e8718697a0075afa5d2
BLAKE2b-256 ba0065127b36547ec356923292c97d6ef5672a77e917cbb7c98e24328bdda33a

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 721091b71e2ff5c1478d872a92beb945d08874fd51d602c54b09a6ba5d62ae42
MD5 afcfe51fc0394103cbfef78c247a4067
BLAKE2b-256 8ea181f01528b12db3b9824f2a4e922b34fab021e02c073c4915c5bcd6c705ed

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp34-cp34m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 c3c8db3c237e1a4d98a9dcc4bc8b7b951ebd9064197d9c384c717fc8e2b51a05
MD5 d79b6ff83bdf21a0a8d9be0e7a42e385
BLAKE2b-256 153ae0cc910df614a76e034c20218c2bd090a4c74fef032573dd09fce7f9fce5

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp34-cp34m-macosx_10_9_intel.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp34-cp34m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 0ff852ed73b61a87f18e755ff13e5ff8fe6a449da696fc766ecf0dc010bab00f
MD5 bd071cc30611ec6371d09d541b0691de
BLAKE2b-256 c48d6a873aaf76129fa6e8d5202c5b2fcf64398eb25b9695f38a8f8f72bba5f1

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c8728918185f1c93b0637f3e1448c3601b090cafdace9d83e9b50da7c2007468
MD5 39d2ef4c68747fed3c4db373f777c711
BLAKE2b-256 0610800f54f99950caca816925353c7b79d3880e81ba9f00e92b23955186eb4f

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27mu-manylinux1_i686.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7d54004ec9082e01b786f08c44bdaaf09b14b44741b1a2927bd48b8903fa123f
MD5 faabc20cecd10ed464ba0758c55e64ef
BLAKE2b-256 a4a4db3c4cb08588a7c01201a61cac01c7ae768bb4c0eb57f20c27a612d8f2da

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 0de98960b4383d6eb0ad3f28b54e80631d409ab973aa756b7860931ef03034a8
MD5 fbf4135657659e210217d9536e531ac6
BLAKE2b-256 288c54183ef0be9867cf7422990967c5287a695731be1754c38ab918945e5ed0

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 3da22c7e02adaf2bca65f7794cc2f05d5ead9fa27dd776cb14f56d12d6e53065
MD5 8d25ac857e266d3c9bf2f32795962712
BLAKE2b-256 c950d2d9fc2c919ebf905a7523023fdea95f77d6c6c3285c4b21b3f2ea9d2558

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 63b6f5a9e33aca0f1b07ed55f4cb1a65425240ad477a0efdfebc546acdb4744f
MD5 9357141489b1b4ed35e52a9232ce3b1c
BLAKE2b-256 4af325c0c7c95e41c2778549e4d1981dcdbde5ca6c6d666de67244dce4e2ff3c

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 252627ea8ad81490858c2beeab4b889f68d4ee753366d6edb69ea143760e69fb
MD5 c74313c29124f5c035fee926cd20fee9
BLAKE2b-256 7ff5f20cb4dfe1c61fa2e9f6277d3a1a964827147e5e9214d081e13c4496bf5f

See more details on using hashes here.

Provenance

File details

Details for the file grpcio_tools-1.2.0-cp27-cp27m-macosx_10_10_intel.whl.

File metadata

File hashes

Hashes for grpcio_tools-1.2.0-cp27-cp27m-macosx_10_10_intel.whl
Algorithm Hash digest
SHA256 06f0a25bf6c2ea139230996271b6ee8e499fa00563b103905ab7380b99a38ff4
MD5 d9c23b3bebcfbfa2c97e030d5fd60c7a
BLAKE2b-256 2c5627505c17c001c5fec91fd6026e13a3c4bd9c709527142645d3e54bcb15ec

See more details on using hashes here.

Provenance

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