is it possible to force python-support trigger to compile .pyo files?

Asked by Andrei Dziahel

I've noticed that python-support compiles .py into .pyc only, not in .pyo. I believe that compiling python libs into .pyo's (and/or -O cli key) allows python-based software (like aptdaemon, ubuntu one etc.) work faster.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu python-support Edit question
Assignee:
No assignee Edit question
Solved by:
Andrei Dziahel
Solved:
Last query:
Last reply:
Revision history for this message
Eliah Kagan (degeneracypressure) said :
#1

According to http://www.network-theory.co.uk/docs/pytut/CompiledPythonfiles.html, currently this only causes assertions to be omitted, and does not perform other optimizations. If that is accurate, then this would probably not be a very useful global option. (Please correct me if that is mistaken, however.)

You will notice that this is not actually an answer to your question. It is for that reason that I have left the question open, so that others know you may still want an answer. However, if you consider the issue resolved, please mark this question as Solved (you can do that at https://answers.launchpad.net/ubuntu/+source/python-support/+question/166604).

Revision history for this message
Joseph (joehms22) said :
#2

It is actually _not_ recommended that you perform optimizations on the software unless you know absolutely what you are doing (read: wrote the software yourself) as the software may wish to use some of the items stripped away i.e. docstrings.

In fact, there is no speedup in execution time (the majority of the time that your program is running) between .py, .pyc, and .pyo files, simply in loading time which happens only once when the program is started and takes fractions of a second.

http://docs.python.org/tutorial/modules.html

Revision history for this message
Andrei Dziahel (develop7) said :
#3

ok, got it

thanks to everyone.