Skip to main content

Cross-platform Python library for creating, extracting and signing MSIX packages

Project description

pymsix

Cross-platform Python library for creating, extracting and signing MSIX packages. Wraps makeappx.exe (Windows) or makemsix (Linux/macOS) — binaries are resolved automatically and built from source if needed.

Requirements

  • Python 3.10+
Platform Requirements
Windows Windows 10 SDK
Linux git, cmake ≥ 3.29.0, clang, osslsigncode (for signing)
macOS git, cmake ≥ 3.29.0, clang (Xcode CLT), osslsigncode (for signing)

On Linux/macOS, makemsix is compiled automatically from microsoft/msix-packaging on first use and cached in ~/.cache/pymsix/.

Installation

pip install pymsix

Usage

from msix import MsixPacker

packer = MsixPacker()
packer.pack("path/to/app-content/", "output/MyApp.msix")
packer.unpack("output/MyApp.msix", "path/to/extracted/")

The app-content/ directory must contain a valid AppxManifest.xml.

Signing

packer = MsixPacker(sign_binary="/usr/local/bin/osslsigncode")
packer.sign("output/MyApp.msix", "cert.pfx", pfx_password="s3cr3t")

API

MsixPacker(binary=None, sign_binary=None, verbose=False)

Parameter Description
binary Path to makeappx.exe or makemsix. Auto-resolved if omitted.
sign_binary Path to signtool.exe (Windows) or osslsigncode (Linux/macOS). Auto-resolved if omitted.
verbose Print the command being executed.

pack(content_dir, output_package, *, overwrite=True, skip_validation=False, hash_algorithm="SHA256")

Creates an MSIX package from a directory. Returns the path to the created file.

Note: overwrite, skip_validation, and hash_algorithm are only supported on Windows (makeappx.exe). These parameters are silently ignored on Linux and macOS, as makemsix does not support them.

unpack(package, output_dir, *, overwrite=True)

Extracts an MSIX package into a directory. Returns the path to the extraction directory.

Note: overwrite is only supported on Windows (makeappx.exe). These parameter is silently ignored on Linux and macOS, as makemsix does not support it.

sign(package, pfx, *, pfx_password=None, timestamp_url="http://timestamp.digicert.com", digest_algorithm="SHA256")

Signs an MSIX package in-place using a PFX certificate. Returns the path to the signed file.

On Windows, signtool.exe is used (auto-detected from the Windows SDK). On Linux and macOS, osslsigncode must be installed:

# Debian/Ubuntu
sudo apt install osslsigncode

# Fedora/RHEL
sudo dnf install osslsigncode

# macOS
brew install osslsigncode
Parameter Description
package Path to the .msix file to sign.
pfx Path to the .pfx certificate file.
pfx_password Password for the .pfx file. Omit if not password-protected.
timestamp_url RFC 3161 timestamp server URL. Set to "" to disable timestamping.
digest_algorithm Digest algorithm for the signature (default "SHA256").

Binary Resolution Order

Pack binary (makeappx.exe / makemsix)

  1. binary constructor argument
  2. PYMSIX_BINARY environment variable
  3. Cached binary at ~/.cache/pymsix/
  4. Windows SDK makeappx.exe (Windows only)
  5. Build from source (Linux/macOS)

Sign binary (signtool.exe / osslsigncode)

  1. sign_binary constructor argument
  2. PYMSIX_SIGN_BINARY environment variable
  3. Windows SDK signtool.exe (Windows only)
  4. osslsigncode on PATH (Linux/macOS)

License

MIT

Project details


Download files

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

Source Distribution

pymsix-1.0.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

pymsix-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file pymsix-1.0.0.tar.gz.

File metadata

  • Download URL: pymsix-1.0.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for pymsix-1.0.0.tar.gz
Algorithm Hash digest
SHA256 27d12f5298831d959fe40d7cbcf95f9804fd715bed8c19304c8b3cc25bbb258a
MD5 5afd8ac15214ef223f598abc2886980c
BLAKE2b-256 c37c5995c085a8acb85dff1913b884f9457ca4327a232e6cd78e140561fe24f7

See more details on using hashes here.

File details

Details for the file pymsix-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pymsix-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for pymsix-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f932210e317940e9febcc0086fa197772b07fc21db955b7c6a314782bbd3b199
MD5 ede67f3caf9b577b1e405f717e3562f0
BLAKE2b-256 a55fd0322ae17628c53211af2585d24ba3618d37d0aecfb6b089b7f556fa92f7

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