Skip to content

Commit 46c061b

Browse files
authored
Merge pull request #1326 from PCMDI/v4.0.0_alpha
v4.0.0_alpha version (`v4.0.0rc1`) release prepare
2 parents 05db16f + 7109fae commit 46c061b

File tree

31 files changed

+271
-256
lines changed

31 files changed

+271
-256
lines changed

setup.cfg renamed to .flake8.cfg

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,3 @@ exclude =
3131
venv
3232
*json
3333
*md
34-
35-
36-
37-
[tool:pytest]
38-
junit_family = xunit2
39-
addopts = --cov=pcmdi_metrics --cov-report term --cov-report html:tests_coverage_reports/htmlcov --cov-report xml:tests_coverage_reports/coverage.xml -s --ignore tests/deprecated
40-
python_files = tests.py test_*.py

.github/workflows/build_workflow.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
should_skip: ${{ steps.skip_check.outputs.should_skip }}
2121
steps:
2222
- id: skip_check
23-
uses: fkirc/skip-duplicate-actions@master
23+
uses: fkirc/skip-duplicate-actions@v5
2424
with:
2525
cancel_others: true
2626
paths_ignore: '["**/README.md", "**/docs/**", "**/ISSUE_TEMPLATE/**", "**/pull_request_template.md", "**/.vscode/**"]'
@@ -32,66 +32,61 @@ jobs:
3232
timeout-minutes: 10
3333
steps:
3434
- name: Checkout Code Repository
35-
uses: actions/checkout@v3
36-
35+
uses: actions/checkout@v4
36+
3737
- name: Set up Python
38-
uses: actions/setup-python@v4
38+
uses: actions/setup-python@v5
3939
with:
40-
python-version: '3.10'
40+
python-version: '3.13'
4141

4242
- name: Install and Run Pre-commit
43-
uses: pre-commit/[email protected].0
43+
uses: pre-commit/[email protected].1
4444

4545
build:
4646
needs: check-jobs-to-skip
4747
if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }} || ${{ github.event_name == 'push' }}
4848
runs-on: ubuntu-latest
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
python-version: ["3.10", "3.11", "3.12", "3.13"]
4953
defaults:
5054
run:
5155
shell: bash -l {0}
5256
timeout-minutes: 15
5357
steps:
54-
- uses: actions/checkout@v3
55-
58+
- uses: actions/checkout@v4
59+
- name: Get Date
60+
id: get-date
61+
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
5662
- name: Set up Conda Environment
5763
uses: conda-incubator/setup-miniconda@v3
5864
with:
5965
miniforge-variant: Miniforge3
6066
miniforge-version: latest
61-
activate-environment: "pcmdi_metrics_ci"
67+
activate-environment: pcmdi_metrics_ci
6268
environment-file: conda-env/ci.yml
6369
channel-priority: flexible
6470
auto-update-conda: true
6571
python-version: ${{ matrix.python-version }}
6672
use-mamba: false
6773
conda-solver: classic
6874

75+
- name: Cache Conda Packages
76+
uses: actions/cache@v4
77+
with:
78+
path: ~/conda_pkgs_dir
79+
key: conda-${{ runner.os }}--${{ runner.arch }}--py${{ matrix.python-version }}--${{ steps.get-date.outputs.today }}--${{ hashFiles('conda-env/ci.yml') }}--${{ env.CACHE_NUMBER }}
80+
env:
81+
CACHE_NUMBER: 0
82+
6983
- name: Verify Conda Environment
7084
run: |
7185
conda info
7286
conda list
7387
conda config --show-sources
7488
conda config --show
7589
76-
# Used for refreshing the cache every 24 hours to avoid inconsistencies of package
77-
# versions between the CI pipeline and local installations.
78-
- name: Get Date
79-
id: get-date
80-
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
81-
shell: bash
82-
83-
- name: Cache Conda
84-
uses: actions/cache@v3
85-
with:
86-
path: ${{ env.CONDA }}/envs
87-
key:
88-
conda-${{ runner.os }}--${{ runner.arch }}--${{
89-
steps.get-date.outputs.today }}-${{
90-
hashFiles('conda-env/ci.yml') }}-${{ env.CACHE_NUMBER}}
91-
env:
92-
# Increase this value to reset cache if conda/dev.yml has not changed in the workflow
93-
CACHE_NUMBER: 0
94-
9590
- name: Install pcmdi_metrics
9691
# Source: https://github.com/conda/conda-build/issues/4251#issuecomment-1053460542
9792
run: |
@@ -111,48 +106,53 @@ jobs:
111106
defaults:
112107
run:
113108
shell: bash -l {0}
114-
timeout-minutes: 5
115109
steps:
116-
- uses: actions/checkout@v3
110+
- uses: actions/checkout@v4
117111
with:
118112
persist-credentials: false
119113
fetch-depth: 0
120114

121115
- name: Cache Conda
122-
uses: actions/cache@v3
116+
uses: actions/cache@v4
123117
env:
124-
# Increase this value to reset cache if conda-env/ci.yml has not changed in the workflow
125118
CACHE_NUMBER: 0
126119
with:
127120
path: ~/conda_pkgs_dir
128-
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
129-
hashFiles('conda-env/dev.yml') }}
121+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda-env/dev.yml') }}
130122

131123
- name: Set up Conda Environment
132124
uses: conda-incubator/setup-miniconda@v3
133125
with:
134-
activate-environment: "pcmdi_metrics_dev"
126+
activate-environment: pcmdi_metrics_dev
127+
environment-file: conda-env/dev.yml
135128
miniforge-variant: Miniforge3
136129
miniforge-version: latest
137-
environment-file: conda-env/dev.yml
138130
channel-priority: strict
139131
auto-update-conda: true
140-
use-mamba: false # Disable libmamba solver
132+
use-mamba: false
133+
conda-solver: classic
134+
python-version: '3.13'
135+
136+
- name: Verify Conda Environment
137+
run: |
138+
conda info
139+
conda list
140+
conda config --show-sources
141+
conda config --show
141142
142143
- name: Install pcmdi_metrics
143-
# Source: https://github.com/conda/conda-build/issues/4251#issuecomment-1053460542
144144
run: |
145-
python -m pip install --no-build-isolation --no-deps -e .
145+
python -m pip install --no-build-isolation --no-deps -e .
146146
147147
- name: Sphinx build
148148
run: |
149149
sphinx-build docs _build
150-
150+
151151
- name: Deploy
152-
uses: peaceiris/actions-gh-pages@v3
152+
uses: peaceiris/actions-gh-pages@v4
153153
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
154154
with:
155-
publish_branch: gh-pages
155+
publish_branch: gh-pages
156156
github_token: ${{ secrets.GITHUB_TOKEN }}
157157
publish_dir: _build/
158158
force_orphan: true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ repos:
3737
rev: 7.3.0
3838
hooks:
3939
- id: flake8
40-
args: ["--config=setup.cfg"]
40+
args: ["--config=.flake8.cfg"]
4141
additional_dependencies: [flake8-isort]

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ keywords:
3939
- climatology
4040
- climate variability
4141
license: BSD-3-Clause
42-
version: '3.9.3'
43-
date-released: '2025-09-18'
42+
version: '4.0.0rc1'
43+
date-released: '2025-09-24'

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ensure custom build backend and generator script are included in sdist
2+
recursive-include _custom_build *.py
3+
include share/setup_default_args.py
4+
include share/DefArgsCIA.json

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Release Notes and History
126126

127127
| <div style="width:300%">[Versions]</div> | Update summary |
128128
| ------------- | ------------------------------------- |
129+
| [v4.0.0rc1] | Pre-release of development version: Newerly support higher Python versions, `>= 3.10, < 3.14`
130+
| ------------- | ------------------------------------- |
129131
| [v3.9.3] | Technical update
130132
| [v3.9.2] | Technical update
131133
| [v3.9.1] | New capability (**new modes for modes of variability metrics: EA, SCA**) and technical update
@@ -183,6 +185,7 @@ Release Notes and History
183185
</details>
184186

185187
[Versions]: https://github.com/PCMDI/pcmdi_metrics/releases
188+
[v4.0.0rc1]: https://github.com/PCMDI/pcmdi_metrics/releases/tag/v4.0.0rc1
186189
[v3.9.3]: https://github.com/PCMDI/pcmdi_metrics/releases/tag/v3.9.3
187190
[v3.9.2]: https://github.com/PCMDI/pcmdi_metrics/releases/tag/v3.9.2
188191
[v3.9.1]: https://github.com/PCMDI/pcmdi_metrics/releases/tag/v3.9.1

_custom_build/backend.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
from __future__ import annotations
2+
3+
import os
4+
import runpy
5+
from pathlib import Path
6+
7+
from setuptools import build_meta as _orig
8+
from setuptools.build_meta import * # noqa: F401,F403 - re-export PEP 517 hooks
9+
10+
_PROJECT_ROOT = Path(__file__).resolve().parent.parent
11+
_GENERATOR = _PROJECT_ROOT / "share" / "setup_default_args.py"
12+
13+
14+
def _run_prebuild_generator() -> None:
15+
"""Run the script that (re)generates share/DefArgsCIA.json if present.
16+
17+
Mirrors the behavior previously invoked in setup.py before packaging.
18+
The script writes DefArgsCIA.json into the share directory.
19+
"""
20+
if _GENERATOR.is_file():
21+
# Execute in-place with cwd=share to preserve original behavior
22+
share_dir = _GENERATOR.parent
23+
cwd = os.getcwd()
24+
try:
25+
os.chdir(share_dir)
26+
# runpy.run_path executes the script as __main__ without spawning a new process
27+
runpy.run_path(str(_GENERATOR), run_name="__main__")
28+
finally:
29+
os.chdir(cwd)
30+
31+
32+
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): # type: ignore[override]
33+
_run_prebuild_generator()
34+
return _orig.build_wheel(wheel_directory, config_settings, metadata_directory)
35+
36+
37+
def build_sdist(sdist_directory, config_settings=None): # type: ignore[override]
38+
_run_prebuild_generator()
39+
return _orig.build_sdist(sdist_directory, config_settings)
40+
41+
42+
def build_editable(wheel_directory, config_settings=None, metadata_directory=None): # type: ignore[override]
43+
# PEP 660 editable install hook (pip -e). Ensure the file exists here too.
44+
_run_prebuild_generator()
45+
return _orig.build_editable(wheel_directory, config_settings, metadata_directory)
46+
47+
48+
def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None): # type: ignore[override]
49+
_run_prebuild_generator()
50+
return _orig.prepare_metadata_for_build_wheel(metadata_directory, config_settings)
51+
52+
53+
def prepare_metadata_for_build_editable(metadata_directory, config_settings=None): # type: ignore[override]
54+
_run_prebuild_generator()
55+
return _orig.prepare_metadata_for_build_editable(
56+
metadata_directory, config_settings
57+
)

conda-env/ci.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ dependencies:
88
# Base
99
# ==================
1010
# NOTE: If versions are updated, also `additional_dependencies` list for mypy in `.pre-commit-config.yaml`
11-
- python=3.10.10
12-
- pip=23.1.2
13-
- numpy >=2.0.0,<2.1.0
11+
- python >=3.10,<3.14
12+
- pip >=23.1.2
13+
- numpy >=2.0.0,<3
1414
- cartopy >=0.22.0
1515
- matplotlib >=3.7.1
16-
- cdp=1.7.0
17-
- eofs=2.0.0
18-
- seaborn=0.12.2
19-
# - enso_metrics=1.1.5
20-
- xcdat >=0.7.3
21-
- xmltodict=0.13.0
22-
- setuptools=67.7.2
23-
- netcdf4>=1.6.3
24-
- regionmask=0.12.1
25-
- rasterio>=1.3.6
16+
- cdp >=1.7.0
17+
- eofs >=2.0.0
18+
- seaborn >=0.12.2
19+
#- enso_metrics >=1.1.5
20+
- xcdat >=0.10.0
21+
- xmltodict >=0.13.0
22+
- setuptools >=67.7.2
23+
- netcdf4 >=1.6.3
24+
- regionmask >=0.12.1
25+
- rasterio >=1.3.6
2626
- shapely >=2.0.1,<=2.0.6
2727
- numdifftools
2828
- nc-time-axis
@@ -32,8 +32,8 @@ dependencies:
3232
# ==================
3333
# Testing
3434
# ==================
35-
- pre_commit=3.2.2
36-
- pytest=7.3.1
37-
- pytest-cov=4.0.0
35+
- pre_commit >=3.2.2
36+
- pytest >=7.3.1
37+
- pytest-cov >=4.0.0
3838

3939
prefix: /opt/miniconda3/envs/pmcdi_metrics_ci

conda-env/dev.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ dependencies:
88
# Base
99
# ==================
1010
# NOTE: If versions are updated, also `additional_dependencies` list for mypy in `.pre-commit-config.yaml`
11-
- python=3.10.10
12-
- pip=23.1.2
13-
- numpy >=2.0.0,<2.1.0
11+
- python >=3.10,<3.14
12+
- pip
13+
- numpy >=2.0.0,<3
1414
- cartopy >=0.22.0
1515
- matplotlib >=3.7.1
16-
- cdp=1.7.0
17-
- eofs=2.0.0
18-
- seaborn=0.12.2
19-
# - enso_metrics=1.1.5
20-
- xcdat >=0.7.3
21-
- xmltodict=0.13.0
22-
- setuptools=67.7.2
23-
- netcdf4>=1.6.3
24-
- regionmask=0.12.1
25-
- rasterio>=1.3.6
16+
- cdp >=1.7.0
17+
- eofs >=2.0.0
18+
- seaborn >=0.12.2
19+
#- enso_metrics >=1.1.5
20+
- xcdat >=0.10.0
21+
- xmltodict >=0.13.0
22+
- setuptools >=67.7.2
23+
- netcdf4 >=1.6.3
24+
- regionmask >=0.12.1
25+
- rasterio >=1.3.6
2626
- shapely >=2.0.1,<=2.0.6
2727
- numdifftools
2828
- nc-time-axis
@@ -32,9 +32,9 @@ dependencies:
3232
# ==================
3333
# Testing
3434
# ==================
35-
- pre_commit=3.2.2
36-
- pytest=7.3.1
37-
- pytest-cov=4.0.0
35+
- pre_commit >=3.2.2
36+
- pytest >=7.3.1
37+
- pytest-cov >=4.0.0
3838
# ==================
3939
# Developer Tools
4040
# ==================

pcmdi_metrics/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.9.3"
1+
__version__ = "4.0.0rc1"

0 commit comments

Comments
 (0)