Skip to main content

openmalaria (Python bindings)

Python bindings for OpenMalaria, built with nanobind. Runs a scenario in-process and returns pandas DataFrames directly. No output.txt/ ctsout.txt files involved.

Install

pip install ./python

(editable, for development: pip install -e ./python)

Usage

import openmalaria as om

result = om.run(path="scenario.xml")
result["survey"]       # pd.DataFrame: survey, column, measure, value
result["continuous"]   # pd.DataFrame (one row per timestep) or None

Or pass scenario XML content directly instead of a file path:

result = om.run(xml=scenario_xml_string, resource_path="/path/to/resources")

NB: schema lookup resolves relative to the current working directory for both path= and xml= (not relative to the scenario file's own directory, if using path=). Run from a directory containing scenario_current.xsd, or otherwise ensure the schema is discoverable from the working directory.

om.run() also accepts validate_only=True (parse/validate the scenario and stop before any timestep evolution. This acts as a cheap sanity check, equivalent to the CLI's --validate-only), seed=<int> (override the scenario's @iseed), and verbose=True/progress=True (equivalent to the CLI flags of the same name).

survey DataFrame schema

Mirrors output.txt's own row schema exactly: survey (1-based survey number), column (encodes age-group/cohort/species/genotype/drug the same way output.txt does), measure (the OutMeasure id), value.

continuous DataFrame schema

One row per reported timestep, one column per enabled monitoring/continuous metric (column names taken from the scenario's own metric titles). None if the scenario has no <continuous> monitoring configured.

Version info

>>> om.version()
{'program_version': 'schema-50.0', 'schema_version': 50}

Equivalent to the CLI's openMalaria --version.

Parallelism (mpi4py)

from mpi4py import MPI
import openmalaria as om

comm = MPI.COMM_WORLD
scenario_paths = [...]  # one per rank, or distribute a longer list up front

result = om.run(path=scenario_paths[comm.rank])

Each MPI rank runs exactly one scenario per process (see Limitations below). Pin ranks to individual cores via your launcher, e.g. mpirun --bind-to core -np N python script.py.

Limitations

om.run() may be called at most once per process. OpenMalaria's C++ core keeps several pieces of state as process-global statics that are populated once and never reset:

  • interventions::InterventionManager -- append-only; throws on a second run reusing any <component id="..."> name, and silently duplicates/accumulates timed and continuous deployments otherwise.
  • WithinHost::Genotypes -- allele/frequency maps are insert-only, never cleared.
  • mon::internal::runtime.conditions -- push_back-only, never cleared.
  • util::CommandLine -- several statics throw if set a second time via parse(); others are simply never reset.

This is the same conclusion already reached and documented by this repo's Emscripten/WASM/JS binding (js/src/index.mjs, js/API.md "Concurrency and isolation"), "fresh module instance per call" there, "fresh OS process per call" here. For N scenarios, use one process per scenario (mpi4py, one MPI rank per scenario; or Python multiprocessing/concurrent.futures.ProcessPoolExecutor), not a loop calling run() repeatedly in one process.

No checkpoint/resume support. Checkpointing (-c/--checkpoint-file on the CLI) remains a CLI-only feature; om.run() exposes no checkpoint parameters.

CPU-core pinning is the caller's responsibility. OpenMalaria's simulation engine has no internal threading (no OpenMP, no std::thread anywhere in the C++ core), so single-core execution is achieved externally: mpirun --bind-to core -np N python script.py, or os.sched_setaffinity(0, {core_id}) (Linux) at the start of a worker process.

Release files for openmalaria 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for openmalaria 0.1.0
File
openmalaria-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
openmalaria-0.1.0-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details
openmalaria-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
openmalaria-0.1.0-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details
openmalaria-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
openmalaria-0.1.0-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details
openmalaria-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
openmalaria-0.1.0-cp311-cp311-macosx_26_0_arm64.whl CPython 3.11 CPython 3.11 macOS 26.0+ ARM64 Details
openmalaria-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
openmalaria-0.1.0-cp310-cp310-macosx_26_0_arm64.whl CPython 3.10 CPython 3.10 macOS 26.0+ ARM64 Details
openmalaria-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
openmalaria-0.1.0-cp39-cp39-macosx_26_0_arm64.whl CPython 3.9 CPython 3.9 macOS 26.0+ ARM64 Details

Total release size: 37.2 MB

Release files / openmalaria-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL openmalaria-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.6 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3e3f590f9472a8139d3315252ba21ef5ef6d714b67720908e24ec84d5ab1137d
BLAKE2b-256 checksum
How to use checksums
4a225573d647e6523fd521617f1b810191859a21dcbe9754c3d888a0d956e527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp314-cp314-macosx_26_0_arm64.whl

Download URL openmalaria-0.1.0-cp314-cp314-macosx_26_0_arm64.whl
Size 2.6 MB
Tags CPython 3.14 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
993f1b0ed73c2da2fa0f3838bb2f99ea2df328b54cf1826ba9612c000428d40f
BLAKE2b-256 checksum
How to use checksums
2239a59f75467b82e467329ff9752bdfd33b2d91eccc3e38f0c9d3ea8742baf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL openmalaria-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.6 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a901c4aba149701079620113d0846459074bcbe38e2507cf36cebe4cfffce2f2
BLAKE2b-256 checksum
How to use checksums
a20bef3fd3d7d83fc0541433839b1d5d8a080f8841a2e0bdd2cb77c008f4dce8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp313-cp313-macosx_26_0_arm64.whl

Download URL openmalaria-0.1.0-cp313-cp313-macosx_26_0_arm64.whl
Size 2.6 MB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
8f7bad6e2ac1d6d2ec0351f132d0e7d683d2194812527ba618e368daf7117b5c
BLAKE2b-256 checksum
How to use checksums
17017abc9780b22695ab2a952a2804e5241a60cb5f2f1f05c5b37380c7bd8db3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL openmalaria-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.6 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2b4d5e171c4e535ce938fa1ddec58c4d513645d5c232c120897055274d2c7d77
BLAKE2b-256 checksum
How to use checksums
d522a41715fde03ec074e9e5b8e96d0f3eabeb8332c39ef995d2aa06e5622ae3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp312-cp312-macosx_26_0_arm64.whl

Download URL openmalaria-0.1.0-cp312-cp312-macosx_26_0_arm64.whl
Size 2.6 MB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
6161e845e2440276cf1c5b75c3650575cd2e85a9c8ddbcdeaa1a72a3cdeec932
BLAKE2b-256 checksum
How to use checksums
3320b1010472abb89730349a78bc830136edf2c109b2a9cea9e15cc8d5250aef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL openmalaria-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.6 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
cd744000ed77839cc172fa58b310e06a0584aa9e8c76e97f64bc1d06bbe266d7
BLAKE2b-256 checksum
How to use checksums
02c16211ba09f710d8639f441b61724794e6f044ca8bce1905648ea75065ac27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp311-cp311-macosx_26_0_arm64.whl

Download URL openmalaria-0.1.0-cp311-cp311-macosx_26_0_arm64.whl
Size 2.6 MB
Tags CPython 3.11 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
adce6c897bb805d63c88c672587a2e2279927ae7423e7a8617234b1bd0dfdc74
BLAKE2b-256 checksum
How to use checksums
d171759400db809d421c68935ca04a6c88373110f6df2abd1eb60c7765bc171e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL openmalaria-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.7 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ee2afe7d9e6056fd500f04bb173acf4df77cd1ec8bb43e015367f365baf809f9
BLAKE2b-256 checksum
How to use checksums
5945313333c528016f34dba591d6a13f6e4fff6fac87c15fe7ff109e42a2a0fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp310-cp310-macosx_26_0_arm64.whl

Download URL openmalaria-0.1.0-cp310-cp310-macosx_26_0_arm64.whl
Size 2.6 MB
Tags CPython 3.10 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
282ba7ce0db5cc6d5da1017097216462909a8a3e16a88a6df4907e92e100074a
BLAKE2b-256 checksum
How to use checksums
857284fc95ce1855f1330adca2ab8573a173a0675c74f6d2349ce9198350f40b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL openmalaria-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.6 MB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7afa936d3cc149e9f7167117b24ba6ab06b51a64cb9b0f2682520e062052305e
BLAKE2b-256 checksum
How to use checksums
ce796d955c296eff8b5fc4c04528935879eb45ce2c292c401a4d7849c0124d23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release files / openmalaria-0.1.0-cp39-cp39-macosx_26_0_arm64.whl

Download URL openmalaria-0.1.0-cp39-cp39-macosx_26_0_arm64.whl
Size 2.6 MB
Tags CPython 3.9 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
c66fd38688d8330ccdcfa1f46ba16d1fb2bb541271ff62db3efe8ad1b0f3e4ae
BLAKE2b-256 checksum
How to use checksums
9a8c4c1f3e52a28b813ff3b9ce8d440eb7f8adb3ecaeecc624713e5d641d5471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

12 release files

This release

0.1.0 This release

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page