Browse Source

drop compatibility with python3.6 & pandas<0.23

https://github.com/fphammerle/ical2vdir/commit/2b32144312b59398a91d4814ea1d3981076b3238
https://github.com/fphammerle/acpi-backlight/commit/6bcb9e76e45fc9564ad78feb8d211e6ac950bc65
Fabian Peter Hammerle 2 years ago
parent
commit
76f63885e2
4 changed files with 11 additions and 34 deletions
  1. 0 18
      .github/workflows/python.yml
  2. 2 1
      CHANGELOG.md
  3. 4 11
      freesurfer_stats/__init__.py
  4. 5 4
      setup.py

+ 0 - 18
.github/workflows/python.yml

@@ -34,31 +34,17 @@ jobs:
     strategy:
       matrix:
         python-version:
-        - '3.6'
         - '3.7'
         - '3.8'
         - '3.9'
         pandas-version:
         - '' # locked version
-        - 0.21.*
-        - 0.22.*
         - 0.23.*
         - 0.24.*
         - 0.25.*
         - 1.1.* # pandas.io.common.get_handle does not yet support urls
         - 1.*
         exclude:
-        - python-version: '3.7'
-          pandas-version: 0.21.*
-        - python-version: '3.7'
-          pandas-version: 0.22.*
-        # > /tmp/pip-install-g4jx0np4/numpy/_configtest.c:6: undefined reference to `exp'
-        # https://travis-ci.org/github/fphammerle/freesurfer-stats/jobs/683704331#L437
-        - python-version: '3.8'
-          pandas-version: 0.21.*
-        # https://travis-ci.org/github/fphammerle/freesurfer-stats/jobs/683704330#L437
-        - python-version: '3.8'
-          pandas-version: 0.22.*
         # no python-version3.8 wheels for pandas v0.24.2 & v0.23.4 available
         # https://travis-ci.org/github/fphammerle/freesurfer-stats/builds/701952350
         # build takes longer than 10min
@@ -67,10 +53,6 @@ jobs:
           pandas-version: 0.23.*
         - python-version: '3.8'
           pandas-version: 0.24.*
-        - python-version: '3.9'
-          pandas-version: 0.21.*
-        - python-version: '3.9'
-          pandas-version: 0.22.*
         - python-version: '3.9'
           pandas-version: 0.23.*
         - python-version: '3.9'

+ 2 - 1
CHANGELOG.md

@@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### Removed
-- compatibility with `python3.5`
+- compatibility with `python3.5` & `python3.6`
+- compatibility with `pandas<0.23`
 
 ## [1.2.1] - 2020-12-31
 ### Fixed

+ 4 - 11
freesurfer_stats/__init__.py

@@ -46,6 +46,8 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <https://www.gnu.org/licenses/>.
 """
 
+from __future__ import annotations
+
 import datetime
 import io
 import pathlib
@@ -81,16 +83,7 @@ def _get_filepath_or_buffer(
     # https://github.com/pandas-dev/pandas/blob/v0.25.3/pandas/io/parsers.py#L436
     # https://github.com/pandas-dev/pandas/blob/v0.25.3/pandas/_typing.py#L30
     # pylint: disable=no-member; for python>=v1.2.0
-    (path_or_buffer, _, _, *instructions) = pandas.io.common.get_filepath_or_buffer(
-        path
-    )
-    if instructions:
-        # https://github.com/pandas-dev/pandas/blob/v0.25.3/pandas/io/common.py#L171
-        assert len(instructions) == 1, instructions
-        should_close = instructions[0]
-    else:
-        # https://github.com/pandas-dev/pandas/blob/v0.21.0/pandas/io/common.py#L171
-        should_close = hasattr(path_or_buffer, "close")
+    (path_or_buffer, _, _, should_close) = pandas.io.common.get_filepath_or_buffer(path)
     return path_or_buffer, should_close
 
 
@@ -229,7 +222,7 @@ class CorticalParcellationStats:
         ).apply(pandas.to_numeric, errors="ignore")
 
     @classmethod
-    def read(cls, path: typing.Union[str, pathlib.Path]) -> "CorticalParcellationStats":
+    def read(cls, path: typing.Union[str, pathlib.Path]) -> CorticalParcellationStats:
         path_or_buffer, should_close = _get_filepath_or_buffer(path)
         stats = cls()
         try:  # pragma: no cover

+ 5 - 4
setup.py

@@ -59,7 +59,6 @@ setuptools.setup(
         "Intended Audience :: Science/Research",
         "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
         # .github/workflows/python.yml
-        "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
@@ -67,12 +66,14 @@ setuptools.setup(
         "Topic :: Scientific/Engineering :: Medical Science Apps.",
         "Topic :: Utilities",
     ],
-    # f-strings & variable type hints
-    python_requires=">=3.6",
+    # >=3.6 f-strings & variable type hints
+    # >=3.7 postponed evaluation of type annotations (PEP563)
+    python_requires=">=3.7",
     install_requires=[
         "numpy<2",
         # still hoping that pandas will stick to semantic versioning in the future
-        "pandas>=0.21,<2",
+        # <0.23 untested
+        "pandas>=0.23,<2",
     ],
     setup_requires=["setuptools_scm"],
     tests_require=["pytest<5"],