Repository: bluesky/event-model (language: python)

Issue:
Python minimum version/using 3.8+ features
https://github.com/bluesky/event-model/blob/eac55ca21e54328a7fc1f16fea71e56460ed6a58/event_model/__init__.py#L14

`importlib.metadata` was added in python 3.8, but event-model does not either specify 3.8 as minimum version or include the [backport pypi package](https://pypi.org/project/importlib-metadata/) as a conditional dependency.

Thus it will install on python 3.7 but fail upon use unless the pypi backport is installed otherwise.


Discussion / hints:
I am 👍 for excluding Python 3.7 from the supported versions. We do it in a few other projects.
also of note, the unit tests GHA is not actually running (and hasn't been for 2 years)

Does not seem to be set up to run on PRs and scheduled pipelines get disabled after 60 days of inactivity (which is itself annoying because one of the best reasons to have scheduled actions is to make sure your dependencies don't break an otherwise stable library....)
Hmm, I've just enabled https://github.com/bluesky/event-model/actions/workflows/testing.yml.
Hmmm... the workflow itself does indicate it should run on PR, but seems like it hasn't been since it was disabled because of the scheduled runs...


Slightly buried in their docs, and it does not make it clear from this that being disabled will disable it _everywhere_, but that seems to be the case...

https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#disabling-and-enabling-workflows

Fix patch:
diff --git a/event_model/__init__.py b/event_model/__init__.py
index 4ea45ce78..b72e83e37 100644
--- a/event_model/__init__.py
+++ b/event_model/__init__.py
@@ -11,7 +11,7 @@
 import inspect
 import os
 from pkg_resources import resource_filename as rs_fn
-from importlib.metadata import version
+import sys
 import threading
 import time as ttime
 import types
@@ -24,6 +24,11 @@
 
 from ._version import get_versions
 
+if sys.version_info < (3, 8):
+    from importlib_metadata import version
+else:
+    from importlib.metadata import version
+
 __all__ = ['DocumentNames', 'schemas', 'schema_validators', 'compose_run']
 
 
diff --git a/requirements.txt b/requirements.txt
index 6462d3ca0..964de5ee1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
+importlib-metadata;python_version<'3.8'
 jsonschema
 numpy


Test patch:
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
index e11d054ef..dd154d4ac 100644
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -12,7 +12,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [3.6, 3.7, 3.8]
+        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
         # We still test against jsonschema 2.x because pip's dependency resolver
         # very often gives us 2.x even though we ask for 3.x. The event-model
         # code has codepaths for either, conditional on what is installed.