viva-copasi
process-bigraph-compatible COPASI Steps and Processes for SBML model simulation.
Exposes any SBML kinetic model as a process-bigraph Step or Process so it can
be composed with other simulators in a bigraph document, using
COPASI / basico as the
simulation back-end.
Installation
uv venv .venv && source .venv/bin/activate
uv pip install -e .
Quick Start
from importlib.resources import files
from process_bigraph import Composite, gather_emitter_results
from viva_copasi.composites import build_composite, register_copasi
# Resolve the bundled Repressilator model
model_path = str(files('viva_copasi.composites').joinpath('repressilator.xml'))
# Build and run the incremental UTC process composite
sim = build_composite('utc-process')
for _ in range(10):
sim.update({}, 1.0) # advance 1 time unit per step
results = gather_emitter_results(sim)
print(results[('emitter',)][-1])
Classes
CopasiUTCStep— one-shot Uniform Time Course (UTC) trajectory (Step)CopasiUTCProcess— incremental UTC simulation (Process)CopasiSteadyStateStep— steady-state solve (Step)BaseCopasi— shared model-load mixin (SBML parsing, species/reaction indexing)
All classes accept a model_source config key pointing to an SBML or COPASI
model file (path or URL).
Composites
Three discoverable composites in viva_copasi/composites/:
| Name | Type | Description |
|---|---|---|
utc-step |
Step | One-shot UTC trajectory; returns full time series in a single update() call |
utc-process |
Process | Incremental UTC; advances one interval per update(), emitting concentrations + fluxes |
steady-state |
Step | Steady-state solve; returns equilibrium concentrations and reaction fluxes |
Each ships with the bundled SBML model BIOMD0000000012 — the Elowitz & Leibler 2000 Repressilator.
Load a composite by name:
from viva_copasi.composites import build_composite, list_composite_specs
print(list_composite_specs()) # ['steady-state', 'utc-process', 'utc-step']
sim = build_composite('utc-process')
Override the model or parameters:
sim = build_composite('utc-step', overrides={
'model_source': '/path/to/my_model.xml',
'time': 50.0,
'n_points': 51,
})
API
CopasiUTCStep (Step)
One-shot UTC trajectory.
Config: model_source (str), time (float, default 1.0), n_points (int, default 2),
species_units ('concentration' | 'amount', default 'concentration').
species_units sets the units of the default species output: 'concentration'
(the prior behavior) or 'amount' (particle number). It hides COPASI's bare-name
(particle count) vs [name] (concentration) split so every species is reported
consistently. Explicit selections are reported verbatim and are unaffected.
Outputs: result — dict with keys time (list), columns (list), values (list of rows).
CopasiUTCProcess (Process)
Incremental UTC simulation.
Fast species binding by default. Each update() sets incoming species with the
low-level COPASI API (CMetab.setInitialConcentration + a single
model.updateInitialValues(...) state-sync) and reads them back with per-metabolite
getConcentration() — ~500× faster than looping basico.set_species /
get_species per name (which rebuilds a DataFrame through basico's global-model
indirection on every call). So the set/get marshalling is only ~¼ of an update();
the COPASI solve dominates. There is no slower mode to opt out of — don't wrap
basico.set_species around this process.
Config: model_source (str), time (float, default 1.0), intervals (int, default 10),
species_units ('concentration' only; 'amount' raises ValueError at construction, because the per-tick
delta would mix concentration starts with particle-number ends).
Outputs: species_concentrations (map[float]), fluxes (map[float]), time (list[float]).
CopasiSteadyStateStep (Step)
Steady-state solve.
Config: model_source (str),
species_units ('concentration' | 'amount', default 'concentration').
Outputs: results — dict with keys time, species_concentrations, fluxes.
register_copasi(core=None)
Register all COPASI process classes, the RAM emitter, and the
SpeciesConcentrationsPlot visualization into a bigraph core.
make_copasi_utc_document(...) / make_copasi_utc_process_document(...) / make_copasi_steady_state_document(...)
Programmatic composite-document factories for callers that want full control over wiring without a YAML file.
Tests
python -m pytest tests/ -q
Demos
python demo/demo_report.py # runs all 3 classes; saves demo/report.html
python demo/composite_report.py # runs utc-process composite; saves demo/utc-process-report.html
Metadata
Release files for viva-copasi 0.2.2
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 |
|---|---|---|---|---|
| viva_copasi-0.2.2.tar.gz | 52.8 kB | With provenance | Details for viva_copasi-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| viva_copasi-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for viva_copasi-0.2.2-py3-none-any.whl |
Total release size: 92.2 kB
Release files / viva_copasi-0.2.2.tar.gz
| Download URL | viva_copasi-0.2.2.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af6832e2844f785af5edb8b1d187d90018489140849f323516967328b789b9c2
|
|
BLAKE2b-256 checksum How to use checksums |
cf061aec6fe582ded5d0b2f79e30594f77ebc7423775d48bd20efa0c4ab5b134
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 4, 2026.
Transparency logRelease files / viva_copasi-0.2.2-py3-none-any.whl
| Download URL | viva_copasi-0.2.2-py3-none-any.whl |
|---|---|
| Size | 39.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c9aed01aa46bc68ea9c9f21ce5d5cec6fd46a7350e62cf0287e2b37f8a71428
|
|
BLAKE2b-256 checksum How to use checksums |
1fad3dddec5fa2c7cfcfa29f7c122ebc1277b2f6231ca4faaaf7f1f6e00f7858
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 4, 2026.
Transparency logSecurity for viva-copasi 0.2.2
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 viva_copasi-0.2.2.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 4, 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.