diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f37ed0bf..17f938e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,19 +38,20 @@ jobs: fail-fast: false matrix: include: - - tox-env: py38-linux - python-version: "3.8" - os: ubuntu-latest - - tox-env: py38-macos - python-version: "3.8" - os: macos-latest - tox-env: py39-linux python-version: "3.9" os: ubuntu-latest + - tox-env: py39-macos + python-version: "3.9" + os: macos-latest - tox-env: py310-linux-upstream python-version: "3.10" os: ubuntu-latest - upstream-branch: "from-official-git" + upstream-branch: "main" + - tox-env: py310-macos-upstream + python-version: "3.10" + os: macos-latest + upstream-branch: "main" - tox-env: py311-linux python-version: "3.11" os: ubuntu-latest @@ -60,6 +61,9 @@ jobs: - tox-env: py312-linux python-version: "3.12" os: ubuntu-latest + - tox-env: py312-macos + python-version: "3.12" + os: macos-latest steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -107,15 +111,8 @@ jobs: strategy: fail-fast: false matrix: - include: - - os: ubuntu-latest - python-version: "3.9" - - os: ubuntu-latest - python-version: "3.10" - - os: ubuntu-latest - python-version: "3.11" - - os: macos-latest - python-version: "3.9" + os: [ubuntu-latest, macos-latest] # windows-latest # disabled until xesmf is available + python-version: ["3.9", "3.10", "3.11", "3.12"] defaults: run: shell: bash -l {0} @@ -141,7 +138,7 @@ jobs: echo "micromamba: $(micromamba --version)" - name: Install RavenPy run: | - pip install -e ".[dev]" + python -m pip install -e ".[dev]" - name: List installed packages run: | conda list diff --git a/HISTORY.rst b/HISTORY.rst index 19ed6b23..40003a14 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,14 +4,17 @@ History 0.14.0 (2024--soon) ------------------- -* Added support for Python3.12. +* Added support for Python 3.12 and dropped support for Python3.8. * Upgraded `raven-hydro` to v0.3.0 and `RavenHydroFramework` to v3.8. +* `ravenpy` now requires `xclim` >= v0.48.2, `xarray` >= v2023.11.0, and `pandas` >= 2.2.0. Internal changes ^^^^^^^^^^^^^^^^ * Updated GitHub publishing workflows to use Trusted Publisher for TestPyPI/PyPI releases. * Added Dependabot to keep dependencies up-to-date. * Now using step-security/harden-runner action to harden GitHub Actions runners. +* Adjusted GitHub Workflows to test against Python 3.9, 3.10, 3.11, and 3.12. +* Updated the build-system requirements when testing with `tox` to use newer `setuptools` and `wheel` versions when building `gdal`. 0.13.0 (2024-01-10) ------------------- diff --git a/environment.yml b/environment.yml index d3c35427..a246da57 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python >=3.8,<3.13 + - python >=3.9,<3.13 - raven-hydro ==0.2.4 - libgcc # for mixing raven-hydro from PyPI with conda environments - affine @@ -26,9 +26,9 @@ dependencies: - lxml - matplotlib - netcdf4 - - numpy <1.25 + - numpy - owslib <0.29.0 # see: https://github.com/geopython/OWSLib/issues/871 - - pandas <2.2.0 # xclim <0.48.0 is incompatible with pandas >=2.2.0 + - pandas >=2.2.0 - pint >=0.20 - platformdirs - pre-commit @@ -44,7 +44,7 @@ dependencies: - spotpy - statsmodels - typing_extensions - - xarray >=2022.12.0,<2023.9.0 # xarray v2023.9.0 is incompatible with xclim<=0.45.0 - - xclim >=0.43,<0.48 + - xarray >=2023.11.0 # xarray v2023.9.0 is incompatible with xclim<=0.45.0 + - xclim >=0.48.2 - xesmf - xskillscore diff --git a/pyproject.toml b/pyproject.toml index 1aa89fce..ba5ca462 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ maintainers = [ {name = "Trevor James Smith", email = "smith.trevorj@ouranos.ca"} ] readme = {file = "README.rst", content-type = "text/x-rst"} -requires-python = ">=3.8.0" +requires-python = ">=3.9.0" keywords = ["raven", "raven-hydro", "hydrology", "gis", "analysis", "modelling"] license = {file = "LICENSE"} classifiers = [ @@ -24,7 +24,6 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -38,52 +37,52 @@ dynamic = ["description", "version"] dependencies = [ "cftime", # cf-xarray is differently named on conda-forge - "cf-xarray[all]<0.8.5; python_version == '3.8'", - "cf-xarray[all]; python_version >= '3.9'", - "climpred>=2.4.0", + "cf-xarray[all]", + "climpred >=2.4.0", "dask", "haversine", "h5netcdf", "matplotlib", "netCDF4", - "numpy<1.25", - "owslib>=0.24.1,<0.29", # see: https://github.com/geopython/OWSLib/issues/871 - "pandas<2.0.0; python_version == '3.8'", - "pandas<2.2.0; python_version >= '3.9'", - "pint>=0.20", + "numpy", + "owslib >=0.24.1,<0.29", # see: https://github.com/geopython/OWSLib/issues/871 + "pandas >=2.2.0", + "pint >=0.20", "platformdirs", - "pydantic>=2.0", + "pydantic >=2.0", "pymbolic", - "raven-hydro==0.2.4", + "raven-hydro ==0.2.4", "requests", "scipy", "spotpy", "statsmodels", "typing-extensions", - "xarray>=2022.12.0,<2023.9.0", # xarray v2023.9.0 is incompatible with xclim<=0.45.0 - "xclim>=0.43.0,<0.48.0", + "xarray >=2023.11.0", + "xclim >=0.48.2", "xskillscore" ] [project.optional-dependencies] dev = [ - "black>=24.1.1", + "black >=24.2.0", "bump2version", "coverage", "coveralls", "filelock", - "flake8>=7.0.0", + "flake8 >=7.0.0", "flit", "holoviews", "hvplot", - "isort>=5.13.2", + "isort >=5.13.2", "mypy", "pre-commit", "pytest", "pytest-cov", - "pytest-xdist>=3.2.0", + "pytest-xdist >=3.2.0", + "setuptools >=68.0", "tox", - "watchdog" + "watchdog", + "wheel >=0.42.0" ] docs = [ "autodoc-pydantic", @@ -94,7 +93,7 @@ docs = [ # Needed for notebooks/HydroShare_integration.ipynb # See: https://github.com/CSHS-CWRA/RavenPy/pull/326 # "hsclient", - "intake", + "intake <2.0.0", "intake-esm", "intake-xarray", "ipykernel", @@ -114,17 +113,17 @@ docs = [ "sphinx-click", "sphinx-codeautolink", "sphinx-copybutton", - "sphinx-rtd-theme>=1.0", + "sphinx-rtd-theme >=1.0", "xesmf" ] gis = [ "affine", - "fiona>=1.9", - "geopandas>=0.13.0", + "fiona >=1.9", + "geopandas >=0.13.0", "gdal", "lxml", "pyogrio", - "pyproj>=3.0.0", + "pyproj >=3.0.0", "rasterio", "rioxarray", "shapely" diff --git a/ravenpy/utilities/coords.py b/ravenpy/utilities/coords.py index ec3632ae..d9454042 100644 --- a/ravenpy/utilities/coords.py +++ b/ravenpy/utilities/coords.py @@ -97,7 +97,7 @@ def infer_scale_and_offset( multi, base, start_anchor, _ = parse_offset(freq) if base in ["M", "Q", "A"]: raise ValueError(f"Irregular time frequency for input data {da}") - real_source = source / multi / units(FREQ_UNITS[base]) + real_source = source / multi / units(FREQ_UNITS.get(base, base)) scale, offset = units_transform(real_source, target) else: raise NotImplementedError(f"data_type: {data_type}") diff --git a/tox.ini b/tox.ini index d1f705d2..15119254 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,8 @@ envlist = requires = flit pip >=23.0 - setuptools >=63.0,<65.6 + setuptools >=68.0 + wheel >=0.42.0 opts = -vv @@ -55,7 +56,7 @@ install_command = deps = # numpy must be present in python env before GDAL is installed numpy - gdal == {env:GDAL_VERSION} + gdal[numpy] == {env:GDAL_VERSION} commands_pre = python -m pip list - python -m pip check @@ -64,7 +65,7 @@ commands = # Rebuild netcdf4 on Linux due to errors in new version (https://github.com/Unidata/netcdf4-python/issues/1192) # linux: python -m pip install --upgrade --force-reinstall --no-deps --no-cache-dir netcdf4==1.6.4 --no-binary netcdf4 # Rebuild GDAL in order to gain access to GDAL system-level objects - python -m pip install --upgrade --force-reinstall --no-deps --no-cache-dir gdal=={env:GDAL_VERSION}.* --no-binary gdal + python -m pip install --upgrade --force-reinstall --no-deps --no-cache-dir --no-build-isolation gdal[numpy]=={env:GDAL_VERSION}.* # Install raven-hydro from the upstream branch upstream: python -m pip install --upgrade --force-reinstall --no-deps --no-cache-dir git+https://github.com/Ouranosinc/raven-hydro.git@{env:UPSTREAM_BRANCH} # Run tests