Skip to content

Commit e13e4c7

Browse files
authored
626 upgrade to python 11 and extend test suite (#682)
1 parent 70acadd commit e13e4c7

43 files changed

Lines changed: 148 additions & 101 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/build-py/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
run: |
2121
cd pycode/memilio-${{ inputs.package }}/
2222
/opt/python/cp38-cp38/bin/python setup.py bdist_wheel
23-
/opt/python/cp310-cp310/bin/python setup.py bdist_wheel
23+
/opt/python/cp311-cp311/bin/python setup.py bdist_wheel
2424
# Exclude memilio-generation, because its a pure python package, cmake is only used in the build process to retrieve data from cpp
2525
if [[ -f "CMakeLists.txt" ]] && [ "${{ inputs.package }}" != "generation" ]; then
2626
# includes native dependencies in the wheel

.github/actions/test-py/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ inputs:
44
package:
55
description: "Package to run the tests for."
66
required: true
7+
version:
8+
description: "Python version to use for the test."
9+
required: false
10+
default: "3.8"
711
coverage:
812
description: "Generate coverage report from running the tests, ON or OFF, default OFF."
913
required: false
@@ -38,14 +42,15 @@ runs:
3842
with:
3943
name: python-wheels-simulation
4044
path: pycode/wheelhouse
41-
- name: Set up Python 3.8
45+
- name: Set up Python ${{ inputs.version }}
4246
uses: actions/setup-python@v4
4347
with:
44-
python-version: 3.8
48+
python-version: ${{ inputs.version }}
4549
- name: Install Python Wheels
4650
shell: bash
4751
run: |
48-
for pkg in `ls pycode/wheelhouse/*cp38*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
52+
export PYTHON_VERSION_NO_DOT=$(echo "${{ inputs.version }}" | sed 's/\.//g')
53+
for pkg in `ls pycode/wheelhouse/*cp$PYTHON_VERSION_NO_DOT*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
4954
for pkg in `ls pycode/wheelhouse/*py3*.whl`; do python -m pip install $pkg; done # pure python packages are not version specific
5055
pip install -r pycode/memilio-${{ inputs.package }}/requirements-dev.txt
5156
- name: Run unit tests

.github/actions/test-pylint/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
- name: Install Python Wheels
2121
shell: bash
2222
run: |
23-
for pkg in `ls pycode/wheelhouse/*cp38*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
23+
for pkg in `ls pycode/wheelhouse/*cp311*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
2424
for pkg in `ls pycode/wheelhouse/*py3*.whl`; do python -m pip install $pkg; done # pure python packages are not version specific
2525
pip install -r pycode/memilio-${{ inputs.package }}/requirements-dev.txt
2626
- name: Run pylint

.github/workflows/epidata_main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@v3
2626
- uses: actions/setup-python@v4
2727
with:
28-
python-version: 3.8
28+
python-version: 3.11
2929
- uses: pre-commit/[email protected]
3030

3131
build-py-epidata:
@@ -62,6 +62,9 @@ jobs:
6262
test-py-plot:
6363
if: github.event.pull_request.draft == false
6464
needs: [build-py-plot, build-py-epidata]
65+
strategy:
66+
matrix:
67+
version: ["3.8", "3.11"]
6568
runs-on: ubuntu-latest
6669
steps:
6770
- uses: actions/checkout@v3
@@ -104,13 +107,13 @@ jobs:
104107
with:
105108
name: python-wheels-epidata
106109
path: pycode/wheelhouse
107-
- name: Set up Python 3.8
110+
- name: Set up Python 3.11
108111
uses: actions/setup-python@v4
109112
with:
110-
python-version: 3.8
113+
python-version: 3.11
111114
- name: Install Python Wheels
112115
run: |
113-
for pkg in `ls pycode/wheelhouse/*cp38*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
116+
for pkg in `ls pycode/wheelhouse/*cp311*.whl`; do python -m pip install $pkg; done # packages that contain native extensions are version specific
114117
for pkg in `ls pycode/wheelhouse/*py3*.whl`; do python -m pip install $pkg; done # pure python packages are not version specific
115118
- name: Download Data
116119
run: |

.github/workflows/main.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v3
2424
- uses: actions/setup-python@v4
2525
with:
26-
python-version: 3.8
26+
python-version: 3.11
2727
- uses: pre-commit/[email protected]
2828

2929
build-cpp-gcc_clang:
@@ -202,16 +202,6 @@ jobs:
202202
with:
203203
package: generation
204204

205-
test-py-generation:
206-
if: github.event.pull_request.draft == false
207-
needs: build-py-generation
208-
runs-on: ubuntu-latest
209-
steps:
210-
- uses: actions/checkout@v3
211-
- uses: ./.github/actions/test-py
212-
with:
213-
package: generation
214-
215205
build-py-simulation:
216206
if: github.event.pull_request.draft == false
217207
runs-on: ubuntu-latest
@@ -234,9 +224,25 @@ jobs:
234224
with:
235225
package: surrogatemodel
236226

227+
test-py-generation:
228+
if: github.event.pull_request.draft == false
229+
strategy:
230+
matrix:
231+
version: ["3.8", "3.11"]
232+
needs: build-py-generation
233+
runs-on: ubuntu-latest
234+
steps:
235+
- uses: actions/checkout@v3
236+
- uses: ./.github/actions/test-py
237+
with:
238+
package: generation
239+
237240
test-py-simulation:
238241
if: github.event.pull_request.draft == false
239242
needs: build-py-simulation
243+
strategy:
244+
matrix:
245+
version: ["3.8", "3.11"]
240246
runs-on: ubuntu-latest
241247
steps:
242248
- uses: actions/checkout@v3
@@ -247,6 +253,9 @@ jobs:
247253
test-py-surrogatemodel:
248254
if: github.event.pull_request.draft == false
249255
needs: [build-py-surrogatemodel, build-py-simulation]
256+
strategy:
257+
matrix:
258+
version: ["3.8", "3.11"]
250259
runs-on: ubuntu-latest
251260
steps:
252261
- uses: actions/checkout@v3

pycode/README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ We recommend to use a virtual python environment to avoid dependency conflicts w
2323
source epi_venv/bin/activate
2424
pip install --upgrade pip
2525
26-
Refer to the `Python documentation <https://docs.python.org/3/library/venv.html>`_ for more information about virtual environments.
26+
Refer to the `Python documentation <https://docs.python.org/3/library/venv.html>`_ for more information about virtual environments.
27+
28+
The packages are tested for Python 3.8 - 3.11.

pycode/memilio-epidata/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ Dependencies
4646

4747
Required python packages:
4848

49-
- pandas<1.2.0
49+
- pandas>=1.2.2
5050
- matplotlib
5151
- tables
52-
- numpy>=1.22
52+
- numpy>=1.22,<1.25
5353
- openpyxl
5454
- xlrd
5555
- requests
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# dev dependencies, pyfakefs 4.2.0 is broken!
2-
pyfakefs==4.1.0
1+
# dev dependencies
2+
# first support of python 3.11
3+
pyfakefs>=4.6
34
coverage>=7.0.1
4-
pylint<=2.11.1
5-
pylint_json2html<=0.3.0
5+
# pylint 2.16 creates problem with wrapt package version
6+
pylint>=2.13.0,<2.16
7+
pylint_json2html==0.4.0

pycode/memilio-epidata/setup.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def run(self):
7676
'pandas>=1.2.2',
7777
'matplotlib',
7878
'tables',
79-
'numpy>=1.22', # smaller numpy versions cause a security issue
79+
# smaller numpy versions cause a security issue, 1.25 breaks testing with pyfakefs
80+
'numpy>=1.22,<1.25',
8081
'openpyxl',
8182
'xlrd',
8283
'requests',
@@ -87,12 +88,13 @@ def run(self):
8788
],
8889
extras_require={
8990
'dev': [
90-
# smaller pyfakefs versions use deprecated functions for matplotlib versions >=3.4
91-
'pyfakefs>=4.2.1',
91+
# first support of python 3.11
92+
'pyfakefs>=4.6',
9293
# coverage 7.0.0 can't find .whl files and breaks CI
9394
'coverage>=7.0.1',
94-
'pylint<=2.11.1',
95-
'pylint_json2html<=0.3.0',
95+
# pylint 2.16 creates problem with wrapt package version
96+
'pylint>=2.13.0,<2.16',
97+
'pylint_json2html==0.4.0',
9698
],
9799
},
98100
cmdclass={

pycode/memilio-generation/memilio/generation/scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def create_ast(self: Self) -> None:
7777
file_args.append(argument)
7878
file_args = file_args[1:-4]
7979
clang_cmd = [
80-
"clang", self.config.source_file,
80+
"clang-14", self.config.source_file,
8181
"-std=c++17", '-emit-ast', '-o', '-']
8282
clang_cmd.extend(file_args)
8383

0 commit comments

Comments
 (0)