Skip to main content

🐍⛓️🧬 Pyskani Stars

PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining.

Actions Coverage License PyPI Bioconda AUR Wheel Python Versions Python Implementations Source Mirror Issues Docs Changelog Downloads Paper

🗺️ Overview

skani[1] is a method developed by Jim Shaw and Yun William Yu for fast and robust metagenomic sequence comparison through sparse chaining. It improves on FastANI by being more accurate and much faster, while requiring less memory.

pyskani is a Python module, implemented using the PyO3 framework, that provides bindings to skani. It directly links to the skani code, which has the following advantages over CLI wrappers:

  • pre-built wheels: pyskani is distributed on PyPI and features pre-built wheels for common platforms, including x86-64 and Arm64 UNIX.
  • single dependency: If your software or your analysis pipeline is distributed as a Python package, you can add pyskani as a dependency to your project, and stop worrying about the skani binary being present on the end-user machine.
  • sans I/O: Everything happens in memory, in Python objects you control, making it easier to pass your sequences to skani without having to write them to a temporary file.

This library is still a work-in-progress, and in an experimental stage, but it should already pack enough features to be used in a standard pipeline.

🔧 Installing

Pyskani can be installed directly from PyPI, which hosts some pre-built CPython wheels for x86-64 Unix platforms, as well as the code required to compile from source with Rust:

$ pip install pyskani

In the event you have to compile the package from source, all the required Rust libraries are vendored in the source distribution, and a Rust compiler will be setup automatically if there is none on the host machine.

🔖 Citation

If you found Pyskani useful, please cite our paper, as well as the original skani paper.

To cite Pyskani:

Martin Larralde, Georg Zeller, Laura M. Carroll. 2025. PyOrthoANI, PyFastANI, and Pyskani: a suite of Python libraries for computation of average nucleotide identity. NAR Genomics and Bioinformatics 7(3):lqaf095. doi:10.1093/nargab/lqaf095.

To cite skani:

Jim Shaw, Yun William Yu. 2023. Fast and robust metagenomic sequence comparison through sparse chaining with skani. Nature Methods 20(11):1661-1665. doi:10.1038/s41592-023-02018-3.

💡 Examples

📝 Creating a database

A database can be created either in memory or using a folder on the machine filesystem to store the sketches. Independently of the storage, a database can be used immediately for querying, or saved to a different location.

Here is how to create a database into memory, using Biopython to load the record:

database = pyskani.Database()
record = Bio.SeqIO.read("vendor/skani/test_files/e.coli-EC590.fasta", "fasta")
database.sketch("E. coli EC590", bytes(record.seq))

For draft genomes, simply pass more arguments to the sketch method, for which you can use the splat operator:

database = pyskani.Database()
records = Bio.SeqIO.parse("vendor/skani/test_files/e.coli-o157.fasta", "fasta")
sequences = (bytes(record.seq) for record in records)
database.sketch("E. coli O157", *sequences)

🗒️ Loading a database

To load a database, either created from skani or pyskani, you can either load all sketches into memory, for fast querying:

database = pyskani.Database.load("path/to/sketches")

Or load the files lazily to save memory, at the cost of slower querying:

database = pyskani.Database.open("path/to/sketches")

🔎 Querying a database

Once a database has been created or loaded, use the Database.query method to compute ANI for some query genomes:

record = Bio.SeqIO.read("vendor/skani/test_files/e.coli-K12.fasta", "fasta")
hits = database.query("E. coli K12", bytes(record.seq))

🔎 See Also

Computing ANI for closed genomes? You may also be interested in pyfastani, a Python package for computing ANI using the FastANI method developed by Chirag Jain et al.

💭 Feedback

⚠️ Issue Tracker

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

🏗️ Contributing

Contributions are more than welcome! See CONTRIBUTING.md for more details.

⚖️ License

This library is provided under the MIT License.

The skani code was written by Jim Shaw and is distributed under the terms of the MIT License as well. See vendor/skani/LICENSE for more information. Source distributions of pyskani vendors additional sources under their own terms using the cargo vendor command.

This project is in no way not affiliated, sponsored, or otherwise endorsed by the original skani authors. It was developed by Martin Larralde during his PhD project at the European Molecular Biology Laboratory in the Zeller team.

📚 References

Metadata

Release files for pyskani 0.3.0

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

Source distribution (sdist)

Source distribution for pyskani 0.3.0
File Size Uploaded Provenance Actions
pyskani-0.3.0.tar.gz 4.3 MB With provenance Details for pyskani-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyskani 0.3.0
File Actions
pyskani-0.3.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for pyskani-0.3.0-cp38-abi3-win_amd64.whl
pyskani-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for pyskani-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pyskani-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for pyskani-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pyskani-0.3.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for pyskani-0.3.0-cp38-abi3-macosx_11_0_arm64.whl
pyskani-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for pyskani-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 28.6 MB

Release files / pyskani-0.3.0.tar.gz

Download URL pyskani-0.3.0.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
663114278d04c586c2684ce8111699884be1122bcef7d2e892a64886938e8e17
BLAKE2b-256 checksum
How to use checksums
89fdea0fff01ba73318c7ccc2bbebeb395bc345f657540583361a23111962114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / pyskani-0.3.0-cp38-abi3-win_amd64.whl

Download URL pyskani-0.3.0-cp38-abi3-win_amd64.whl
Size 4.8 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2bb18ee2540704275186a2da89ab2362b427a6ae95fb0d0f36681a5cd750ec31
BLAKE2b-256 checksum
How to use checksums
3c8707a3a5bc4aba61a8fe922f69eee9a8d8df89477d598695124971c1c4571d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / pyskani-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyskani-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.0 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f3ead969424a717f480a753b53a75f17d738d320ad96505735620ff2586698ac
BLAKE2b-256 checksum
How to use checksums
e866878ed01a742ac1570eb70e889a7f630a5886e176e58c6c603c59e95317e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / pyskani-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyskani-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.9 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
da1637b0943d57fd0b485376969b7e05b6cf91bc3fe5c347e73d46149db5f190
BLAKE2b-256 checksum
How to use checksums
3c40d371b1ab7fc2000264e67977e3c0e23db0369a421af4fc2823b47a08ff6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / pyskani-0.3.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL pyskani-0.3.0-cp38-abi3-macosx_11_0_arm64.whl
Size 4.8 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7f4f762fd8ea470c55b5a85ceb1fff32ae3c9617acac0d6099d79074c9988031
BLAKE2b-256 checksum
How to use checksums
1251fe7a5e8853b586ba4d48e3371b854133a007f7617a90dac3aece6c3e4ab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / pyskani-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl

Download URL pyskani-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl
Size 4.8 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
14433051b12055c8219aadc5ea288289143ea5bde95d78a187d5b17ea9ecab70
BLAKE2b-256 checksum
How to use checksums
5d71ede388f0ce81be1c0ebd57453232162c41a07904ed742612c25aa591ae0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Security for pyskani 0.3.0

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pyskani-0.3.0.tar.gz

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 Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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