Skip to content

Commit

Permalink
[DE-565] changes for support for Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
james.a committed Dec 9, 2024
1 parent 3c50346 commit 714d323
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12', '3.13']

runs-on: ubuntu-latest

Expand Down
89 changes: 79 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exclude = '''

[tool.poetry]
name = 'climate_indices'
version = '2.0.1'
version = '2.0.2'
description = 'Reference implementations of various climate indices typically used for drought monitoring'
authors = ['James Adams <[email protected]>']
readme = 'README.md'
Expand All @@ -33,27 +33,27 @@ classifiers = [
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering :: Atmospheric Science',
'Topic :: Scientific/Engineering :: Physics'
'Topic :: Scientific/Engineering :: Climate Science',
]
packages = [{include = 'climate_indices', from = 'src'}]

[tool.poetry.dependencies]
# only Python and scipy are required for the base library code
python = '>=3.8,<3.12'
scipy = '1.10.1'
python = '>=3.10,<3.14'
scipy = '>=1.14.1'
# remaining dependencies are required for the CLI (console) scripts
cftime = '>=1.6.4'
dask = '>=2023.5.0'
h5netcdf = '>=1.1.0'
xarray = '>=2023.1.0'
dask = '>=2024.12.0'
h5netcdf = '>=1.4.0'
xarray = '>=2024.11.0'

[tool.poetry.dev-dependencies]
coverage = '^7.6.9'
pytest = '8.3.3'
toml = '>=0.10.2'

Expand All @@ -68,3 +68,72 @@ spi = 'climate_indices.__spi__:main'
filterwarnings = [
'ignore::FutureWarning',
]

## ========================== below for conversion to uv instead of poetry ==========================
#[project]
# authors = [
# {name = "James Adams", email = "[email protected]"},
# ]
# requires-python = ">=3.10,<3.14"
# dependencies = [
# "scipy>=1.14.1",
# "cftime",
# "dask",
# "h5py",
# "xarray",
# ]
# name = "climate_indices"
# version = "2.0.2"
# description = "Reference implementations of various climate indices typically used for drought monitoring"
# readme = "README.md"
# classifiers = [
# "Development Status :: 5 - Production/Stable",
# "Intended Audience :: Developers",
# "Intended Audience :: Education",
# "Intended Audience :: Science/Research",
# "License :: OSI Approved :: BSD License",
# "Programming Language :: Python :: 3.10",
# "Programming Language :: Python :: 3.11",
# "Programming Language :: Python :: 3.12",
# "Programming Language :: Python :: 3.13",
# "Topic :: Software Development :: Libraries :: Python Modules",
# "Topic :: Scientific/Engineering :: Climate Science",
# ]
#
#[dependency-groups]
# dev = [
# "sphinx-autodoc-typehints==2.0.1",
# "pytest==8.3.3",
# "toml>=0.10.2",
# ]
#
#[project.urls]
# 'Homepage' = 'https://github.com/monocongo/climate_indices'
# 'Bug Tracker' = 'https://github.com/monocongo/climate_indices/issues'
#
#[project.scripts]
# process_climate_indices = "climate_indices.__main__:main"
# spi = "climate_indices.__spi__:main"
#
#[tool.black]
#line-length = 120
#target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
#include = '\.pyi?$'
#exclude = '''
#/(
# \.git
# | \.mypy_cache
# | \.tox
# | \.venv
# | build
# | dist
#)/
#'''
#
#[tool.pytest.ini_options]
#filterwarnings = [
# 'ignore::FutureWarning',
#]
#
#[tool.pdm.build]
#includes = ["src/climate_indices"]
7 changes: 4 additions & 3 deletions src/climate_indices/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Common classes and functions used to compute the various climate indices.
"""
from enum import Enum
from distutils.version import LooseVersion
# from distutils.version import LooseVersion
import logging
from typing import Tuple

Expand All @@ -21,8 +21,9 @@
"transform_fitted_pearson",
]

# depending on the version of scipy we may need to use a workaround due to a bug in some versions of scipy
_do_pearson3_workaround = LooseVersion(scipy.version.version) < "1.6.0"
# # depending on the version of scipy we may need to use a workaround due to a bug in some versions of scipy
# _do_pearson3_workaround = LooseVersion(scipy.version.version) < "1.6.0"
_do_pearson3_workaround = False

# Retrieve logger and set desired logging level
_logger = utils.get_logger(__name__, logging.WARN)
Expand Down

0 comments on commit 714d323

Please sign in to comment.