appnexus / pyrobuf

A Cython alternative to Google's Python Protobuf library
Other
554 stars 76 forks source link

How to import google.protobuf.* ?? #133

Open wencan opened 5 years ago

wencan commented 5 years ago

I need import "google/protobuf/timestamp.proto".

I already cloned protocolbuffers/protobuf, and exec "pyrobuf --proto3 --include xxx/yyy/protocolbuffers/protobuf/src myproto3.proto" pyrobuf output: "AssertionError: unexpected ENUM_FIELD token on line 44: ' google.protobuf.Timestamp xxx yyy"

nefethael commented 5 years ago

Hi,

I have the same question, I'm trying to use google/protobuf/any.proto and google/protobuf/timestamp.proto, I'm not sure it's supported by pyrobuf?

Regards, Vincent

alysidi commented 4 years ago

Did you guys figure this out for includes?

bobbymlp commented 3 years ago

I am having the same issue

re0078 commented 2 years ago

It doesn't seem to be supported yet. Including this piece of code in .proto file works for me (for timestamp in particular).

message Timestamp {
  // Represents seconds of UTC time since Unix epoch
  // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
  // 9999-12-31T23:59:59Z inclusive.
  int64 seconds = 1;

  // Non-negative fractions of a second at nanosecond resolution. Negative
  // second values with fractions must still have non-negative nanos values
  // that count forward in time. Must be from 0 to 999,999,999
  // inclusive.
  int32 nanos = 2;
}