Skip to content

Commit

Permalink
Python 3.8 support (#927)
Browse files Browse the repository at this point in the history
* Add Python 3.8 support to edmtool.py

* Experiment: add 3.8/PySide6 on Linux.

* Runtime and toolkit were reversed.

* Add support for Windows and Mac; fix caching of packages.

* Mess with ordering for more coherent appearance.

* Add -Xfaulthandler to test runs; update test params.

* Fix caching again.

* Add os to `include` specification.
  • Loading branch information
corranwebster authored Apr 6, 2022
1 parent c495399 commit fa865d8
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bleeding-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# Note that Ubuntu 20 cannot be used because its SWIG version is 4.0
# (enthought/enable#360)
os: [ubuntu-18.04]
toolkit: ['pyside2', 'wx']
toolkit: ['pyside6', 'pyside2', 'wx']
python-version: [3.8]
runs-on: ${{ matrix.os }}
steps:
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/test-with-edm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
strategy:
matrix:
toolkit: ['null', 'pyqt5', 'pyside2', 'wx']
runtime: ['3.6']
include:
- toolkit: 'pyside6'
runtime: '3.8'
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
Expand All @@ -35,28 +39,36 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }}
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ matrix.runtime }}-${{ hashFiles('ci/edmtool.py') }}
- name: Setup EDM
uses: enthought/setup-edm-action@v1
with:
edm-version: ${{ env.INSTALL_EDM_VERSION }}
- name: Install click to the default EDM environment
run: edm --config ci/.edm.yaml install -y wheel click coverage
- name: Install test environment
run: edm run -- python ci/edmtool.py install --toolkit=${{ matrix.toolkit }}
run: edm run -- python ci/edmtool.py install --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }}
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
# kiva agg requires at least 15-bit color depth.
# The --server-args assumes xvfb-run is called, hence Linux only.
run: --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }}
run: --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }}

# Test against EDM packages on Windows and OSX
test-with-edm:
strategy:
matrix:
os: [macos-latest, windows-latest]
toolkit: ['pyqt5', 'pyside2', 'wx']
runtime: ['3.6']
include:
- os: macos-latest
toolkit: 'pyside6'
runtime: '3.8'
- os: windows-latest
toolkit: 'pyside6'
runtime: '3.8'
runs-on: ${{ matrix.os }}
env:
# Set root directory, mainly for Windows, so that the EDM Python
Expand All @@ -70,14 +82,14 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }}
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ matrix.runtime }}-${{ hashFiles('ci/edmtool.py') }}
- name: Setup EDM
uses: enthought/setup-edm-action@v1
with:
edm-version: ${{ env.INSTALL_EDM_VERSION }}
- name: Install click to the default EDM environment
run: edm --config ci/.edm.yaml install -y wheel click coverage
- name: Install test environment
run: edm run -- python ci/edmtool.py install --toolkit=${{ matrix.toolkit }}
run: edm run -- python ci/edmtool.py install --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }}
- name: Run tests
run: edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }}
run: edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }}
65 changes: 44 additions & 21 deletions ci/edmtool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down Expand Up @@ -86,25 +86,44 @@

supported_combinations = {
'3.6': {'pyside2', 'pyqt5', 'wx', 'null'},
'3.8': {'pyside6', 'pyqt6', 'wx', 'null'},
}

dependencies = {
"apptools",
"celiagg",
"coverage",
"Cython",
"fonttools",
"kiwisolver",
"numpy",
"pillow",
"pyface",
"pygments",
"pyparsing",
"pypdf2",
"reportlab",
"swig",
"traits",
"traitsui",
'3.6': {
"apptools",
"celiagg",
"coverage",
"Cython",
"fonttools",
"kiwisolver",
"numpy",
"pillow",
"pyface",
"pygments",
"pyparsing",
"pypdf2",
"reportlab",
"swig",
"traits",
"traitsui",
},
'3.8': {
"apptools",
"celiagg",
"coverage",
"Cython",
"fonttools",
"kiwisolver",
"numpy",
"pillow_simd",
"pyface",
"pygments",
"pyparsing",
"swig",
"traits",
"traitsui",
}
}

# Dependencies we install from source for cron tests
Expand All @@ -119,15 +138,19 @@

extra_dependencies = {
'pyqt5': {'pyqt5'},
'pyqt6': {'pyqt6'},
'pyside2': {'pyside2'},
'pyside6': {'pyside6'},
# XXX once wxPython 4 is available in EDM, we will want it here
"wx": set(),
'null': set()
}

environment_vars = {
'pyside2': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyside2'},
'pyside6': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyside6'},
'pyqt5': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyqt5'},
'pyqt6': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyqt6'},
'wx': {'ETS_TOOLKIT': 'wx'},
'null': {'ETS_TOOLKIT': 'null.image'},
}
Expand Down Expand Up @@ -168,14 +191,14 @@ def install(runtime, toolkit, environment, source):
"""
parameters = get_parameters(runtime, toolkit, environment)
parameters['packages'] = ' '.join(
dependencies | extra_dependencies.get(toolkit, set()))
dependencies[runtime] | extra_dependencies.get(toolkit, set()))
# edm commands to setup the development environment
commands = [
("edm --config {edm_config} environments create {environment} "
"--force --version={runtime}"),
("edm --config {edm_config} install -y -e {environment} {packages} "
"--add-repository enthought/lgpl"),
("edm run -e {environment} -- pip install -r ci/requirements.txt"
("edm run -e {environment} -- pip install -r ci/requirements_{runtime}.txt"
" --no-dependencies"),
]

Expand Down Expand Up @@ -350,9 +373,9 @@ def test(runtime, toolkit, environment):
environ["PYTHONUNBUFFERED"] = "1"
environ["PYTHONFAULTHANDLER"] = "1"
commands = [
("edm run -e {environment} -- python -W default -m"
("edm run -e {environment} -- python -W default -Xfaulthandler -m"
"coverage run -m unittest discover enable -v"),
("edm run -e {environment} -- python -W default -m"
("edm run -e {environment} -- python -W default -Xfaulthandler -m"
"coverage run -a -m unittest discover kiva -v"),
]

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions ci/requirements_3.8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pygarrayimage
pyglet
pypdf2
reportlab

0 comments on commit fa865d8

Please sign in to comment.