Commol
Declarative dynamical modelling in Python.
In Commol, a model is a description of a system rather than a set of equations. You state what the system is made of and how it changes: its states, the flows between them and the rates that drive them. Commol turns that description into equations, solves them, and fits them to your data.
Writing the description instead of the equations keeps a model small as the system grows: splitting every state into subgroups takes a few lines, not dozens of new equations. And since the description says nothing about how it is solved, the same model runs in discrete steps or continuously, and can be calibrated against observations without extra code.
What you can model
Commol supports compartmental models: quantities that flow between states at rates written as formulas. A quantity can be a count, a mass or a concentration, and each state can be split into as many subgroups as the problem needs. This structure is common in epidemiology, pharmacokinetics, ecology and chemical kinetics, and Commol assumes none of them.
Models are deterministic and evolve along a single variable, usually time. Calibration is based on optimization from one or several starts; the uncertainty methods share one weighted parameter sample, its predictive and its scores.
Installation
pip install commol
Commol requires Python 3.12 or later. Prebuilt wheels are available for Linux and macOS (x86_64 and arm64) and for Windows (x86_64); on other platforms pip builds Commol from source, which needs a Rust toolchain (see Installation).
Commol is under active development. Until version 1.0, a minor release
(0.2 → 0.3) may break the API; the
changelog lists
every such change.
Example
A model of three states with one unknown rate. Commol describes the model with the equations it derived, fits the rate to five observations, and simulates the result:
from commol import (
Aggregate,
CalibrationParameter,
CalibrationProblem,
Calibrator,
ModelBuilder,
NelderMeadConfig,
ObservedDataPoint,
Simulation,
)
# 1. Write the process (the states and the flows between them), and build it
# with a structure (how much starts where) and an engine.
model = (
ModelBuilder(name="Three states")
.add_bin(id="A", name="State A")
.add_bin(id="B", name="State B")
.add_bin(id="C", name="State C")
.add_parameter(id="k1", value=None) # unknown: calibration finds it
.add_parameter(id="k2", value=0.1)
.add_transition(id="t_ab", source=["A"], target=["B"], rate="k1 * A * B / total")
.add_transition(id="t_bc", source=["B"], target=["C"], rate="k2")
.build(
Aggregate(
bin_amounts={"A": 990, "B": 10, "C": 0},
),
engine="DifferentialEquations",
) # or "DifferenceEquations"
)
print(model.describe().render("text")) # the equations Commol derived, and more
model.describe().save("model.md") # Markdown, with the state graph as a diagram
# 2. Fit the unknown to the observations of B.
observed = [
ObservedDataPoint(at=at, output="B", value=value)
for at, value in [(10, 150.8), (20, 404.7), (30, 239.0), (40, 104.0), (50, 42.6)]
]
problem = CalibrationProblem(
observed_data=observed,
parameters=[
CalibrationParameter(
id="k1", parameter_type="parameter", min_bound=0.0, max_bound=1.0
)
],
loss_function="sse",
optimization_config=NelderMeadConfig(max_iterations=500),
)
result = Calibrator(Simulation(model), problem).run()
model.apply_calibration_parameters(result, problem)
# 3. Simulate the calibrated model.
results = Simulation(model).run(num_steps=60)
print(f"k1 = {result.best_parameters['k1']:.2f}") # k1 = 0.40
print(f"B at 60: {results['B'][-1]:.1f}")
Features
- Subgroups. Split every state by any number of categories, nest a split inside one subgroup, and give each subgroup its own rates.
- Two engines. Run the same model as difference equations or as ordinary differential equations, with solvers for stiff systems.
- Rates that change. Write rates as formulas of the state and the axis, or build them from data series, pulses, intervals, ramps and impulses.
- Calibration. Fit parameters and initial conditions to observations of single outputs, sums or counts per window, under constraints.
- Uncertainty. Read a weighted sample of the parameters, the band of its predictive, and scores of the predictive against held-out data.
- Checks and output. Check units, print the equations as text or LaTeX, and save models and reports as JSON.
Documentation
The documentation begins with a Quick Start that builds, runs and calibrates a first model. The User Guide explains every concept and option, and the API Reference documents every public class and function.
Contributing
Bug reports, questions and suggestions are welcome in the
issue tracker. Contributors to the
code should first read the
contributing guide,
which explains how to set up the project and open a pull request. AI agents
should begin with AGENTS.md.
Citation
If you use Commol in your research, please cite it as follows:
@software{commol2025,
title = {Commol: High-Performance Declarative Dynamical Modelling in Python},
author = {
Villanueva Micó, Rafael J.
and Andreu Vilarroig, Carlos
and Martínez Rodríguez, David
},
year = {2025},
url = {https://github.com/MUNQU/commol}
}
License and authors
Commol is licensed under the MIT License. It is developed by the MUNQU team:
- Rafael J. Villanueva Micó - rjvillan@imm.upv.es
- Carlos Andreu Vilarroig - caranvi1@upv.es
- David Martínez Rodríguez - damarro3@upv.es
Metadata
Release files for commol 0.6.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 | |
|---|---|---|---|---|
| commol-0.6.0.tar.gz | 1.0 MB | With provenance | Details |
Built distributions (wheels)
Total release size: 63.7 MB
Release files / commol-0.6.0.tar.gz
| Download URL | commol-0.6.0.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b9ac71f5e717713ceac3cdd2e1c528fedcae387a986b5a4d139dadd7493abba
|
|
BLAKE2b-256 checksum How to use checksums |
eb904c70e09a9e863e33b68fe7dcc9a8e8efd24bdfd9954679f04a3ad6a0fa7a
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp314-cp314-win_amd64.whl
| Download URL | commol-0.6.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
04a08b9470f08a9041c438c5c6027eea99ab42258d370f930983946d937edb01
|
|
BLAKE2b-256 checksum How to use checksums |
65d4d1ecb39357b656d7c7bbfbfad0eb9d270b5e29129673bcbdf1909acf7575
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | commol-0.6.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
10c4cdecb1e92c54623e90aa92fb541f6f3389b2dd5060cbe1ce4f44cffec6ca
|
|
BLAKE2b-256 checksum How to use checksums |
a80d841b39517540ac5de4635ee48c8d464d1bf87eb6d1afb4b67f4eefa9b697
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | commol-0.6.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
bf3ebc0a1fe1f3c78019eeae3b95bf126833613aaabaaf62d2cc0b8e990be364
|
|
BLAKE2b-256 checksum How to use checksums |
99479f4cdcf1819141f8ea2db163698d3e0bae9da93e663cd76a7623956e7aa5
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | commol-0.6.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
54620686e1e1aaeb4d328a8dfa998deaf8ad07b18ac1ee40f57aa3a6099cf53c
|
|
BLAKE2b-256 checksum How to use checksums |
92442374600e2636aea9d8518cbf9e636fe2a077c99a30c9584f4de7d346c854
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | commol-0.6.0-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a28b0ea1f76da1542b2e390f11337d043ec027428dbe645960b49f72c5105271
|
|
BLAKE2b-256 checksum How to use checksums |
247e2b898b3ddc36d30df14c56768560c06e8caff429a6d2f87022b9e8ce2430
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp313-cp313-win_amd64.whl
| Download URL | commol-0.6.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a6193822653939bdf216467be0a440aab8b6a22df2b4205443430ffe3c87a55d
|
|
BLAKE2b-256 checksum How to use checksums |
bc4c788c028a602267d0132f7dcd1e86eb93e3ab22f0f468286dcaa30bb7008d
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | commol-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c388b1b06113006490c41fb5ad154acf33832efd04eb9846a0b66509ec8b67db
|
|
BLAKE2b-256 checksum How to use checksums |
f15104046df8a07bee51d234610272e5e043a37956ef2b0a4d8c27388e2d58f5
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | commol-0.6.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
ecfd8057280feff3350eccd60fee88cc5d4ca35d815a3341e73f84ed89c1c3c7
|
|
BLAKE2b-256 checksum How to use checksums |
fec5fb588f23c4e26f9d30f0f0a58fb02f2fb3b3205f67c7672c070ee08be123
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | commol-0.6.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
379f4e678a9de5ef7906ccb3a69e15ad5dee1a12872e17107905703440bbc11c
|
|
BLAKE2b-256 checksum How to use checksums |
ae6fbfdef14ea3d3190d2b92d215e7c2ecfe5ea21b2dc3a39fd3103259fca479
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | commol-0.6.0-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
380936b01dabd5ab792708320cf36ba3069de5f53ba2de128a878ccde4c441d4
|
|
BLAKE2b-256 checksum How to use checksums |
9bc708427f6ee07bf6e1bf1897dd56609b468be4804fa4fbf53f3df3e437c0ec
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp312-cp312-win_amd64.whl
| Download URL | commol-0.6.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
64714e7ab26143f1988b4ad2dd525e8ae9c60cbcba5b830f0c0d843205ee690c
|
|
BLAKE2b-256 checksum How to use checksums |
21299ae681fb6ad140bda60eccd2252005ff2a3f783f227db1a062be935edaa1
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | commol-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9adfc09a939bb890f8609083ba824367c8bd44aaedc953f76d424b44e2e90f3d
|
|
BLAKE2b-256 checksum How to use checksums |
d8df740f6be4e2bf4c076f7b51db24f3a40ccf89dee8e0e98e24cb9f72cadca0
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | commol-0.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
e4567d6e2fe59bc6fd2005216393543e7406e60be605124862c754d6e082b8e0
|
|
BLAKE2b-256 checksum How to use checksums |
64ca96e132bb8ff9dba30016165e8526210c0d5e111400ec41c7673097279d48
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | commol-0.6.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a8c903efda9e106fca2bfc8bce490805117dd598c7b4fb48cd9885eac7f91350
|
|
BLAKE2b-256 checksum How to use checksums |
1f853f208f0cbe2efea9ec478df5fb3637aeadcefb230bdb4ba2df01db611b1a
|
| 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 Oct 21, 2026.
Transparency logRelease files / commol-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | commol-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
4ffcfe108f8d9f11a307e3140364f13792f54fd25ed58240860830f22e435da6
|
|
BLAKE2b-256 checksum How to use checksums |
10e0f8e0b674634a65cf3b457afb76bed19e75ca8829054b2c45d35c2366bc86
|
| 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 Oct 21, 2026.
Transparency logSecurity for commol 0.6.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
All 16 files in this release have been uploaded with provenance metadata.
Attestation for commol-0.6.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 Oct 21, 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.