.py to .pyc bytecode for interpreter
Ahead-Of-Time compile
import py_compile py_compile.compile('example.py')
python -m py_compile example.py
When is it actually useful?
- Pre-validating compile errors before CI/CD deployment
- Distributing only
.pycfiles in restricted environments (though pip wheels can also accomplish this)
- Note that
.pycfiles can be easily decompiled, making them unsuitable as a complete source code protection measure

Seonglae Cho