Repository: nprint/nprintml (language: python)

Issue:
[Feature]: support for Python 3.9+
### What would you like the software to do?

I would like nPrintML to work with as little set-up as possible.

As operating systems increasingly ship with default versions of Python greater than 3.8, more users will be inconvenienced by nPrintML's lack of support for these. Moreover, it is ideal for nPrintML to support whichever is Python's most recent stable version, for the convenience of users who do install Python themselves.

### Existing workarounds

I can install a version of Python that nPrintML supports. (In theory anyway.)

### Implementation notes

This work appears to depend on #66. AutoGluon v0.1.0 does not support Python v3.9+. (Moreover, only "pre-release" versions of AutoGluon suggest support for Python v3.9+. As such, this issue might currently be blocked.)


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index 4430650..78c187b 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -25,7 +25,7 @@ jobs:
           - macos-latest
 
         python-version:
-          - '3.8'
+          - '3.9'
 
     steps:
       - name: Checkout repository
diff --git a/README.md b/README.md
index 207f219..6330399 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ For brief [installation](#set-up) and [usage](#usage) instructions, or for the [
 
 ### Dependencies
 
-Python versions 3.6 through 3.8 are supported.
+Python versions 3.7 through 3.9 are supported.
 
 You might check what versions of Python are installed on your system, _e.g._:
 
diff --git a/image/Dockerfile b/image/Dockerfile
index 9213408..1647bdb 100644
--- a/image/Dockerfile
+++ b/image/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.8.12-bullseye
+FROM python:3.9.15-bullseye
 
 ARG NML_VERSION
 
diff --git a/setup.cfg b/setup.cfg
index 8375833..7e12201 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -12,10 +12,10 @@ current_version = 1.1.2
 max-line-length = 100
 
 [tox:tox]
-envlist = py36, py37, py38, lint
+envlist = py37, py38, py39, lint
 minversion = 3.20.1
 
-[testenv:py{36,37,38}]
+[testenv:py{37,38,39}]
 allowlist_externals = sh
 commands_pre = 
 	sh -c 'test "$(which nprint)" = "{envbindir}/nprint" || nprint-install -fs && test "$(which nprint)" = "{envbindir}/nprint"'
diff --git a/setup.py b/setup.py
index fdf2e79..2c25b18 100644
--- a/setup.py
+++ b/setup.py
@@ -11,35 +11,45 @@
 
 REQUIREMENTS_PATH = DIR_PATH / 'requirement'
 
+
+def get_requirements(path):
+    with path.open() as fd:
+        return list(map(str, parse_requirements(fd)))
+
+
+_DEV_REQUIRES = get_requirements(REQUIREMENTS_PATH / 'dev.txt')
+
+_TESTS_REQUIRE = get_requirements(REQUIREMENTS_PATH / 'test.txt')
+
+EXTRAS_REQUIRE = {
+    'dev': _DEV_REQUIRES + _TESTS_REQUIRE,
+    'test': _TESTS_REQUIRE,
+}
+
+
 INSTALL_REQUIRES = [
     'argparse-formatter ~= 1.4',
-    'Dickens ~= 1.0.1',
 
-    'autogluon.tabular ~= 0.1.0',
+    'Dickens ~= 2.0.0',
 
-    # autogluon.core *also* requires numpy, so match autogluon
-    'numpy == 1.19.5',
+    'autogluon.tabular ~= 0.6.0',
 
-    'pandas ~= 1.1.5',
-    'pyarrow ~= 4.0.0',
+    # autogluon *also* requires numpy and pandas so match autogluon:
+    'numpy == 1.23.5; python_version >= "3.8"',
+    'numpy == 1.21.6; python_version < "3.8"',
 
-    'matplotlib ~= 3.3.4',
-    'seaborn ~= 0.11.1',
+    'pandas == 1.5.1; python_version >= "3.8"',
+    'pandas == 1.3.5; python_version < "3.8"',
 
-    'toml ~= 0.10.2',
-]
+    'pyarrow ~= 10.0.1',
 
-with (REQUIREMENTS_PATH / 'dev.txt').open() as dev_fd:
-    _DEV_REQUIRES = list(map(str, parse_requirements(dev_fd)))
+    'matplotlib ~= 3.6.2; python_version >= "3.8"',
+    'matplotlib ~= 3.5.3; python_version < "3.8"',
 
-_TESTS_REQUIRE = [
-    'tox==3.23.0',
-]
+    'seaborn ~= 0.12.1',
 
-EXTRAS_REQUIRE = {
-    'dev': _DEV_REQUIRES + _TESTS_REQUIRE,
-    'test': _TESTS_REQUIRE,
-}
+    'toml ~= 0.10.2',
+]
 
 
 setup(name='nprintml',
@@ -49,7 +59,7 @@
       long_description_content_type="text/markdown",
       url='https://github.com/nprint/nprintml',
       license='License :: OSI Approved :: Apache Software License',
-      python_requires='>=3.6,<3.9',
+      python_requires='>=3.7,<3.10',
       install_requires=INSTALL_REQUIRES,
       extras_require=EXTRAS_REQUIRE,
       classifiers=[
@@ -61,9 +71,9 @@
           'Intended Audience :: System Administrators',
           'Intended Audience :: Telecommunications Industry',
           'Programming Language :: Python :: 3',
-          'Programming Language :: Python :: 3.6',
           'Programming Language :: Python :: 3.7',
           'Programming Language :: Python :: 3.8',
+          'Programming Language :: Python :: 3.9',
           'Topic :: Internet',
           'Topic :: Software Development :: Libraries',
           'Topic :: Software Development :: Libraries :: Python Modules',
diff --git a/src/nprintml/learn/automl.py b/src/nprintml/learn/automl.py
index b227169..28c18bc 100644
--- a/src/nprintml/learn/automl.py
+++ b/src/nprintml/learn/automl.py
@@ -12,8 +12,7 @@
 
 import matplotlib.pyplot as plt
 import seaborn as sns
-from autogluon.tabular import TabularPredictor
-from autogluon.core.features.feature_metadata import FeatureMetadata
+from autogluon.tabular import FeatureMetadata, TabularPredictor
 from autogluon.features.generators import AutoMLPipelineFeatureGenerator
 from sklearn.model_selection import train_test_split
 from sklearn.preprocessing import LabelBinarizer


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 433c415..155cbc2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -20,9 +20,9 @@ jobs:
           - macos-latest
 
         python-version:
+          - '3.9'
           - '3.8'
           - '3.7'
-          - '3.6'
 
     steps:
       - name: Checkout repository
@@ -63,7 +63,7 @@ jobs:
         run: brew install argp-standalone
 
       - name: Install tox
-        run: python -m pip install $(grep tox setup.py | tr -d "',")
+        run: python -m pip install -r requirement/test.txt
 
       - name: Test
         env:
@@ -99,7 +99,7 @@ jobs:
             ${{ runner.os }}-
 
       - name: Install tox
-        run: python -m pip install $(grep tox setup.py | tr -d "',")
+        run: python -m pip install -r requirement/test.txt
 
       - name: Lint
         run: tox -e lint
diff --git a/requirement/test.txt b/requirement/test.txt
new file mode 100644
index 0000000..3e9be59
--- /dev/null
+++ b/requirement/test.txt
@@ -0,0 +1,1 @@
+tox==3.23.0