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.3.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

grpcio_tools-1.3.0-cp36-cp36m-manylinux1_x86_64.whl (19.1 MB view details)

Uploaded CPython 3.6m

grpcio_tools-1.3.0-cp36-cp36m-manylinux1_i686.whl (18.4 MB view details)

Uploaded CPython 3.6m

grpcio_tools-1.3.0-cp36-cp36m-macosx_10_9_intel.whl (3.3 MB view details)

Uploaded CPython 3.6m macOS 10.9+ intel

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

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m Windows x86

grpcio_tools-1.3.0-cp35-cp35m-manylinux1_x86_64.whl (19.1 MB view details)

Uploaded CPython 3.5m

grpcio_tools-1.3.0-cp35-cp35m-manylinux1_i686.whl (18.4 MB view details)

Uploaded CPython 3.5m

grpcio_tools-1.3.0-cp35-cp35m-macosx_10_9_intel.whl (3.3 MB view details)

Uploaded CPython 3.5m macOS 10.9+ intel

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

Uploaded CPython 3.4m Windows x86-64

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

Uploaded CPython 3.4m Windows x86

grpcio_tools-1.3.0-cp34-cp34m-manylinux1_x86_64.whl (19.1 MB view details)

Uploaded CPython 3.4m

grpcio_tools-1.3.0-cp34-cp34m-manylinux1_i686.whl (18.4 MB view details)

Uploaded CPython 3.4m

grpcio_tools-1.3.0-cp34-cp34m-macosx_10_9_intel.whl (3.3 MB view details)

Uploaded CPython 3.4m macOS 10.9+ intel

grpcio_tools-1.3.0-cp27-cp27mu-manylinux1_x86_64.whl (19.1 MB view details)

Uploaded CPython 2.7mu

