Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Python3.8, Support Python3.12 and newer xclim/xarray/pandas #343

Merged
merged 8 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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}
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-------------------
Expand Down
10 changes: 5 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
47 changes: 23 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ravenpy/utilities/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ envlist =
requires =
flit
pip >=23.0
setuptools >=63.0,<65.6
setuptools >=68.0
wheel >=0.42.0
opts =
-vv

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading