diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ba3e555..7d24ce5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v4 @@ -75,6 +75,46 @@ jobs: cd geoarrow-pandas pytest --pyargs geoarrow.pandas --doctest-modules --import-mode=importlib + # This is a test of geoarrow-types on Python 3.7 (which implies pyarrow 12 + # since this is the last supported version there). Python 3.7 is still the + # runtime available on some hosted platforms (e.g., it is the minimum required + # version for apache-sedona Python) + oldest-supported: + runs-on: ubuntu-latest + container: + image: python:3.7 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + tags: true + + - name: Check git setup + run: | + git config --global --add safe.directory "$(pwd)" + git describe --long --match='geoarrow-types-*' + + # setuptools_scm available for Python 3.7 does not support version_file + # (it can still be installed on Python 3.7, it just can't be built there + # without this modification) + - name: Patch pyproject.toml + run: | + cd geoarrow-types + sed -i.bak '/^version_file/d' pyproject.toml + echo '__version__ = "0.0.0"' > src/geoarrow/types/_version.py + echo '__version_tuple__ = (0, 0, 0)' >> src/geoarrow/types/_version.py + + - name: Install (geoarrow-types) + run: | + pip install --upgrade setuptools setuptools_scm + cd geoarrow-types + pip install ".[test]" + + - name: Run tests (geoarrow-types) + run: | + pytest geoarrow-types/tests -v -s + coverage: needs: [test] diff --git a/geoarrow-types/pyproject.toml b/geoarrow-types/pyproject.toml index 0f096d6..03a0d49 100644 --- a/geoarrow-types/pyproject.toml +++ b/geoarrow-types/pyproject.toml @@ -22,11 +22,11 @@ dynamic = ["version"] description = "" authors = [{name = "Dewey Dunnington", email = "dewey@dunnington.ca"}] license = {text = "Apache-2.0"} -requires-python = ">=3.8" +requires-python = ">=3.7" dependencies = [] [project.optional-dependencies] -test = ["pytest", "pyarrow"] +test = ["pytest", "pyarrow >= 12", "numpy"] [project.urls] homepage = "https://geoarrow.org" diff --git a/geoarrow-types/src/geoarrow/types/crs.py b/geoarrow-types/src/geoarrow/types/crs.py index 4b945c9..520b091 100644 --- a/geoarrow-types/src/geoarrow/types/crs.py +++ b/geoarrow-types/src/geoarrow/types/crs.py @@ -1,6 +1,13 @@ from copy import deepcopy import json -from typing import Union, Mapping, Protocol, Optional +from typing import Union, Mapping, Optional + +try: + from typing import Protocol +except ImportError: + + class Protocol: + pass class Crs(Protocol): diff --git a/geoarrow-types/tests/test_type_pyarrow.py b/geoarrow-types/tests/test_type_pyarrow.py index 8c0da33..02bbced 100644 --- a/geoarrow-types/tests/test_type_pyarrow.py +++ b/geoarrow-types/tests/test_type_pyarrow.py @@ -7,6 +7,10 @@ def test_wrap_array_non_exact(): + pa_version_tuple = tuple(int(component) for component in pa.__version__.split(".")) + if pa_version_tuple < (14,): + pytest.skip("wrap_array with non-exact type requires pyarrow >= 14") + from pyarrow import compute as pc storage = pc.make_struct( @@ -448,6 +452,10 @@ def test_roundtrip_extension_type(spec): def test_register_extension_type(): + pa_version_tuple = tuple(int(component) for component in pa.__version__.split(".")) + if pa_version_tuple < (14,): + pytest.skip("Can't test extension type registration pyarrow < 14") + with type_pyarrow.registered_extension_types(): schema_capsule = gt.point().to_pyarrow().__arrow_c_schema__() pa_type = pa.DataType._import_from_c_capsule(schema_capsule)