Skip to content

Commit 0fb8373

Browse files
Modernise Packaging and CI (#1203)
This PR: - [x] removes setup.py and uses pyproject.toml instead (version information is now only via importlib.metadata) - [x] runs CI using PyPI and `pip` with Python 3.8 and 3.10 - matrix is Pyside2, PySide6, PyQt5 on all platforms; wxPython on windows only (due to problems installing wheels) - [x] updates EDM-based ci to use Python 3.8 and PySide6 only - [x] adds a github action for installing Qt dependencies on ubuntu (copied from TraitsUI) - [x] switches to using `qt` as the name of the qt toolkit instance instead of `qt4` (but the latter still works, we just prefer `ETS_TOOLKIT=qt` not `ETS_TOOLKIT=qt4`) - fixes #1194 - [x] fixes #1207 - [x] cleans up the `SplitEditorAreaPane` tests and generally makes Tasks `destroy` methods idempotent, which helps test robustness and fixes #1107 This will need an update to the expected tests before merging. --------- Co-authored-by: Mark Dickinson <[email protected]>
1 parent 74fb6fd commit 0fb8373

39 files changed

+734
-971
lines changed

setup.cfg .flake8

File renamed without changes.

.gitattributes

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Install Qt dependencies
2+
3+
This action calls `apt-get` to install packages required for running Qt on Ubuntu.
4+
5+
## Inputs
6+
7+
There are no inputs.
8+
9+
## Outputs
10+
11+
There are no outputs.
12+
13+
## Example usage
14+
15+
```yml
16+
17+
jobs:
18+
test:
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Install Qt dependencies
26+
uses: ./.github/actions/install-qt-support
27+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: install-qt-support
2+
description: 'Install supporting OS packages for Qt-using code'
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Install Linux packages for Qt
7+
if: runner.os == 'Linux'
8+
run: |
9+
sudo apt-get update
10+
sudo apt-get install qtbase5-dev
11+
sudo apt-get install qtchooser
12+
sudo apt-get install qt5-qmake
13+
sudo apt-get install qtbase5-dev-tools
14+
sudo apt-get install libegl1
15+
sudo apt-get install libxkbcommon-x11-0
16+
sudo apt-get install libxcb-icccm4
17+
sudo apt-get install libxcb-image0
18+
sudo apt-get install libxcb-keysyms1
19+
sudo apt-get install libxcb-randr0
20+
sudo apt-get install libxcb-render-util0
21+
sudo apt-get install libxcb-xinerama0
22+
sudo apt-get install libxcb-shape0
23+
sudo apt-get install pulseaudio
24+
sudo apt-get install libpulse-mainloop-glib0
25+
# Needed to work around https://bugreports.qt.io/browse/PYSIDE-1547
26+
sudo apt-get install libopengl0
27+
# Needed for Qt6 video playback
28+
sudo apt-get install libgstreamer-gl1.0-0
29+
shell: bash

.github/workflows/ets-from-source.yml

+8-35
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
env:
10-
INSTALL_EDM_VERSION: 3.3.1
10+
INSTALL_EDM_VERSION: 3.5.0
1111
QT_MAC_WANTS_LAYER: 1
1212

1313
jobs:
@@ -17,10 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest, macos-latest, windows-latest]
20-
toolkit: ['wx', 'pyqt5', 'pyside2']
21-
exclude:
22-
- os: ubuntu-latest
23-
toolkit: 'wx'
20+
toolkit: ['pyside6']
2421
runs-on: ${{ matrix.os }}
2522
env:
2623
# Set root directory, mainly for Windows, so that the EDM Python
@@ -29,41 +26,17 @@ jobs:
2926
# relative path between the site-packages and the source directory.
3027
EDM_ROOT_DIRECTORY: ${{ github.workspace }}/.edm
3128
steps:
32-
- uses: actions/checkout@v2
33-
- name: Install Qt dependencies for Linux
34-
run: |
35-
sudo apt-get update
36-
sudo apt-get install qtbase5-dev
37-
sudo apt-get install qtchooser
38-
sudo apt-get install qt5-qmake
39-
sudo apt-get install qtbase5-dev-tools
40-
sudo apt-get install libegl1
41-
sudo apt-get install libxkbcommon-x11-0
42-
sudo apt-get install libxcb-icccm4
43-
sudo apt-get install libxcb-image0
44-
sudo apt-get install libxcb-keysyms1
45-
sudo apt-get install libxcb-randr0
46-
sudo apt-get install libxcb-render-util0
47-
sudo apt-get install libxcb-xinerama0
48-
sudo apt-get install libxcb-shape0
49-
sudo apt-get install pulseaudio
50-
sudo apt-get install libpulse-mainloop-glib0
51-
shell: bash
52-
if: startsWith(matrix.os, 'ubuntu') && matrix.toolkit != 'wx'
53-
- name: Install Wx dependencies for Linux
54-
run: |
55-
sudo apt-get update
56-
sudo apt-get install libsdl-image1.2
57-
sudo apt-get install libsdl2-2.0-0
58-
shell: bash
59-
if: startsWith(matrix.os, 'ubuntu') && matrix.toolkit == 'wx'
29+
- uses: actions/checkout@v3
30+
- name: Install Qt dependencies
31+
uses: ./.github/actions/install-qt-support
32+
if: matrix.toolkit != 'wx'
6033
- name: Cache EDM packages
61-
uses: actions/cache@v2
34+
uses: actions/cache@v3
6235
with:
6336
path: ~/.cache
6437
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
6538
- name: Setup EDM
66-
uses: enthought/setup-edm-action@v1
39+
uses: enthought/setup-edm-action@v2
6740
with:
6841
edm-version: ${{ env.INSTALL_EDM_VERSION }}
6942
- name: Install click to the default EDM environment

.github/workflows/publish-on-pypi.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111

1212
steps:
1313
- name: Check out the release commit
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
- name: Set up Python
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: '3.8'
1919
- name: Install Python packages needed for build and upload

.github/workflows/run-style-checks.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v4
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies and local packages

.github/workflows/run-tests.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Run test suite for Qt and wxPython
2+
3+
on: [pull_request, workflow_dispatch]
4+
5+
env:
6+
PYTHONUNBUFFERED: 1
7+
8+
jobs:
9+
tests-qt:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
python-version: ['3.8', '3.10']
14+
qt-api: ['pyqt5', 'pyside2', 'pyside6']
15+
fail-fast: false
16+
17+
env:
18+
ETS_TOOLKIT: qt
19+
EXCLUDE_TESTS: wx
20+
21+
runs-on: ${{ matrix.os }}
22+
timeout-minutes: 20 # should be plenty, it's usually < 5
23+
24+
steps:
25+
- name: Check out the target commit
26+
uses: actions/checkout@v3
27+
- name: Install Qt dependencies
28+
uses: ./.github/actions/install-qt-support
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install dependencies and local packages
34+
run: |
35+
python -m pip install ".[${{ matrix.qt-api }},numpy,pillow,test,traitsui]"
36+
- name: Create clean test directory
37+
run: |
38+
mkdir testdir
39+
- name: Run the test suite (Linux)
40+
run: cd testdir && xvfb-run -a python -X faulthandler -m unittest discover -v pyface
41+
if: matrix.os == 'ubuntu-latest'
42+
- name: Run the test suite (Windows/macOS)
43+
run: cd testdir && python -X faulthandler -m unittest discover -v pyface
44+
if: matrix.os != 'ubuntu-latest'
45+
46+
tests-wx:
47+
strategy:
48+
matrix:
49+
os: [windows-latest]
50+
python-version: ['3.8', '3.10']
51+
fail-fast: false
52+
53+
env:
54+
ETS_TOOLKIT: wx
55+
EXCLUDE_TESTS: qt
56+
57+
runs-on: ${{ matrix.os }}
58+
59+
steps:
60+
- name: Check out the target commit
61+
uses: actions/checkout@v3
62+
- name: Set up Python ${{ matrix.python-version }}
63+
uses: actions/setup-python@v4
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
- name: Install dependencies and local packages
67+
run: |
68+
python -m pip install ".[wx,test,traitsui]"
69+
- name: Create clean test directory
70+
run: |
71+
mkdir testdir
72+
- name: Run the test suite (Windows/macOS)
73+
run: cd testdir && python -X faulthandler -m unittest discover -v pyface

.github/workflows/test-with-edm.yml

+9-36
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Test with EDM
77
on: pull_request
88

99
env:
10-
INSTALL_EDM_VERSION: 3.3.1
10+
INSTALL_EDM_VERSION: 3.5.0
1111
QT_MAC_WANTS_LAYER: 1
1212

1313
jobs:
@@ -17,10 +17,8 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest, macos-latest, windows-latest]
20-
toolkit: ['wx', 'pyqt5', 'pyside2', 'pyside6']
21-
exclude:
22-
- os: ubuntu-latest
23-
toolkit: 'wx'
20+
toolkit: ['pyside6']
21+
fail-fast: false
2422
timeout-minutes: 20 # should be plenty, it's usually < 5
2523
runs-on: ${{ matrix.os }}
2624
env:
@@ -30,42 +28,17 @@ jobs:
3028
# relative path between the site-packages and the source directory.
3129
EDM_ROOT_DIRECTORY: ${{ github.workspace }}/.edm
3230
steps:
33-
- uses: actions/checkout@v2
34-
- name: Install Qt dependencies for Linux
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install qtbase5-dev
38-
sudo apt-get install qtchooser
39-
sudo apt-get install qt5-qmake
40-
sudo apt-get install qtbase5-dev-tools
41-
sudo apt-get install libegl1
42-
sudo apt-get install libxkbcommon-x11-0
43-
sudo apt-get install libxcb-icccm4
44-
sudo apt-get install libxcb-image0
45-
sudo apt-get install libxcb-keysyms1
46-
sudo apt-get install libxcb-randr0
47-
sudo apt-get install libxcb-render-util0
48-
sudo apt-get install libxcb-xinerama0
49-
sudo apt-get install libxcb-shape0
50-
sudo apt-get install pulseaudio
51-
sudo apt-get install libpulse-mainloop-glib0
52-
sudo apt-get install libgstreamer-gl1.0-0
53-
shell: bash
54-
if: startsWith(matrix.os, 'ubuntu') && matrix.toolkit != 'wx'
55-
- name: Install Wx dependencies for Linux
56-
run: |
57-
sudo apt-get update
58-
sudo apt-get install libsdl-image1.2
59-
sudo apt-get install libsdl2-2.0-0
60-
shell: bash
61-
if: startsWith(matrix.os, 'ubuntu') && matrix.toolkit == 'wx'
31+
- uses: actions/checkout@v3
32+
- name: Install Qt dependencies
33+
uses: ./.github/actions/install-qt-support
34+
if: matrix.toolkit != 'wx'
6235
- name: Cache EDM packages
63-
uses: actions/cache@v2
36+
uses: actions/cache@v3
6437
with:
6538
path: ~/.cache
6639
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
6740
- name: Setup EDM
68-
uses: enthought/setup-edm-action@v1
41+
uses: enthought/setup-edm-action@v2
6942
with:
7043
edm-version: ${{ env.INSTALL_EDM_VERSION }}
7144
- name: Install click to the default EDM environment

MANIFEST.in

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
include image_LICENSE.txt
2-
include image_LICENSE_Eclipse.txt
3-
include image_LICENSE_Nuvola.txt
4-
include image_LICENSE_OOo.txt
5-
include LICENSE-CC-BY-3.0.txt
6-
include LICENSE.txt
7-
include README.rst
81
include MANIFEST.in
2+
include .flake8
3+
include .coveragerc
4+
include *.rst
5+
include *.txt
6+
include *.cfg
7+
include *.toml
8+
include etstool.py
99
recursive-include pyface *.py *.png *.jpg *.gif *.svg *.zip *.txt
1010
graft docs
1111
prune docs/build

docs/source/image_types.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ The image code like the following in my_module.py will work:
8989
action = Action(image="my_image")
9090
9191
When using this approach, remember that image files will need to be added
92-
to the ``package_data`` in ``setup.py`` or they will not be shipped alongside
93-
the code.
92+
to the ``package_data`` in the project configuration or they will not be
93+
shipped alongside the code.
9494

9595
:mod:`~pyface.util.image_helpers` Module
9696
----------------------------------------

docs/source/toolkits.rst

+7
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ the third party library, something like this::
9191
}
9292
)
9393

94+
or in a ``pyproject.toml`` something like:
95+
96+
.. code-block:: toml
97+
98+
[project.entry-points.'pyface.toolkits']
99+
my_toolkit = 'my_project.my_toolkit.init:toolkit_object'
100+
94101
The left-hand side is the name of the toolkit, suitable for use with
95102
:py:obj:`ETSConfig`, and the right-hand side is the location of a toolkit
96103
object which matches the specification above: a callable object which takes

0 commit comments

Comments
 (0)