Skip to content

Commit

Permalink
Update to Python 3.12 (#43)
Browse files Browse the repository at this point in the history
* Add Python 3.12 to GHA pytest-with-coverage workflow

This lets us use the workflow to test whether all the packages NEMO-Cmd depends
on have been updated to support Python 3.12.

* Add workflow_dispatch trigger to GHA CI workflow

Enables workflow to be triggered from GitHub CLI, browser, or via API.

This is primarily to allow the workflow to be run via
    gh workflow run pytest-with-coverage --ref py312
during the conda-forge Python 3.12 migration to test if the environment is
solvable yet.

* Update pkgs & versions used in recent dev env

* Change dev & rtd envs to Python 3.12

* Drop TROVE classifiers

They are now just outdated maintenance overhead.

* Change sphinx-linkcheck workflow to Python 3.12

* Change to Python 3.12 for development

* Drop support for Python 3.8, 3.9 & 3.10

* Update bbox assertion in test_random_oil_spills

Update shapely testing function re: "ShapelyDeprecationWarning: The
'almost_equals()' method is deprecated and will be removed in Shapely 2.1".
  • Loading branch information
douglatornell authored Dec 18, 2023
1 parent ff4863c commit 9f2ef0f
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 224 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pytest-with-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: pytest-with-coverage
on:
push:
branches: [ '*' ]
# Enable workflow to be triggered from GitHub CLI, browser, or via API
# primarily for testing conda env solution for new Python versions
workflow_dispatch:

jobs:
pytest-with-coverage:
Expand All @@ -12,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.11', '3.12']
uses: UBC-MOAD/gha-workflows/.github/workflows/pytest-with-coverage.yaml@main
with:
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sphinx-linkcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
# Need to specify Python version here because we use test env which gets its
# Python version via matrix
python-version: [ '3.10' ]
python-version: [ '3.12' ]
uses: UBC-MOAD/gha-workflows/.github/workflows/sphinx-linkcheck.yaml@main
with:
python-version: ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ UBC EOAS MOAD Group Tools Package
.. image:: https://img.shields.io/badge/license-Apache%202-cb2533.svg
:target: https://www.apache.org/licenses/LICENSE-2.0
:alt: Licensed under the Apache License, Version 2.0
.. image:: https://img.shields.io/badge/python-3.8+-blue.svg
:target: https://docs.python.org/3.10/
.. image:: https://img.shields.io/badge/Python-3.11%20%7C%203.12-blue?logo=python&label=Python&logoColor=gold
:target: https://docs.python.org/3.12/
:alt: Python Version
.. image:: https://img.shields.io/badge/version%20control-git-blue.svg?logo=github
:target: https://github.com/UBC-MOAD/moad_tools
Expand Down
279 changes: 136 additions & 143 deletions docs/pkg_development.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion envs/environment-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
- pandas
- pip
- pytables
- python=3.10
- python=3.12
- pyyaml
- rasterio
- scipy
Expand Down
2 changes: 1 addition & 1 deletion envs/environment-rtd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ channels:
- nodefaults

dependencies:
- python=3.10
- python=3.12

# RTD packages
- mock
Expand Down
113 changes: 55 additions & 58 deletions envs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,103 +5,100 @@
# to create an isolated development environment.
#
# Create/update this file with:
# (moad-tools)$ python3 -m pip list --format=freeze >> envs/requirements.txt
# (moad-tools)$ python -m pip list --format=freeze >> envs/requirements.txt

affine==2.4.0
alabaster==0.7.13
arrow==1.2.3
arrow==1.3.0
attrs==23.1.0
Babel==2.12.1
black==23.7.0
branca==0.6.0
Brotli==1.0.9
certifi==2023.7.22
cftime==1.6.2
charset-normalizer==3.2.0
Babel==2.14.0
black==23.11.0
branca==0.7.0
Brotli==1.1.0
certifi==2023.11.17
cftime==1.6.3
charset-normalizer==3.3.2
click==8.1.7
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
contourpy==1.1.0
coverage==7.3.0
cycler==0.11.0
docutils==0.18.1
exceptiongroup==1.1.3
Fiona==1.9.4
folium==0.14.0
fonttools==4.42.1
GDAL==3.7.1
geopandas==0.13.2
idna==3.4
contourpy==1.2.0
coverage==7.3.3
cycler==0.12.1
docutils==0.20.1
exceptiongroup==1.2.0
fiona==1.9.5
folium==0.15.1
fonttools==4.46.0
GDAL==3.8.1
geopandas==0.14.1
idna==3.6
imagesize==1.4.1
importlib-metadata==6.8.0
importlib-metadata==7.0.0
iniconfig==2.0.0
Jinja2==3.1.2
joblib==1.3.2
kiwisolver==1.4.5
mapclassify==2.5.0
mapclassify==2.6.1
MarkupSafe==2.1.3
matplotlib==3.7.2
munch==4.0.0
matplotlib==3.8.2
munkres==1.1.4
mypy-extensions==1.0.0
netCDF4==1.6.4
networkx==3.1
numexpr==2.8.4
numpy==1.25.2
packaging==23.1
pandas==2.0.3
pathspec==0.11.2
Pillow==10.0.1
pip==23.3
platformdirs==3.10.0
netCDF4==1.6.5
networkx==3.2.1
numexpr==2.8.7
numpy==1.26.2
packaging==23.2
pandas==2.1.4
pathspec==0.12.1
Pillow==10.1.0
pip==23.3.2
platformdirs==4.1.0
pluggy==1.3.0
ply==3.11
pooch==1.7.0
py-cpuinfo==9.0.0
Pygments==2.16.1
pyparsing==3.0.9
pyproj==3.6.0
Pygments==2.17.2
pyparsing==3.1.1
pyproj==3.6.1
PyQt5==5.15.9
PyQt5-sip==12.12.2
PySocks==1.7.1
pytest==7.4.0
pytest==7.4.3
pytest-cov==4.1.0
pytest-randomly==3.15.0
python-dateutil==2.8.2
pytz==2023.3
pytz==2023.3.post1
PyYAML==6.0.1
rasterio==1.3.8
rasterio==1.3.9
requests==2.31.0
Rtree==1.0.1
scikit-learn==1.3.0
scipy==1.11.2
setuptools==68.1.2
shapely==2.0.1
sip==6.7.11
Rtree==1.1.0
scikit-learn==1.3.2
SciPy==1.11.4
setuptools==68.2.2
shapely==2.0.2
sip==6.7.12
six==1.16.0
snowballstemmer==2.2.0
snuggs==1.4.7
Sphinx==7.2.4
sphinx-notfound-page==0.8.3
sphinx-rtd-theme==1.3.0
Sphinx==7.2.6
sphinx-notfound-page==1.0.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
tables==3.8.0
tables==3.9.2
threadpoolctl==3.2.0
toml==0.10.2
tomli==2.0.1
tornado==6.3.3
typing_extensions==4.7.1
types-python-dateutil==2.8.19.14
tzdata==2023.3
unicodedata2==15.0.0
urllib3==2.0.7
wheel==0.41.2
xarray==2023.8.0
xyzservices==2023.7.0
zipp==3.16.2
urllib3==2.1.0
wheel==0.42.0
xarray==2023.12.0
xyzservices==2023.10.1
zipp==3.17.0
17 changes: 1 addition & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,12 @@ url = https://ubc-moad-tools.readthedocs.org/en/latest/
long_description = file: README.rst
license = Apache License, Version 2.0
platform = Linux
classifiers =
Development Status :: 5 - Production
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Operating System :: POSIX :: Linux
Operating System :: Unix
Environment :: Console
Intended Audience :: Science/Research
Intended Audience :: Education
Intended Audience :: Developers

[options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >=3.8
python_requires = >=3.11
install_requires =
# see envs/environment-dev.yaml for conda environment dev installation
# see envs/requirements.txt for versions most recently used in development
Expand All @@ -62,7 +48,6 @@ install_requires =
# PyTables
tables
xarray
# moad_tools # use python3 -m pip install --editable moad_tools/

[options.entry_points]
console_scripts =
Expand Down
3 changes: 2 additions & 1 deletion tests/test_random_oil_spills.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import pandas
import pytest
import shapely.geometry
import shapely.testing
import xarray
import yaml

Expand Down Expand Up @@ -270,7 +271,7 @@ def test_get_lat_lon_indices(self, config_file):
assert lon == pytest.approx(expected.lon)
assert geotiff_x_index == expected.geotiff_x_index
assert geotiff_y_index == expected.geotiff_y_index
assert geotiff_bbox.almost_equals(expected.geotiff_bbox)
shapely.testing.assert_geometries_equal(geotiff_bbox, expected.geotiff_bbox, tolerance=1e-6)


class TestGetVesselType:
Expand Down

0 comments on commit 9f2ef0f

Please sign in to comment.