It looks like what the OP is after already exists: https://docs.python.org/3/library/zipapp.html "This module provides tools to manage the creation of zip files containing Python code, which can be executed directly by the Python interpreter." -- Greg