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

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

According to, 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

Revision history for this message
Joseph (joehms22) said :

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.

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

ok, got it

thanks to everyone.