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: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- uses: pre-commit/action@v3.0.1

test:
Expand All @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -36,9 +36,9 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: abatilo/actions-poetry@v4.0.0
with:
poetry-version: 1.5.1
run: |
pipx install poetry --python python${{ matrix.python-version }}
poetry --version

- name: Install dependencies
run: poetry install
Expand All @@ -53,7 +53,7 @@ jobs:
github.event.pull_request.user.login == 'pre-commit-ci[bot]'
) && (
matrix.os == 'ubuntu-latest' &&
matrix.python-version == '3.10'
matrix.python-version == '3.11'
)
}}
uses: codecov/codecov-action@v5
Expand All @@ -68,13 +68,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"

- name: Install Poetry
uses: abatilo/actions-poetry@v4.0.0
with:
poetry-version: 1.5.1

run: |
pipx install poetry --python python3.11
poetry --version
- name: Install dependencies
run: poetry install

Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class MyReferenceStyle(AuthorYearReferenceStyle):
("py:class", "dataclasses.InitVar"),
("py:class", "Quantity"),
("py:class", "numpy._typing._array_like._ScalarType_co"),
("py:class", "numpy._typing._array_like._ScalarT"),
# God only knows why this is needed. We don't refer to pint.util.Quantity and it
# isn't in the pint objects.inv, so why the hell is intersphinx trying to build
# references to it.
Expand Down
5 changes: 1 addition & 4 deletions docs/source/using_the_ve/virtual_ecosystem_in_static_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,11 @@ Once the baseline run is complete, you can set up the experiment with default
# Generate the static config file programmatically
import sys
import tomllib
from pathlib import Path
import tomli_w
if sys.version_info[:2] >= (3, 11):
import tomllib
else:
import tomli as tomllib
# Create output directory
output_dir = Path("/tmp/ve_example/HydroDefault_out/")
Expand Down
1,741 changes: 873 additions & 868 deletions poetry.lock

Large diffs are not rendered by default.

75 changes: 41 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[tool.poetry]
[project]
authors = [
"Rob Ewers <r.ewers@imperial.ac.uk>",
"David Orme <d.orme@imperial.ac.uk>",
"Jacob Cook <j.cook17@imperial.ac.uk>",
"Vivienne Groner <v.groner@imperial.ac.uk>",
"Taran Rallings <t.rallings@imperial.ac.uk>",
"Olivia Daniel <olivia.daniel08@imperial.ac.uk>",
"Jaideep Joshi <joshi@iiasa.ac.at>",
"Anna Rallings <a.rallings@imperial.ac.uk>",
"Priyanga Amarasekare <pamarasekare@gmail.com>",
"Diego Alonso Alvarez <d.alonso-alvarez@imperial.ac.uk>",
"Alex Dewar <a.dewar@imperial.ac.uk>",
{name = "Rob Ewers", email = "r.ewers@imperial.ac.uk"},
{name = "David Orme", email = "d.orme@imperial.ac.uk"},
{name = "Jacob Cook", email = "j.cook17@imperial.ac.uk"},
{name = "Vivienne Groner", email = "v.groner@imperial.ac.uk"},
{name = "Taran Rallings", email = "t.rallings@imperial.ac.uk"},
{name = "Olivia Daniel", email = "olivia.daniel08@imperial.ac.uk"},
{name = "Jaideep Joshi", email = "joshi@iiasa.ac.at"},
{name = "Anna Rallings", email = "a.rallings@imperial.ac.uk"},
{name = "Priyanga Amarasekare", email = "pamarasekare@gmail.com"},
{name = "Diego Alonso Alvarez", email = "d.alonso-alvarez@imperial.ac.uk"},
{name = "Alex Dewar", email = "a.dewar@imperial.ac.uk"},
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
Expand All @@ -19,33 +19,40 @@ classifiers = [
"Topic :: Scientific/Engineering",
]
description = """An holistic ecosystem simulation model."""
homepage = "https://virtual-ecosystem.readthedocs.io/"
license = "BSD-3-Clause"
license-files = ["LICENSE"]
name = "virtual_ecosystem"
readme = "README.md"
repository = "https://github.com/ImperialCollegeLondon/virtual_ecosystem"
version = "0.1.1a11"
version = "0.1.1a12"

requires-python = ">=3.11"

dependencies = [
"Shapely (>2.0)",
"dask (>2023.6)",
"dpath (>2.0)",
"jsonschema (>4.14)",
"netcdf4 (>1.6)",
"numpy (>2.0)",
"openpyxl (>3.1)",
"pint (>0.24)",
"pyrealm (>=2.0.0rc5)",
"scipy (>1.12)",
"tomli-w (>1.0)",
"tqdm (>4.66)",
"xarray (>2024.6)",
"types-tabulate (>0.9)",
]

[tool.poetry.scripts]
[project.scripts]
ve_run = "virtual_ecosystem.entry_points:ve_run_cli"

[tool.poetry.dependencies]
Shapely = "^2.0"
dask = ">=2023.6,<2026.0"
dpath = "^2.0.6"
jsonschema = "^4.14.0"
netcdf4 = "^1.6.5"
numpy = "^2.0"
openpyxl = "^3.1.5"
pint = "^0.24.1"
pyrealm = {git = "https://github.com/ImperialCollegeLondon/pyrealm.git", branch = "develop"}
python = ">=3.10,<3.14"
scipy = "^1.9.0"
tomli = {version = "^2.0.1", python = "<3.11"}
tomli-w = "^1.0.0"
tqdm = "^4.66.2"
xarray = ">=2024.6,<2026.0"
types-tabulate = "^0.9.0.20241207"
[project.urls]
homepage = "https://virtual-ecosystem.readthedocs.io/"
repository = "https://github.com/ImperialCollegeLondon/virtual_ecosystem"

[tool.poetry]
requires-poetry = ">=2.0"

[tool.poetry.group.types.dependencies]
types-dataclasses = "^0.6.6"
Expand Down Expand Up @@ -104,7 +111,7 @@ python_files = 'test_*.py'
testpaths = ['tests']

[tool.ruff]
target-version = "py310"
target-version = "py311"

[tool.ruff.lint]
# Enable all `pydocstyle` rules, limiting to those that adhere to the
Expand Down
7 changes: 0 additions & 7 deletions tests/core/test_variables.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
"""Tests for the virtual_ecosystem.core.variables module."""

import sys

import pytest

if sys.version_info[:2] >= (3, 11):
import tomllib
else:
import tomli as tomllib # noqa: F401


@pytest.fixture(autouse=True)
def known_variables():
Expand Down
7 changes: 1 addition & 6 deletions virtual_ecosystem/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module for details.
""" # noqa: D205

import sys
import tomllib
from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
Expand All @@ -22,11 +22,6 @@
from virtual_ecosystem.core.registry import MODULE_REGISTRY, register_module
from virtual_ecosystem.core.schema import ValidatorWithDefaults, merge_schemas

if sys.version_info[:2] >= (3, 11):
import tomllib
else:
import tomli as tomllib


def config_merge(
dest: dict, source: dict, conflicts: tuple = (), path: str = ""
Expand Down
7 changes: 1 addition & 6 deletions virtual_ecosystem/core/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import json
import pkgutil
import sys
import tomllib
from collections.abc import Hashable
from dataclasses import asdict, dataclass, field
from graphlib import CycleError, TopologicalSorter
Expand All @@ -46,11 +46,6 @@
from virtual_ecosystem.core.logger import LOGGER
from virtual_ecosystem.core.schema import ValidatorWithDefaults

if sys.version_info[:2] >= (3, 11):
import tomllib
else:
import tomli as tomllib


def to_camel_case(snake_str: str) -> str:
"""Convert a snake_case string to CamelCase.
Expand Down
9 changes: 2 additions & 7 deletions virtual_ecosystem/entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import argparse
import sys
import textwrap
import tomllib
from collections.abc import Sequence
from pathlib import Path
from shutil import copytree, ignore_patterns
from tomllib import TOMLDecodeError
from typing import Any

import virtual_ecosystem as ve
Expand All @@ -19,13 +21,6 @@
from virtual_ecosystem.core.logger import LOGGER
from virtual_ecosystem.main import Progress, ve_run

if sys.version_info[:2] >= (3, 11):
import tomllib
from tomllib import TOMLDecodeError
else:
import tomli as tomllib
from tomli import TOMLDecodeError


def _parse_param_str(s: str) -> dict[str, Any]:
"""Parse a single parameter string into a dict.
Expand Down
2 changes: 1 addition & 1 deletion virtual_ecosystem/models/hydrology/above_ground.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def calculate_soil_evaporation(
saturation_vapour_pressure = calc_vp_sat(
ta=temperature,
core_const=pyrealm_const(),
).astype(np.floating) # pyrealm returning np.float64
)

saturated_specific_humidity = (
gas_constant_water_vapour * saturation_vapour_pressure
Expand Down
2 changes: 1 addition & 1 deletion virtual_ecosystem/models/plants/plants_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ def partition_reproductive_tissue(

non_propagule_mass = reproductive_tissue_mass - (
n_propagules * self.model_constants.carbon_mass_per_propagule
).astype(np.integer)
)

return n_propagules, non_propagule_mass

Expand Down
Loading