plugins
plugins copied to clipboard
Plugin request for Buf Schema Registry: protobuf_to_pydantic
Mandatory
Where is the source code for the plugin?
https://github.com/so1n/protobuf_to_pydantic
Optional
Does the plugin have a valid semver version?
Latest: https://github.com/so1n/protobuf_to_pydantic/releases/tag/v0.1.7
Does the plugin have a dependency on another plugin?
I don't think so, but it has runtime dependencies: https://github.com/so1n/protobuf_to_pydantic/blob/master/requirements-no-grpc.txt
Does the output of this plugin depend on any other external libraries?
The output depends on the python library pydantic: https://docs.pydantic.dev/latest/
Seconding this as a feature request!
I'm not sure this will work as a Remote Plugin. Browsing around the linked repository, there are two potential issues:
- This code reads a config file from the filesystem, this isn't something we support.
https://github.com/so1n/protobuf_to_pydantic/blob/fdab3a37f63d5436b0095a62e9f1a039ca458640/protobuf_to_pydantic/plugin/code_gen.py#L49
- I don't see where it implements the CodeGeneratorRequest on stdin. Is this a typical
protoc-gen-
plugin?
Can this plugin be used with protoc
or buf
locally? Could you provide an example how you'd use it with one of the tools I mentioned?
I've used this locally with buf, simply by installing it via pypoetry or pip, and specifying protobuf_to_pydantic
as a plugin in a buf.gen.yml.
(For pypoetry, buf will have to be run through poetry run buf .
~@cfstras can you provide the relevant snippet of your buf.gen.yaml
?~
Local usage:
- plugin: protobuf-to-pydantic
out: ../python/src/pydantic
For more context, integration with Pydantic will allow for proto
use with FastAPI, which is the most widely used Python REST API framework. https://github.com/tiangolo/fastapi
I've used this locally with buf, simply by installing it via pypoetry or pip, and specifying
protobuf_to_pydantic
as a plugin in a buf.gen.yml.(For pypoetry, buf will have to be run through
poetry run buf .
Okay, that's good to hear. Does it require any local state, like reading a config from your filesystem?
The author of the source plugin (@so1n) said they are on board with implementing it https://github.com/so1n/protobuf_to_pydantic/issues/26
@dwwhitlock based on the comment above
I've used this locally with buf, simply by installing it via pypoetry or pip, and specifying protobuf_to_pydantic as a plugin in a buf.gen.yml.
It sounds like this is a plugin that already works with buf
or protoc
, but I have not looked into that code deeply outside a cursory 30s scan.
My outstanding question is, does it require any local state, like reading a config or .proto files directly from the filesystem?
It looks like it has an optional configuration .py
file, which you mentioned would not be supported. That said, I also haven't looked deeply into it yet
Hello, I am the author of this library. I've just finished implementing version 0.2.1, which enables protobuf-to-pydantic
to run as a plugin for buf-cli
(all feature of protobuf-to-pydantic
works).The relevant description already exists in document.
However, I found that I cannot upload public plugins to buf.build
, I hope to get your help. @mfridman