Search code examples
pythonzippackageegg

How to package a runnable python program in 1 file


I'm planning to package my large python program into a single file;

My requirements are:

  • only 1 file to download
  • file can be checksummed
  • ideally file contains some version info
  • uses system python

so far the best candidates for package format are .egg and .zip.

What are practical differences between eggs and zips?

What I intend to do:

An embedded system downloads my code, e.g. package.zip; it starts my code, e.g. python2 package.zip my code can verify itself, e.g. md5sum sys.argv[0]. Checksum is reported and monitored on my server.


Solution

  • An egg is a zip file.

    You'll be able to use the md5sum (or any other hash function) on your file regardless of which method you use to package it - they don't care about the extension of the file, just that the binary contents are the same.