Update Python versions to reflect that we now support 3.8 through 3.11

PiperOrigin-RevId: 569317472
diff --git a/python/BUILD b/python/BUILD
index c1e044c..6d8ba1c 100644
--- a/python/BUILD
+++ b/python/BUILD
@@ -26,7 +26,7 @@
 )
 
 LIMITED_API_FLAG_SELECT = {
-    ":limited_api_3.7": ["-DPy_LIMITED_API=0x03070000"],
+    ":limited_api_3.8": ["-DPy_LIMITED_API=0x03080000"],
     ":limited_api_3.10": ["-DPy_LIMITED_API=0x030a0000"],
     "//conditions:default": [],
 }
@@ -41,48 +41,22 @@
     build_setting_default = "system",
     values = [
         "system",
-        "37",
         "38",
         "39",
         "310",
+        "311",
     ],
 )
 
 config_setting(
-    name = "limited_api_3.7",
+    name = "limited_api_3.8",
     flag_values = {
         ":limited_api": "True",
-        ":python_version": "37",
+        ":python_version": "38",
     },
 )
 
 config_setting(
-    name = "full_api_3.7_win32",
-    flag_values = {
-        ":limited_api": "False",
-        ":python_version": "37",
-    },
-    values = {"cpu": "win32"},
-)
-
-config_setting(
-    name = "full_api_3.7_win64",
-    flag_values = {
-        ":limited_api": "False",
-        ":python_version": "37",
-    },
-    values = {"cpu": "win64"},
-)
-
-selects.config_setting_group(
-    name = "full_api_3.7",
-    match_any = [
-        ":full_api_3.7_win32",
-        ":full_api_3.7_win64",
-    ],
-)
-
-config_setting(
     name = "full_api_3.8_win32",
     flag_values = {
         ":limited_api": "False",
diff --git a/python/dist/BUILD.bazel b/python/dist/BUILD.bazel
index aa03fbe..4330fe1 100644
--- a/python/dist/BUILD.bazel
+++ b/python/dist/BUILD.bazel
@@ -296,7 +296,6 @@
 py_wheel(
     name = "binary_wheel",
     abi = select({
-        "//python:full_api_3.7": "cp37m",
         "//python:full_api_3.8": "cp38",
         "//python:full_api_3.9": "cp39",
         "//conditions:default": "abi3",
@@ -306,10 +305,10 @@
     classifiers = [
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
-        "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",
     ],
     distribution = "protobuf",
     extra_distinfo_files = {
@@ -328,9 +327,8 @@
         ":windows_x86_64": "win_amd64",
         "//conditions:default": "any",
     }),
-    python_requires = ">=3.7",
+    python_requires = ">=3.8",
     python_tag = selects.with_or({
-        ("//python:limited_api_3.7", "//python:full_api_3.7"): "cp37",
         "//python:full_api_3.8": "cp38",
         "//python:full_api_3.9": "cp39",
         "//python:limited_api_3.10": "cp310",
@@ -362,10 +360,10 @@
     classifiers = [
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
-        "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",
     ],
     distribution = "protobuf",
     extra_distinfo_files = {
@@ -374,7 +372,7 @@
     homepage = "https://developers.google.com/protocol-buffers/",
     license = "3-Clause BSD License",
     platform = "any",
-    python_requires = ">=3.7",
+    python_requires = ">=3.8",
     python_tag = "py3",
     strip_path_prefixes = [
         "python/",
@@ -430,7 +428,6 @@
     ],
     # Windows needs version-specific wheels until 3.10.
     full_api_versions = [
-        "37",
         "38",
         "39",
     ],
@@ -444,9 +441,9 @@
         # TODO: fix win32 build
         "win32": "310",
         "win64": "310",
-        "linux-x86_64": "37",
-        "linux-aarch_64": "37",
-        "osx-universal2": "37",
+        "linux-x86_64": "38",
+        "linux-aarch_64": "38",
+        "osx-universal2": "38",
     },
     pure_python_wheel = ":pure_python_wheel",
     tags = ["manual"],
diff --git a/python/dist/setup.py b/python/dist/setup.py
index b4fc21a..fc90953 100755
--- a/python/dist/setup.py
+++ b/python/dist/setup.py
@@ -56,10 +56,10 @@
     classifiers=[
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
-        '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',
     ],
     namespace_packages=['google'],
     packages=find_packages(),
@@ -76,5 +76,5 @@
             extra_link_args=extra_link_args,
         )
     ],
-    python_requires='>=3.7',
+    python_requires='>=3.8',
 )
diff --git a/python/protobuf_distutils/setup.py b/python/protobuf_distutils/setup.py
index f6a0d48..52238aa 100644
--- a/python/protobuf_distutils/setup.py
+++ b/python/protobuf_distutils/setup.py
@@ -30,12 +30,10 @@
         # These Python versions should match the protobuf package:
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.3",
-        "Programming Language :: Python :: 3.4",
-        "Programming Language :: Python :: 3.5",
-        "Programming Language :: Python :: 3.6",
-        "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",
         "Topic :: Software Development :: Code Generators",
     ],
     description=('This is a distutils extension to generate Python code for '
diff --git a/python/py_extension.bzl b/python/py_extension.bzl
index 7b918bc..1de830f 100644
--- a/python/py_extension.bzl
+++ b/python/py_extension.bzl
@@ -27,9 +27,7 @@
         linkshared = True,
         linkstatic = True,
         deps = deps + select({
-            "//python:limited_api_3.7": ["@python-3.7.0//:python_headers"],
-            "//python:full_api_3.7_win32": ["@nuget_python_i686_3.7.0//:python_full_api"],
-            "//python:full_api_3.7_win64": ["@nuget_python_x86-64_3.7.0//:python_full_api"],
+            "//python:limited_api_3.8": ["@python-3.8.0//:python_headers"],
             "//python:full_api_3.8_win32": ["@nuget_python_i686_3.8.0//:python_full_api"],
             "//python:full_api_3.8_win64": ["@nuget_python_x86-64_3.8.0//:python_full_api"],
             "//python:full_api_3.9_win32": ["@nuget_python_i686_3.9.0//:python_full_api"],