Skip to main content

gRPC Poetry plugin

Project description

Poetry gRPC plugin

A Poetry plugin to run the Protocol Buffers compiler with gRPC support.

Installing the plugin

Requires Poetry version 1.2.0 or above

poetry self add poetry-grpc-plugin

Usage

To run it manually:

poetry help protoc

Usage:
  protoc [options]

Options:
      --proto_path[=PROTO_PATH]             Base path for protobuf resources. [default: "<module_name>"]
      --python_out[=PYTHON_OUT]             Output path for generated protobuf wrappers. [default: "."]
      --grpc_python_out[=GRPC_PYTHON_OUT]   Output path for generated gRPC wrappers. Defaults to same path as python_out.
      --mypy_out[=MYPY_OUT]                 Output path for mypy type information for generated protobuf wrappers. Defaults to same path as python_out.
      --mypy_grpc_out[=MYPY_GRPC_OUT]       Output path for mypy type information for generated gRPC wrappers. Defaults to same path as grpc_python_out.
      --venv_proto_paths[=VENV_PROTO_PATHS] Additional protobuf resources paths, from the plugin's venv. Defaults to None.
      ...

Run on poetry update

[tool.poetry-grpc-plugin]

Additional config

[tool.poetry-grpc-plugin]
proto_path = "protos"               # Defaults to module name
python_out = "."                    # Defaults to .
venv_proto_paths = ["google/type"]  # Defaults to None

Settings in pyproject.toml will be used as defaults for manual execution with poetry protoc.

Using venv_proto_paths, one can import additional protos from packages installed in the same virtual environment as this plugin. For example:

pipx inject poetry googleapis-common-protos
[tool.poetry-grpc-plugin]
...
venv_proto_paths = ["google/type"]  # Defaults to None

Then in your proto file you can do:

import "latlng.proto";

Project details


Download files

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

Source Distribution

poetry_grpc_plugin-0.1.9.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

poetry_grpc_plugin-0.1.9-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

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