Skip to content

Commit a467eef

Browse files
authored
chore(geoarrow-types): Test against Python 3.7 and Python 3.8 (#62)
1 parent d75f8b2 commit a467eef

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

.github/workflows/test.yaml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest]
20-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
20+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
2121

2222
steps:
2323
- uses: actions/checkout@v4
@@ -75,6 +75,46 @@ jobs:
7575
cd geoarrow-pandas
7676
pytest --pyargs geoarrow.pandas --doctest-modules --import-mode=importlib
7777
78+
# This is a test of geoarrow-types on Python 3.7 (which implies pyarrow 12
79+
# since this is the last supported version there). Python 3.7 is still the
80+
# runtime available on some hosted platforms (e.g., it is the minimum required
81+
# version for apache-sedona Python)
82+
oldest-supported:
83+
runs-on: ubuntu-latest
84+
container:
85+
image: python:3.7
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
fetch-depth: 0
91+
tags: true
92+
93+
- name: Check git setup
94+
run: |
95+
git config --global --add safe.directory "$(pwd)"
96+
git describe --long --match='geoarrow-types-*'
97+
98+
# setuptools_scm available for Python 3.7 does not support version_file
99+
# (it can still be installed on Python 3.7, it just can't be built there
100+
# without this modification)
101+
- name: Patch pyproject.toml
102+
run: |
103+
cd geoarrow-types
104+
sed -i.bak '/^version_file/d' pyproject.toml
105+
echo '__version__ = "0.0.0"' > src/geoarrow/types/_version.py
106+
echo '__version_tuple__ = (0, 0, 0)' >> src/geoarrow/types/_version.py
107+
108+
- name: Install (geoarrow-types)
109+
run: |
110+
pip install --upgrade setuptools setuptools_scm
111+
cd geoarrow-types
112+
pip install ".[test]"
113+
114+
- name: Run tests (geoarrow-types)
115+
run: |
116+
pytest geoarrow-types/tests -v -s
117+
78118
coverage:
79119
needs: [test]
80120

geoarrow-types/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ dynamic = ["version"]
2222
description = ""
2323
authors = [{name = "Dewey Dunnington", email = "[email protected]"}]
2424
license = {text = "Apache-2.0"}
25-
requires-python = ">=3.8"
25+
requires-python = ">=3.7"
2626
dependencies = []
2727

2828
[project.optional-dependencies]
29-
test = ["pytest", "pyarrow"]
29+
test = ["pytest", "pyarrow >= 12", "numpy"]
3030

3131
[project.urls]
3232
homepage = "https://geoarrow.org"

geoarrow-types/src/geoarrow/types/crs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
from copy import deepcopy
22
import json
3-
from typing import Union, Mapping, Protocol, Optional
3+
from typing import Union, Mapping, Optional
4+
5+
try:
6+
from typing import Protocol
7+
except ImportError:
8+
9+
class Protocol:
10+
pass
411

512

613
class Crs(Protocol):

geoarrow-types/tests/test_type_pyarrow.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88

99
def test_wrap_array_non_exact():
10+
pa_version_tuple = tuple(int(component) for component in pa.__version__.split("."))
11+
if pa_version_tuple < (14,):
12+
pytest.skip("wrap_array with non-exact type requires pyarrow >= 14")
13+
1014
from pyarrow import compute as pc
1115

1216
storage = pc.make_struct(
@@ -448,6 +452,10 @@ def test_roundtrip_extension_type(spec):
448452

449453

450454
def test_register_extension_type():
455+
pa_version_tuple = tuple(int(component) for component in pa.__version__.split("."))
456+
if pa_version_tuple < (14,):
457+
pytest.skip("Can't test extension type registration pyarrow < 14")
458+
451459
with type_pyarrow.registered_extension_types():
452460
schema_capsule = gt.point().to_pyarrow().__arrow_c_schema__()
453461
pa_type = pa.DataType._import_from_c_capsule(schema_capsule)

0 commit comments

Comments
 (0)