From ba1569347f828fb236d14004aaa9aa81fe406312 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:29:02 -0500 Subject: [PATCH 1/6] add numba anaconda repository --- .github/workflows/main.yml | 10 ++- environment.yml | 149 +++++++++++++++++++------------------ 2 files changed, 82 insertions(+), 77 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 201a02778..cf8a918de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -181,8 +181,12 @@ jobs: strategy: matrix: include: - - tox-env: py310 - python-version: "3.10" + - python-version: "3.10" + install-python: "3.10" + - python-version: "3.11" + install-python: "3.11" + - python-version: "3.12" + install-python: "3.12" defaults: run: shell: bash -l {0} @@ -212,7 +216,7 @@ jobs: environment-file: environment.yml create-args: >- conda - python=${{ matrix.python-version }} + python=${{ matrix.install-python }} - name: Conda and Mamba versions run: | conda --version diff --git a/environment.yml b/environment.yml index 04ae0e482..06d5fc29b 100644 --- a/environment.yml +++ b/environment.yml @@ -1,78 +1,79 @@ name: xclim channels: - - conda-forge - - defaults + - numba # Added to gain access to Python3.12-compatible numba release candidates. + - conda-forge + - defaults dependencies: - - python >=3.8 - - astroid - - boltons >=20.1 - - bottleneck >=1.3.1 - - cf_xarray >=0.6.1 - - cftime >=1.4.1 - - Click >=8.1 - - dask >=2.6.0 - - importlib-resources # For Python3.8 - - jsonpickle - - lmoments3 - - numba - - numpy >=1.16 - - pandas >=0.23,<2.2 - - pint >=0.9 - - poppler >=0.67 - - pyyaml - - scikit-learn >=0.21.3 - - scipy >=1.2 - - statsmodels - - xarray >=2022.06.0,<2023.11.0 - - yamale - # Extras - - eofs - - flox + - python >=3.8,<3.13 + - astroid + - boltons >=20.1 + - bottleneck >=1.3.1 + - cf_xarray >=0.6.1 + - cftime >=1.4.1 + - Click >=8.1 + - dask >=2.6.0 + - importlib-resources # For Python3.8 + - jsonpickle + - lmoments3 + - numba + - numpy >=1.16 + - pandas >=0.23,<2.2 + - pint >=0.9 + - poppler >=0.67 + - pyyaml + - scikit-learn >=0.21.3 + - scipy >=1.2 + - statsmodels + - xarray >=2022.06.0,<2023.11.0 + - yamale + # Extras + - eofs + - flox # Testing and development dependencies - - black >=22.12 - - blackdoc - - bump-my-version - - cairosvg - - codespell - - coverage - - distributed >=2.0 - - filelock - - flake8 - - flake8-rst-docstrings - - flit - - h5netcdf - - ipykernel - - ipython - - matplotlib - - mypy - - nbqa - - nbsphinx - - nbval - - nc-time-axis - - netCDF4 >=1.4 - - notebook - - platformdirs - - pooch - - pre-commit - - pybtex - - pylint - - pytest - - pytest-cov - - pytest-socket - - pytest-xdist >=3.2 - - ruff >=0.1.0 - - sphinx - - sphinx-autodoc-typehints - - sphinx-codeautolink - - sphinx-copybutton - - sphinx_rtd_theme >=1.0 - - sphinxcontrib-bibtex - - tokenize-rt - - tox -# - tox-conda # Will be added when a tox@v4.0+ compatible plugin is released. - - xdoctest - - yamllint - - pip - - pip: - - flake8-alphabetize - - sphinxcontrib-svg2pdfconverter + - black >=22.12 + - blackdoc + - bump-my-version + - cairosvg + - codespell + - coverage + - distributed >=2.0 + - filelock + - flake8 + - flake8-rst-docstrings + - flit + - h5netcdf + - ipykernel + - ipython + - matplotlib + - mypy + - nbqa + - nbsphinx + - nbval + - nc-time-axis + - netCDF4 >=1.4 + - notebook + - platformdirs + - pooch + - pre-commit + - pybtex + - pylint + - pytest + - pytest-cov + - pytest-socket + - pytest-xdist >=3.2 + - ruff >=0.1.0 + - sphinx + - sphinx-autodoc-typehints + - sphinx-codeautolink + - sphinx-copybutton + - sphinx-rtd-theme >=1.0 + - sphinxcontrib-bibtex + - tokenize-rt + - tox +# - tox-conda # Will be added when a tox@v4.0+ compatible plugin is released. + - xdoctest + - yamllint + - pip + - pip: + - flake8-alphabetize + - sphinxcontrib-svg2pdfconverter From e461973e37d00c93198cfcc3a2580263249246f7 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:46:30 -0500 Subject: [PATCH 2/6] support Python3.12 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7b822c8ec..855f13943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Atmospheric Science" ] dynamic = ["description", "version"] From 0b45defee08d7e5dbcdc62d5932020ea0e72bf15 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:59:30 -0500 Subject: [PATCH 3/6] add Python3.12 Python build to tox and main.yml, conda builds to Python3.9 and Python3.12 --- .github/workflows/main.yml | 13 ++++++------- tox.ini | 4 ++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf8a918de..be56aff2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,6 +131,9 @@ jobs: - tox-env: offline-prefetch python-version: "3.11" markers: -m 'not slow and not requires_internet' + - tox-env: py312 + python-version: "3.12" + markers: -m 'not slow' steps: - name: Harden Runner uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 @@ -172,7 +175,7 @@ jobs: test-conda: needs: lint - name: test-conda-${{ matrix.tox-env }} (Python${{ matrix.python-version }}) + name: test-conda-Python${{ matrix.python-version }} if: | contains(github.event.pull_request.labels.*.name, 'approved') || (github.event.review.state == 'approved') || @@ -181,12 +184,8 @@ jobs: strategy: matrix: include: - - python-version: "3.10" - install-python: "3.10" - - python-version: "3.11" - install-python: "3.11" + - python-version: "3.9" - python-version: "3.12" - install-python: "3.12" defaults: run: shell: bash -l {0} @@ -216,7 +215,7 @@ jobs: environment-file: environment.yml create-args: >- conda - python=${{ matrix.install-python }} + python=${{ matrix.python-version }} - name: Conda and Mamba versions run: | conda --version diff --git a/tox.ini b/tox.ini index 3017f8de9..3d33cdcfc 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ env_list = py39-upstream-doctest py310 py311 + py312 labels = test = py38, py39-upstream-doctest, py310, py311, notebooks_doctests, offline-prefetch requires = @@ -103,6 +104,9 @@ passenv = extras = dev deps = py38: scipy<1.9 + # FIXME: Remove when numba 0.59.0 is released + py312: numba==0.59.0rc1 + py312: llvmlite==0.42.0rc1 coverage: coveralls upstream: -rrequirements_upstream.txt eofs: eofs From 192c17fc8f7caa0f9a5d90ade93284f6389d0e3e Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:17:56 -0500 Subject: [PATCH 4/6] update CHANGES.rst and metadata --- .github/workflows/main.yml | 6 +++--- CHANGES.rst | 1 + pyproject.toml | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be56aff2a..0d649624c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,14 +126,14 @@ jobs: - tox-env: py311-coverage-sbck python-version: "3.11" markers: -m 'not slow' + - tox-env: py312-coverage + python-version: "3.12" + markers: -m 'not slow' - tox-env: notebooks_doctests python-version: "3.10" - tox-env: offline-prefetch python-version: "3.11" markers: -m 'not slow and not requires_internet' - - tox-env: py312 - python-version: "3.12" - markers: -m 'not slow' steps: - name: Harden Runner uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 diff --git a/CHANGES.rst b/CHANGES.rst index c80832fcf..0a6d038e0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,7 @@ Contributors to this version: Juliette Lavoie (:user:`juliettelavoie`), Pascal B Announcements ^^^^^^^^^^^^^ +* `xclim` now officially supports Python3.12 (requires `numba>=0.59.0`). (:pull:`1613`). * `xclim` now adheres to the `Semantic Versioning 2.0.0 `_ specification. (:issue:`1556`, :pull:`1569`). * The `xclim` repository now uses `GitHub Discussions `_ to offer help for users, coordinate translation efforts, and support general Q&A for the `xclim` community. The `xclim` `Gitter` room has been deprecated in favour of GitHub Discussions. (:issue:`1571`, :pull:`1572`). diff --git a/pyproject.toml b/pyproject.toml index 855f13943..03f6db874 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,8 @@ dependencies = [ "importlib-resources; python_version == '3.8'", "jsonpickle", "lmoments3>=1.0.5", - "numba", + "numba; python_version <= '3.11'", + "numba>=0.59.0; python_version >= '3.12'", "numpy>=1.16", "pandas>=0.23,<2.0; python_version == '3.8'", "pandas>=0.23,<2.2; python_version >= '3.9'", From 27fd516af7c72cd10bf7cbeb1e0c2df512a9c6f4 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:28:46 -0500 Subject: [PATCH 5/6] reorganize version pinning to allow for fewer breaking changes --- .github/workflows/main.yml | 2 +- pyproject.toml | 3 +-- tox.ini | 9 ++++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d649624c..7233985bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,7 +126,7 @@ jobs: - tox-env: py311-coverage-sbck python-version: "3.11" markers: -m 'not slow' - - tox-env: py312-coverage + - tox-env: py312-coverage-numba python-version: "3.12" markers: -m 'not slow' - tox-env: notebooks_doctests diff --git a/pyproject.toml b/pyproject.toml index 03f6db874..855f13943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,8 +43,7 @@ dependencies = [ "importlib-resources; python_version == '3.8'", "jsonpickle", "lmoments3>=1.0.5", - "numba; python_version <= '3.11'", - "numba>=0.59.0; python_version >= '3.12'", + "numba", "numpy>=1.16", "pandas>=0.23,<2.0; python_version == '3.8'", "pandas>=0.23,<2.2; python_version >= '3.9'", diff --git a/tox.ini b/tox.ini index 3d33cdcfc..1c0692cf5 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ env_list = py39-upstream-doctest py310 py311 - py312 + py312-numba labels = test = py38, py39-upstream-doctest, py310, py311, notebooks_doctests, offline-prefetch requires = @@ -104,9 +104,12 @@ passenv = extras = dev deps = py38: scipy<1.9 + # FIXME: Remove when Python3.8 is dropped + py38: numba<0.59.0 + py38: llvmlite<0.42.0 # FIXME: Remove when numba 0.59.0 is released - py312: numba==0.59.0rc1 - py312: llvmlite==0.42.0rc1 + numba: numba==0.59.0rc1 + numba: llvmlite==0.42.0rc1 coverage: coveralls upstream: -rrequirements_upstream.txt eofs: eofs From 559f8f11a484086627459000b780e5eb3d89fac5 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:35:14 -0500 Subject: [PATCH 6/6] Update environment.yml --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 06d5fc29b..3ce0cefa9 100644 --- a/environment.yml +++ b/environment.yml @@ -4,7 +4,7 @@ channels: - conda-forge - defaults dependencies: - - python >=3.8,<3.13 + - python >=3.8 - astroid - boltons >=20.1 - bottleneck >=1.3.1