Browse Source

drop compatibility with python3.6 & pandas<0.23

https://github.com/fphammerle/ical2vdir/commit/2b32144312b59398a91d4814ea1d3981076b3238
https://github.com/fphammerle/ical2vdir/commit/3e94b1f5382ff1b31508b26d005748882b6ce852
https://github.com/fphammerle/acpi-backlight/commit/6bcb9e76e45fc9564ad78feb8d211e6ac950bc65
Fabian Peter Hammerle 2 years ago
parent
commit
66bab9a5d5

+ 1 - 22
.github/workflows/python.yml

@@ -34,38 +34,21 @@ 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.* # python3.6
+        - 1.1.* # pandas does not use semantic versioning
         - 1.*
         exclude:
-        # https://github.com/pandas-dev/pandas/commit/83807088329b2a7e6422e0d0ba460870a265d3d2#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7R768
-        - python-version: 3.6
-          pandas-version: 1.*
-        - python-version: 3.7
-          pandas-version: 0.21.*
-        - python-version: 3.7
-          pandas-version: 0.22.*
         # > astroid.exceptions.AttributeInferenceError: '_constructor_expanddim' not found on <ClassDef.Series l.139 at 0x7f314baa6410>.
         # https://github.com/fphammerle/freesurfer-volume-reader/runs/1937182916
         - python-version: 3.7
           pandas-version: 1.1.*
-        # >/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 python3.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
@@ -78,10 +61,6 @@ jobs:
         # https://github.com/fphammerle/freesurfer-volume-reader/runs/1937182916
         - python-version: 3.8
           pandas-version: 1.1.*
-        - 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

+ 4 - 2
CHANGELOG.md

@@ -8,9 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 - added `pyproject.toml` to specify build dependencies & build backend
 
+### Deprecated
+- `freesurfer_volume_reader.parse_version_string`
+
 ### Removed
-- compatibility with `python3.5`
-- examples: drop compatibility with `python3.6`
+- compatibility with `python3.5`, `python3.6` & `pandas<0.23`
 
 ## [2.1.1] - 2021-06-11
 ### Fixed

+ 2 - 2
Pipfile

@@ -6,8 +6,8 @@ name = "pypi"
 [packages]
 freesurfer-volume-reader = {editable = true, path = "."}
 
-# python3.6 compatibility
-numpy = "<1.20"
+# python3.7 compatibility
+numpy = "<1.22"
 
 [dev-packages]
 black = "==20.8b1"

+ 1 - 1
Pipfile.lock

@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "a19ac0b142a1255113c3551433ad31d2ddeb675428e063bc1f37aa7b983a2cbe"
+            "sha256": "0b1945197b7afe4e719d11a528d95a5b20db43629fb456539a911990256d40ca"
         },
         "pipfile-spec": 6,
         "requires": {

+ 4 - 0
freesurfer_volume_reader/__init__.py

@@ -19,6 +19,7 @@ import abc
 import os
 import re
 import typing
+import warnings
 
 import pandas
 
@@ -31,6 +32,9 @@ except ImportError:  # pragma: no cover
 def parse_version_string(
     version_string: str,
 ) -> typing.Tuple[typing.Union[int, str], ...]:
+    warnings.warn(  # previously used in `__main__.concat_dataframes`
+        "function `parse_version_string` is deprecated"
+    )
     return tuple(int(p) if p.isdigit() else p for p in version_string.split("."))
 
 

+ 1 - 13
freesurfer_volume_reader/__main__.py

@@ -7,7 +7,6 @@ import argparse
 import os
 import re
 import sys
-import typing
 
 import pandas
 
@@ -15,20 +14,9 @@ from freesurfer_volume_reader import (
     __version__,
     ashs,
     freesurfer,
-    parse_version_string,
     remove_group_names_from_regex,
 )
 
-
-def concat_dataframes(
-    dataframes: typing.Iterable[pandas.DataFrame],
-) -> pandas.DataFrame:  # pragma: no cover
-    # pylint: disable=unexpected-keyword-arg
-    if parse_version_string(pandas.__version__) < (0, 23):
-        return pandas.concat(dataframes, ignore_index=True)
-    return pandas.concat(dataframes, ignore_index=True, sort=False)
-
-
 VOLUME_FILE_FINDERS = {
     "ashs": ashs.HippocampalSubfieldsVolumeFile,
     # https://github.com/freesurfer/freesurfer/tree/release_6_0_0/HippoSF
@@ -91,7 +79,7 @@ def main():
             file=sys.stderr,
         )
         return os.EX_NOINPUT
-    united_volume_frame = concat_dataframes(volume_frames)
+    united_volume_frame = pandas.concat(volume_frames, ignore_index=True, sort=False)
     print(united_volume_frame.to_csv(index=False))
     return os.EX_OK
 

+ 3 - 3
setup.py

@@ -34,7 +34,6 @@ setuptools.setup(
         "Development Status :: 3 - Alpha",
         "Intended Audience :: Healthcare Industry",
         "Intended Audience :: Science/Research",
-        "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
@@ -48,10 +47,11 @@ setuptools.setup(
             "freesurfer-volume-reader = freesurfer_volume_reader.__main__:main"
         ]
     },
-    python_requires=">=3.6",
+    python_requires=">=3.7",  # python<3.7 untested
     install_requires=[
         # >=0.21.0 pandas.DataFrame.drop(columns=[...], ...)
-        "pandas>=0.21.0,<2"
+        # <0.23 untested
+        "pandas>=0.23.0,<2"
     ],
     setup_requires=["setuptools_scm"],
     tests_require=["pytest<5", "pytest-timeout<2"],

+ 4 - 2
tests/init_test.py

@@ -3,11 +3,11 @@
 import pytest
 
 from freesurfer_volume_reader import (
+    SubfieldVolumeFile,
+    VolumeFile,
     __version__,
     parse_version_string,
     remove_group_names_from_regex,
-    VolumeFile,
-    SubfieldVolumeFile,
 )
 
 
@@ -15,6 +15,7 @@ def test_module_version():
     assert len(__version__) >= len("0.1.0")
 
 
+@pytest.mark.filterwarnings("ignore:function `parse_version_string` is deprecated")
 @pytest.mark.parametrize(
     ("version_string", "expected_tuple"),
     [
@@ -27,6 +28,7 @@ def test_parse_version_string(version_string, expected_tuple):
     assert expected_tuple == parse_version_string(version_string)
 
 
+@pytest.mark.filterwarnings("ignore:function `parse_version_string` is deprecated")
 def test_parse_version_string_comparison():
     assert parse_version_string("0.24.2") == (0, 24, 2)
     assert parse_version_string("0.24.2") < (0, 25)