diff --git a/.github/actions/install-qt-support/README.md b/.github/actions/install-qt-support/README.md new file mode 100644 index 000000000..47c86e009 --- /dev/null +++ b/.github/actions/install-qt-support/README.md @@ -0,0 +1,27 @@ +# Install Qt dependencies + +This action calls `apt-get` to install packages required for running Qt on Ubuntu. + +## Inputs + +There are no inputs. + +## Outputs + +There are no outputs. + +## Example usage + +```yml + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Install Qt dependencies + uses: ./.github/actions/install-qt-support +``` diff --git a/.github/actions/install-qt-support/action.yml b/.github/actions/install-qt-support/action.yml new file mode 100644 index 000000000..66b98ab7e --- /dev/null +++ b/.github/actions/install-qt-support/action.yml @@ -0,0 +1,30 @@ +name: install-qt-support +description: 'Install supporting OS packages for Qt-using code' +runs: + using: composite + steps: + - name: Install Linux packages for Qt + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install qtbase5-dev + sudo apt-get install qtchooser + sudo apt-get install qt5-qmake + sudo apt-get install qtbase5-dev-tools + sudo apt-get install libegl1 + sudo apt-get install libxkbcommon-x11-0 + sudo apt-get install libxcb-icccm4 + sudo apt-get install libxcb-image0 + sudo apt-get install libxcb-keysyms1 + sudo apt-get install libxcb-randr0 + sudo apt-get install libxcb-render-util0 + sudo apt-get install libxcb-xinerama0 + sudo apt-get install libxcb-shape0 + sudo apt-get install libxcb-cursor0 + sudo apt-get install pulseaudio + sudo apt-get install libpulse-mainloop-glib0 + # Needed to work around https://bugreports.qt.io/browse/PYSIDE-1547 + sudo apt-get install libopengl0 + # Needed for Qt6 video playback + sudo apt-get install libgstreamer-gl1.0-0 + shell: bash diff --git a/.github/workflows/ets-from-source.yml b/.github/workflows/ets-from-source.yml index 5cc91fe09..dd4dfe2b8 100644 --- a/.github/workflows/ets-from-source.yml +++ b/.github/workflows/ets-from-source.yml @@ -20,33 +20,17 @@ jobs: toolkit: ['null', 'pyqt5', 'pyside2'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Install Qt dependencies for Linux - run: | - sudo apt-get update - sudo apt-get install qtbase5-dev - sudo apt-get install qtchooser - sudo apt-get install qt5-qmake - sudo apt-get install qtbase5-dev-tools - sudo apt-get install libegl1 - sudo apt-get install libxkbcommon-x11-0 - sudo apt-get install libglu1-mesa-dev - sudo apt-get install libxcb-icccm4 - sudo apt-get install libxcb-image0 - sudo apt-get install libxcb-keysyms1 - sudo apt-get install libxcb-randr0 - sudo apt-get install libxcb-render-util0 - sudo apt-get install libxcb-xinerama0 - sudo apt-get install libxcb-shape0 - shell: bash - if: runner.os == 'Linux' + - uses: actions/checkout@v3 + - name: Install Qt dependencies + uses: ./.github/actions/install-qt-support + if: matrix.toolkit != 'wx' - name: Cache EDM packages uses: actions/cache@v2 with: path: ~/.cache key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }} - name: Set up EDM - uses: enthought/setup-edm-action@v1 + uses: enthought/setup-edm-action@v2 with: edm-version: ${{ env.INSTALL_EDM_VERSION }} - name: Install click to the default EDM environment @@ -54,28 +38,26 @@ jobs: - name: Install test environment run: edm run -- python ci/edmtool.py install --toolkit=${{ matrix.toolkit }} --source - 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 }} + # kiva agg requires at least 15-bit color depth. + # The --server-args assumes xvfb-run is called, hence Linux only. + run: xvfb-run -a --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} # Test against EDM packages from source on Windows and OSX test-ets-source: strategy: matrix: - os: [macos-latest, windows-latest] + os: [windows-latest] toolkit: ['null', 'pyqt5', 'pyside2'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache EDM packages uses: actions/cache@v2 with: path: ~/.cache key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }} - name: Setup EDM - uses: enthought/setup-edm-action@v1 + uses: enthought/setup-edm-action@v2 with: edm-version: ${{ env.INSTALL_EDM_VERSION }} - name: Install click to the default EDM environment diff --git a/.github/workflows/release-to-pypi.yml b/.github/workflows/release-to-pypi.yml index a7ae32c4e..60a6db449 100644 --- a/.github/workflows/release-to-pypi.yml +++ b/.github/workflows/release-to-pypi.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install Python packages needed for wheel build and upload run: python -m pip install twine @@ -54,7 +54,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install Python packages needed for sdist build and upload run: python -m pip install build twine diff --git a/.github/workflows/test-with-edm-3.8.yml b/.github/workflows/test-with-edm-3.8.yml deleted file mode 100644 index 19c5cfd61..000000000 --- a/.github/workflows/test-with-edm-3.8.yml +++ /dev/null @@ -1,80 +0,0 @@ -# This workflow targets stable released dependencies from EDM. -# Note that some packages may not actually be installed from EDM but from -# PyPI, see ci/edmtool.py implementations. - -name: Test with EDM on Python 3.8 - -on: pull_request - -env: - INSTALL_EDM_VERSION: 3.5.0 - -jobs: - - # Test against EDM packages on Linux - test-edm-linux-38: - strategy: - matrix: - toolkit: ['null', 'pyside6'] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install Qt dependencies for Linux - run: | - sudo apt-get update - sudo apt-get install libegl1 - sudo apt-get install libxkbcommon-x11-0 - sudo apt-get install libglu1-mesa-dev - sudo apt-get install libxcb-icccm4 - sudo apt-get install libxcb-image0 - sudo apt-get install libxcb-keysyms1 - sudo apt-get install libxcb-randr0 - sudo apt-get install libxcb-render-util0 - sudo apt-get install libxcb-xinerama0 - sudo apt-get install libxcb-shape0 - # Needed to work around https://bugreports.qt.io/browse/PYSIDE-1547 - sudo apt-get install libopengl0 - if: matrix.toolkit != 'null' - - name: Cache EDM packages - uses: actions/cache@v2 - with: - path: ~/.cache - key: ${{ runner.os }}-3.8-${{ matrix.toolkit }}-${{ 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 install -y wheel click coverage - - name: Install test environment - run: edm run -- python ci/edmtool.py install --runtime=3.8 --toolkit=${{ matrix.toolkit }} - - name: Flake8 - run: edm run -- python ci/edmtool.py flake8 --runtime=3.8 --toolkit=${{ matrix.toolkit }} - if: matrix.toolkit == 'null' - - name: Run tests - run: xvfb-run --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --runtime=3.8 --toolkit=${{ matrix.toolkit }} - - # Test against EDM packages on Windows and OSX - test-with-edm-38: - strategy: - matrix: - os: [macos-latest, windows-latest] - toolkit: ['null', 'pyside6'] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - name: Cache EDM packages - uses: actions/cache@v2 - with: - path: ~/.cache - key: ${{ runner.os }}-3.8-${{ matrix.toolkit }}-${{ 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 install -y wheel click coverage - - name: Install test environment - run: edm run -- python ci/edmtool.py install --runtime=3.8 --toolkit=${{ matrix.toolkit }} - - name: Run tests - run: edm run -- python ci/edmtool.py test --runtime=3.8 --toolkit=${{ matrix.toolkit }} diff --git a/.github/workflows/test-with-edm.yml b/.github/workflows/test-with-edm.yml index 6ff7e9d98..544a23e32 100644 --- a/.github/workflows/test-with-edm.yml +++ b/.github/workflows/test-with-edm.yml @@ -2,70 +2,51 @@ # Note that some packages may not actually be installed from EDM but from # PyPI, see ci/edmtool.py implementations. -name: Test with EDM +name: Test with EDM on Python 3.8 on: pull_request env: - INSTALL_EDM_VERSION: 3.2.3 + INSTALL_EDM_VERSION: 3.5.0 jobs: # Test against EDM packages on Linux - test-edm-linux: + test-edm-linux-38: strategy: matrix: - toolkit: ['null', 'pyqt5', 'pyside2'] + toolkit: ['null', 'pyside6'] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install Qt dependencies for Linux - run: | - sudo apt-get update - sudo apt-get install qtbase5-dev - sudo apt-get install qtchooser - sudo apt-get install qt5-qmake - sudo apt-get install qtbase5-dev-tools - sudo apt-get install libegl1 - sudo apt-get install libxkbcommon-x11-0 - sudo apt-get install libglu1-mesa-dev - sudo apt-get install libxcb-icccm4 - sudo apt-get install libxcb-image0 - sudo apt-get install libxcb-keysyms1 - sudo apt-get install libxcb-randr0 - sudo apt-get install libxcb-render-util0 - sudo apt-get install libxcb-xinerama0 - sudo apt-get install libxcb-shape0 + - uses: actions/checkout@v3 + - name: Install Qt dependencies + uses: ./.github/actions/install-qt-support if: matrix.toolkit != 'null' - name: Cache EDM packages uses: actions/cache@v2 with: path: ~/.cache - key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }} + key: ${{ runner.os }}-3.8-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }} - name: Setup EDM - uses: enthought/setup-edm-action@v1 + uses: enthought/setup-edm-action@v2 with: edm-version: ${{ env.INSTALL_EDM_VERSION }} - name: Install click to the default EDM environment run: edm 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 --runtime=3.8 --toolkit=${{ matrix.toolkit }} - name: Flake8 - run: edm run -- python ci/edmtool.py flake8 --toolkit=${{ matrix.toolkit }} + run: edm run -- python ci/edmtool.py flake8 --runtime=3.8 --toolkit=${{ matrix.toolkit }} if: matrix.toolkit == 'null' - 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: xvfb-run -a --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --runtime=3.8 --toolkit=${{ matrix.toolkit }} # Test against EDM packages on Windows and OSX - test-with-edm: + test-with-edm-38: strategy: matrix: - os: [macos-latest, windows-latest] - toolkit: ['null', 'pyqt5', 'pyside2'] + os: [windows-latest] + toolkit: ['null', 'pyside6'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -73,7 +54,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache - key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }} + key: ${{ runner.os }}-3.8-${{ matrix.toolkit }}-${{ hashFiles('ci/edmtool.py') }} - name: Setup EDM uses: enthought/setup-edm-action@v1 with: @@ -81,6 +62,6 @@ jobs: - name: Install click to the default EDM environment run: edm 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 --runtime=3.8 --toolkit=${{ matrix.toolkit }} - name: Run tests - run: edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} + run: edm run -- python ci/edmtool.py test --runtime=3.8 --toolkit=${{ matrix.toolkit }} diff --git a/.github/workflows/test-with-pip.yml b/.github/workflows/test-with-pip.yml new file mode 100644 index 000000000..0c4d92bb9 --- /dev/null +++ b/.github/workflows/test-with-pip.yml @@ -0,0 +1,180 @@ + +# This workflow installs dependencies from main branch + +name: Test with pip + +on: + pull_request: + # Make it possible to manually trigger the workflow + workflow_dispatch: + +jobs: + test-qt: + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + toolkit: ['pyside6'] + kiva-backend: ['image'] + python-version: ['3.8', '3.11'] + include: + # Do more Python versions on linux + - os: 'ubuntu-latest' + toolkit: 'pyside6' + kiva-backend: 'image' + python-version: '3.9' + - os: 'ubuntu-latest' + toolkit: 'pyside6' + kiva-backend: 'image' + python-version: '3.10' + runs-on: ${{ matrix.os }} + env: + ETS_TOOLKIT: qt4.${{ matrix.kiva-backend }} + QT_API: ${{ matrix.toolkit }} + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Qt dependencies + uses: ./.github/actions/install-qt-support + if: matrix.toolkit == 'pyside6' + - name: Install dependencies for Linux + run: | + # needed for Celiagg + sudo apt-get install libfreetype-dev libharfbuzz-dev + # needed for Cairo + sudo apt-get install libcairo2-dev + if: matrix.os == 'ubuntu-latest' + - name: Install dependencies for Mac + run: | + brew install cairo + if: matrix.os == 'macos-latest' + - name: Install build dependencies + run: | + python -m pip install --upgrade pip wheel + - name: Install local enable main (temporary) + run: pip install --force "enable[celiagg,layout,svg] @ git+https://github.com/enthought/enable.git" + - name: Install local packages + run: pip install ".[tests,${{ matrix.toolkit }}]" + - name: Sanity check package version + run: pip list + - name: Run chaco test suite (Linux) + env: + PYTHONFAULTHANDLER: 1 + # kiva agg requires at least 15-bit color depth. + run: xvfb-run -a --server-args="-screen 0 1024x768x24" python -m unittest discover -v chaco + if: matrix.os == 'ubuntu-latest' + working-directory: ${{ runner.temp }} + - name: Run enable test suite (not Linux) + env: + PYTHONFAULTHANDLER: 1 + run: python -m unittest discover -v chaco + if: matrix.os != 'ubuntu-latest' + working-directory: ${{ runner.temp }} + + test-wx: + strategy: + fail-fast: false + matrix: + os: ['windows-latest'] + toolkit: ['wx'] + kiva-backend: ['image'] + python-version: ['3.8', '3.10'] + runs-on: ${{ matrix.os }} + env: + ETS_TOOLKIT: ${{ matrix.toolkit }}.${{ matrix.kiva-backend }} + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for Linux + run: | + # needed for Celiagg + sudo apt-get install libfreetype-dev libharfbuzz-dev + # needed for Cairo + sudo apt-get install libcairo2-dev + if: matrix.os == 'ubuntu-latest' + - name: Install dependencies for Mac + run: | + brew install cairo + if: matrix.os == 'macos-latest' + - name: Install build dependencies + run: | + python -m pip install --upgrade pip wheel + - name: Install local enable main (temporary) + run: pip install --force "enable[celiagg,layout,svg] @ git+https://github.com/enthought/enable.git" + - name: Install local packages + run: pip install ".[tests,${{ matrix.toolkit }}]" + - name: Sanity check package version + run: pip list + - name: Run chaco test suite (Linux) + env: + PYTHONFAULTHANDLER: 1 + # kiva agg requires at least 15-bit color depth. + run: xvfb-run -a --server-args="-screen 0 1024x768x24" python -m unittest discover -v chaco + if: matrix.os == 'ubuntu-latest' + working-directory: ${{ runner.temp }} + - name: Run enable test suite (not Linux) + env: + PYTHONFAULTHANDLER: 1 + run: python -m unittest discover -v chaco + if: matrix.os != 'ubuntu-latest' + working-directory: ${{ runner.temp }} + + test-null: + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + toolkit: ['null'] + kiva-backend: ['image', 'celiagg'] + python-version: ['3.8', '3.11'] + runs-on: ${{ matrix.os }} + env: + ETS_TOOLKIT: ${{ matrix.toolkit }}.${{ matrix.kiva-backend }} + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for Linux + run: | + # needed for Celiagg + sudo apt-get install libfreetype-dev libharfbuzz-dev + # needed for Cairo + sudo apt-get install libcairo2-dev + if: matrix.os == 'ubuntu-latest' + - name: Install dependencies for Mac + run: | + brew install cairo + if: matrix.os == 'macos-latest' + - name: Install build dependencies + run: | + python -m pip install --upgrade pip wheel + - name: Install local enable main (temporary) + run: pip install --force "enable[celiagg,cairo,layout,svg] @ git+https://github.com/enthought/enable.git" + - name: Install local packages + run: pip install ".[tests,${{ matrix.toolkit }}]" + - name: Sanity check package version + run: pip list + - name: Run chaco test suite (Linux) + env: + PYTHONFAULTHANDLER: 1 + # kiva agg requires at least 15-bit color depth. + run: xvfb-run -a --server-args="-screen 0 1024x768x24" python -m unittest discover -v chaco + if: matrix.os == 'ubuntu-latest' + working-directory: ${{ runner.temp }} + - name: Run enable test suite (not Linux) + env: + PYTHONFAULTHANDLER: 1 + run: python -m unittest discover -v chaco + if: matrix.os != 'ubuntu-latest' + working-directory: ${{ runner.temp }} diff --git a/chaco/__init__.py b/chaco/__init__.py index 5538c1407..a167f30d3 100644 --- a/chaco/__init__.py +++ b/chaco/__init__.py @@ -10,14 +10,27 @@ __requires__ = [ - "traits>=6.2.0", "traitsui", "pyface>=7.2.0", "numpy", "enable>=5.2.0" + "traits>=6.2.0", + "traitsui", + "pyface>=7.2.0", + "numpy", + "enable[layout,svg]>=5.2.0" ] __extras_require__ = { "docs": ["enthought-sphinx-theme", "sphinx", "sphinx-copybutton"], - 'examples': ["encore", - "importlib_resources; python_version<'3.9'", - "scipy", - "pandas"] + 'examples': [ + 'encore', + "importlib_resources; python_version<'3.9'", + 'scipy', + 'pandas', + ], + 'tests': ['pandas'], + 'pyside2': ['enable[pyside2]'], + 'pyside6': ['enable[pyside6]'], + 'pyqt5': ['enable[pyqt5]'], + 'pyqt6': ['enable[pyqt6]'], + 'wx': ['enable[wx]'], + 'null': [], } diff --git a/chaco/tests/test_border.py b/chaco/tests/test_border.py index 59a4a46e0..0d22f0fc3 100644 --- a/chaco/tests/test_border.py +++ b/chaco/tests/test_border.py @@ -35,6 +35,7 @@ def test_draw_border_simple(self): container = Plot(padding=1, border_visible=True) container.outer_bounds = list(size) gc = PlotGraphicsContext(size) + gc.clear() gc.render_component(container) desired = array( diff --git a/pyproject.toml b/pyproject.toml index 26b1ea674..b1256a319 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["cython", "oldest-supported-numpy", "setuptools<65.2", "wheel"] +requires = ["cython", "oldest-supported-numpy", "setuptools", "wheel"] build-backend = "setuptools.build_meta" [tool.cibuildwheel]