Wednesday, November 28, 2012

How to ship eggs with pyo files only in Python

There is sometimes a need to ship python egg distribution with pyo files only. There is confusion using bdist_egg command since it doesn't have any options to do that; instead, you can instruct install_lib command. Here is what you need in setup.cfg file:
compile = 0
optimize = 2

exclude-source-files = 1
Issue the following command to build egg.
python -q bdist_egg
Note, the egg file has only python byte code optimized module files (look at dist directory). You can read about compiled modules here.

No comments :

Post a Comment