You can search for “.pyc” in the slice source tree.
The simplest is probably to write a short Python script that compiles your .py files and then replaces the .py files by the .pyc files.
This script could added as a custom build or installation step in your extension build CMake files. If you are not sure how to do it, you can ask advice on the CMake forum or contract a CMake expert at Kitware.