grpcio_tools-1.3.0-cp27-cp27mu-manylinux1_i686.whl (18.4 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m Windows x86

grpcio_tools-1.3.0-cp27-cp27m-manylinux1_x86_64.whl (19.1 MB view details)

Uploaded CPython 2.7m

grpcio_tools-1.3.0-cp27-cp27m-manylinux1_i686.whl (18.4 MB view details)

Uploaded CPython 2.7m

grpcio_tools-1.3.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.3.0.tar.gz.

File metadata

File hashes

Hashes for grpcio-tools-1.3.0.tar.gz
Algorithm Hash digest
SHA256 3b1417ec3bd5a906e5693a7bd2cf9b9bc8083b0be96a575b27454607f2765ef8
MD5 679ff621f48cae54cc019d24548682bb
BLAKE2b-256 b2c59443480380f5ff28b1e301801243597a77a4e9c4386771355c769499d2c1

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 09e5a13db64f5ab449718736c2ab62875e80d7a9dc1711b17ab464c4bb296ab3
MD5 782f0975e2d98cfa98e8dfe18c08a12d
BLAKE2b-256 5bb44e8fc836239abefea5305ddfc87f913bcbe6dbbe1d44c301cf799dba685f

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 49bb93c9e4a00a19908c61ed68b7ad68fe52c3ea0d0556edbdbf885de8074fd4
MD5 ce58f7b6b212bb35621b4f1f33386120
BLAKE2b-256 e26392a0b3833cee079f002ab3ea98853f2b592cb40932abcb6eebc71bc10efd

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0841f1da9dbaa04184207863b184ef6fce335f9d08f1f25eec8c3217eb3852b9
MD5 d7a3fb60a3c34e8137854ca689dc9c1c
BLAKE2b-256 e348e4ecaff637af3f4b756a39f5892f6cd7cc7b6dea04597ffb7739cb9565c9

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 f405f8d17cf4b27108a8745476bf29d7f16a5d84f184d7d9e76ba883e9fcce45
MD5 7a38b2622575c2f69bad39bb51b8e0aa
BLAKE2b-256 6951c0e1c6de77ce0ad86fade4a00b6f1fa042cc5f12e16cc2f66f7ae6b2ae5f

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp36-cp36m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 0606883e82e05363fcb981b4c70b0b7becda0ba401a57472a17cd9ae3826ea3c
MD5 8c16d161077b0a687579c5df703e358e
BLAKE2b-256 e245984e93773e5f47419aa83c6ed79e025426c82e25d11633e3d7b5e943dee2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 51b20adcbef69a1a9ffca59d38b05f84e73ff39f6b77596db74ed95e593207ba
MD5 ac08c07a0751b7d724527bf6830aea78
BLAKE2b-256 3b83f59f3b3c5d041b430041e5b2feae1223a351b5d913e128aede66312522cd

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 08a23d3b093c3e1ce30eb10301cd137dae283f4aea071a8d2005397eb893ec84
MD5 dd9574baab31324e965360fa643f55f0
BLAKE2b-256 f563cfbcd27325ed6b6bf6f93661158166241e8868b0db6b5a262d328157c0e0

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2a79b06a0004182bcef1b91a8830763a6077fc8ccba63376c2d333f33f147a5e
MD5 61b425a142ceb111276729810b0c3061
BLAKE2b-256 fe5cbbef2f7dcd793cbd03b6881da4f912d9cb44624e29b64d3da80529aeb693

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 1ef3ee996b1a3042e7586a4701cb2bd45cecb5bbfcc908e63284526764f0d990
MD5 3240afb50f2afd5d440a3b0da749a794
BLAKE2b-256 4afe18a4b616e50a8267567cabec2642b53d15639264064412b7dea1c21ace91

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp35-cp35m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 967814b71dfc49bdad270223e47c4df575ba9b817dbdb9b6bfdc0add690281bc
MD5 44bc5ba3d6060b93ab131a0575ae80af
BLAKE2b-256 a866f8bf5d4386a059c872df3281b29b4bcad06a5526def672ab4915abe9d6e5

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 0d57a2617e1d474d46ec3c8cba8f61b10883a9ae93b0bc93d63ab390fc4747eb
MD5 e2d895ec98976bca65cbb4bf0338e370
BLAKE2b-256 da35f49a61ab4a6d71c345daa41752e22b0628cb84776b4966cc3f4ca1b3eba2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 d31ca1e1af79d734151aeff3f9b62b8a7d65b534aa085d6540d2930b5e3db470
MD5 8d6fab292a9a4821090e7e1c466aa555
BLAKE2b-256 28cba61c2d22a19c0aa92158b6bc0a3eee5ef1d9685c8650045d59a79957a711

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fb1a263e767b7395c8a1cd94874d999fe6d2cbde7acd69f0c6053874b09f27ab
MD5 6cdcdbe12fe657b429f5f0aec8a3168c
BLAKE2b-256 9b56432b9c7a04f62f87b8a6f6492ab9517dba3dd1a9e063695c62a8ec3a5313

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3d3c8310de75caa78700231159ae0d0bd5ea957a7ef79d325db40b6304a7c179
MD5 4f719960467a14b5e587e386933aa331
BLAKE2b-256 862c9d78267b91a46b119ba5f296705d71e2fee1c24b6102d04c01d5a7722a4a

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp34-cp34m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 f87049b1a8265883fdd5618ebcc34b255dec2a765df2da22aaaed7d0f5dbe3a5
MD5 25d255de48ef34f8dd72b7d6432251c2
BLAKE2b-256 4e560b894aabde370d843678afd55aca2ee759ad8ce63223d0d82f743ae1832e

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3dded50678c20adfef1a0cfd36f44ee314057038892fbd0c32867dbf3be3f6db
MD5 22df197f68c5e0322db90df608f584c0
BLAKE2b-256 c6e01ace889739b0abf608c98b218db3769bfd5b21f3237c4ff1e0364c69e147

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 b13dc4aefd3d4a6f04ee77077aa9b3b7f6f060b7dd1325f6c3ec77caa1f2b018
MD5 b8fed2f3b530816da1589d2a3284c011
BLAKE2b-256 68da8cc0e197cd42dc0267412ada13d951a63c19596dc94b1db784aca4239bb1

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 5ad60ee5464b2a26d55bd429c1493120a4af8caf2ce22212d58027880ad59fd2
MD5 6394c7841a7a07d128020021df4fae70
BLAKE2b-256 9c0cd3ecacef415676206db809805564200ca241bcefae0e71e0c9ba5cec166b

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 5efaa02a3c9301689df35e3523c8493597fade3e84396388c341c4dbac07b233
MD5 5345474e366b2409744f5c484bbc3791
BLAKE2b-256 bbb397f08f5f9b3b7f45a35b99b1f0214077c14b0d9bd65eb65dfd210c265c93

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3c7729a76d19f3121719e661dbc5f439dca284744ba4da80a94ebc16ce2dab54
MD5 860c151e5c84483c10791c7695bd795c
BLAKE2b-256 1b7a513f9db4bb0937b1ae38196f0f04eca6f6a5e866d28e53bd1574bc9b7a22

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3ecc47049ddbe6a55e44aba3a03501f9fa26b9d894c229e5e02bb53d1c6be538
MD5 b79bbf4f2629f1b72d99b3e3e7e480b6
BLAKE2b-256 b19008a4a6c17d105d1172d350e7406c4f8d3b09ef63f99fb13181b00e1e4d79

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.3.0-cp27-cp27m-macosx_10_10_intel.whl
Algorithm Hash digest
SHA256 52d92d7bfe31393274dad3419d3fee72376449b7317c8fb725915f7d974bd736
MD5 3dab2a3e2a0043cd08c18d00f7bc999f
BLAKE2b-256 ed043ff9a3574abfd64e3a8d78096d283e4589cdeb93d19ce02548181d446dd1

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