Skip to main content

UNKNOWN

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

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

More info

The source code is hosted at https://github.com/bdarnell/codegenloader Detailed documentation can be found at http://codegenloader.readthedocs.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codegenloader-0.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file codegenloader-0.1.tar.gz.

File metadata

  • Download URL: codegenloader-0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for codegenloader-0.1.tar.gz
Algorithm Hash digest
SHA256 43a84340d6dd1645bf1f497fb7f3b7b428c57f6ac1addc61c38c1dac6057090e
MD5 18f62ae7499f1342d01c504447b4a6e1
BLAKE2b-256 eb7d2dc702cd2fc3d0d4c174688f26e189bf631b12e8158df65170114ff2e317

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page