Skip to content

Commit

Permalink
Add readme, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed Jun 19, 2012
1 parent d10cd14 commit e15a093
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include LICENSE.txt
include README.rst
35 changes: 35 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CodeGenLoader
=============

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.

Installation
------------

::

pip install codegenloader

Prerequisites
-------------

CodeGenLoader 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.

Example
-------

Add 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 Foo
41 changes: 38 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
codegenloader Documentation
===========================
CodeGenLoader
=============

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.

Installation
------------

::

pip install codegenloader

Prerequisites
-------------

CodeGenLoader 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.

Example
-------

Add 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 Foo

Detailed docs
-------------

.. toctree::

Expand All @@ -13,4 +49,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
"codegenloader.test": ["thrift/simple.thrift"],
},
author="Ben Darnell",
url="https://github.com/bdarnell/codegenloader",
)

0 comments on commit e15a093

Please sign in to comment.