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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m macOS 10.9+ intel

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

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m macOS 10.9+ intel

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

Uploaded CPython 3.4m Windows x86-64

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

Uploaded CPython 3.4m Windows x86

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

Uploaded CPython 3.4m

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

Uploaded CPython 3.4m

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

Uploaded CPython 3.4m macOS 10.9+ intel

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m Windows x86

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

grpcio_tools-1.2.1-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.1.tar.gz.

File metadata

File hashes

Hashes for grpcio-tools-1.2.1.tar.gz
Algorithm Hash digest
SHA256 7f34a7169bff33e626d6c6c1502f01a63520249e165bfa4c77d07011a9248d66
MD5 395f4e3fc07e70e723fceed01a6f1c37
BLAKE2b-256 98c4df9330735ddbcf3ed174179fac1115442b3f383eae70820dfe67c2c18b37

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d2aa79e5bf34469e8dc1d0b3dd2b11c28749fe2b8254ca6fef953a4eb7ea3abb
MD5 2cc4386ebdae29f16bfb6dacd66fa651
BLAKE2b-256 ddcaa2edb314e37b347d3297212b652b4b3b0608461ed93642c5cfc38c721d70

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 57472e1a316587255ae1c32cf696b3bee7a546f9898efc5f99b49ad81ad6d141
MD5 fe3fd1c4989d09c499505ced6b992916
BLAKE2b-256 16c75f3ce1718167aa05ef4076d86ab172f3ef16fa9f08594f207b5c14c635b1

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4d9364bdc32603562bea892f76cf9a6d7f15118572b5413fcafbebf79b2df3a9
MD5 a01fbd2debde549e8bcb04b00c142e39
BLAKE2b-256 7430e176543420a409b600b82b566b251988511b1372e452d73976c7461f11ea

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 a1b1556c5ec1516bf7a990fad5e952e882a30782f71a8bd75886281f2b1f133e
MD5 cb83094dfd9be42d3caa4ec9d3e84d15
BLAKE2b-256 6c8646aaa48097393c685d36eeac0e05930db914df4cc9ba588d2e576cd59ded

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp36-cp36m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 cebbdc881dd8f20ade047cf35fff179505f60ea029630b4a0beb7b6caed6bb99
MD5 01f6dc746e9643e5e44747e0c3acf297
BLAKE2b-256 768642761c24114248675ea7313befc2200907c496d04cfa365b189ea31d01d4

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 59c5f06e62222ab479f54608141aed17a985de1774beb4de1c77d764a62a275f
MD5 627d88ebde3b88b4a3fb7aa2b6a36347
BLAKE2b-256 f2823a896428aefb13bab6250dbe7d8f358962e7bfb1c65bbd2d216e559afc9d

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 5b735e927a16455c1397334f76449c77125e326d9c35e27635b5a26cefdcd3db
MD5 c56da691fbddd4201d06bf43bc55a0c2
BLAKE2b-256 00f35228b243abe472b7b7f6945d8a5bd0fa2df69e609a179b639e004a5cd160

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 da8bb6dd5cb68665072b20f7d5a373ab483caf1cba6ff5b4d260e79d751eee57
MD5 7ca31c1e5105531e9c02f2338f868668
BLAKE2b-256 8717ec34dfadd95ede92ff42fcbec4fece4c56215519b664f6d017b681b248e3

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 4e92299986ee15dd7789affccb91de1165acd3d1100782e532739349e6be4f9a
MD5 ae86e4a3e5f7a4538fc0a303368b0e8e
BLAKE2b-256 257b08528dbe71b02d80d933caa31a5cab0ac65be734e86c0f989494c74939ef

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp35-cp35m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 170a0d1afd21032df474df86b871502f23777cee9d93f5f52caafc3cb8100d7f
MD5 4c074d70d0ff354fe841553590b7d265
BLAKE2b-256 196679a748d1c16259541a85b4fe056e784df2c6f92ba5ae5c9d8bd729177387

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 2ec411b59dff6376a0631c9fd3d367af81c6afb61749a36a4de00d24d0f1967f
MD5 355be5984304a0673a4b81a2efc88beb
BLAKE2b-256 9a2c51a2e09324509d88d2d379cca04bc7b2d9cc803e5ea43c9c07a7c4357695

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 7c8c15b8666db281dd4ba7984ef9acce8a34b8a8faba085474bda22ee9eb14f8
MD5 09a7716f03047a35c892f5a299070446
BLAKE2b-256 996049840fa0e0cbaefc6131292adbd36e381e04d780ef6efd7c6287b4cff713

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fada47ee81ae603528931707f863f7ea60f71e4104f90bc44c1dbfaaa211e732
MD5 deb410dfb617a5d5d7b9dbc474f585c2
BLAKE2b-256 8e113b79e5f20e477b3e7cde0998ad54863895d2ebbfe5f63e5db2a5b79e05d0

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 93c6be3573d58623a6401c1bd4f541bb30841181f9c97783475554e18e07da01
MD5 a46f6b2bae6c86bae9d1b3bbc8e6a93e
BLAKE2b-256 88e767cd5b3eba7ab49ebfe95077874eaa01fb164e17fca23c36f2e2f88d70a7

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp34-cp34m-macosx_10_9_intel.whl
Algorithm Hash digest
SHA256 f3ce73e267a56c3949cf2d0fbb1864d433c741a81970bec4a16c620ddde9e209
MD5 e123db8b4b9d4ea402cfc462133cc73b
BLAKE2b-256 b521eb0e1de413a60a8649a75533802bde98d9b0e204e58b4c0fdc467f05f371

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 13989419b0dbf3b621e1e54176fb559939b99d413bde3e1fd56099584bdb1782
MD5 a6b7e4a64e8bd556ae82db6d127d5b95
BLAKE2b-256 6f48bf82e17d103bbe8d888563bee572f5542e8da11230cbb1ab90ad078925e3

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 f84942fd03e7db9f13d464ef100f592f3c98f41a038bc9bf7846fda2079ed7d1
MD5 37fdd6a3cecc954baf715620cdabf2e7
BLAKE2b-256 8d2279729f5c64737c71c5d114ef3b73d16eaa80f859343adf2ecb1da050566a

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 837bf12128fd2c93192fa9f46de97ed644b337f5ee51609b359c2d2dd703d2f2
MD5 beeb0e11fe6e23cc4128ee41868e917f
BLAKE2b-256 700713697ea004bf02a0fb35651a2dc9b5f79fce35be700b26ea7b262a344c30

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 c31ac6f787bee7e7b1a87e1ed13a33c3dc3a01b70c3fe5257b4980e72fbe21eb
MD5 161f5edc29fbd285c1f6bff5b9b4481d
BLAKE2b-256 ab99b961d0d89e4137c14e0384ba40ed49b363e3e38ea1d7e59f2b15c5cb5a20

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b3d5737d07e002ea22c34a7e4242229143e7b7464e453c6c3f7450697ec5a591
MD5 c648f266e3e9b77db0c55d9cc577d3a3
BLAKE2b-256 fc7590abaa03eeb2827081e9de6d9fc0f893eaf413ce36f111b20b83c54c07f9

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 bd2a35085052746b0539d6f5c6c03435e41322ab5a921552ca812af0c44d42c1
MD5 c5a9d347843c43706996f9a35205af66
BLAKE2b-256 f8f42c44f12eedaba95767c424b8c26fd87304f4379dc9908b3b47a60fb65094

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for grpcio_tools-1.2.1-cp27-cp27m-macosx_10_10_intel.whl
Algorithm Hash digest
SHA256 7fed197a1c37346531a6ff8191a214d061e1aca93eae44f0286adefd41758b86
MD5 b2e8ef0bb515f7347ce0ba2d38b9117f
BLAKE2b-256 f636a47a32e3ced5d82572d31ab55b33792b448e1db8af3b44f30f4e77dcaabd

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