Add support for Python 3.11 and 3.12 and drop EOL 3.7

Mako 1.3.0 bumps the minimum Python version to 3.8, as 3.7 is EOL as of
2023-06-27.   Python 3.12 is now supported explicitly.

Closes: #379
Pull-request: https://github.com/sqlalchemy/mako/pull/379
Pull-request-sha: 9f09d4c704ca540f4592d88968fb62609b88ee8f

Change-Id: Ie02118907071ac77cf4975be8affe4b6a2c3d7ad
diff --git a/.github/workflows/run-on-pr.yaml b/.github/workflows/run-on-pr.yaml
index 9b8b545..fa6c759 100644
--- a/.github/workflows/run-on-pr.yaml
+++ b/.github/workflows/run-on-pr.yaml
@@ -28,10 +28,10 @@
     # steps to run in each job. Some are github actions, others run shell commands
     steps:
       - name: Checkout repo
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Set up python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
           architecture: ${{ matrix.architecture }}
diff --git a/.github/workflows/run-test.yaml b/.github/workflows/run-test.yaml
index 60307ea..88e5a96 100644
--- a/.github/workflows/run-test.yaml
+++ b/.github/workflows/run-test.yaml
@@ -23,10 +23,11 @@
           - "windows-latest"
           - "macos-latest"
         python-version:
-          - "3.7"
           - "3.8"
           - "3.9"
           - "3.10"
+          - "3.11"
+          - "3.12"
 
         exclude:
           # beaker raises warning on 3.10. only windows seems affected
@@ -39,12 +40,13 @@
     # steps to run in each job. Some are github actions, others run shell commands
     steps:
       - name: Checkout repo
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Set up python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
+          allow-prereleases: true
           architecture: ${{ matrix.architecture }}
 
       - name: Install dependencies
diff --git a/doc/build/changelog.rst b/doc/build/changelog.rst
index 98f7423..eb0e2b9 100644
--- a/doc/build/changelog.rst
+++ b/doc/build/changelog.rst
@@ -3,13 +3,17 @@
 Changelog
 =========
 
-1.2
+1.3
 ===
 
 .. changelog::
-    :version: 1.2.5
+    :version: 1.3.0
     :include_notes_from: unreleased
 
+1.2
+===
+
+
 .. changelog::
     :version: 1.2.4
     :released: Tue Nov 15 2022
diff --git a/doc/build/unreleased/py312.rst b/doc/build/unreleased/py312.rst
new file mode 100644
index 0000000..e111845
--- /dev/null
+++ b/doc/build/unreleased/py312.rst
@@ -0,0 +1,5 @@
+.. change::
+    :tags: change, installation
+
+    Mako 1.3.0 bumps the minimum Python version to 3.8, as 3.7 is EOL as of
+    2023-06-27.   Python 3.12 is now supported explicitly.
diff --git a/mako/__init__.py b/mako/__init__.py
index 8f2d359..25d577d 100644
--- a/mako/__init__.py
+++ b/mako/__init__.py
@@ -5,4 +5,4 @@
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
 
-__version__ = "1.2.5"
+__version__ = "1.3.0"
diff --git a/mako/compat.py b/mako/compat.py
index ae118ca..4de11c5 100644
--- a/mako/compat.py
+++ b/mako/compat.py
@@ -5,13 +5,13 @@
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
 import collections
+from importlib import metadata as importlib_metadata
 from importlib import util
 import inspect
 import sys
 
 win32 = sys.platform.startswith("win")
 pypy = hasattr(sys, "pypy_version_info")
-py38 = sys.version_info >= (3, 8)
 
 ArgSpec = collections.namedtuple(
     "ArgSpec", ["args", "varargs", "keywords", "defaults"]
@@ -62,12 +62,6 @@
     return exc.__class__.__name__
 
 
-if py38:
-    from importlib import metadata as importlib_metadata
-else:
-    import importlib_metadata  # noqa
-
-
 def importlib_metadata_get(group):
     ep = importlib_metadata.entry_points()
     if hasattr(ep, "select"):
diff --git a/pyproject.toml b/pyproject.toml
index b3193b9..320d94a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,4 +4,4 @@
 
 [tool.black]
 line-length = 79
-target-version = ['py37']
+target-version = ['py38']
diff --git a/setup.cfg b/setup.cfg
index 09d84fd..f643d01 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,10 +16,11 @@
     Intended Audience :: Developers
     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
+    Programming Language :: Python :: 3.12
     Programming Language :: Python :: Implementation :: CPython
     Programming Language :: Python :: Implementation :: PyPy
     Topic :: Internet :: WWW/HTTP :: Dynamic Content
@@ -29,12 +30,11 @@
 
 [options]
 packages = find:
-python_requires = >=3.7
+python_requires = >=3.8
 zip_safe = false
 
 install_requires =
     MarkupSafe >= 0.9.2
-    importlib-metadata;python_version<"3.8"
 
 [options.packages.find]
 exclude =