Giter Club home page Giter Club logo

fast-python-pb's People

Contributors

acg avatar asarazan avatar bkad avatar joeshaw avatar jparise avatar kevinclark avatar olt avatar peterscott avatar robbywalker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fast-python-pb's Issues

setup.py missing install_requires on jinja2, protobuf

fastpb is missing dependency declarations in its setup.py file, which makes it harder to use inside a virtualenv.

To get things running I had to install jinja2 and protobuf. Things should work if you add them as a install_requires kwarg to the setup() call:

install_requires=["jinja2", "protobuf"]

enum in a nested message doesn't appear to get set

If I have a definition like so:

enum Status {
    IN_PROGRESS = 1;
    ERROR = 2;
}

message Foo {
    message Bar {
        optional Status status = 1;
    }

    optional Bar bar = 1;
}

And code like so:

foo = Foo()
foo.bar = Foo_Bar()
foo.bar.status = Status.IN_PROGRESS
print foo.bar.status

None is printed instead of 1. Things work ok if I move the status field from the inner Bar message to the outer Foo.

Members of a list become disassociated when you mutate them

Say you have a protocol buffer that contains a repeated element which in turn contains more repeated elements. If you mutate one of the repeated elements at the root, you're fine. However, if you mutate a repeated element that is a child of another repeated element, it becomes a different object from the one that's in its parent's list.

This demonstrates how the same object gets dissociated

nested_item = Top.items[0]
nested_item.items += (item,)
nested_item.items.length != Top.items[0].items.length

This quickly demonstrates the anomaly and how it eats data

length_before = Top.items[0].items.length
Top.items[0].items += (item,)
length_after = Top.items[0].items.length
length_before == length_after

KeyError from protoc

Here's what I get when trying to compile my *.proto file:

protoc --fastpython_out=. --cpp_out=. --proto_path=. messages.proto
Traceback (most recent call last):
  File "/usr/local/bin/protoc-gen-fastpython", line 9, in <module>
    load_entry_point('fastpb==0.1', 'console_scripts', 'protoc-gen-fastpython')()
  File "/usr/local/lib/python2.7/dist-packages/fastpb-0.1-py2.7.egg/fastpb/generator.py", line 185, in main
    writeCFile(response, name, fileObject)
  File "/usr/local/lib/python2.7/dist-packages/fastpb-0.1-py2.7.egg/fastpb/generator.py", line 101, in writeCFile
    messages = sort_messages(fileObject)
  File "/usr/local/lib/python2.7/dist-packages/fastpb-0.1-py2.7.egg/fastpb/generator.py", line 96, in sort_messages
    return [msgDict[n] for n in sortedMsgNames]
KeyError: u'.Event'
--fastpython_out: protoc-gen-fastpython: Plugin failed with status code 1.
make: *** [messages_pb2.py] Error 1

And here's the content of messages.proto:

message Event {
  optional fixed64 id = 1;

  optional bytes   hashcode = 2;
  optional int32   severity = 3;
  optional int32   facility = 4;
  optional string  message = 5;
  optional string  host = 6;
  optional string  program = 7;
  optional string  cisco_mnemonic = 8;
  optional fixed64 first_occurence = 9; // This is unix time in us (time() * 1e6)
  optional fixed32 duration = 12;       // last_occurence = first_occurence + duration
  optional fixed32 counter = 13;

  repeated fixed32 extra_ipv4 = 20;
  repeated bytes   extra_ipv6 = 21;
  repeated string  extra_string = 22;
  repeated int32   extra_int32 = 23;

  enum MessageType {
      NEW = 0;
      UPDATE = 1;
  };
  optional MessageType message_type = 50 [ default = NEW ];
}

message EventPack {
  repeated Event events = 1;
}

option optimize_for = SPEED;

Any ideas?

BTW, with --python_out it works fine.

Licensing needs clarification

It looks like the project is meant for general consumption (eg: not internal) and has been advertised as such in several places. However, several people have pointed out there's no license terms given anywhere. What is it? BSD? GPL? Or not meant to be used by others?

Nested enums don't have a python object created

If you next an enum inside an object, like so:

message Foo {
    message Bar {
        enum Quux {
            NAH = 0;
            YEAH = 1;
         }

         optional Quux quux = 1;
    }

    optional Bar bar = 1;
}

It never is placed into the enums list, and the Python object is never constructed for it.

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.