This has hit the repository but 2.5.0 release isn't finalized yet. You can play around with it in trunk though: http://code.google.com/p/protobuf/source/browse/#svn%2Ftrunk%2Fpython%2Fgoogle%2Fprotobuf
On Tue, Sep 25, 2012 at 12:14 AM, JP Brahma <[email protected]> wrote: > Hi, > I am also looking for this feature. I saw the SVN update to > CHANGES.txt<http://code.google.com/p/protobuf/source/browse/trunk/CHANGES.txt?spec=svn426&r=425>. > > Can you please confirm if this has been committed to the public svn ? > > Thanks > > > On Monday, September 10, 2012 10:51:16 PM UTC-4, Jason Hsueh wrote: > >> This feature was just implemented internally, and I believe it should >> make the next release (2.5.0). It's in progress, but not quite ready to hit >> svn yet. >> >> >> On Thu, Aug 30, 2012 at 6:53 AM, Jan Koriťák <[email protected]> wrote: >> >>> Hello, >>> >>> I am using Python to write a tool to control our backends which >>> communicate using protocol buffers. >>> >>> We would like our tool to be independent on current version of backends >>> and therefore independent on .proto files that were used to build the >>> particular version of the backend. >>> >>> Therefore the tool receives serialized FileDescriptorSet over network, >>> which should allow to create messages from the same descriptors, that are >>> used at the backend side. >>> >>> This is possible to implement in C++ (and we actually use it in another >>> component) using DynamicMessage. (Create DescriptorPool, load all the >>> FileDescriptors >>> to the pool using BuildFile(), and then retrieve Descriptor from the >>> pool. Then it is possible to create message using DynamicMessageFactory) >>> >>> However, after thorough research on the web and of the source code of >>> protocol buffers python bindings, I couldn't figure out how to do this >>> (version 2.4.0). >>> >>> I was able to deserialize FileDescriptorSet, iterate over >>> FileDescriptorProtos >>> and get DescriptorProto object. However I didn't find a way to >>> construct Descriptor objects, which are needed to create classes for >>> message types(with GeneratedProtocolMessageType as a metaclass). >>> >>> I tried another way, when I found some access to C++ library API in >>> google.protobuf.internal (which is probably not a good idea to use). I >>> tried to indirectly use the C++ descriptor pool by >>> cpp_message.BuildFile(), but there is no way to get the Descriptorobject >>> back from the pool (it would be C++ object anyway). However there is >>> a method cpp_message.NewCMessage, which can construct a message using >>> descriptors from the pool. I was able to construct messages that way, but I >>> was unable to set any fields. Only method that appeared usable was >>> SetScalar, which requires C++ decriptor, which I was unable to get. Not >>> to mention all of the Python magic is gone when dealing directly with the >>> C++ API. >>> >>> Is there any way to create messages of arbitrary type, which is >>> distributed over network, in Python ? I see those possibilities in both >>> Java and C++, is Python library lacking such funcionality ? >>> >>> Thank you very much, hope I was clear enough. >>> Best regards,¨ >>> >>> Jan Koritak >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Protocol Buffers" group. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/protobuf/-/LEFgfPpImWEJ<https://groups.google.com/d/msg/protobuf/-/LEFgfPpImWEJ> >>> . >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to protobuf+u...@** >>> googlegroups.com. >>> >>> For more options, visit this group at http://groups.google.com/** >>> group/protobuf?hl=en <http://groups.google.com/group/protobuf?hl=en>. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/protobuf/-/L9mSM7H-GywJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
