Skip to content

Commit

Permalink
87 drop python 38 support (#372)
Browse files Browse the repository at this point in the history
* updated mindeps workflow, remove py 3.8 from pytest workflow

* update dependency versions

* update contributing python version

* update minimal netcdf4 version

* uncomment assertion

* updated minimal dependency versions to make python 3.9 testcase succeed

* filterwarning error
  • Loading branch information
veenstrajelmer authored Mar 3, 2025
1 parent e87d18b commit 188a9fe
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pytest-py38-mindeps
name: pytest-py39-mindeps

on:
push:
Expand All @@ -18,19 +18,13 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8.14' #used at HMC
python-version: '3.9'
- name: Set fixed versions in requirements.txt extracted from pyproject.toml
run: |
python -m pip install --upgrade pip
python -m pip install "toml-to-requirements==0.1.0" # highest version available to py38
toml-to-req --toml-file pyproject.toml --include-optional # --optional-lists dev # commented arg is available from toml-to-requirements 0.2.0, but that version is not available for py38.
python -m pip install toml-to-requirements
toml-to-req --toml-file pyproject.toml --optional-lists dev
sed -i -E 's/>=/==/' requirements.txt
# temporarily removing all non-dev optional requirements manually, can be done more cleanly with toml-to-req>=0.2.0
sed -i '/^sphinx/d' requirements.txt
sed -i '/^nbsphinx/d' requirements.txt
sed -i '/^pydata-sphinx-theme/d' requirements.txt
sed -i '/^jupyter/d' requirements.txt
sed -i '/^notebook/d' requirements.txt
- name: Print contents of requirements.txt
run: |
# print file contents
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# Python 3.8.14 is used at HMC
python-version: ["3.8.14", "3.9", "3.12", "3.13"]
python-version: ["3.9", "3.12", "3.13"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- download Miniforge3 from [the miniforge github](https://github.com/conda-forge/miniforge?tab=readme-ov-file#download) and install it with the recommended settings.
- open Miniforge Prompt and navigate to hatyan checkout folder, e.g. ``C:\DATA\hatyan``
- ``conda create --name hatyan_hmcenv python=3.8.13 git spyder -y`` (``git`` and ``spyder``, python version should be the one at HMC)
- ``conda create --name hatyan_hmcenv python=3.11.7 git spyder -y`` (``git`` and ``spyder``, python version should be the one at HMC)
- ``conda activate hatyan_hmcenv``
- ``pip install -r environment_hmc.txt`` (installs fixed python/package versions like on HMC)
- ``python -m pip install -e .[dev,docs,examples]`` (pip developer mode, any updates to the local folder are immediately available in your python. It also installs all requirements via pip, square brackets are to install optional dependency groups)
Expand Down
8 changes: 4 additions & 4 deletions hatyan/data/leap-seconds.list
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
#
# The following line shows the last update of this file in NTP timestamp:
#
#$ 3929093563
#$ 3945196800
#
# 2) Expiration date of the file given on a semi-annual basis: last June or last December
#
# File expires on 28 June 2025
# File expires on 28 December 2025
#
# Expire date in NTP timestamp:
#
#@ 3960057600
#@ 3975868800
#
#
# LIST OF LEAP SECONDS
Expand Down Expand Up @@ -117,4 +117,4 @@
# please see the readme file in the 'source' directory :
# https://hpiers.obspm.fr/iers/bul/bulc/ntp/sources/README
#
#h be738595 57b0cf1b b0218343 fb77062f 5a775e7
#h 848434d5 570f7ea8 d79ba227 a00fc821 f608e2d4
4 changes: 3 additions & 1 deletion hatyan/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,9 @@ def read_dia(filename, station=None, block_ids=None, allow_duplicates=False):
else: # equidistant
data_pd_oneblock = read_dia_equidistant(filename_one, diablocks_pd, block_id)

# add status column
# add status columnm
# first set dtype via empty column to avoid FutureWarning
data_pd_oneblock['status'] = ''
block_status_list = diablocks_pd.loc[block_id,'STA'].split('!')
for block_status_one in block_status_list:
status_tstart = pd.to_datetime(block_status_one[4:17],format='%Y%m%d;%H%M').tz_localize("UTC+01:00")
Expand Down
44 changes: 21 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,28 @@ description = "Tidal analysis and prediction tool of Rijkswaterstaat"
readme = "README.md"
keywords = ["hatyan", "tidal analysis", "tidal prediction"]
license = { text = "LGPLv3" }
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
#scipy<1.5.4 env creation failed in https://github.com/Deltares/hatyan/issues/71
#scipy>=1.5.4 env creation succeeded in https://github.com/Deltares/hatyan/issues/71
"scipy>=1.5.4",
#numpy 1.21 is EOL since june 2023
"numpy>=1.22.0",
#TODO: contour colorbar on uniform values fails with matplotlib<3.7.0, several other features with matplotlib<3.6.0
#matplotlib<3.5.2 raises "ValueError: Multi-dimensional indexing" in hatyan.plot_timeseries()
"matplotlib>=3.5.2",
#TODO: pandas>=1.4.0 is required by xarray>=2023.3.0
#pandas<2.0.0 supports non-nanosecond timestep and therefore larger min/max range
"pandas>=2.0.0",
#TODO: netcdf4<1.5.4 pip install fails in py39
#netcdf4<1.5.3 from setup.cfg
"netcdf4>=1.5.3",
#pyproj<3.1.0 not pip installable in py38
#numpy>=1.24.0 is oldest supported version in Q4 2024
"numpy>=1.24.0",
#matplotlib>=3.7.0 contour colorbar on uniform values succeeds
"matplotlib>=3.7.0",
#pandas>=2.1.0 has persistent max attrs (test_metadata_persistence)
"pandas>=2.1.0",
#netcdf4>=1.5.6 does not call numpy.bool (avoids AttributeError)
"netcdf4>=1.5.6",
#pyproj>=3.1.0 is pip installable in py38
"pyproj>=3.1.0",
#requests<2.28.0 not tested on hmc
#requests>=2.28.0 was tested on hmc
"requests>=2.28.0",
#TODO: xarray<2023.4.0 conflicts with pandas<2.0.0 for resampling, only available for py39
#xarray>=2022.6.0 is quite old version from dfm_tools
"xarray>=2022.6.0",
#rws-ddlpy<0.5.0 supports timezones for input dates
#xarray>=2023.4.0 does not conflict with pandas<2.0.0 for resampling
"xarray>=2023.4.0",
#rws-ddlpy>=0.5.0 supports timezones for input dates
"rws-ddlpy>=0.5.0",
#click<7.1 is not available on github release page
"click>7.1",
#click>=7.1 is the first version available on github release page
"click>=7.1",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -45,7 +41,6 @@ classifiers = [
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -90,7 +85,10 @@ console_output_style = "count"
testpaths = ["tests"]
python_files = "test_*.py"
addopts = "-v --tb=short --durations=0"
filterwarnings = ["ignore::UserWarning"]
filterwarnings = [
"error",
"ignore::UserWarning",
]
markers = [
"unittest: mark a test as unittest. Used for testing single methods",
"systemtest: mark a test as systemtest. Used for testing at a higher level, verifying a given input returns the expected output",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ def test_metadata_persistence():

assert len(comp.iloc[:10].attrs) > 0
assert len(comp["A"].attrs) > 0
# assert len(comp.max().attrs) > 0 # TODO: max is not persistent in python 3.8
assert len(comp.max().attrs) > 0

0 comments on commit 188a9fe

Please sign in to comment.