Skip to main content

PyPI version

pyminimap2: a Python wrapper for minimap2

pyminimap2 is a Python wrapper for minimap2 (developed by Heng Li). pyminimap2 generates exactly the same output as minimap2 as it simply pass the command-line arguments to the main function in main.c of minimap2.

Compared to invoking minimap2 through subprocess.run or os.system(), using pyminimap2 incurs significantly lower overhead.

In our benchmark, running pyminimap2.main('--version') is approximately 20–30 times faster than invoking minimap2 --version using subprocess.run, and about 40 times faster than calling it via os.system().

pyminimap2 is a good choice for applications requiring frequent or high-throughput invocations of minimap2 from within Python.

How to install

Option 1: Install via pip (Recommended)

We provide pre-compiled binaries for Linux and Python versions 3.9 to 3.13. Simply run the following command:

pip install pyminimap2

Option 2: Clone and compile from source

git clone --recursive https://github.com/TheFangLab/pyminimap2.git
cd pyminimap2
pip install .

Choose this option if you are using Python 3.14 or a later version. You need to have a C compiler (e.g. GCC).

How to use

Assuming your orignal command for executing minimap2 is

minimap2 -x map-ont ref.fa read.fq.gz

You can use pyminimap2 as follows:

import pyminimap2 as pymm2
out, err = pymm2.main("-x map-ont ref.fa read.fq.gz")

This would generate the exact same output as minimap2 -x map-ont ref.fa read.fq.gz.

If you want to save the output to a file, you can use the -o option (same as the -o option of minimap2):

out, err = pymm2.main("-x map-ont ref.fa read.fq.gz -o output.paf")

This would generate a output.paf file.

In summary, if you use -o to specify the output file, pyminimap2 will generate the same output file as minimap2. If -o is not specified, pymm2.main() returns a tuple (out, err) where out contains the stdout and err contains the stderr.

You can find explainations of the command-line arguments of minimap2 at

  1. https://github.com/lh3/minimap2
  2. https://lh3.github.io/minimap2/minimap2.html

Difference from mappy

1. Access to the Full Command-Line Interface (CLI).

pyminimap2 accepts exactly the same command-line arguments as minimap2. Everything minimap2 can do via CLI is available.

2. Identical Output

pyminimap2 generates exact the same output as minimap2. If you are running existing pipelines that rely on parsing standard PAF or SAM files generated by the CLI tool, pyminimap2 creates strictly identical text output (stdout) or files.

mappy requires a deeper understanding of the Python API (such as mappy.Aligner and mappy.Alignment).

3. Low Migration Friction

If you have existing scripts using subprocess.run or os.system() to call minimap2, migrating to pyminimap2 is almost trivial. You just pass the specific string of arguments you were already using.

About version

You can use the following code to print the version number of minimap2 bound in pyminimap2:

import pyminimap2 as pymm2
print(pymm2.main('--version')[0])

Maintainers

pyminimap2 is currently maintained by Li Fang at Sun Yat-sen University. For issues and feature requests, please open an issue here.

Acknowledgments

  • Heng Li, original author and maintainer of minimap2.
  • All contributors to the minimap2 project.

License

pyminimap2 is released under the MIT license.

Metadata

Release files for pyminimap2 2.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyminimap2 2.31
File Size Uploaded
pyminimap2-2.31.tar.gz 86.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyminimap2 2.31
File
pyminimap2-2.31-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
pyminimap2-2.31-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
pyminimap2-2.31-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
pyminimap2-2.31-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
pyminimap2-2.31-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 2.3 MB

Release files / pyminimap2-2.31.tar.gz

Download URL pyminimap2-2.31.tar.gz
Size 86.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5a05fca0ac30f168fff668448a0b3b27d925df69fc05e12ac333dc3ed4ecdb85
BLAKE2b-256 checksum
How to use checksums
f3bcb16613f2128f5b60cf3d963d3a8fb42418656418dd71f9e42407ae6b6617
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 Aug 7, 2026.

Transparency log

Release files / pyminimap2-2.31-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyminimap2-2.31-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 443.1 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e2c19909dfe01a0cbdbf368a5be782731e65185bd7368d0b0d4e12ae7ae75025
BLAKE2b-256 checksum
How to use checksums
669f3a4d2222c25d2117b523a9ccb9c94f910ec487ecf65624b268b5d6710555
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 Aug 7, 2026.

Transparency log

Release files / pyminimap2-2.31-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyminimap2-2.31-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 443.1 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
59c4593699bbdb84f55bd19768da836c90b3689529613863c28232a8537e5739
BLAKE2b-256 checksum
How to use checksums
697a1572028e27032bf266dc6b75a0acf8d84140518e8dd4428b16cb30574d2a
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 Aug 7, 2026.

Transparency log

Release files / pyminimap2-2.31-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyminimap2-2.31-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 443.1 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fb826eb2e10c91294aaf29eb724a4a355e1ca5e72e75cbbbcf20155ddff18014
BLAKE2b-256 checksum
How to use checksums
0bfef7049b044d6fda695758360ea5e65d4b529901ccad3580e75ab543a0d354
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 Aug 7, 2026.

Transparency log

Release files / pyminimap2-2.31-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyminimap2-2.31-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 442.3 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f767f140896975c1a7f5bfdc573096b64f7109ef0c996a32ea220ce397c6693d
BLAKE2b-256 checksum
How to use checksums
099bf3b22e94b124870ae72e4d8c6137ed9950d6ae354bf3b7a697597bdc8fe3
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 Aug 7, 2026.

Transparency log

Release files / pyminimap2-2.31-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyminimap2-2.31-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 442.1 kB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ef99c8fb6e7c13dd7b6690966df0c0ce85734b6548f6808d8cc6051cc11a3969
BLAKE2b-256 checksum
How to use checksums
9b38868d9a32e0837212ec372757ae0b8b0108253d86cdadf6ff571e1837f46c
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 Aug 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.31 This release

6 release files

2.30.3

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page