diff --git a/CITATION.cff b/CITATION.cff index a98bfe58e..9ea057712 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -65,6 +65,9 @@ authors: - given-names: Andrew family-names: Nolan orcid: 'https://orcid.org/0000-0002-9785-0196' + - given-names: Courtney + family-names: Shafer + orcid: 'https://orcid.org/0009-0001-3651-2812' - family-names: Saenz given-names: Juan - given-names: Maciej @@ -76,6 +79,5 @@ authors: family-names: Smith repository-code: 'https://github.com/MPAS-Dev/MPAS-Tools' url: 'https://mpas-dev.github.io/MPAS-Tools/master/' -version: 1.2.2 -date-released: '2025-06-15' - +version: 1.3.0 +date-released: '2025-08-15' diff --git a/conda_package/ci/linux_64_python3.10.____cpython.yaml b/conda_package/ci/linux_64_python3.10.____cpython.yaml index 7d3422283..c5a01eccd 100644 --- a/conda_package/ci/linux_64_python3.10.____cpython.yaml +++ b/conda_package/ci/linux_64_python3.10.____cpython.yaml @@ -13,13 +13,13 @@ cxx_compiler: cxx_compiler_version: - '13' docker_image: -- quay.io/condaforge/linux-anvil-cos7-x86_64 +- quay.io/condaforge/linux-anvil-x86_64:alma9 fortran_compiler: - gfortran fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/linux_64_python3.11.____cpython.yaml b/conda_package/ci/linux_64_python3.11.____cpython.yaml index e9a9811e1..5f3013292 100644 --- a/conda_package/ci/linux_64_python3.11.____cpython.yaml +++ b/conda_package/ci/linux_64_python3.11.____cpython.yaml @@ -13,13 +13,13 @@ cxx_compiler: cxx_compiler_version: - '13' docker_image: -- quay.io/condaforge/linux-anvil-cos7-x86_64 +- quay.io/condaforge/linux-anvil-x86_64:alma9 fortran_compiler: - gfortran fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/linux_64_python3.12.____cpython.yaml b/conda_package/ci/linux_64_python3.12.____cpython.yaml index dd2339584..4738dda10 100644 --- a/conda_package/ci/linux_64_python3.12.____cpython.yaml +++ b/conda_package/ci/linux_64_python3.12.____cpython.yaml @@ -13,13 +13,13 @@ cxx_compiler: cxx_compiler_version: - '13' docker_image: -- quay.io/condaforge/linux-anvil-cos7-x86_64 +- quay.io/condaforge/linux-anvil-x86_64:alma9 fortran_compiler: - gfortran fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/linux_64_python3.13.____cpython.yaml b/conda_package/ci/linux_64_python3.13.____cpython.yaml index 0e63a1fed..ef027c9f7 100644 --- a/conda_package/ci/linux_64_python3.13.____cpython.yaml +++ b/conda_package/ci/linux_64_python3.13.____cpython.yaml @@ -13,13 +13,13 @@ cxx_compiler: cxx_compiler_version: - '13' docker_image: -- quay.io/condaforge/linux-anvil-cos7-x86_64 +- quay.io/condaforge/linux-anvil-x86_64:alma9 fortran_compiler: - gfortran fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/linux_64_python3.9.____cpython.yaml b/conda_package/ci/linux_64_python3.9.____cpython.yaml index 4e1d5c98a..8288041bb 100644 --- a/conda_package/ci/linux_64_python3.9.____cpython.yaml +++ b/conda_package/ci/linux_64_python3.9.____cpython.yaml @@ -13,13 +13,13 @@ cxx_compiler: cxx_compiler_version: - '13' docker_image: -- quay.io/condaforge/linux-anvil-cos7-x86_64 +- quay.io/condaforge/linux-anvil-x86_64:alma9 fortran_compiler: - gfortran fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 netcdf_fortran: diff --git a/conda_package/ci/osx_64_python3.10.____cpython.yaml b/conda_package/ci/osx_64_python3.10.____cpython.yaml index 034b64155..a10d0af4a 100644 --- a/conda_package/ci/osx_64_python3.10.____cpython.yaml +++ b/conda_package/ci/osx_64_python3.10.____cpython.yaml @@ -19,7 +19,7 @@ fortran_compiler: fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 llvm_openmp: diff --git a/conda_package/ci/osx_64_python3.11.____cpython.yaml b/conda_package/ci/osx_64_python3.11.____cpython.yaml index a8af6b0c8..53fd73c4f 100644 --- a/conda_package/ci/osx_64_python3.11.____cpython.yaml +++ b/conda_package/ci/osx_64_python3.11.____cpython.yaml @@ -19,7 +19,7 @@ fortran_compiler: fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 llvm_openmp: diff --git a/conda_package/ci/osx_64_python3.12.____cpython.yaml b/conda_package/ci/osx_64_python3.12.____cpython.yaml index 0c9ec6cd6..a3c13e58f 100644 --- a/conda_package/ci/osx_64_python3.12.____cpython.yaml +++ b/conda_package/ci/osx_64_python3.12.____cpython.yaml @@ -19,7 +19,7 @@ fortran_compiler: fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 llvm_openmp: diff --git a/conda_package/ci/osx_64_python3.13.____cpython.yaml b/conda_package/ci/osx_64_python3.13.____cpython.yaml index 5f91480ea..a63d13635 100644 --- a/conda_package/ci/osx_64_python3.13.____cpython.yaml +++ b/conda_package/ci/osx_64_python3.13.____cpython.yaml @@ -19,7 +19,7 @@ fortran_compiler: fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 llvm_openmp: diff --git a/conda_package/ci/osx_64_python3.9.____cpython.yaml b/conda_package/ci/osx_64_python3.9.____cpython.yaml index 22c972534..d845ca340 100644 --- a/conda_package/ci/osx_64_python3.9.____cpython.yaml +++ b/conda_package/ci/osx_64_python3.9.____cpython.yaml @@ -19,7 +19,7 @@ fortran_compiler: fortran_compiler_version: - '13' hdf5: -- 1.14.4 +- 1.14.6 libnetcdf: - 4.9.2 llvm_openmp: diff --git a/conda_package/docs/conf.py b/conda_package/docs/conf.py index 6cac7a1df..f8e89e2ca 100644 --- a/conda_package/docs/conf.py +++ b/conda_package/docs/conf.py @@ -60,11 +60,13 @@ # General information about the project. project = 'mpas_tools' year = date.today().year -copyright = f'This software is open source software available under the BSD-3' \ - f'license. Copyright (c) {year} Triad National Security, LLC. ' \ - f'All rights reserved. Copyright (c) {year} Lawrence Livermore ' \ - f'National Security, LLC. All rights reserved. Copyright (c) ' \ - f'{year} UT-Battelle, LLC. All rights reserved.' +copyright = ( + f'This software is open source software available under the BSD-3' + f'license. Copyright (c) {year} Triad National Security, LLC. ' + f'All rights reserved. Copyright (c) {year} Lawrence Livermore ' + f'National Security, LLC. All rights reserved. Copyright (c) ' + f'{year} UT-Battelle, LLC. All rights reserved.' +) author = 'MPAS-Tools development team' # The version info for the project you're documenting, acts as replacement for diff --git a/conda_package/mpas_tools/__init__.py b/conda_package/mpas_tools/__init__.py index 318ab213d..4a117aa44 100644 --- a/conda_package/mpas_tools/__init__.py +++ b/conda_package/mpas_tools/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = (1, 2, 2) +__version_info__ = (1, 3, 0) __version__ = '.'.join(str(vi) for vi in __version_info__) diff --git a/conda_package/recipe/meta.yaml b/conda_package/recipe/meta.yaml index 712b6aa07..723307976 100644 --- a/conda_package/recipe/meta.yaml +++ b/conda_package/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set name = "mpas_tools" %} -{% set version = "1.2.2" %} +{% set version = "1.3.0" %} package: name: {{ name|lower }} diff --git a/update_version.py b/update_version.py new file mode 100755 index 000000000..af4cd77af --- /dev/null +++ b/update_version.py @@ -0,0 +1,149 @@ +#! /usr/bin/env python +import argparse +import re +import sys +from datetime import date +from pathlib import Path + + +def parse_args(): + parser = argparse.ArgumentParser( + description=( + "Bump version across files (CITATION.cff, __init__.py, meta.yaml)." + ) + ) + parser.add_argument( + "-v", + "--version", + required=True, + help="New version in the form X.Y.Z (e.g., 1.3.0)", + ) + return parser.parse_args() + + +def ensure_semver(version: str): + m = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)", version) + if not m: + sys.exit("Error: version must be in the form X.Y.Z (e.g., 1.3.0).") + return tuple(int(p) for p in m.groups()) + + +def read_text(path: Path): + try: + return path.read_text(encoding="utf-8") + except FileNotFoundError: + return None + + +def write_text_if_changed(path: Path, content: str) -> bool: + old = read_text(path) + if old is None: + return False + if old != content: + path.write_text(content, encoding="utf-8") + return True + return False + + +def bump_citation(root: Path, version: str, today: str) -> bool: + path = root / "CITATION.cff" + content = read_text(path) + if content is None: + print(f"Skip (not found): {path}") + return False + + # version: 1.2.1 -> version: 1.2.2 + content_new = re.sub( + r"(?m)^(version:\s*)(.+)\s*$", rf"\g<1>{version}", content, count=1 + ) + # date-released: '2025-06-12' -> date-released: 'YYYY-MM-DD' + content_new = re.sub( + r"""(?m)^(date-released:\s*)['"]?\d{4}-\d{2}-\d{2}['"]?\s*$""", + rf"\g<1>'{today}'", + content_new, + count=1, + ) + # Ensure a final newline at EOF + if not content_new.endswith("\n"): + content_new += "\n" + + changed = write_text_if_changed(path, content_new) + if changed: + print(f"Updated: {path}") + else: + print(f"No changes: {path}") + return changed + + +def bump_init(pkg_dir: Path, version_tuple) -> bool: + path = pkg_dir / "mpas_tools" / "__init__.py" + content = read_text(path) + if content is None: + print(f"Skip (not found): {path}") + return False + + major, minor, patch = version_tuple + content_new = re.sub( + r"(?m)^__version_info__\s*=\s*\(.+\)\s*$", + f"__version_info__ = ({major}, {minor}, {patch})", + content, + count=1, + ) + + changed = write_text_if_changed(path, content_new) + if changed: + print(f"Updated: {path}") + else: + print(f"No changes: {path}") + return changed + + +def bump_meta(recipe_dir: Path, version: str) -> bool: + path = recipe_dir / "meta.yaml" + content = read_text(path) + if content is None: + print(f"Skip (not found): {path}") + return False + + # {% set version = "1.2.1" %} -> {% set version = "1.2.2" %} + content_new = re.sub( + r'(?m)^\{\%\s*set\s+version\s*=\s*["\']([^"\']+)["\']\s*\%\}', + f'{{% set version = "{version}" %}}', + content, + count=1, + ) + + changed = write_text_if_changed(path, content_new) + if changed: + print(f"Updated: {path}") + else: + print(f"No changes: {path}") + return changed + + +def main(): + args = parse_args() + version = args.version.strip() + version_tuple = ensure_semver(version) + today = date.today().isoformat() + + # Resolve repo layout relative to this script + script_dir = Path(__file__).resolve().parent + repo_root = script_dir + pkg_dir = script_dir / "conda_package" + recipe_dir = pkg_dir / "recipe" + + changed = [] + changed.append(bump_citation(repo_root, version, today)) + changed.append(bump_init(pkg_dir, version_tuple)) + changed.append(bump_meta(recipe_dir, version)) + + if not any(changed): + print("No files modified.") + return 0 + print(f"Done. Bumped to {version} (date-released: {today}).") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())