Skip to content

Commit

Permalink
Update build machinery to support Python 3.8 and PySide 6 (#477)
Browse files Browse the repository at this point in the history
This PR extends the build machinery to support Python 3.8 and PySide 6, and does general cleanup and streamlining of the GitHub Actions workflows.

Notable changes:

* I've added a minimal pyproject.toml file.
* For EDM-based workflows, we use the GitHub Actions Python for our bootstrap environment instead of creating an EDM bootstrap environment; creation and population of the bootstrap environment takes ~5s.
* For the wxPython workflow, I've disabled Python 3.6: the workflow only runs on Python 3.8. The pip install of wxPython 4.2.0 on Python 3.6 appears to be broken.
* I've added platform-specific skips for a couple of troublesome tests; there are linked issues for those skips
* All workflows can now be run manually
  • Loading branch information
mdickinson authored Aug 12, 2022
1 parent 7e93aa0 commit d3a808b
Show file tree
Hide file tree
Showing 14 changed files with 156 additions and 106 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/release_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Release candidate
- [ ] Create a PR against ``main`` to bump version number, merge that PR
- [ ] From the commit just before bumping the version, create a new branch `maint/<release version number>`
- [ ] Update changelog and open PR targeting a new `maint/<release version number>` branch
- [ ] Update `ci-src-requirements.txt` if needed
- [ ] Check MANIFEST and requirements are still up to date.
- [ ] Update version in setup.py for the prerelease, open 2 PRs against `maint/<release version number>`
- [ ] Create a new branch from `maint/<release version number>`: `git checkout maint/<release version number>`; `git pull`; `git checkout -b call-it-anything-you-like`
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/bootstrap-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
click
36 changes: 26 additions & 10 deletions .github/workflows/ets-from-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: '0 0 * * 5'

env:
INSTALL_EDM_VERSION: 3.2.3
INSTALL_EDM_VERSION: 3.3.1
QT_MAC_WANTS_LAYER: 1

jobs:
Expand All @@ -17,11 +17,21 @@ jobs:
test-with-edm:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolkit: ['null', 'pyqt5', 'pyside2']
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runtime: ['3.6', '3.8']
toolkit: ['null', 'pyqt5', 'pyside2', 'pyside6']
exclude:
- runtime: '3.6'
toolkit: 'pyside6'
- runtime: '3.8'
toolkit: 'pyside2'
- runtime: '3.8'
toolkit: 'pyqt5'

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Clone the Envisage source
uses: actions/checkout@v3
- name: Install Qt dependencies for Linux
run: |
sudo apt-get update
Expand All @@ -35,25 +45,31 @@ jobs:
sudo apt-get install libxcb-xinerama0
sudo apt-get install pulseaudio
sudo apt-get install libpulse-mainloop-glib0
shell: bash
sudo apt-get install libopengl0
if: runner.os == 'Linux'
- name: Cache EDM packages
uses: actions/cache@v2
with:
path: ~/.cache
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
key: ${{ runner.os }}-${{ matrix.runtime }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
- name: Set up EDM
uses: enthought/setup-edm-action@v1
with:
edm-version: ${{ env.INSTALL_EDM_VERSION }}
- name: Install click to the default EDM environment
run: edm install -y wheel click coverage
- name: Set up bootstrap Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: '.github/workflows/bootstrap-requirements.txt'
- name: Install click to the bootstrap environment
run: python -m pip install -r .github/workflows/bootstrap-requirements.txt
- name: Install test environment
run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }} --source
run: python etstool.py install --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }} --source
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: edm run -- python etstool.py test --toolkit=${{ matrix.toolkit }}
run: python etstool.py test --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}

notify-on-failure:
needs: test-with-edm
Expand Down
40 changes: 28 additions & 12 deletions .github/workflows/test-with-edm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

name: Test with EDM

on: pull_request
on: [pull_request, workflow_dispatch]

env:
INSTALL_EDM_VERSION: 3.2.3
INSTALL_EDM_VERSION: 3.3.1
QT_MAC_WANTS_LAYER: 1

jobs:
Expand All @@ -16,11 +16,21 @@ jobs:
test-with-edm:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolkit: ['null', 'pyqt5', 'pyside2']
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runtime: ['3.6', '3.8']
toolkit: ['null', 'pyqt5', 'pyside2', 'pyside6']
exclude:
- runtime: '3.6'
toolkit: 'pyside6'
- runtime: '3.8'
toolkit: 'pyside2'
- runtime: '3.8'
toolkit: 'pyqt5'

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Clone the Envisage source
uses: actions/checkout@v3
- name: Install Qt dependencies for Linux
run: |
sudo apt-get update
Expand All @@ -34,25 +44,31 @@ jobs:
sudo apt-get install libxcb-xinerama0
sudo apt-get install pulseaudio
sudo apt-get install libpulse-mainloop-glib0
shell: bash
sudo apt-get install libopengl0
if: runner.os == 'Linux'
- name: Cache EDM packages
uses: actions/cache@v2
with:
path: ~/.cache
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
key: ${{ runner.os }}-${{ matrix.runtime }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
- name: Set up EDM
uses: enthought/setup-edm-action@v1
with:
edm-version: ${{ env.INSTALL_EDM_VERSION }}
- name: Install click to the default EDM environment
run: edm install -y wheel click coverage
- name: Set up bootstrap Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: '.github/workflows/bootstrap-requirements.txt'
- name: Install click to the bootstrap environment
run: python -m pip install -r .github/workflows/bootstrap-requirements.txt
- name: Install test environment
run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }}
run: python etstool.py install --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
- name: Flake8
run: edm run -- python etstool.py flake8
run: python etstool.py flake8 --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
if: runner.os == 'Linux' && matrix.toolkit == 'null'
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: edm run -- python etstool.py test --toolkit=${{ matrix.toolkit }}
run: python etstool.py test --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
29 changes: 15 additions & 14 deletions .github/workflows/test-with-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test with PyPI

