gmg: Python bindings (#37)
pip install guess-my-genome # the module you import is `gmg`
Wheels are published for Linux (x86_64, aarch64) and macOS on Apple Silicon (Python >= 3.9). Other platforms: build from the repository with maturin
(see below) or use a release binary. (pip install gmg is a different, unrelated project.)
The same Rust code as gmg run and the web app, for notebooks and scripts.
import gmg
ix = gmg.Index("bfd-reps-2026.10.5-s20000.gmgi") # any index from the releases
rec = ix.classify("genome.fa.gz") # a dict: the record `gmg run` writes to results.jsonl
rec["status"], rec["best_rank"] # ok | low_confidence | no_match | error
rec["guess"]["calls"]["genus"]["taxon"] # per-rank calls, ANI, top hits, QC flags in rec["qc"]
records = [ix.classify(p) for p in paths] # failures are records (status "error"), not exceptions
open("results.tsv", "w").write(gmg.results_tsv_text(records)) # identical to the CLI's results.tsv
h = ix.sketch(open("x.fa", "rb").read()) # sorted unique hashes at the index's k / scaled
ix.guess_hashes(h) # the JSON of `gmg guess`, as a dict
ix.use_thresholds("novel") # known (default) | permissive | novel
Index.classify(path, kind="auto", min_abund=0, max_records=0, top=5, id=None) reads plain or gzipped FASTA/FASTQ; classify_bytes(data, name=...)
takes sequence text in memory. Not in the bindings: sample sheets, read pairing and --exclude-* (use the CLI for those).
Build and test
pip install maturin pytest
cd crates/gmg-py && maturin develop # or: maturin build --release (an abi3 wheel for Python >= 3.9)
GMG_BIN=../../target/debug/gmg pytest tests # the tests build a small index with the gmg binary and compare with `gmg run`
The crate is outside the main Cargo workspace (like fuzz/), so cargo test at the root does not need Python; .github/workflows/python.yml builds and tests it.
Metadata
Release files for guess-my-genome 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| guess_my_genome-0.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details for guess_my_genome-0.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| guess_my_genome-0.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details for guess_my_genome-0.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| guess_my_genome-0.3.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for guess_my_genome-0.3.2-cp39-abi3-macosx_11_0_arm64.whl |
Total release size: 1.5 MB
Release files / guess_my_genome-0.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | guess_my_genome-0.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 536.1 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0ee5f749f7e567608eb8f7db014e7afb1d7de9afc986abe9e938f16bdac0dc0c
|
|
BLAKE2b-256 checksum How to use checksums |
f6b74ab5dc97de2a1537473df3aa5493683d2e2e0850e23eca6f5aa3e274eee7
|
| 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 Nov 4, 2026.
Transparency logRelease files / guess_my_genome-0.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | guess_my_genome-0.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 516.3 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
976ba04d4c3035c1cf8885dceab0ce7a8a4f225172cfd8be1f421d292a16ab0e
|
|
BLAKE2b-256 checksum How to use checksums |
c8890fb9d78c2b23bcf6bbf9186acc5d0e2926b953bc3a0369ebc98fcc36dbdc
|
| 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 Nov 4, 2026.
Transparency logRelease files / guess_my_genome-0.3.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | guess_my_genome-0.3.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 472.9 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d474dd5a916c3be2eb54bc8758e8d54a78392101c43e322ca7da046753ed77ae
|
|
BLAKE2b-256 checksum How to use checksums |
52cbe18c0e96e32dd68abb5de034e605a424877af55e6c717d4271c63e09a72b
|
| 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 Nov 4, 2026.
Transparency logSecurity for guess-my-genome 0.3.2
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 3 files in this release have been uploaded with provenance metadata.
Attestation for guess_my_genome-0.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
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 Nov 4, 2026.
Transparency logA 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.