3 ms·
>The whole point of protobuffs is that they're easily usable in multiple programming languages, While that's true in theory there are issues in practice. It's
by tjpnz 7y ago
>The whole point of protobuffs is that they're easily usable in multiple programming languages,
While that's true in theory there are issues in practice. It's especially true if you've had the misfortune of working with the Python or PHP compilers. Documentation isn't particularly great and I do recall a time when the Python compiler was generating code that was broken and required manual tweaks. Again in the case of Python things go even further downhill if you're trying to get everything working in a Docker container.
Things are of course significantly better if you're working in Go or Java.
- kortex 7y agoPython3 relative import syntax was flat out broken for years [0][1]. It's workable finally (not sure which PR fixed it) but it's still a monster to try to get protoc/grpc plugin to emit _pb2.py files which a) have correct import syntax b) have a top-level package name c) are readily packageable for pip install d) do all the above in a reproducible and uninstallable manner e) also be able to import 3rd party protos f) all the above without any post-processing. Like, yes python constrains package names to the folder names. But why not check a flag so I can let the emitted python structure dominate the folder structure? Or, easier, just let me ignore the folder structure and specify a dang top-level-package in the emitted _pb2.py and let me wrangle it with setup.py? [0] - https://github.com/protocolbuffers/protobuf/issues/90 https://github.com/protocolbuffers/protobuf/issues/90 [1] - https://github.com/protocolbuffers/protobuf/issues/1491 https://github.com/protocolbuffers/protobuf/issues/1491
- sosodev 7y agoI had the displeasure of working with gRPC and Python as an intern. I ended up writing a makefile that would generate the files and then immediately run sed on them to fix their imports. It felt like a terrible hack and I hated having to do it. What’s worse is my overall task was to come up with ways of doing this type of thing reproducibly in a bunch of different languages that had poor gRPC support so that the team could distribute consistent (and verifiably working) API bindings to other teams. At that point it felt like we probably should have conceded that gRPC sucks and not used it at all. I’m 99% sure it was just resume driven development by the lead dev.
- zomglings 7y agoYep, that make + sed combination is exactly what I do every time I use protobuf in Python.