Skip to main content

A small library for zipping Python application dependencies

Project description

The depzip library can be used for zipping dependencies of Python applications.

This library uses the sys.modules dictionary to discover dependencies and the ctypes.util.dllist function to discover DLLs loaded by dependencies.

Installation

This library can be installed using pip:

python -m pip install depzip

Usage

Here is a Python script showing how to use depzip to copy the dependencies of a Python application using matplotlib, numpy, and PySide6 into a file called bundle.zip:

import depzip

depzip.bundle(
    applications=[
        "app",
        "pyside6-uic",
    ],
    modules=[
        "app",
        "PySide6.QtUiTools",
    ],
    includes=[
        "Lib\\site-packages\\matplotlib\\mpl-data",
        "Lib\\site-packages\\numpy.libs",
        "Lib\\site-packages\\pyside6-uic",
        "Lib\\site-packages\\PySide6\\plugins\\platforms\\qwindows.dll",
        "Lib\\site-packages\\PySide6\\plugins\\styles\\qmodernwindowsstyle.dll",
        "Lib\\site-packages\\PySide6\\uic.exe",
    ],
    excludes=[
        "python.exe",
        "pythonw.exe",
    ],
    output="bundle.zip",
)

The source code of this script can be found in examples/bundle.py.

The provided executable file run.exe can be used to run a Python application. It initializes Python and runs a module with the same name as the executable file. For example, to run a Python module named app, the executable file run.exe should be renamed to app.exe.

The source code of the executable file run.exe can be found in examples/run.c.

The applications parameter is a list of application names that is used to automatically copy run.exe to executable files with names in this list.

The modules parameter is a list of Python modules used by the applications. These modules are copied to the output file along with all their dependencies.

The includes parameter is a list of additional files and directories to be copied to the output file.

The excludes parameter is a list of files that should not be copied to the output file.

The output parameter is the name of the output file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

depzip-0.8-py3-none-win_amd64.whl (11.2 kB view details)

Uploaded Python 3Windows x86-64

File details

Details for the file depzip-0.8-py3-none-win_amd64.whl.

File metadata

  • Download URL: depzip-0.8-py3-none-win_amd64.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for depzip-0.8-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 91c016a357ae89505fe08d82cf4d37b9d364c3ea5d65ebd71e7126df3e2de746
MD5 698e1a3f57d1d7402f4cd25fa326f7a2
BLAKE2b-256 ed885dfea047fba2a7ee302e49f66e72aa94e62d6d8821e277ed9330789b0c1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page