You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2022/05/18 17:10:22 UTC

[iceberg] branch master updated: Python: Set Python 3.8 as minimum version (#4784)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new a120e1a8c Python: Set Python 3.8 as minimum version (#4784)
a120e1a8c is described below

commit a120e1a8cc7b199c549c906e28fc45692975008a
Author: Fokko Driesprong <fo...@tabular.io>
AuthorDate: Wed May 18 19:10:15 2022 +0200

    Python: Set Python 3.8 as minimum version (#4784)
---
 .github/workflows/python-ci.yml            |  3 +--
 python/.python-version                     |  2 +-
 python/setup.cfg                           |  6 ++----
 python/src/iceberg/expressions/literals.py | 23 ++++++++---------------
 python/src/iceberg/schema.py               |  8 +-------
 python/src/iceberg/types.py                |  8 +-------
 python/tox.ini                             |  4 ++--
 7 files changed, 16 insertions(+), 38 deletions(-)

diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml
index 4e9462f78..d727aa827 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 7ffc3f2f4..879a09404 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 18f4d8245..ab1aa16e3 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 1c21f00e6..a6128ee6c 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 @@ from iceberg.types import (
     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 59b9cc835..15622fa7c 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 77b704a98..75bf1955a 100644
--- a/python/src/iceberg/types.py
+++ b/python/src/iceberg/types.py
@@ -29,16 +29,10 @@ Example:
 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 865a0a382..488957edf 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]