Skip to content

How To: Protect a ZIP Archive

If your application is not built with a specific packaging tool, you can upload it as a generic ZIP archive. PyLocket will find and encrypt all Python bytecode inside.


Prerequisites

  • PyLocket CLI installed and authenticated
  • An app registered with PyLocket
  • A ZIP archive containing your Python application

Create a ZIP Archive

Package your application directory:

cd myproject
zip -r ../myapp.zip . -x '*.pyc' '__pycache__/*' '.git/*'

Or include only the distribution files:

zip -r myapp.zip src/ config/ main.py requirements.txt

Protect

pylocket protect \
  --app <APP_ID> \
  --artifact myapp.zip \
  --platform linux-x64 \
  --python 3.12

Download

pylocket fetch --build <BUILD_ID> --out dist/protected/

The output is a new ZIP with encrypted Python files and the bundled PyLocket runtime.


Notes

  • All .py and .pyc files in the archive are encrypted.
  • Directory structure is preserved.
  • Non-Python files are included unchanged.
  • Supported archive formats: .zip, .tar.gz, .tgz, .tar.bz2

See Also