diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 4e9462f78eaa..d727aa827e1f 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [3.7, 3.8, 3.9] + python: ['3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v2 @@ -52,4 +52,3 @@ jobs: pip install -U tox-gh-actions - working-directory: ./python run: tox - diff --git a/python/.python-version b/python/.python-version index 7ffc3f2f467d..879a094044b1 100644 --- a/python/.python-version +++ b/python/.python-version @@ -1,3 +1,3 @@ -3.7.12 3.8.12 3.9.10 +3.10.4 diff --git a/python/setup.cfg b/python/setup.cfg index 18f4d8245d40..ab1aa16e3537 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -33,19 +33,17 @@ license_files = classifiers = License :: OSI Approved :: Apache Software License Operating System :: OS Independent - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 [options] package_dir = = src packages = find: -python_requires = >=3.7 +python_requires = >=3.8 install_requires = mmh3 - singledispatch - cached-property; python_version <= '3.7' [options.extras_require] arrow = pyarrow diff --git a/python/src/iceberg/expressions/literals.py b/python/src/iceberg/expressions/literals.py index 1c21f00e6c29..a6128ee6c699 100644 --- a/python/src/iceberg/expressions/literals.py +++ b/python/src/iceberg/expressions/literals.py @@ -21,25 +21,11 @@ # pylint: disable=W0613 import struct -import sys from decimal import ROUND_HALF_UP, Decimal -from functools import singledispatch +from functools import singledispatch, singledispatchmethod from typing import Optional, Union from uuid import UUID -from iceberg.utils.datetime import ( - date_to_days, - micros_to_days, - time_to_micros, - timestamp_to_micros, - timestamptz_to_micros, -) - -if sys.version_info >= (3, 8): - from functools import singledispatchmethod # pragma: no cover -else: - from singledispatch import singledispatchmethod # pragma: no cover - from iceberg.expressions.base import Literal from iceberg.types import ( BinaryType, @@ -58,6 +44,13 @@ TimeType, UUIDType, ) +from iceberg.utils.datetime import ( + date_to_days, + micros_to_days, + time_to_micros, + timestamp_to_micros, + timestamptz_to_micros, +) @singledispatch diff --git a/python/src/iceberg/schema.py b/python/src/iceberg/schema.py index 59b9cc8358cb..15622fa7c7d9 100644 --- a/python/src/iceberg/schema.py +++ b/python/src/iceberg/schema.py @@ -18,18 +18,12 @@ from __future__ import annotations -import sys from abc import ABC, abstractmethod from dataclasses import dataclass +from functools import singledispatch from typing import Any, Dict, Generic, Iterable, List, Optional, TypeVar from iceberg.files import StructProtocol - -if sys.version_info >= (3, 8): - from functools import singledispatch # pragma: no cover -else: - from singledispatch import singledispatch # pragma: no cover - from iceberg.types import ( IcebergType, ListType, diff --git a/python/src/iceberg/types.py b/python/src/iceberg/types.py index 77b704a9806d..75bf1955a9ff 100644 --- a/python/src/iceberg/types.py +++ b/python/src/iceberg/types.py @@ -29,16 +29,10 @@ Notes: - https://iceberg.apache.org/#spec/#primitive-types """ -import sys from dataclasses import dataclass, field +from functools import cached_property from typing import ClassVar, Dict, List, Optional, Tuple -if sys.version_info >= (3, 8): - from functools import cached_property -else: - # In the case of <= Python 3.7 - from cached_property import cached_property - class Singleton: _instance = None diff --git a/python/tox.ini b/python/tox.ini index 865a0a382a48..488957edf331 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -16,7 +16,7 @@ # under the License. [tox] -envlist = py37,py38,py39,linters +envlist = py38,py39,py310,linters skip_missing_interpreters = true [testenv] @@ -97,9 +97,9 @@ addopts = --doctest-modules [gh-actions] python = - 3.7: py37 3.8: py38, linters 3.9: py39 + 3.10: py310 [mypy]