cy3sbml for Python
Visualize SBML models in Cytoscape and call the cy3sbml app's automation commands from Python scripts and notebooks. The package uses py4cytoscape.
Install
Use Python 3.11 or later. Start Cytoscape 3.10 or later with the cy3sbml app version 0.8.0 or later installed. The Python package connects to Cytoscape's CyREST API.
python -m pip install cy3sbml
Install cy3sbml[antimony] to convert Antimony text or files to SBML before
visualization.
Visualize a model
from cy3sbml import export_image, visualize_sbml
suid = visualize_sbml("model.xml")
if suid is not None:
export_image("model.svg", format="SVG", fit_content=True, network=suid)
visualize_sbml imports the file and selects the main model's base network.
The return value is the network SUID, or None with a logged warning if
Cytoscape cannot import or display the model. visualize_antimony accepts
Antimony text or a local file. Pass a pathlib.Path when you want it to check
that the file exists.
The visualizers keep the current session open by default. Passing
delete_session=True closes the session without saving before import.
The file given to visualize_sbml and the output path given to export_image
are paths on the Cytoscape computer. For a model on another computer, pass
its absolute path as it appears on the Cytoscape host. To connect to a different
CyREST endpoint, pass its base_url, including the API version (for example
http://127.0.0.1:4321/v1).
Cytoscape renders view changes asynchronously. If Python can read the export
file, use export_png(path, suid) to export the view until two successive PNGs
match. It returns the path reported by Cytoscape, including the extension.
To use saved Cytoscape boundingBox XML positions, call
apply_layout(read_layout_xml("layout.xml"), network=suid). You can also give
apply_layout a pandas DataFrame with x and y columns indexed by SBML ID.
Use add_annotations with AnnotationText, AnnotationShape, or
AnnotationBoundedText to add labels and shapes to the view.
Call app commands
from cy3sbml import command, network, network_of_type
model = command("import", biomodelsId="BIOMD0000000012")["models"][0]
base = network_of_type(model, "base")
print(command("element", network=network(base), sbmlId="PX")["elements"])
See the automation guide for command arguments and results.
Develop
From python/ in a Git checkout, use uv to run the
offline tests and build the package.
uv sync --locked --extra antimony
uv run --no-sync ruff check
uv run --no-sync ruff format --check
uv run --no-sync ty check
uv run --no-sync pytest
uv build --no-sources
uv run --no-sync twine check --strict dist/*
See the Python release procedure for publishing.
Metadata
Release files for cy3sbml 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cy3sbml-0.1.0.tar.gz | 10.3 kB | With provenance | Details for cy3sbml-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cy3sbml-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cy3sbml-0.1.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / cy3sbml-0.1.0.tar.gz
| Download URL | cy3sbml-0.1.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8545b86d4bef36338c946d29065d29435f7dbfb2e8c79e391f4c5e1dc9e803b
|
|
BLAKE2b-256 checksum How to use checksums |
9f064f8f63c42d7a795e262f8be5334bea63e6c62d4814ef502a90192b6a1288
|
| 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 25, 2026.
Transparency logRelease files / cy3sbml-0.1.0-py3-none-any.whl
| Download URL | cy3sbml-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3224e6053a23c863f46db5e7dce46abb5b98641b98c3cfcdd4ae3463243466dd
|
|
BLAKE2b-256 checksum How to use checksums |
a81732e3822836b7e6c36a6c206fea0e4145923a58c731e3e94506d292c184b4
|
| 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 25, 2026.
Transparency logSecurity for cy3sbml 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cy3sbml-0.1.0.tar.gz
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 25, 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.