python -m compileall .
This simple command will enforce all files in the current directory will be compiled to .pyc files. Python by default creates .pyc files only on imported modules.
(python -B option is not to compile them at all)
You can also compile in python code using the py_compile module
import py_compile
py_compile.compile("somemodule.py")
You can used it for speed or to protect your source code from being changed.
Compiled python files (.pyc) are little harder( but not impossible) to edit. You would have to decompile it first to edit.