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 details)

Uploaded Source

File details

Details for the file plone.recipe.precompiler-0.3.tar.gz.

File metadata

File hashes

Hashes for plone.recipe.precompiler-0.3.tar.gz
Algorithm Hash digest
SHA256 bfcfaef3b93ece4b823d137175cf4ee0fdd7d2d3defee9f37d5f639e324cdea6
MD5 b18275444046ca3ed7f19fe0c718b539
BLAKE2b-256 f3197e08ac729ba436dd66c69c1fe9dc1ae1cb051342930209ac50b0bb8a1587

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