Skip to main content

blazeseq (Python)

Python bindings for BlazeSeq — high-performance FASTQ parsing.

Wheels only: install from PyPI. No source build of the extension.

Requires Python 3.10–3.14 and MAX 26.7.0 (installed automatically). Linux requires glibc 2.34 or newer; Apple Silicon requires macOS 13 or newer. CPU parsing does not require GPU hardware. The Python API remains a CPU parsing API; device batching is exposed by the bundled Mojo library.

# Install (uv recommended)
uv pip install blazeseq

# Or with pip
pip install blazeseq

Quick start

import blazeseq

# quality_schema defaults to "generic"; use keyword args for clarity
parser = blazeseq.parser("file.fastq", quality_schema="sanger")
while parser.has_more():
    rec = parser.next_record()
    print(rec.id, rec.sequence)

Or use the iterator over records:

for rec in parser.records:
    print(rec.id, rec.sequence)

For batched iteration (default 100 records per batch):

for batch in parser.batches:
    for rec in batch:
        print(rec.id, rec.sequence)

Custom batch size:

for batch in parser.batches_with_size(50):
    for rec in batch:
        print(rec.id, rec.sequence)

Gzip files: use .fastq.gz or .fq.gz and set parallelism for decompression threads (default 4):

parser = blazeseq.parser("reads.fastq.gz", quality_schema="sanger", parallelism=8)
for rec in parser.records:
    print(rec.id, rec.sequence)

API reference

Module-level

Function Description
parser(path, quality_schema="generic", parallelism=4) Create a FASTQ parser. Supports .fastq, .fq, .fastq.gz, .fq.gz. quality_schema: "generic", "sanger", "solexa", "illumina_1.3", "illumina_1.5", "illumina_1.8". parallelism: decompression threads for gzip (default 4). Returns a parser supporting records, batches, batches_with_size(n), has_more(), next_record(), next_batch(n).

Parser (returned by parser / create_parser)

Method / attribute Description
has_more() Return True if there may be more records to read.
next_record() Return the next record as a FastqRecord. Raises on EOF or parse error.
next_ref_as_record() Return the next record (from zero-copy ref) as a FastqRecord. Raises on EOF or parse error.
next_batch(max_records) Return a batch of up to max_records records as a FastqBatch. Returns a partial batch at EOF.
records Iterable over records: for rec in parser.records.
batches Iterable over batches (default 100 records per batch): for batch in parser.batches then for rec in batch.
batches_with_size(batch_size) Iterable over batches of the given size.
__iter__ / __next__ Iterator protocol; equivalent to iterating over records.

FastqRecord

Property / method Description
id Read identifier (without leading @).
sequence Sequence line (bases).
quality Quality line (raw quality string).
__len__() Sequence length (number of bases).
phred_scores Phred quality scores as a Python list of integers.

FastqBatch

Method Description
num_records() Number of records in the batch.
get_record(index) Return the record at the given index as a FastqRecord.
__iter__ Iterate over records: for rec in batch.

Local development (uv)

From the repo root, after building the Mojo extension into python/blazeseq/_extension/:

uv pip install -e python/
uv run python tests/test_python_bindings.py

Build and upload to PyPI

Prerequisites: Build the Mojo extension so that python/blazeseq/_extension/ contains the platform wheel (.so). Ensure version in pyproject.toml is bumped for releases.

  1. Install build tools and twine:

    uv pip install build twine
    
  2. Build the package (from the python/ directory):

    cd python
    uv run python -m build
    

    This produces dist/blazeseq-<version>.tar.gz (sdist) and dist/blazeseq-<version>-*.whl (wheel).

  3. Upload to PyPI (use a PyPI API token; create one at pypi.org):

    uv run twine upload dist/*
    

    For Test PyPI first:

    uv run twine upload --repository testpypi dist/*
    

Metadata

Release files for blazeseq 0.4.0

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

Built distributions (wheels)

Table of built distributions (wheels) for blazeseq 0.4.0
File Interpreter ABI Platform Actions
blazeseq-0.4.0-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details for blazeseq-0.4.0-cp314-cp314-manylinux_2_34_x86_64.whl
blazeseq-0.4.0-cp314-cp314-macosx_13_0_arm64.whl CPython 3.14 CPython 3.14 macOS 13.0+ ARM64 Details for blazeseq-0.4.0-cp314-cp314-macosx_13_0_arm64.whl

Total release size: 1.4 MB

Release files / blazeseq-0.4.0-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL blazeseq-0.4.0-cp314-cp314-manylinux_2_34_x86_64.whl
Size 721.9 kB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
1b947bf6ad040f074585993177a0cf7bf1af387f917f12d1e0ba9ffafbaecb6d
BLAKE2b-256 checksum
How to use checksums
bb8e3e6a088ae1e883a2bdd7ae1114166f12e4c73ce613385a2061d6ba90a7de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / blazeseq-0.4.0-cp314-cp314-macosx_13_0_arm64.whl

Download URL blazeseq-0.4.0-cp314-cp314-macosx_13_0_arm64.whl
Size 698.8 kB
Tags CPython 3.14 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
4baea318b0e8270bcf9ebb57e72b111af9657d84b0ad97ccb952f1896d09f7ff
BLAKE2b-256 checksum
How to use checksums
4aa904d6b4903ab855ee7fd3876dcf70b838e192173a7dad3fa90e80f29394c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for blazeseq 0.4.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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