diff --git a/.gitignore b/.gitignore index 13e1e34d..f2935fd3 100755 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ work/* .pytest_cache/* docs/source/_build docs/build -.venv +.venv* dist *~ .python-version diff --git a/pyproject.toml b/pyproject.toml index f1cb99d9..4601b465 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,12 +6,25 @@ authors = ["Christopher Villalobos "] license = "BSD-3-Clause" [tool.poetry.dependencies] -python = "^3.8" -Fiona = "^1.9" +python = ">=3.8,<4.0" + +numpy = [ + {version = "^1.16", python = "<3.12"}, + {version = "^2.4", python = ">=3.12"} +] + +Fiona = [ + {version = "^1.9", python = "<3.12"}, + {version = "^1.10", python = ">=3.12"} +] + +rasterio = [ + {version = "^1.0", python = "<3.12"}, + {version = "^1.5", python = ">=3.12"} +] + jinja2 = "^3.0" -numpy = "^1.16" -rasterio = "^1.0" -rtree = "^0.8" +rtree = "^0.8" [tool.poetry.dev-dependencies] pytest = "^5.1" @@ -32,4 +45,4 @@ black = "^22.8.0" [build-system] requires = ["setuptools", "poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/pythia/io.py b/pythia/io.py index ace368b9..4dc67513 100644 --- a/pythia/io.py +++ b/pythia/io.py @@ -4,7 +4,12 @@ import fiona import numpy.ma as ma import rasterio -from functools import cache + +try: + from functools import cache +except ImportError: + from functools import lru_cache as cache + from typing import Any, Dict, Tuple from pythia.gis import euclidean_distance