Open RobertoRoos opened 1 week ago
I see there are a bunch of unofficial attempts at this already: https://pypi.org/project/protoc-wheel, https://pypi.org/project/protoc-wheel-0, https://pypi.org/project/protoc-exe
The main problem is these have no affiliation with the protobuf project, so they are not maintained and importantly, there is no guarantee they packaged the legit binaries.
In the meantime I've created a package that will download the official protoc
during it's own installation: https://github.com/RobertoRoos/protobuf-protoc-exe
What language does this apply to?
Python
Describe the problem you are trying to solve.
Installing the protobuf compiler (
protoc
) on Windows doesn't have a fixed procedure, not like e.g.apt install
on Linux. So if I share a Python project with a protobuf, where the user needs to generate protobuf files based on the definition, that user still needs to figure out theirprotoc
installation.But protobuf does have a nice Pip package, and pip packages could very well include platform specific binaries.
Describe the solution you'd like
I would suggest to either:
protoc
in the protobuf Pip package.protoc
, without actual Python code.The downside of the first is you might conflict with the user's system install. With the second you make the Pip installed binary optional, which might be more convenient.
Describe alternatives you've considered
N.a.
Additional context
If such a Pip package exists, a Python project might contain the following in its
pyproject.toml
:Where
build.py
is a script to generate protobuf files, based onprotoc
.protoc
is then installed only during the build step of this package. The used version would be pinned to the package specification and otherwise isolated to the Python environment being used. Moreover, using it in Python would require no action outside Python and Pip.As a result it would work like: