Skip to content

Commit

Permalink
Update lockfiles and fix for new esmpy (#342)
Browse files Browse the repository at this point in the history
* fix for new esmpy

* alternate fix for esmpy 8.6

* upgrade python versions

* upgrade python versions for wheel ci

* alternate approach for coverage

* try codecov v3

* add token to codecov action

* pin conda for asv

* fix conda for asv

* fix conda for asv

* back out conda actions

* pin conda for benchmarks

* fix conda for benchmarks

* fix ESMFMKFILE for benchmarks
  • Loading branch information
stephenworsley authored Apr 25, 2024
1 parent 94f3e05 commit 01369d1
Show file tree
Hide file tree
Showing 10 changed files with 825 additions and 200 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
include:
- python-version: "3.10"
- python-version: "3.11"
coverage: true

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: ["3.10", "3.11", "3.12"]
session: ["wheel"]

steps:
Expand Down
1 change: 1 addition & 0 deletions benchmarks/asv_delegated_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _prep_env(self) -> None:
message = f"Running delegated environment management for: {self.name}"
log.info(message)
env_path = Path(self._path)
environ["ESMFMKFILE"] = str(env_path / "lib" / "esmf.mk")

def copy_asv_files(src_parent: Path, dst_parent: Path) -> None:
"""For copying between self._path and a temporary cache."""
Expand Down
6 changes: 6 additions & 0 deletions benchmarks/benchmarks/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pathlib import Path
import re
from subprocess import CalledProcessError, check_output, run
import sys
from textwrap import dedent
from warnings import warn

Expand Down Expand Up @@ -55,6 +56,8 @@
# False forces a benchmark run to re-make all the data files.
REUSE_DATA = True

ESMFMKFILE = "ESMFMKFILE"


def run_function_elsewhere(func_to_run, *args, **kwargs):
"""
Expand Down Expand Up @@ -90,9 +93,12 @@ def run_function_elsewhere(func_to_run, *args, **kwargs):
f"{func_to_run.__name__}(" + ",".join(func_call_term_strings) + ")"
)
python_string = "\n".join([func_string, func_call_string])
old_esmf_mk_file = environ.get(ESMFMKFILE, None)
environ[ESMFMKFILE] = str(Path(sys.executable).parents[1] / "lib" / "esmf.mk")
result = run(
[DATA_GEN_PYTHON, "-c", python_string], capture_output=True, check=True
)
environ[ESMFMKFILE] = old_esmf_mk_file
return result.stdout


Expand Down
5 changes: 2 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
PACKAGE = "esmf_regrid"

#: GHA-CI environment variable hook.
PY_VER = os.environ.get("PY_VER", ["3.10", "3.11"])
PY_VER = os.environ.get("PY_VER", ["3.10", "3.11", "3.12"])

#: GHA-CI environment variable hook.
COVERAGE = os.environ.get("COVERAGE", False)
Expand Down Expand Up @@ -370,6 +370,7 @@ def benchmarks(
COMPARE_FACTOR = 2.0

session.install("asv", "nox", "pyyaml")
session.run("conda", "install", "--yes", "conda<24.3")

data_gen_var = "DATA_GEN_PYTHON"
if data_gen_var in os.environ:
Expand All @@ -391,8 +392,6 @@ def benchmarks(
Path(".nox").rglob(f"tests*/bin/python{PY_VER}")
).resolve()
session.env[data_gen_var] = data_gen_python
esmf_mk_file = data_gen_python.parents[1] / "lib" / "esmf.mk"
session.env[ESMFMKFILE] = esmf_mk_file

print("Running ASV...")
session.cd("benchmarks")
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Atmospheric Science",
]
description = "Iris regridding scheme using ESMF"
Expand All @@ -44,7 +45,7 @@ Issues = "https://github.com/SciTools-incubator/iris-esmf-regrid/issues"

[tool.black]
line-length = 88
target-version = ['py310', 'py311']
target-version = ['py310', 'py311', 'py312']
include = '\.pyi?$'

[tool.pytest.ini_options]
Expand Down
310 changes: 213 additions & 97 deletions requirements/locks/py310-linux-64.lock

Large diffs are not rendered by default.

307 changes: 211 additions & 96 deletions requirements/locks/py311-linux-64.lock

Large diffs are not rendered by default.

355 changes: 355 additions & 0 deletions requirements/locks/py312-linux-64.lock

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions requirements/py312.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: esmf-regrid-dev

channels:
- conda-forge

dependencies:
- python=3.12

# Setup dependencies.
- setuptools>=40.8.0

# Core dependencies.
- cartopy>=0.18
- numpy>=1.14
- scipy
- esmpy>=7.0
- iris
- cf-units

# Test dependencies.
- asv
- codecov
- nox
- pre-commit
- pytest
- pytest-cov

# Docs dependencies.
- pydata-sphinx-theme
- sphinx
- sphinx-copybutton
- sphinxcontrib-apidoc

0 comments on commit 01369d1

Please sign in to comment.