Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
26 changes: 10 additions & 16 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,29 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
# Add <, macOS-latest> to os to test TiMBA's functionality for macOS. Currently, macOS produces different results
# compared to ubuntu and windows without clear reason.
# Newest Python version 3.12 cannot be tested as Python >3.12.6 is not compatible with pandas < 2.0

runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5

- name: Set up uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
version: "0.7.8"
python-version: ${{ matrix.python-version }}
enable-cache: true

# Install dependencies necessary for the package
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install coverage
run: uv sync --python ${{ matrix.python-version }}

# Run tests with coverage (tests excluded, warnings ignored)
- name: Run test suite with coverage
run: |
python -W ignore::DeprecationWarning -m coverage run --rcfile=.coveragerc -m unittest discover -s test -p "test*.py"
coverage report
coverage xml -o coverage.xml
uv run python -W ignore::DeprecationWarning -m coverage run --rcfile=.coveragerc -m unittest discover -s test -p "test*.py"
uv run coverage report
uv run coverage xml -o coverage.xml

# Upload the coverage XML report as an artifact
- name: Upload coverage XML artifact
uses: actions/upload-artifact@v4
with:
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/sonarscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,31 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
version: "0.7.8"
python-version: ${{ matrix.python-version }}
enable-cache: true

# Install dependencies necessary for the package
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install coverage
run: uv sync --python ${{ matrix.python-version }}

# Generate a coverage report
- name: Run tests with coverage
run: |
python -W ignore::DeprecationWarning -m coverage run --rcfile=.coveragerc -m unittest discover
coverage report
coverage xml -o coverage.xml
uv run python -W ignore::DeprecationWarning -m coverage run --rcfile=.coveragerc -m unittest discover
uv run coverage report
uv run coverage xml -o coverage.xml

# Execute project scan and upload the coverage report to SonarCloud
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v2
with:
args: >
-Dsonar.organization=ti-forest-sector-modelling
-Dsonar.projectKey=TI-Forest-Sector-Modelling_TiMBA
-Dsonar.projectName=TiMBA
-Dsonar.projectVersion=1.0.3
-Dsonar.projectVersion=1.3.0
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.exclusions=test/**,**/test_*.py
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## Unreleased

