Skip to content

Bring the Python API to parity with the Rust API #13

Description

@nh13

Goal

Bring the Python API (spoars-py) to parity with the Rust Graph/engine API. The Python wrapper is currently a deliberately thin, high-level surface (Poa with add / consensus / msa / gfa / dot / num_nodes / num_edges / num_sequences, plus the poa() helper and Scoring), while the Rust crate exposes a substantially richer graph-inspection and manipulation layer. The intent is for the two to be similarly rich.

Policy

We fill Python API gaps opportunistically: whenever a PR touches a given area of the Rust API, it should carry the matching Python bindings (and python/spoars/_spoars.pyi stub update + pytest coverage) in the same change, rather than leaving Python behind. This issue is the durable record of that intent and a running inventory of the gaps.

Known gaps (Rust API not yet in Python)

  • Read-only graph accessors (added in cacf516): nodes / edges, node / edge id lookups, num_codes, encode / decode, rank_order, sequence_starts / sequence_path, consensus_nodes, msa_columns, column_members, and the Node helpers (coverage, successor, base). None are exposed to Python.
  • A node-id / graph-object layer. Python has no notion of a NodeId or a graph object it can walk; exposing the accessors above requires deciding how nodes/ids surface in Python.
  • An alignment layer. Poa.add() aligns-and-adds in one step with no way to obtain the alignment; there is no standalone align call or alignment object. Several Rust features (e.g. update_alignment, windowed POA) depend on this.

Related feature issues

The following track individual features whose Rust and Python sides should land together; each references this issue:

Definition of done

This issue stays open as a living tracker. It is "done" only once the Python surface covers the Rust graph-inspection and manipulation API at parity; individual gaps are closed by the feature issues and by opportunistic PRs that reference this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions