From 010d1ddd03de4103a5fa61e62b2d471472f31a96 Mon Sep 17 00:00:00 2001 From: Lucian Bellini Date: Thu, 2 Apr 2026 22:46:54 -0300 Subject: [PATCH] build(deps): add Python 3.12 version markers for incompatible dependencies Update pyproject.toml to support Python 3.12+ environments by introducing Poetry version markers on packages that require newer releases under 3.12. Also added wildcard after '.venv' in .gitignore to avoid committing virtual environments created to test updates. Packages without version conflict (jinja2, rtree) remain unchanged. --- .gitignore | 2 +- pyproject.toml | 25 +++++++++++++++++++------ pythia/io.py | 7 ++++++- 3 files changed, 26 insertions(+), 8 deletions(-) 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