Repository: FEniCS/ufl (language: python)

Issue:
Replace `pkg_resources` with `importlib.metadata`
Built-in functionality to use with Python>=3.8, ref:
https://docs.python.org/3/library/importlib.metadata.html

**Context**
Python 3.7 EOL is happening in 2 months: https://endoflife.date/python
and the usage of `pkg_resources` with `ufl` causes a lot of deprecation warnings:
```bash
 python3 -Wd -c "import pkg_resources"    
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
  warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
```

As Legacy DOLFIN does not support main branch of UFL, this is safe from a DOLFIN perspective, as DOLFINx, requires Python>=3.8 (https://github.com/FEniCS/dolfinx/blob/main/python/setup.py).
As far as I can tell, Firedrake still supports Python 3.7.



Discussion / hints:
Drop it. Firedrake policy is to support Python for its designated lifetime. However since we're only a couple of months off dropping 3.7 anyway, there is nothing to be gained by doing extra work to support it.

Fix patch:
diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml
index 3feb86104..695aad6c7 100644
--- a/.github/workflows/pythonapp.yml
+++ b/.github/workflows/pythonapp.yml
@@ -20,7 +20,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest]
-        python-version: ['3.7', '3.8', '3.9', '3.10']
+        python-version: ['3.8', '3.9', '3.10', '3.11']
 
     steps:
       - uses: actions/checkout@v3
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index 500ba06ed..60a0af8ee 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -12,11 +12,8 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys
-import os
-import shlex
-import pkg_resources
 import datetime
+import importlib.metadata
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -58,7 +55,8 @@
 this_year = datetime.date.today().year
 copyright = u'%s, FEniCS Project' % this_year
 author = u'FEniCS Project'
-version = pkg_resources.get_distribution("fenics-ufl").version
+
+version = importlib.metadata.version("fenics-ufl")
 release = version
 
 # The language for content autogenerated by Sphinx. Refer to documentation
diff --git a/setup.cfg b/setup.cfg
index 44b1f1651..256c55d64 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -26,10 +26,10 @@ classifiers =
     Operating System :: MacOS :: MacOS X
     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
     Topic :: Scientific/Engineering :: Mathematics
     Topic :: Software Development :: Libraries :: Python Modules
 
@@ -37,7 +37,7 @@ classifiers =
 packages = find:
 include_package_data = True
 zip_safe = False
-python_requires = >= 3.7
+python_requires = >= 3.8
 setup_requires =
     setuptools >= 62
     wheel
diff --git a/ufl/__init__.py b/ufl/__init__.py
index e6d823003..8b356688a 100644
--- a/ufl/__init__.py
+++ b/ufl/__init__.py
@@ -241,9 +241,9 @@
 # Modified by Massimiliano Leoni, 2016
 # Modified by Cecile Daversin-Catty, 2018
 
-import pkg_resources
+import importlib.metadata
 
-__version__ = pkg_resources.get_distribution("fenics-ufl").version
+__version__ = importlib.metadata.version("fenics-ufl")
 
 # README
 # Imports here should be what the user sees when doing "from ufl import *",


Test patch:
diff --git a/.github/workflows/fenicsx-tests.yml b/.github/workflows/fenicsx-tests.yml
index 7aaf42d7f..f9c7d811f 100644
--- a/.github/workflows/fenicsx-tests.yml
+++ b/.github/workflows/fenicsx-tests.yml
@@ -55,8 +55,6 @@ jobs:
     container: fenicsproject/test-env:nightly-openmpi
 
     env:
-      CC: clang
-      CXX: clang++
 
       PETSC_ARCH: linux-gnu-complex-32
       OMPI_ALLOW_RUN_AS_ROOT: 1
diff --git a/.github/workflows/tsfc-tests.yml b/.github/workflows/tsfc-tests.yml
index 601422623..06b10a13d 100644
--- a/.github/workflows/tsfc-tests.yml
+++ b/.github/workflows/tsfc-tests.yml
@@ -42,5 +42,6 @@ jobs:
           pip install git+https://github.com/FInAT/FInAT.git#egg=finat
           pip install git+https://github.com/firedrakeproject/loopy.git#egg=loopy
           pip install .[ci]
+          pip install pytest
       - name: Run tsfc unit tests
         run: python3 -m pytest tsfc/tests