### Added
- Migrated dependency management to [uv](https://docs.astral.sh/uv/).
- Added `.python-version` pinning Python 3.11 and a `uv.lock` file for reproducible installs.
- Added macOS to the CI test matrix.
- Documented the uv workflow in `README.md`, `AGENTS.md`, and `CONTRIBUTING.md`.

### Changed
- Updated GitHub Actions workflows (`actions.yml`, `sonarscan.yml`) to use uv for dependency installation and test execution.
- Cleaned up `pyproject.toml` metadata (`requires-python` and classifiers).
- `requirements.txt` is kept as a fallback for non-uv users.


## [v1.4.0] - 2026-07-16

### Added
Expand Down
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: TiMBA (Timber market Model for policy-Based Analysis)
message: >-
Expand Down Expand Up @@ -40,8 +37,10 @@ authors:
orcid: 'https://orcid.org/0000-0002-6719-0190'
identifiers:
- type: doi
value: 'https://doi.org/10.5281/zenodo.13842384'
value: '10.5281/zenodo.13842384'
description: 'Zenodo Archive'
- type: swh
value: swh:1:dir:e6e6240c08c0b70af91ed91083b3e37fce702214
repository-code: 'https://github.com/TI-Forest-Sector-Modelling/TiMBA'
abstract: |-
TiMBA is a partial economic equilibrium model for the
Expand All @@ -60,5 +59,6 @@ keywords:
- optimization
- wood markets
license: AGPL-3.0-or-later
message: If you use this software, please cite it using the metadata from this file.
version: 1.4.0
date-released: '2026-07-16'
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ initiate a topic under the [Github discussion section](#https://github.com/TI-Fo
Below you can find some guidance that helps us to streamline the integration of your code contributions or facilitate addressing
any issues you report.

## Development setup

TiMBA uses [uv](https://docs.astral.sh/uv/) for dependency management. The project is pinned to Python 3.11 in `.python-version`.

After installing uv, clone the repository and run:

```bash
uv sync
```

This installs the locked dependencies and the package in editable mode. Most development commands are then run via `uv run`:

```bash
uv run run_timba --help
uv run python -W ignore::DeprecationWarning -m coverage run --rcfile=.coveragerc -m unittest discover
uv run coverage report
uv run build --sdist --wheel
```

If you prefer pip, you can still install the project with `pip install -r requirements.txt` and `pip install -e .`.

## Contributing code

-----------------
Expand Down
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ equilibrium for each country and product in a given period by maximizing the soc
In the equilibrium processes, product supply, demand and price are balanced for each simulation period.

-----------------
<!-- TOC -->

- [TiMBA - Timber market Model for policy-Based Analysis](#timba---timber-market-model-for-policy-based-analysis)
- [1. Cite TiMBA](#1-cite-timba)
- [2. Installation](#2-installation)
- [2.1 Requirements](#21-requirements)
- [2.2 Install uv](#22-install-uv)
- [2.2.1 Linux](#221-linux)
- [2.2.2 Windows](#222-windows)
- [2.3 Install the TiMBA command line programs](#23-install-the-timba-command-line-programs)
- [2.3.1 Troubleshooting: `uv` command not found](#231-troubleshooting-uv-command-not-found)
- [2.4 Install TiMBA from PyPi](#24-install-timba-from-pypi)
- [2.5 Install TiMBA from GitHub](#25-install-timba-from-github)
- [3. Testing TiMBA](#3-testing-timba)
- [2.5.1 Install from GitHub without 'uv\`](#251-install-from-github-without-uv)
- [2.6. Testing TiMBA](#26-testing-timba)
- [3. Use TiMBA](#3-use-timba)
- [4. Supplementary modules](#4-supplementary-modules)
- [5. Project structure](#5-project-structure)
Expand All @@ -44,25 +49,29 @@ In the equilibrium processes, product supply, demand and price are balanced for
- [10.1 Findable](#101-findable)
- [10.2 Accessible](#102-accessible)
- [10.3 Interoperable](#103-interoperable)
- [10.3.1 Software interoperability](#1031-software-interoperability)
- [10.3.2 Data interoperability](#1032-data-interoperability)
- [10.4 Reusable](#104-reusable)
- [11. Contributing to the project](#11-contributing-to-the-project)
- [12. Authors](#12-authors)
- [13. Contribution statement](#13-contribution-statement)
- [14. License and copyright note](#14-license-and-copyright-note)
- [15. Acknowledgements](#15-acknowledgements)
- [16. References](#16-references)

<!-- /TOC -->
-----------------

## 1. Cite TiMBA

We are happy that you use TiMBA for your research. When publishing your work in articles, working paper, presentations
or elsewhere, please cite the model as
We are happy that you use TiMBA for your research. When publishing your work in articles, working paper, presentations or elsewhere, please cite the model as

TI-FSM, Morland, C., Schier, F., Tandetzki, J., Honkomp, T. (2025). TiMBA (Timber market Model for policy-Based Analysis). Journal of Open Source Software, 10(115), 8034, [https://doi.org/10.21105/joss.08034](https://doi.org/10.21105/joss.08034)
[Download BibTeX](./citation.bib)

The authors' collective is named Thünen Institute Forest Sector Modelling (TI-FSM). The individual authors are listed as
co-authors in alphabetical order.
The authors' collective is named "Thünen Institute Forest Sector Modelling
(TI-FSM)". The individual authors are listed as Co-authors in alphabetical
order.

## 2. Installation

Expand All @@ -75,22 +84,22 @@ system images](https://github.com/actions/runner-images#available-images)
### 2.1 Requirements

- Operating system: Linux or Windows on a x64 architecture. We test Windows 11
and Ubuntu 24.04, but other Windows and Linux versions are likely to work too.
and Ubuntu 24.04 but other Windows and Linux versions are likely to work, too.
- The Python package manager [uv](https://docs.astral.sh/uv/). We recommend to
use `uv`, because it provides a user-friendly, quick, platform-independent
and reliable way to install, use and develop TiMBA.
use `uv`, because it provides a user-friendly, quick, platform-independent,
and reliable way to install, use, and develop TiMBA.

That said, TiMBA can be also installed classically by creating a virtual
environment using [`venv`](https://docs.python.org/3.14/library/venv.html) and
installing with [`pip`](https://pip.pypa.io/en/stable/). To make the virtual
environment use the right Python version (if your system Python doesn't happen
to be version 3.9 - 3.11), you need to install a supported Python the the
operating system level and create the virtual environment with that version,
installing with [`pip`](https://pip.pypa.io/en/stable/). If your system Python
doesn't happen to be version 3.9 - 3.11, you need to install a supported Python
version to make the virtual environment use.

e.g. `python3.11 -m venv .venv`.

***Known Issues***:
TiMBA currently does not work with Python 3.12 or higher. We observe numerical discrepancies
(>5% compared to results generated on Windows or Linux) when running TiMBA on macOS which
(>5% compared to results generated on Windows or Linux) when running TiMBA on MacOS which
could traced back to the solver OSQP in CVXPY. The results with MacOS have not been validated.
We are investigating the issue.

Expand Down Expand Up @@ -196,6 +205,7 @@ To install TiMBA in editable mode, so that you can modify the TiMBA source code,
uv run timba run --help
uv run timba run -MP=1
```

#### 2.5.1 Install from GitHub without 'uv`

If you want to develop without using `uv`, you can install TiMBA with `venv` and `pip`, for example for Windows like so:
Expand All @@ -206,17 +216,14 @@ Windows](https://github.com/oleksis/pylauncher/blob/master/docs/launcher.rst)
installed.

1. Clone the repository and move into the project folder:
```bash
git clone https://github.com/TI-Forest-Sector-Modelling/TiMBA.git timba
cd timba
```
>git clone https://github.com/TI-Forest-Sector-Modelling/TiMBA.git timba
>cd timba

2. Create a virtual environment

Select the correct Python interpreter.
Show installed versions:
Show installed versions:
>py -0
>

- If you have installed multiple versions of Python, activate the correct version using the py-Launcher.
>py -3.11 -m venv venv
>
Expand All @@ -234,7 +241,7 @@ Enable the virtual environment to isolate TiMBA dependencies.
you might need to update the pip version you use with:
>python.exe -m pip install --upgrade pip

### 3. Testing TiMBA
### 2.6. Testing TiMBA

The TiMBA model comes with a test suite to ensure its functionality. Run the
test suite to check the functionality of the package and validate the produced
Expand Down
86 changes: 86 additions & 0 deletions codemeta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@id": "https://doi.org/10.5281/zenodo.17806030",
"@type": "SoftwareSourceCode",
"identifier": [
{
"@type": "doi",
"value": "10.5281/zenodo.13842384",
"propertyID": "http://doi.org/10.5281/zenodo.13842384"
},
{
"@type": "swhid",
"value": "swh:1:dir:e6e6240c08c0b70af91ed91083b3e37fce702214;origin=https://doi.org/10.5281/zenodo.13842384;visit=swh:1:snp:2f6aed0842a62a28ae45836d1833807ac77f2a2d;anchor=swh:1:rel:82b8d27a24ca85e5c57a89bcae5b69d8f9bc047f;path=TI-Forest-Sector-Modelling-TiMBA-b659274",
"propertyID": "https://archive.softwareheritage.org/swh:1:dir:e6e6240c08c0b70af91ed91083b3e37fce702214;origin=https://doi.org/10.5281/zenodo.13842384;visit=swh:1:snp:2f6aed0842a62a28ae45836d1833807ac77f2a2d;anchor=swh:1:rel:82b8d27a24ca85e5c57a89bcae5b69d8f9bc047f;path=TI-Forest-Sector-Modelling-TiMBA-b659274"
}
],
"name": "TiMBA (Timber market Model for policy-Based Analysis)",
"creator": [
{
"@type": "Person",
"name": "TI-FSM"
},
{
"name": "Morland, Christian",
"givenName": "Christian",
"familyName": "Morland",
"@id": "https://orcid.org/0000-0001-6600-570X",
"@type": "Person",
"affiliation": {
"@type": "Organization",
"name": "Thünen Institue of Forestry"
}
},
{
"@id": "https://orcid.org/0000-0002-3378-1371",
"@type": "Person",
"affiliation": {
"@type": "Organization",
"name": "Thünen Institue of Forestry"
},
"familyName": "Schier",
"givenName": "Franziska"
},
{
"@id": "https://orcid.org/0000-0002-0630-9434",
"@type": "Person",
"affiliation": {
"@type": "Organization",
"name": "Thünen Institue of Forestry"
},
"familyName": "Tandetzki",
"givenName": "Julia"
},
{
"@id": "https://orcid.org/0000-0002-6719-0190",
"@type": "Person",
"affiliation": {
"@type": "Organization",
"name": "Thünen Institue of Forestry"
},
"familyName": "Honkomp",
"givenName": "Tomke"
}
],
"publisher": {
"@type": "Organization",
"name": "Zenodo"
},
"keywords": "research, Forest sector model, partial equilibrium model, optimization, wood markets",
"dateCreated": "2025-12-03",
"dateModified": "2026-07-08",
"datePublished": "2025-12-03",
"version": "v1.3.0",
"license": "https://www.gnu.org/licenses/agpl.txt",
"description": "TiMBA is a partial economic equilibrium model for the\n global forest products market. The model endogenously\n simulates production, consumption and trade of wood and\n wood-based products in 180 countries. TiMBA recursively\n computes the market equilibrium for each country and\n product in a given period by maximizing the social surplus\n in the global forest sector. In the equilibrium processes,\n product supply, demand and price are balanced for each\n simulation period. ",
"hasPart": [
{
"@type": "CreativeWork",
"@id": "https://doi.org/10.5281/zenodo.19466845"
}
],
"url": "https://zenodo.org/records/17806030",
"codeRepository": "https://github.com/TI-Forest-Sector-Modelling/TiMBA",
"programmingLanguage": "Python",
"developmentStatus": "Active"
}
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
license = { text = "AGPL-3.0-or-later" }
keywords = ["timba", "model", "optimization", "thuenen institute", "economics of forests", "research"]

requires-python = ">=3.9,<3.12 "
requires-python = ">=3.9,<3.12"
dependencies = [
"click==8.1.7",
"coverage==7.6.3",
Expand All @@ -37,7 +37,6 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Operating System :: Microsoft :: Windows",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Intended Audience :: Science/Research",
Expand Down
Loading
Loading