zipfile.PyZipFile.writepy

PyZipFile.writepy(pathname, basename='')[source]

Add all files from “pathname” to the ZIP archive.

If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain directory, listdir *.py and enter all modules. Else, pathname must be a Python *.py file and the module will be put into the archive. Added modules are always module.pyo or module.pyc. This method will compile the module.py into module.pyc if necessary.