pycapnp
pycapnp copied to clipboard
How to compile the capnp schema file to py?
I got a schema file in capnp language. But I don't know how to compile it to python file like what I did in C++.
pycapnp uses import hooks to compile the .capnp files at runtime.
import capnp # Must be imported first to install the import hooks
import mycapnpfile_capnp # Import your capnp files, notice the _capnp, that corresponds to the .capnp file extension
Also see: https://github.com/capnproto/pycapnp/blob/master/examples/addressbook.py
😲 cool