Skip to content

emcfarlane/starlarkproto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starlarkproto

GoDev

Supports protobuffers in starlark with rich type conversion to and from starlark. Most methods on lists and maps are supported, see package internals for details.

test = proto.file("github.com/emcfarlane/starlarkproto/testpb/star.proto")
m = test.Message(body="Hello, world!")
print(m)  # Message(body = Hello, world!, type = UNKNOWN, ...)
m.type = "GREETING"  # Enums can be assigned by String, Int or proto.Enum
print(m)  # Message(body = Hello, world!, type = GREETING, ...)

greeting = test.Message.Type.GREETING
print(greeting)  # GREETING

data = proto.marshal(m)  # Byte encoded string
m2 = test.Message()
proto.unmarshal(data, m2)  # Unmarshal back to message

About

Support protobuffers in Starlark

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published