Skip to content

Python API — Overview

The fastdpplot Python package is a thin layer on top of the Rust extension (fastdpplot._rs). All heavy lifting — file I/O, binning, sparse conversion — happens in Rust. Python adds:

  • Friendly function signatures with sensible defaults.
  • A pandas DataFrame interface consumed by the rendering stack.
  • A datashader + Panel interactive server.
  • Optional cuDF GPU acceleration.

Module summary

Module Public symbols Purpose
io load(), load_bin() Load data from Parquet, text, or .bin+FASTA.
plot render_static(), serve_interactive(), show() Render or serve dotplots.
server run(), run_bin() Start the Panel server from Python.
sparse_convert to_scipy_sparse() Convert binning output to a scipy sparse matrix.

Import conventions

# High-level: recommended for most users
from fastdpplot.io import load, load_bin
from fastdpplot.plot import render_static, serve_interactive, show

# Low-level: access the Rust extension directly
from fastdpplot._rs import load_parquet, load_txt, bin_points_py, to_coo
from fastdpplot._rs import parse_fasta_first, parse_fasta_all
from fastdpplot._rs import load_bin_matrix_normalized, load_dp_input

Rust extension availability

If the Rust extension has not been compiled yet, direct imports from fastdpplot._rs will fail with Python's default ModuleNotFoundError.

The high-level wrapper modules such as io and plot provide a friendlier guidance message instead:

fastdpplot._rs is not available. Run 'maturin develop' to build the Rust extension first.


Data contract

All rendering functions expect a pandas.DataFrame with three columns:

Column dtype Meaning
x float64 X coordinate (subject position or arbitrary).
y float64 Y coordinate (query position or arbitrary).
value float32 Scalar weight (identity, score, or 1.0).

load() and load_bin() both return this shape.