Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 43 lines (29 sloc) 1.205 kB
e15a093 @bdarnell Add readme, update docs
authored
1 CodeGenLoader
2 =============
3
4 CodeGenLoader is a Python import hook that transparently runs a code
5 generator at import time, allowing the use of generated code without
6 a separate compilation step. The package includes an extensible base
7 class as well as implementations for the Protocol Buffer and
8 Thrift code generators.
9
10 Installation
11 ------------
12
13 ::
14
15 pip install codegenloader
16
17 Prerequisites
18 -------------
19
cff9d53 @bdarnell Update readme too.
authored
20 CodeGenLoader runs on Python 2 (2.5+) and 3, including pypy and
21 jython. The base class does not have any external dependencies, but
22 to use the Thrift or Protocol Buffer subclasses you will need the
23 thrift or protobuf packages installed. Note that protobuf 3.0.0
24 (currently in alpha) is required to use protobuf on Python 3.
e15a093 @bdarnell Add readme, update docs
authored
25
26 Example
27 -------
28
29 Add the following two lines to `mypackage/proto/__init__.py`::
30
31 import codegenloader.protobuf
32 __path__ = codegenloader.protobuf.make_path(__name__, ".")
33
34 Now, assuming `foo.proto` exists in in `mypackage/proto/`, you can do::
35
36 from mypackage.proto.foo_pb2 import Foo
43c9b73 @bdarnell Add link from readme to docs
authored
37
38 More info
39 ---------
40
41 The source code is hosted at https://github.com/bdarnell/codegenloader
42 Detailed documentation can be found at http://codegenloader.readthedocs.org
Something went wrong with that request. Please try again.