Skip to content

Maintain Python3.8 #276

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

Merged
merged 6 commits into from
Apr 17, 2023
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
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
strategy:
matrix:
include:
- tox-env: py38
python-version: "3.8"
- tox-env: py39-numpy
python-version: "3.9"
- tox-env: py310
Expand Down Expand Up @@ -78,7 +80,8 @@ jobs:
environment-file: environment.yml
extra-specs: |
mamba
python="3.9"
pip<23.1
python=3.9
- name: Conda and Mamba versions
run: |
mamba --version
Expand Down
4 changes: 2 additions & 2 deletions ravenpy/config/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,9 @@ def from_nc(
alt_names: Optional[Dict[str, str]] = None,
mon_ave: bool = False,
data_kwds: Optional[
dict[
Dict[
str,
Union[dict[str, Union[bool, dict[str, int], float]], dict[str, Any]],
Union[Dict[str, Union[bool, Dict[str, int], float]], Dict[str, Any]],
]
] = None,
**kwds,
Expand Down
16 changes: 12 additions & 4 deletions ravenpy/extractors/forecasts.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import datetime as dt
import logging
import re
from pathlib import Path
from typing import Any, List, Tuple, Union

import fiona
import pandas as pd
import xarray as xr
from pandas import DatetimeIndex, Series, Timestamp
from xarray import Dataset

from . import gis_import_error_message

try:
import fiona
except (ImportError, ModuleNotFoundError) as e:
msg = gis_import_error_message.format(Path(__file__).stem)
raise ImportError(msg) from e

LOGGER = logging.getLogger("PYWPS")


Expand All @@ -32,7 +40,7 @@ def get_hindcast_day(region_coll: fiona.Collection, date, climate_model="GEPS"):
def get_CASPAR_dataset(
climate_model: str, date: dt.datetime
) -> Tuple[
xr.Dataset, list[Union[Union[DatetimeIndex, Series, Timestamp, Timestamp], Any]]
xr.Dataset, List[Union[Union[DatetimeIndex, Series, Timestamp, Timestamp], Any]]
]:
"""Return CASPAR dataset."""

Expand All @@ -58,8 +66,8 @@ def get_CASPAR_dataset(

def get_ECCC_dataset(
climate_model: str,
) -> tuple[
Dataset, list[Union[Union[DatetimeIndex, Series, Timestamp, Timestamp], Any]]
) -> Tuple[
Dataset, List[Union[Union[DatetimeIndex, Series, Timestamp, Timestamp], Any]]
]:
"""Return latest GEPS forecast dataset."""
if climate_model == "GEPS":
Expand Down
2 changes: 1 addition & 1 deletion ravenpy/utilities/forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def _shift_esp_time(nc, year, dim="member"):
)

# Write to disk
fn = nc.with_stem(nc.stem + "_shifted")
fn = nc.parent.joinpath(f"{nc.stem}_shifted{nc.suffix}")
out.to_netcdf(fn, mode="w")
return fn

Expand Down
4 changes: 2 additions & 2 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pip
pip>=21.0,<23.1
bump2version
wheel
watchdog
Expand All @@ -13,7 +13,7 @@ pytest
pytest-cov
pytest-xdist>=3.2.0
filelock
black>=23.1.0
black>=23.3.0
isort
pre-commit
holoviews
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ filterwarnings =

[isort]
profile = black
py_version = 39
py_version = 38
append_only = true

[coverage:run]
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def run(self):
setup(
author="David Huard",
author_email="[email protected]",
python_requires=">=3.9",
python_requires=">=3.8",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand All @@ -248,6 +248,7 @@ def run(self):
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python",
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
min_version = 4.0
envlist = black, py{39,310}-numpy, docs
envlist = black, py{38,39,310}-numpy, docs
requires =
pip >= 21.0
pip >=21.0,<23.1
setuptools >=63.0,<65.6
opts = --verbose

Expand Down