Skip to main content

ZC Buildout recipe for precompiling .py files

Project description

ZC Buildout recipe for precompiling Python in product directories

This recipe searches for Python scripts with .py filename extensions and compiles them into .pyc bytecode files.

It will compile all the files in specified directories and their descendents. A “skip” list of directory names will be bypassed.

This recipe will probably usually be used in a Zope or Plone buildout using plone.recipe.* recipes. When it is, it will automatically use the product directories specified in plone.recipe.zope2instance recipes. Skip directories will be those required to produce an error-free build in that environment.

Precompiling Python code files to bytecode can prevent the Zope process from writing out .pyc files as it operates – which requires that the daemon process be able to write into program directories.

This recipe may return harmless warnings regarding the inability to compile skin layer scripts, which typically have “return” outside of a function. While these warnings are harmless, you may suppress them by tuning the skip list.

Usage

When used in a typical Plone install, usage is as simple as:

[precompile]
recipe = plone.recipe.precompiler

When used in a different type of install, or with a need for manual tuning:

[precompile]
recipe = plone.recipe.precompiler
dirs = list of dirs
    in multiple
    indented lines
skip = list of skip
   directories
   in multiple
   indented lines
rx = individual file exclusion regular expression

Default usage is equivalent to:

[instance]
...
[precompile]
recipe = plone.recipe.precompiler
dirs = ${instance:products}
skip =
    tests
    skins
    doc
    kupu_plone_layer
    Extensions
    .svn
rx = /\.

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

plone.recipe.precompiler-0.3.tar.gz (3.6 kB view hashes)

Uploaded Source

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