Repository: dbt-labs/dbt-core

Issue:
[CT-2228] Python 3.7 End of Life: June 2023
Python 3.7 will reach EOL in June 2023 ([PEP 537](https://peps.python.org/pep-0537/))

Per [our documented policy](https://docs.getdbt.com/faqs/core/install-python-compatibility), we should remove support for py37 in the subsequent release of `dbt-core`, which will be v1.6 in July 2023.

This looks like:
- Bumping the required minimum version in `setup.py`, [here](https://github.com/dbt-labs/dbt-core/blob/main/core/setup.py#L5-L8) and [here](https://github.com/dbt-labs/dbt-core/blob/main/core/setup.py#L86)
- Removing "3.7" from the classifiers [here](https://github.com/dbt-labs/dbt-core/blob/main/core/setup.py#L80)
- Removing "3.7" from our automated test matrix

And doing the same for each of our adapter plugins.


Discussion:
We can also remove the conditional requirement on `networkx`, which handled a bug specific to Python <3.8 (https://github.com/dbt-labs/dbt-core/issues/5254):
https://github.com/dbt-labs/dbt-core/blob/a88f64039583b1fce764408c841b22963d4908b8/core/setup.py#L58

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -2,9 +2,9 @@
 import os
 import sys
 
-if sys.version_info < (3, 7, 2):
+if sys.version_info < (3, 8):
     print("Error: dbt does not support this version of Python.")
-    print("Please upgrade to Python 3.7.2 or higher.")
+    print("Please upgrade to Python 3.8 or higher.")
     sys.exit(1)
 
 
@@ -55,8 +55,7 @@
         "logbook>=1.5,<1.6",
         "mashumaro[msgpack]==3.6",
         "minimal-snowplow-tracker==0.0.2",
-        "networkx>=2.3,<2.8.1;python_version<'3.8'",
-        "networkx>=2.3,<3;python_version>='3.8'",
+        "networkx>=2.3,<3",
         "packaging>20.9",
         "sqlparse>=0.2.3,<0.4.4",
         "dbt-extractor~=0.4.1",
@@ -79,11 +78,10 @@
         "Operating System :: Microsoft :: Windows",
         "Operating System :: MacOS :: MacOS X",
         "Operating System :: POSIX :: Linux",
-        "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: 3.11",
     ],
-    python_requires=">=3.7.2",
+    python_requires=">=3.8",
 )
diff --git a/plugins/postgres/setup.py b/plugins/postgres/setup.py
--- a/plugins/postgres/setup.py
+++ b/plugins/postgres/setup.py
@@ -2,9 +2,9 @@
 import os
 import sys
 
-if sys.version_info < (3, 7):
+if sys.version_info < (3, 8):
     print("Error: dbt does not support this version of Python.")
-    print("Please upgrade to Python 3.7 or higher.")
+    print("Please upgrade to Python 3.8 or higher.")
     sys.exit(1)
 
 
@@ -79,11 +79,10 @@ def _dbt_psycopg2_name():
         "Operating System :: Microsoft :: Windows",
         "Operating System :: MacOS :: MacOS X",
         "Operating System :: POSIX :: Linux",
-        "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: 3.11",
     ],
-    python_requires=">=3.7",
+    python_requires=">=3.8",
 )


Test patch:
diff --git a/Dockerfile.test b/Dockerfile.test
--- a/Dockerfile.test
+++ b/Dockerfile.test
@@ -33,13 +33,6 @@ RUN apt-get update \
     python \
     python-dev \
     python3-pip \
-    python3.6 \
-    python3.6-dev \
-    python3-pip \
-    python3.6-venv \
-    python3.7 \
-    python3.7-dev \
-    python3.7-venv \
     python3.8 \
     python3.8-dev \
     python3.8-venv \
diff --git a/tests/adapter/setup.py b/tests/adapter/setup.py
--- a/tests/adapter/setup.py
+++ b/tests/adapter/setup.py
@@ -2,9 +2,9 @@
 import os
 import sys
 
-if sys.version_info < (3, 7):
+if sys.version_info < (3, 8):
     print("Error: dbt does not support this version of Python.")
-    print("Please upgrade to Python 3.7 or higher.")
+    print("Please upgrade to Python 3.8 or higher.")
     sys.exit(1)
 
 
@@ -48,9 +48,10 @@
         "Operating System :: Microsoft :: Windows",
         "Operating System :: MacOS :: MacOS X",
         "Operating System :: POSIX :: Linux",
-        "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3.11",
     ],
-    python_requires=">=3.7",
+    python_requires=">=3.8",
 )