corneto.io.read_sbml#

corneto.io.read_sbml(source, *, annotations=False, compression='auto', timeout=30.0)#

Read supported metabolic SBML into plain Python records.

Supports SBML Level 3 Version 1 Core, FBC Version 2, and optional Groups Version 1. Inputs can be local paths, HTTP(S) URLs, or binary readable streams. Compression is detected from magic bytes by default. Unsupported dynamic semantics, missing stoichiometry, and unresolved or incomplete flux bounds raise ValueError.

This parser uses only the Python standard library. Boundary and constant species remain in model.species. With annotations=True, embedded RDF resource URIs are stored on their owning record; annotation URIs are not fetched.

Parameters:
  • source (str | PathLike | BinaryIO) – SBML path, HTTP(S) URL, or binary readable stream. Caller-owned streams are read from their current position and remain open.

  • annotations (bool) – Include embedded RDF resource URIs in record metadata.

  • compression (str | None) – "auto" detects gzip, bz2, or xz by magic bytes; None disables decompression, and an explicit codec forces it.

  • timeout (float) – HTTP request timeout in seconds.

Returns:

A MetabolicModel containing the parsed SBML records.

Raises:
Return type:

MetabolicModel