Comments (7)
It seems kind of odd that a protobuf plugin like this would require the user to structure their files in a specific way to be usable.
Besides that, I disagree with your suggestion and feel that
service FooService {
rpc GetSomething(FooRequest) returns (FooResponse);
}
for a service like this, having FooRequest
and FooResponse
in the same file is better than having them separated from FooService
.
from python-betterproto.
Why not split them into different .proto files?
I think that would be more intuitive and clear for a potential code maintainer
from python-betterproto.
The obvious workaround is to remove the code you don't want to from the generated files.
That said I think it does make sense for betterproto to support this kind of use case, and maybe also offer the option for generating grpcio vs grpclib backed gRPC stuff as well.
AFAIK there's no first class way to pass parameters to a protoc plugin, but this could be achieved by factoring out multiple plugin executables, one with gRPC related content and one without.
from python-betterproto.
Similar issue: #20
from python-betterproto.
What would it take to have this implemented? I can try to scratch my itch since it would help me lower the number of dependencies since I am not using grpc at all - I believe I could get rid off grpclib
, h2
, multidict
, hpack
and hyperframe
.
The obvious workaround is to remove the code you don't want to from the generated files.
Just having import betterproto
needs to have all the above mentioned dependencies installed so this workaround does seem to be possible.
from python-betterproto.
The first step for first-party support for this would come from #165 (see --no-generate-services argument) if I can ever get around to fixing the compilation issues I was having with windows and linux. After that, I'm not sure how you can remove some dependencies if an extra (e.g. betterproto[compiler] the extra is compiler) is provided. Currently having things like code generation behind an extra is already a big headache and I can imagine having grpc support off by default would be more of the same.
from python-betterproto.
#165 seems huge undertaking - not really something an outsider like me can easily help with. However the split (no matter the headache) seems to be worth it to me. I don't mind having everything installed for development. For deployment, there is no need for a compiler - and in my case - neither for the grpc stuff. So if anything, I'll try to cut out grpc in a fork and see what that involves to get and idea about the scale/headache.
from python-betterproto.
Related Issues (20)
- TypeError: object AsyncChannel can't be used in 'await' expression
- Strip enum prefixes during compilation HOT 1
- SerializeToString Error for `List of List` HOT 1
- Inconsistency with google protobuf when converting to dict/json with include_default_values=True
- Nested message with repeated field not in to_json when mutated after initialization
- gRPC server example not working HOT 1
- Code Quality: mypy check failed HOT 1
- Complex protos w/ Enums? HOT 2
- Empty fields which one of None HOT 3
- `Struct().from_dict(...)` has no effect HOT 5
- Missing import in generated code when using well known types HOT 1
- Generated code has non-existent relative import HOT 2
- Error parsing proto with map field HOT 3
- Type error on server-side unary-unary handler code
- Invalid code generated when package name contains uppercase letter HOT 1
- Support proto3 optional fields HOT 1
- Warning for optional fields HOT 1
- Make `grpclib` dependency optional HOT 1
- deepcopy with betterproto.Enum fields fails HOT 2
- Enums are set as integers instead of enums when parsing betterproto.Message HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-betterproto.