Repository: pints-team/pints (language: python)

Issue:
NUTS coroutines don't work on Python 3.11
```
 Traceback (most recent call last):
Testing notebooks
  File "/home/runner/work/pints/pints/run-tests.py", line 584, in <module>
Skipping ignored notebook: examples/interfaces/statsmodels-arima.ipynb
    run_notebook_tests()
  File "/home/runner/work/pints/pints/run-tests.py", line 376, in run_notebook_tests
    ok &= test_notebook(notebook)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/pints/pints/run-tests.py", line 438, in test_notebook
    import pints
  File "/home/runner/work/pints/pints/pints/__init__.py", line 224, in <module>
    from ._mcmc._nuts import NoUTurnMCMC
  File "/home/runner/work/pints/pints/pints/_mcmc/_nuts.py", line 210, in <module>
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'. Did you mean: 'coroutines'?
```

See notebooks: https://github.com/pints-team/pints/actions/runs/3407521360/jobs/5667241465


Discussion / hints:
https://docs.python.org/3.10/library/asyncio-task.html#generator-based-coroutines
How about we rewrite and make NUTS work only on 3.8+?

Still a note in there for 3.3: https://github.com/pints-team/pints/blob/master/pints/_mcmc/_nuts.py#L506

@martinjrobins do you have time to look at this?

Fix patch:
diff --git a/.github/workflows/upload-to-pypi.yml b/.github/workflows/upload-to-pypi.yml
index d08c6f6f2..7d28e2964 100644
--- a/.github/workflows/upload-to-pypi.yml
+++ b/.github/workflows/upload-to-pypi.yml
@@ -12,10 +12,12 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
 
       - name: install dependencies
         run: |


Test patch:
diff --git a/.github/workflows/copyright-test.yml b/.github/workflows/copyright-test.yml
index 76477a2f4..2d7e7abda 100644
--- a/.github/workflows/copyright-test.yml
+++ b/.github/workflows/copyright-test.yml
@@ -20,10 +20,12 @@ jobs:
     if: github.event.pull_request.draft == false
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+            python-version: '3.10'
 
       - name: install pints
         run: |
diff --git a/.github/workflows/coverage-test.yml b/.github/workflows/coverage-test.yml
index 3b851469f..d6f18b448 100644
--- a/.github/workflows/coverage-test.yml
+++ b/.github/workflows/coverage-test.yml
@@ -20,10 +20,12 @@ jobs:
     if: github.event.pull_request.draft == false
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
 
       - name: install pints
         run: |
diff --git a/.github/workflows/docs-test.yml b/.github/workflows/docs-test.yml
index 1ba1d5b40..e8bde581d 100644
--- a/.github/workflows/docs-test.yml
+++ b/.github/workflows/docs-test.yml
@@ -20,10 +20,12 @@ jobs:
     if: github.event.pull_request.draft == false
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
 
       - name: install pints
         run: |
diff --git a/.github/workflows/notebook-interfaces-test.yml b/.github/workflows/notebook-interfaces-test.yml
index c701d5a7f..528cc44fa 100644
--- a/.github/workflows/notebook-interfaces-test.yml
+++ b/.github/workflows/notebook-interfaces-test.yml
@@ -12,10 +12,12 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
 
       # We use e.g. install pints[stan] to install dependencies for interfaces
       # that have some code in pints/interfaces. Dependencies that are not used
diff --git a/.github/workflows/notebook-test.yml b/.github/workflows/notebook-test.yml
index 0f7eebf8e..7bbddafe4 100644
--- a/.github/workflows/notebook-test.yml
+++ b/.github/workflows/notebook-test.yml
@@ -12,10 +12,12 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
 
       - name: install pints
         run: |
diff --git a/.github/workflows/style-test.yml b/.github/workflows/style-test.yml
index 441234ad4..27efe7ca5 100644
--- a/.github/workflows/style-test.yml
+++ b/.github/workflows/style-test.yml
@@ -20,10 +20,10 @@ jobs:
     if: github.event.pull_request.draft == false
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
 
       - name: install pints
         run: |
diff --git a/.github/workflows/unit-test-os-coverage.yml b/.github/workflows/unit-test-os-coverage.yml
index a2bd18965..df6d5dc9e 100644
--- a/.github/workflows/unit-test-os-coverage.yml
+++ b/.github/workflows/unit-test-os-coverage.yml
@@ -24,10 +24,12 @@ jobs:
         os: [ubuntu-18.04, macos-latest, windows-latest]
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
 
       - name: install pints
         run: |
diff --git a/.github/workflows/unit-test-python-coverage.yml b/.github/workflows/unit-test-python-coverage.yml
index f26eb905e..55c20dab3 100644
--- a/.github/workflows/unit-test-python-coverage.yml
+++ b/.github/workflows/unit-test-python-coverage.yml
@@ -21,13 +21,13 @@ jobs:
 
     strategy:
       matrix:
-        python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
+        python-version: ['3.6', '3.7', '3.8', '3.9']  # Latest version is tested by coverage test and os tests
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
 
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
           architecture: x64