pyMzLib
mzLib for Python. mzLib is a mass-spectrometry and proteomics library written in C#, developed in the Smith lab at UW–Madison. pyMzLib makes it callable from Python.
pip install mzlib
Install it as mzlib, import it as pymzlib — the same split as pip install scikit-learn /
import sklearn.
That is the whole installation. There is no .NET to install, no runtime to configure, and no third-party Python package to reconcile with the rest of your environment — pyMzLib declares zero runtime dependencies and carries everything it needs inside the wheel.
Quick start
import pymzlib
# Read a mass-spectrometry data file: mzML, Thermo .raw, Bruker .d, timsTOF .d, MGF, msalign.
# Scan headers always; peaks only when you ask, because they are thousands of times larger.
scans = pymzlib.readers.read_spectra("run.mzML", ms_order=2, limit=5, peaks=True)
print(scans.scan_count, scans.columns["selected_ion_mz"])
# What's in a PRIDE Archive project?
files = pymzlib.pride.list_files("PXD000001")
print(f"{len(files)} files, {pymzlib.pride.total_size_bytes(files) / 1e9:.2f} GB")
for f in files:
print(f"{f.category:8s} {f.size_mb:9.1f} MB {f.file_name}")
# Pull down just the raw files.
paths = pymzlib.pride.download("PXD000001", "downloads", category="RAW")
Downloads stream to a temporary name and are moved into place only when complete, so an
interrupted transfer never leaves you with a truncated file. Pass overwrite=False to skip
files you already have — a cheap resume for a large project.
What's covered
Coverage is deliberately partial and grows by demand, the same way pyOpenMS grew.
| Area | Status |
|---|---|
| PRIDE Archive — list project files, filtered download | ✅ |
| Peptidoforms — digest an annotated protein, apply its modifications, fragment every peptide | ✅ |
| Quantification — FlashLFQ label-free quant with match-between-runs, and median-polish protein roll-up | ✅ |
Readers — read spectra from mzML, Thermo .raw, Bruker .d, timsTOF .d, MGF and msalign; identify and read all 31 file types mzLib knows, search results included |
✅ |
| Everything else in mzLib | not yet — tell us what you need |
How it works, and why you probably don't care
mzLib runs as a self-contained executable bundled inside this package; pyMzLib starts it, speaks JSON to it, and hands you ordinary Python objects. The mechanism is an implementation detail and may change — the public API will not.
The consequence worth knowing: calls carry a small fixed startup cost (tens of milliseconds), so pyMzLib is built for coarse-grained operations, not for calling in a tight per-spectrum loop.
Errors
Everything mzLib can fail at arrives as a typed Python exception:
try:
pymzlib.pride.list_files("PXD000001")
except pymzlib.UsageError: # you passed something invalid
...
except pymzlib.BridgeError as e: # mzLib/PRIDE failed; e.error_type says how
...
Development
# Build the .NET payload and stage it into the package
.\..\build\publish-bridge.ps1
# Set up a dev environment and run the fast tests
python -m venv .venv
.\.venv\Scripts\python -m pip install -e ".[dev]"
.\.venv\Scripts\python -m pytest -m "not network"
pytest -m network additionally hits the live PRIDE Archive.
License
LGPL-3.0-or-later, matching mzLib.
Release files for mzlib 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| mzlib-0.1.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| mzlib-0.1.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details |
| mzlib-0.1.0-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details |
| mzlib-0.1.0-py3-none-macosx_12_0_arm64.whl | Python 3 | none | macOS 12.0+ ARM64 | Details |
Total release size: 249.4 MB
Release files / mzlib-0.1.0-py3-none-win_amd64.whl
| Download URL | mzlib-0.1.0-py3-none-win_amd64.whl |
|---|---|
| Size | 62.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cd2249d565c46b1a52b2e7c769666222e8d58951238fdd75c8d3c618feeb3b7c
|
|
BLAKE2b-256 checksum How to use checksums |
018cc61c72ddd4063975f9b85cc578091cf2f16da3ae8277af3ed15265404b3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency logRelease files / mzlib-0.1.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | mzlib-0.1.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 59.2 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f040f6e488a8f4f9a1446c6ac8fbf2e823438cdb3b9f5f7591dd207b76fd6f7f
|
|
BLAKE2b-256 checksum How to use checksums |
54d2ba61fdb0d06abb99b2829e2c91947a810694dbed674be611be6c28bad6dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency logRelease files / mzlib-0.1.0-py3-none-macosx_12_0_x86_64.whl
| Download URL | mzlib-0.1.0-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 65.0 MB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
0bb7b8b3b2bf1eae818e935cebf760c0827010211e23dedc0bd38c996f65cb67
|
|
BLAKE2b-256 checksum How to use checksums |
e29299cf0d90d71e0a2a376a5ecb51d5dabb9afacaa37447a68a6fd9b7e86d36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency logRelease files / mzlib-0.1.0-py3-none-macosx_12_0_arm64.whl
| Download URL | mzlib-0.1.0-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 62.9 MB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a1afda63a4cb7896f033d9a80c95b9669cb0cbb588df006d707b9decc654446d
|
|
BLAKE2b-256 checksum How to use checksums |
785896e138505ea675cc52ea9985fb59d02244e00926f3df7591b378950134eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency log