Skip to content

Commit

Permalink
Update dependency pins, fix typo (#1870)
Browse files Browse the repository at this point in the history
### What kind of change does this PR introduce?

* Synchronizes dependencies between `pyproject.toml` and
`environment.yml`
* Sets a few pins to their latest versions
* Fixes a small typo in `cli.py`
* Fixes an issue with the latest version of `dask` (2024.8.0)
* Removed `poppler` from the list of Conda dependencies

### Does this PR introduce a breaking change?

No.

---------

Co-authored-by: Pascal Bourgault <bourgault.pascal@ouranos.ca>
  • Loading branch information
Zeitsperre and aulemahal authored Aug 7, 2024
1 parent 1407011 commit a2b34f5
Show file tree
Hide file tree
Showing 17 changed files with 130 additions and 232 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
python -m tox -- -m 'not slow'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true

test-pypi:
needs: lint
Expand Down Expand Up @@ -192,7 +193,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
- name: Test with tox (specialized tests)
if: ${{ matrix.tox-env != 'standard' }}
run: |
Expand All @@ -201,7 +201,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github

test-conda:
needs: lint
Expand Down Expand Up @@ -278,7 +277,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github

finish:
needs:
Expand All @@ -301,4 +299,3 @@ jobs:
python -m coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
18 changes: 10 additions & 8 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ v0.52.0 (unreleased)
--------------------
Contributors to this version: David Huard (:user:`huard`), Trevor James Smith (:user:`Zeitsperre`), Hui-Min Wang (:user:`Hem-W`), Éric Dupuis (:user:`coxipi`), Sarah Gammon (:user:`SarahG-579462`), Pascal Bourgault (:user:`aulemahal`), Juliette Lavoie (:user:`juliettelavoie`).

Announcements
^^^^^^^^^^^^^
* `xclim` now supports both `numpy` versions `>=1.20` and `>=2.0`. (:issue:`1785`, :pull:`1814`, :pull:`1870`).
* `xclim` now needs ``cf_xarray>=0.9.3`` but continues to support older versions of `pint` (`<0.24`) for compatibility reasons. (:pull:`1870`).

New features and enhancements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* ``xclim.sdba.nbutils.quantile`` and its child functions are now faster. If the module `fastnanquantile` is installed, it is used as the backend for the computation of quantiles and yields even faster results. This dependency is now listed in the `xclim[extras]` recipe. (:issue:`1255`, :pull:`1513`).
* New multivariate bias adjustment class `MBCn`, giving a faster and more accurate implementation of the 'MBCn' algorithm (:issue:`1551`, :pull:`1580`).
* New multivariate bias adjustment class ``MBCn``, giving a faster and more accurate implementation of the ``MBCn`` algorithm. (:issue:`1551`, :pull:`1580`).
* `xclim` is now compatible with `pytest` versions `>=8.0.0`. (:pull:`1632`).

Breaking changes
^^^^^^^^^^^^^^^^
* As updated in ``cf_xarray>=0.9.3``, dimensionless quantities now use the "1" units attribute as specified by the CF conventions, previously an empty string was returned. (:pull:`1814`).

Breaking changes
^^^^^^^^^^^^^^^^
* As of ``cf_xarray>=0.9.3``, dimensionless quantities now use the "1" units attribute as specified by the CF conventions, previously an empty string was returned. (:pull:`1814`).
* The definitions of the ``frost_free_season_start`` and ``frost_free_season_end`` have been slightly changed to be coherent with the ``frost_free_season_length`` and `xclim`'s notion of `season` in general. Indicator and indices signature have changed. (:pull:`1845`).
* Season length indicators have been modified to return ``0`` for all cases where a proper season was not found, but the data is valid. Previously, a ``nan`` was given if neither a start or an end were found, even if the data was valid, and a ``0`` was given if an end was found but no start. (:pull:`1845`).

Bug fixes
^^^^^^^^^
* Fixed the indexer bug in the ``xclim.indices.standardized_index_fit_params`` when multiple or non-array indexers are specified and fitted parameters are reloaded from netCDF. (:issue:`1842`, :pull:`1843`).
* Addressed a bug found in ``wet_spell_*`` indicators that was contributing to erroneous results. A new generic spell length statistic function ``xclim.indices.generic.spell_length_statistics`` is now used in wet and dry spells indicators. (:issue:`1834`, :pull:`1838`).
* Syntax for ``nan`` and ``inf`` was adapted to support ``numpy>=2.0.0``. (:pull:`1814`, :issue:`1785`).
* Force type in `jitter` to work with new version of dask. (:pull:`1864`)
* Syntax for ``nan`` and ``inf`` was adapted to support `numpy>=2.0`. (:pull:`1814`, :issue:`1785`).
* Force type in ``jitter`` to work with new version of `dask`. (:pull:`1864`).

Internal changes
^^^^^^^^^^^^^^^^
Expand All @@ -39,7 +41,7 @@ CI changes
* `pip-tools` (`pip-compile`) has been used to generate a lock file with hashes for the CI dependencies. (:pull:`1841`).
* The ``main.yml`` workflow has been updated to use simpler trigger logic. (:pull:`1841`).
* A workflow bug has been fixed that was causing multiple duplicate comments to be made on Pull Requests originating from forks. (:pull:`1841`).
* The ``upstream.yml`` workflow was adapted to not install upstream Python dependencies using hashes (impossible to install directly from GitHub sources using --require-hashes). (:pull:`1859`).
* The ``upstream.yml`` workflow was adapted to not install upstream Python dependencies using hashes (as it is impossible to install directly from GitHub sources using ``--require-hashes``). (:pull:`1859`).
* The `tox-gh` configuration has been set to handle the environment configurations on GitHub Workflows. The tox.ini file is also a bit more organized/consistent. (:pull:`1859`).

v0.51.0 (2024-07-04)
Expand Down
50 changes: 25 additions & 25 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,77 +6,77 @@ dependencies:
- python >=3.9
- boltons >=20.1
- bottleneck >=1.3.1
- cf_xarray >=0.6.1
- cf_xarray >=0.9.3
- cftime >=1.4.1
- click >=8.1
- dask >=2.6.0
- jsonpickle
- numba
- filelock >=3.14.0
- jsonpickle >=3.1.0
- numba >=0.54.1
- numpy >=1.20.0
- packaging >=24.0
- pandas >=2.2.0
- pint >=0.18.0
- poppler >=0.67
- pyarrow # Strongly encouraged for Pandas v2.2.0+
- pyyaml
- pyarrow >=15.0.0 # Strongly encouraged for Pandas v2.2.0+
- pyyaml >=6.0.1
- scikit-learn >=0.21.3
- scipy >=1.9.0
- statsmodels
- statsmodels >=0.14.2
- xarray >=2023.11.0
- yamale
- yamale >=5.0.0
# Extras
- flox
- lmoments3 # Required for some Jupyter notebooks
# Testing and development dependencies
- black ==24.4.2
- blackdoc ==0.3.9
- bump-my-version >=0.23.0
- bump-my-version >=0.24.3
- cairosvg
- codespell ==2.3.0
- coverage >=7.5.0
- coveralls >=4.0.0
- deptry ==0.16.1
- deptry ==0.18.0
- distributed >=2.0
- filelock
- flake8 >=7.0.0
- flake8-rst-docstrings
- flake8 >=7.1.1
- flake8-rst-docstrings >=0.3.0
- flit >=3.9.0
- furo >=2023.9.10
- h5netcdf >=1.3.0
- ipykernel
- ipython
- isort ==5.13.2
- matplotlib
- mypy
- mypy >=1.10.0
- nbconvert <7.14 # Pinned due to directive errors in sphinx. See: https://github.com/jupyter/nbconvert/issues/2092
- nbqa
- nbqa >=1.8.2
- nbsphinx
- nbval >=0.11.0
- nc-time-axis
- nc-time-axis >=1.4.1
- notebook
- pandas-stubs
- platformdirs
- pooch
- pandas-stubs >=2.2
- platformdirs >=3.2
- pooch >=1.8.0
- pre-commit >=3.7
- pybtex >=0.24.0
- pylint >=3.1
- pytest >=8.0.0
- pytest-cov
- pytest-socket
- pytest-cov >=5.0.0
- pytest-socket >=0.6.0
- pytest-xdist >=3.2
- ruff >=0.4.10
- ruff >=0.5.6
- sphinx >=7.0.0
- sphinx-autobuild >=2024.4.16
- sphinx-autodoc-typehints
- sphinx-codeautolink
- sphinx-copybutton
- sphinx-mdinclude
- sphinxcontrib-bibtex
- tokenize-rt
- tokenize-rt >=5.2.0
- tox >=4.16.0
# - tox-conda # Will be added when a tox@v4.0+ compatible plugin is released.
- vulture # ==2.11 # The conda-forge version is out of date.
- xdoctest >=1.1.5
- yamllint
- pip
- yamllint >=1.35.1
- pip >=24.0
- pip:
- sphinxcontrib-svg2pdfconverter
70 changes: 37 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,35 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Atmospheric Science"
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Topic :: Scientific/Engineering :: Hydrology",
"Typing :: Typed"
]
dynamic = ["description", "version"]
dependencies = [
"boltons>=20.1",
"bottleneck>=1.3.1",
"boltons >=20.1",
"bottleneck >=1.3.1",
# cf-xarray is differently named on conda-forge
"cf-xarray>=0.6.1",
"cftime>=1.4.1",
"click>=8.1",
"dask[array]>=2.6",
"filelock",
"jsonpickle",
"numba",
"numpy>=1.20.0",
"packaging",
"pandas>=2.2",
"pint>=0.18",
"cf-xarray >=0.9.3",
"cftime >=1.4.1",
"click >=8.1",
"dask[array] >=2.6",
"filelock >=3.14.0",
"jsonpickle >=3.1.0",
"numba >=0.54.1",
"numpy >=1.20.0",
"packaging >=24.0",
"pandas >=2.2",
"pint >=0.18",
"platformdirs >=3.2",
"pyarrow", # Strongly encouraged for pandas v2.2.0+
"pyyaml",
"scikit-learn>=0.21.3",
"scipy>=1.9.0",
"statsmodels",
"xarray>=2023.11.0",
"yamale"
"pyarrow >=15.0.0", # Strongly encouraged for pandas v2.2.0+
"pyyaml >=6.0.1",
"scikit-learn >=0.21.3",
"scipy >=1.9.0",
"statsmodels >=0.14.2",
"xarray >=2023.11.0",
"yamale >=5.0.0"
]

[project.optional-dependencies]
Expand All @@ -65,27 +68,28 @@ dev = [
"coverage[toml] >=7.5.0",
"coveralls >=4.0.0",
"deptry ==0.18.0",
"flake8 >=7.1.0",
"flake8-rst-docstrings",
"flake8 >=7.1.1",
"flake8-rst-docstrings >=0.3.0",
"h5netcdf>=1.3.0",
"ipython",
"isort ==5.13.2",
"mypy",
"mypy >=1.10.0",
"nbconvert <7.14", # Pinned due to directive errors in sphinx. See: https://github.com/jupyter/nbconvert/issues/2092
"nbqa >=1.8.2",
"nbval >=0.11.0",
"pandas-stubs >=2.2",
"pip >=24.0",
"platformdirs >=3.2",
"pooch",
"pooch >=1.8.0",
"pre-commit >=3.7",
"pylint >=3.2.4",
"pytest >=8.0.0",
"pytest-cov",
"pytest-socket",
"pytest-cov >=5.0.0",
"pytest-socket >=0.6.0",
"pytest-xdist[psutil] >=3.2",
"ruff >=0.4.10",
"tokenize-rt",
"tox >=4.16.0",
"ruff >=0.5.6",
"tokenize-rt >=5.2.0",
"tox >=4.17.0",
# "tox-conda", # Will be added when a tox@v4.0+ compatible plugin is released.
"vulture ==2.11",
"xdoctest >=1.1.5",
Expand All @@ -98,8 +102,8 @@ docs = [
"ipykernel",
"matplotlib",
"nbsphinx",
"nc-time-axis",
"pooch",
"nc-time-axis >=1.4.1",
"pooch >=1.8.0",
"pybtex >=0.24.0",
"sphinx >=7.0.0",
"sphinx-autobuild >=2024.4.16",
Expand All @@ -110,7 +114,7 @@ docs = [
"sphinxcontrib-bibtex",
"sphinxcontrib-svg2pdfconverter[Cairosvg]"
]
extras = ["fastnanquantile"]
extras = ["fastnanquantile >=0.0.2"]
all = ["xclim[dev]", "xclim[docs]", "xclim[extras]"]

[project.scripts]
Expand Down
8 changes: 1 addition & 7 deletions tests/test_atmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import numpy as np
import xarray as xr
from cf_xarray import __version__ as __cfxr_version__
from packaging.version import Version

from xclim import atmos, set_options

Expand Down Expand Up @@ -262,11 +260,7 @@ def test_wind_profile(atmosds):

def test_wind_power_potential(atmosds):
out = atmos.wind_power_potential(wind_speed=atmosds.sfcWind)

if Version(__cfxr_version__) < Version("0.9.3"):
assert out.attrs["units"] == ""
else:
assert out.attrs["units"] == "1"
assert out.attrs["units"] == "1"
assert (out >= 0).all()
assert (out <= 1).all()

Expand Down
7 changes: 1 addition & 6 deletions tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import numpy as np
import pytest
import xarray as xr
from cf_xarray import __version__ as __cfxr_version__
from packaging.version import Version

from xclim.core.calendar import doy_to_days_since, select_time
from xclim.indices import generic
Expand Down Expand Up @@ -104,10 +102,7 @@ def test_doyminmax(self, q_series):
for attr in ["units", "is_dayofyear", "calendar"]:
assert attr in da.attrs.keys()

if Version(__cfxr_version__) < Version("0.9.3"):
assert da.attrs["units"] == ""
else:
assert da.attrs["units"] == "1"
assert da.attrs["units"] == "1"
assert da.attrs["is_dayofyear"] == 1


Expand Down
8 changes: 1 addition & 7 deletions tests/test_hydrology.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import annotations

import numpy as np
from cf_xarray import __version__ as __cfxr_version__
from packaging.version import Version

from xclim import indices as xci

Expand Down Expand Up @@ -42,11 +40,7 @@ def test_simple(self, snw_series):
snw = snw_series(a, start="1999-01-01")
out = xci.snw_max_doy(snw, freq="YS")
np.testing.assert_array_equal(out, [11, np.nan])

if Version(__cfxr_version__) < Version("0.9.3"):
assert out.attrs["units"] == ""
else:
assert out.attrs["units"] == "1"
assert out.attrs["units"] == "1"


class TestSnowMeltWEMax:
Expand Down
Loading

0 comments on commit a2b34f5

Please sign in to comment.