on: pull_request
on: [pull_request, workflow_dispatch]

env:
PYTHONUNBUFFERED: 1
Expand All @@ -10,15 +10,23 @@ jobs:

# Test against PyPI packages
test-with-pypi:

strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.6, 3.8, 3.9]
os: ['ubuntu-latest']
python-version: ['3.6', '3.8', '3.10']
toolkit: ['pyside2', 'pyside6']
exclude:
- python-version: '3.6'
toolkit: 'pyside6'
- python-version: '3.8'
toolkit: 'pyside2'
- python-version: '3.10'
toolkit: 'pyside2'

runs-on: ${{ matrix.os }}

steps:
- name: Clone the Envisage source
uses: actions/checkout@v3
- name: Install Qt dependencies for Linux
run: |
sudo apt-get update
Expand All @@ -31,19 +39,12 @@ jobs:
sudo apt-get install libxcb-render-util0
sudo apt-get install libxcb-xinerama0
if: runner.os == 'Linux'
- name: Check out the target commit
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update necessary Python packages
run: |
pip install --upgrade pip setuptools wheel
- name: Install package and dependencies
run: |
pip install pyside2
pip install .[ipython]
run: python -m pip install .[${{ matrix.toolkit }},ipython]
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/test-wx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,51 @@ on:
- cron: '0 0 * * 5'

env:
INSTALL_EDM_VERSION: 3.2.3
INSTALL_EDM_VERSION: 3.3.1

jobs:

# Test against EDM packages
test-with-edm:
strategy:
matrix:
os: [ubuntu-18.04]
os: ['ubuntu-20.04']
runtime: ['3.8']
toolkit: ['wx']

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Clone the Envisage source
uses: actions/checkout@v3
- name: Install Wx dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install libsdl-image1.2
sudo apt-get install libsdl2-2.0-0
shell: bash
if: runner.os == 'Linux'
- name: Cache EDM packages
uses: actions/cache@v2
with:
path: ~/.cache
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
key: ${{ runner.os }}-${{ matrix.runtime }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
- name: Set up EDM
uses: enthought/setup-edm-action@v1
with:
edm-version: ${{ env.INSTALL_EDM_VERSION }}
- name: Install click to the default EDM environment
run: edm install -y wheel click coverage
- name: Set up bootstrap Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: '.github/workflows/bootstrap-requirements.txt'
- name: Install click to the bootstrap environment
run: python -m pip install -r .github/workflows/bootstrap-requirements.txt
- name: Install test environment
run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }}
run: python etstool.py install --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: edm run -- python etstool.py test --toolkit=${{ matrix.toolkit }}
run: python etstool.py test --runtime=${{ matrix.runtime }} --toolkit=${{ matrix.toolkit }}

notify-on-failure:
needs: test-with-edm
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# file types to ignore
*.pyc
*.pyd
*.so
*~
.DS_Store

# ignore the build directories
*.egg-info/
build/
dist/
/dist/
/docs/build/
/docs/source/api/*.rst
!/docs/source/api/envisage.api.rst
Expand Down
Empty file removed ci-src-requirements.txt
Empty file.
6 changes: 6 additions & 0 deletions edm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Change this if you are using on-premise brood
store_url: "https://packages.enthought.com"

repositories:
- enthought/free
- enthought/lgpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ def test_zmq_sockets_closed(self):
sockets = self.objects_of_type(zmq.Socket)
self.assertTrue(all(socket.closed for socket in sockets))

@unittest.skipIf(
sys.platform == "win32" and sys.version_info[:2] == (3, 8),
"xref: enthought/envisage#463"
)
def test_ipykernel_live_objects(self):
# Check that all IPython-related objects have been cleaned up
# as expected.
Expand Down
16 changes: 7 additions & 9 deletions envisage/ui/tasks/tests/test_tasks_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# Thanks for using Enthought open source!

import os
import pickle
import shutil
import sys
import tempfile
import unittest

import pkg_resources
from pyface.i_gui import IGUI
from traits.api import HasTraits, provides

from envisage.ui.tasks.api import TasksApplication
from envisage.ui.tasks.tasks_application import DEFAULT_STATE_FILENAME
from pyface.i_gui import IGUI
from traits.api import HasTraits, provides

requires_gui = unittest.skipIf(
os.environ.get("ETS_TOOLKIT", "none") in {"null", "none"},
Expand All @@ -32,15 +32,16 @@ class DummyGUI(HasTraits):
pass


@unittest.skipIf(
sys.platform == "linux" and sys.version_info >= (3, 8),
"xref: enthought/envisage#476",
)
@requires_gui
class TestTasksApplication(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.tmpdir)

@unittest.skipUnless(
3 <= pickle.HIGHEST_PROTOCOL, "Test uses pickle protocol 3"
)
def test_layout_save_with_protocol_3(self):
# Test that the protocol can be overridden on a per-application basis.
state_location = self.tmpdir
Expand Down Expand Up @@ -82,9 +83,6 @@ def test_layout_load(self):
state = app._state
self.assertEqual(state.previous_window_layouts[0].size, (492, 743))

@unittest.skipUnless(
3 <= pickle.HIGHEST_PROTOCOL, "Test uses pickle protocol 3"
)
def test_layout_load_pickle_protocol_3(self):
# Same as the above test, but using a state stored with pickle
# protocol 3.
Expand Down
Loading

0 comments on commit d3a808b

Please sign in to comment.