How To: Protect a cx_Freeze Application¶
cx_Freeze is a popular Python packaging tool that produces a directory of files. PyLocket supports cx_Freeze output on all platforms.
Prerequisites¶
- PyLocket CLI installed and authenticated
- An app registered with PyLocket
- cx_Freeze installed (
pip install cx_Freeze)
Build with cx_Freeze¶
Using a setup.py¶
# setup.py
from cx_Freeze import setup, Executable
setup(
name="MyApp",
version="1.0",
executables=[Executable("myapp.py")],
)
This creates build/exe.<platform>/ containing your executable and dependencies.
Using cxfreeze CLI¶
Package for Upload¶
Compress the cx_Freeze output directory:
Protect¶
pylocket protect \
--app <APP_ID> \
--artifact build/myapp-cxfreeze.zip \
--platform linux-x64 \
--python 3.12
Download¶
Notes¶
- cx_Freeze always produces a directory (no onefile mode). Compress the directory into a ZIP before uploading.
- The
--pythonversion must match the Python used to build with cx_Freeze. - Non-Python files (data, images) are passed through without encryption.