Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: tests

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install ".[dev]"
- run: pytest -q
env:
MPLBACKEND: Agg
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ wheels/
# OS
.DS_Store
Thumbs.db

# MkDocs build output
site/
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## [0.1.1] — 2026-10-08

First citable release. The `v0.1.0` tag was created before the release
branch was merged and points to the previous code (no license, citation
metadata or tests); use 0.1.1.

- Models compatible with dissmodel 0.5.0 or later (tested with 0.5.0, 0.6.0 and 0.6.6).
- `tests/test_models_smoke.py` runs every exported model for a few steps, headless,
and checks that its state stays numeric; a GitHub Actions workflow runs it.
- `streamlit` is no longer a required dependency: no module of the package uses
it, only the Streamlit examples (`pip install "dissmodel-sysdyn[examples]"`).
- `demo/`: self-contained Streamlit app (Dockerfile, pinned requirements,
Hugging Face Space header) that can be deployed on its own; before, the
Dockerfile copied `src/` and `pyproject.toml` from the repository root.
- MIT license and `CITATION.cff`.
26 changes: 26 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "dissmodel-sysdyn: System Dynamics extension for DisSModel"
abstract: >-
System dynamics models for the DisSModel framework: population growth, SIR, predator-prey, Lorenz, Daisyworld and other classic examples, ported from the TerraME model collection.
authors:
- family-names: "Costa"
given-names: "Sérgio Souza"
orcid: "https://orcid.org/0000-0002-0232-4549"
- family-names: "Santos Junior"
given-names: "Nerval de Jesus"
orcid: "https://orcid.org/0009-0000-2339-3191"
- family-names: "Vale"
given-names: "Mateus Dutra"
orcid: "https://orcid.org/0009-0005-1301-879X"
version: 0.1.1
date-released: "2026-10-08"
license: MIT
url: "https://github.com/DisSModel/dissmodel-sysdyn"
repository-code: "https://github.com/DisSModel/dissmodel-sysdyn"
keywords:
- system dynamics
- DisSModel
- simulation
- TerraME
type: software
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2025 Sérgio Souza Costa, Nerval de Jesus Santos Junior,
Mateus Dutra Vale

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# dissmodel-sysdyn

System Dynamics models for [dissmodel](https://github.com/LambdaGeo/dissmodel).
System Dynamics models for [dissmodel](https://github.com/DisSModel/dissmodel).

This library provides a collection of System Dynamics models implemented using the `dissmodel` core.

## Installation

The package is not on PyPI. Install it from GitHub:

```bash
pip install dissmodel-sysdyn
pip install git+https://github.com/DisSModel/dissmodel-sysdyn
```

or, from a clone, `pip install .` (`pip install ".[examples]"` for the Streamlit apps, `pip install ".[dev]"` for the tests).

## Models

The library includes a wide range of System Dynamics models:
Expand Down
31 changes: 11 additions & 20 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
# Self-contained: build from this folder only (e.g. a Hugging Face Space).
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
libgl1 \
libglib2.0-0 \
# git: dissmodel-sysdyn is installed from GitHub (not on PyPI)
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*

# Set up a new user to avoid running as root
# Hugging Face runs the container as uid 1000
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
PATH=/home/user/.local/bin:$PATH \
MPLBACKEND=Agg

WORKDIR $HOME/app

# Copy requirements and install
COPY --chown=user demo/requirements.txt ./demo/requirements.txt
RUN pip install --no-cache-dir -r demo/requirements.txt
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

COPY --chown=user pyproject.toml README.md ./
COPY --chown=user src ./src
COPY --chown=user demo/app.py ./demo/app.py
COPY --chown=user app.py .

RUN pip install --no-cache-dir .

# Expose the port Streamlit will run on (Hugging Face uses 7860)
# Hugging Face Spaces expect port 7860
EXPOSE 7860

# Command to run the app
CMD ["streamlit", "run", "demo/app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
30 changes: 30 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: DisSModel System Dynamics Explorer
emoji: 📈
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
license: mit
short_description: Run the dissmodel-sysdyn models in the browser
---

# System Dynamics Explorer

Interactive demo of [dissmodel-sysdyn](https://github.com/DisSModel/dissmodel-sysdyn):
pick a model (SIR, predator–prey, Lorenz, Daisyworld…), set its parameters in
the sidebar and watch the stocks evolve.

This folder is self-contained and is what gets deployed:

```bash
# locally
pip install -r requirements.txt
streamlit run app.py

# or with Docker
docker build -t sysdyn-demo . && docker run -p 7860:7860 sysdyn-demo
```

To publish on Hugging Face, create a Space with the Docker SDK and push the
contents of this folder to it. The header above is the Space configuration.
8 changes: 8 additions & 0 deletions demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

This application dynamically discovers all available models and generates
the corresponding UI for parameters and live plotting.

Standalone: this folder is what gets deployed (e.g. to a Hugging Face
Space), so the app imports only installed packages (see requirements.txt).

Usage
-----
pip install -r requirements.txt
streamlit run app.py
"""
from __future__ import annotations

Expand Down
6 changes: 4 additions & 2 deletions demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
streamlit
matplotlib
# Pinned so that the deployed demo is reproducible; bump together with releases.
dissmodel==0.6.6
dissmodel-sysdyn @ git+https://github.com/DisSModel/dissmodel-sysdyn@v0.1.1
streamlit>=1.30
27 changes: 19 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,34 @@ build-backend = "setuptools.build_meta"

[project]
name = "dissmodel-sysdyn"
version = "0.1.0"
description = "System Dynamics models for dissmodel"
version = "0.1.1"
description = "System dynamics models for DisSModel"
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"dissmodel>=0.1.0",
"streamlit",
]
license = { text = "MIT" }
authors = [
{ name = "Sergio", email = "sergio@example.com" },
{ name = "Sérgio Souza Costa", email = "sergio.costa@ufma.br" },
{ name = "Nerval de Jesus Santos Junior" },
{ name = "Mateus Dutra Vale" },
]
requires-python = ">=3.10"
dependencies = [
"dissmodel>=0.5.0",
]

[project.optional-dependencies]
examples = [
"streamlit",
]
dev = [
"pytest",
]

[tool.setuptools]
package-dir = {"" = "src"}
packages = ["dissmodel_sysdyn", "dissmodel_sysdyn.models"]

[project.urls]
Homepage = "https://github.com/DisSModel/dissmodel-sysdyn"

[tool.pytest.ini_options]
testpaths = ["tests"]
Loading
Loading