One of common question of python programming is how to do jar equivalent - i.e. run something like python myapp.zip . Below I describe a method producing a close result (hey python team - good place to enhance): unfortunately couple of bugs in python zip handling (e.g. python can't import module from zipfile with comments) make this task a little bit tricky.

  1. Make sure you app is ready to work with zip bundle i.e. file is replaced to ZipFile when necessary.
  1. Prepare the entry point:
    main.py
    def __main__():
         ....
    
  1. create a bundle
    zip -r test.zip *.py *.pyc
    
  1. create a launcher either shell or pure python one and place it somewhere.
#!/bin/sh
mod="$1"
shift
python -c "import sys; sys.path.insert(0,'${mod}'); import main;main.__main__()" $*
import sys
sys.path.insert(0,sys.argv[1])
import main
main.__main__()

enjoy