Coder Social home page Coder Social logo

Comments (4)

Gobot1234 avatar Gobot1234 commented on May 31, 2024 3

v.2.0.0b4 has just been released and includes support for this.

from python-betterproto.

kalzoo avatar kalzoo commented on May 31, 2024 1

+1 - as a quick(er) fix, even just internally treating the optional field as a oneof with only one option would allow betterproto to be used with protobuf definitions that can currently be handled by other language generators like protoc-gen-go and prost (Rust). On-the-wire that should be compatible, IIUC, and then it would just be a matter of improving ergonomics in Python as time allows.

As it stands, if we select betterproto as our Python generator, we have to remove optional from all of its source proto definitions, even if all other generators can handle it.

from python-betterproto.

nat-n avatar nat-n commented on May 31, 2024

Explicitly representing field optionality makes sense. Actually enforcing it at runtime with python dataclasses would be a bit tricky.

from python-betterproto.

davidmankin avatar davidmankin commented on May 31, 2024

I just had a PR in my project reverted because it used optional int32 and a consumer of the proto files uses betterproto.

I wasn't even aware of betterproto, but it looks better in almost every way — except that it doesn't support the new(ish) optional keyword for primitives. Please consider adding this support. (I don't need it to enforce that I only put "None" on optional fields; I just need it to be interoperable with the rest of the protobuf ecosystem. Essentially, what @kalzoo said.)

from python-betterproto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.