modelx.zip_model#

zip_model(model, model_path, backup=True, log_input=False, compression=8, compresslevel=None, version=None)[source]#

Archive model to a zip file

Write model to a single zip file. The contents are the same as the directory tree output by the write_model() function.

Changed in version 0.9.0: compression and compresslevel parameters are added.

New in version 0.8.0.

Parameters:
  • model – Model object to archive.

  • model_path (str) – Path to the zip file.

  • backup (bool, optional) – Whether to backup an existing file with the same name if it already exists. Defaults to True.

  • log_input (bool, optional) – If True, input values in Cells are output to _input_log.txt under model_path. Defaults to False.

  • compression (optional) – Identifier of the ZIP compression method to use. This method uses zipfile.ZipFile class internally and compression and compresslevel arguments are passed to zipfile.ZipFile constructor. See zipfile.ZipFile manual page for available identifiers. Defaults to zipfile.ZIP_DEFLATED.

  • compresslevel (optional) – Integer identifier to indicate the compression level to use. If not specified, the default compression level is used. See zipfile.ZipFile explanation on the Python Standard Library site for available integer identifiers for each compression method. For Python 3.6, this parameter is ignored.

  • version (int, optional) – Format version to write model. Defaults to the most recent version. This parameter should be left unspecified in normal cases.

See also

write_model()