CodeGenLoader

Runs a code generator at import time
Download

CodeGenLoader Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • Ben Darnell
  • Publisher web site:
  • http://thoughtstream.org/

CodeGenLoader Tags


CodeGenLoader Description

CodeGenLoader is a Python import hook that transparently runs a code generator at import time, allowing the use of generated code without a separate compilation step. The package includes an extensible base class as well as implementations for the Protocol Buffer and Thrift code generators.Installationpip install codegenloaderPrerequisitesCodeGenLoader runs on Python 2.5, 2.6, 2.7, pypy, and Jython. The base class does not have any external dependencies, but to use the Thrift or Protocol Buffer subclasses you will need the thrift or protobuf packages installed.ExampleAdd the following two lines to mypackage/proto/__init__.py:import codegenloader.protobuf__path__ = codegenloader.protobuf.make_path(__name__, ".")Now, assuming foo.proto exists in in mypackage/proto/, you can do:from mypackage.proto.foo_pb2 import FooMore infoThe source code is hosted at https://github.com/bdarnell/codegenloader Detailed documentation can be found at http://codegenloader.readthedocs.orgProduct's homepage


CodeGenLoader Related Software