From b49bf7251632ad23a2f6bbb0eb3fc12fbc2d1fe3 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Mon, 11 Sep 2023 18:22:28 +0100 Subject: [PATCH] Backport #1757 to the release branch and bring CI workflows in line with main --- .github/workflows/release-to-pypi.yml | 25 +++++---------- .github/workflows/run-core-traits-tests.yml | 4 +-- .github/workflows/run-style-checks.yml | 12 ++----- .github/workflows/run-traits-tests.yml | 6 ++-- .../workflows/test-documentation-build.yml | 15 +++------ .github/workflows/test-from-pypi.yml | 31 +++++++++++++------ pyproject.toml | 9 ++++++ setup.py | 15 ++++----- 8 files changed, 56 insertions(+), 61 deletions(-) diff --git a/.github/workflows/release-to-pypi.yml b/.github/workflows/release-to-pypi.yml index fdf3af13c..93389a95e 100644 --- a/.github/workflows/release-to-pypi.yml +++ b/.github/workflows/release-to-pypi.yml @@ -27,19 +27,13 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Install Python packages needed for wheel build and upload - run: | - python -m pip install --upgrade pip setuptools - python -m pip install twine wheel + run: python -m pip install twine - name: Build wheels - uses: pypa/cibuildwheel@v2.14.1 - env: - CIBW_SKIP: 'pp*' - CIBW_ARCHS_LINUX: "auto aarch64" - CIBW_ARCHS_MACOS: "auto universal2" + uses: pypa/cibuildwheel@v2.15.0 - name: Check and upload wheels env: @@ -60,21 +54,18 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Install Python packages needed for sdist build and upload - run: | - python -m pip install --upgrade pip setuptools - python -m pip install twine + run: python -m pip install build twine - name: Build sdist - run: | - python setup.py sdist + run: python -m build --sdist - name: Publish sdist to PyPI env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python -m twine check --strict dist/*.tar.gz - python -m twine upload dist/*.tar.gz + python -m twine check --strict dist/* + python -m twine upload dist/* diff --git a/.github/workflows/run-core-traits-tests.yml b/.github/workflows/run-core-traits-tests.yml index 26c65f650..5693f85b3 100644 --- a/.github/workflows/run-core-traits-tests.yml +++ b/.github/workflows/run-core-traits-tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] runs-on: ${{ matrix.os }} @@ -21,9 +21,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install local package run: | - python -m pip install --upgrade pip # Uninstall setuptools so that the tests will catch any accidental # dependence of the Traits source on setuptools. Note that in future # setuptools may not exist in a newly-created venv diff --git a/.github/workflows/run-style-checks.yml b/.github/workflows/run-style-checks.yml index 82d10f3c7..dc8836b84 100644 --- a/.github/workflows/run-style-checks.yml +++ b/.github/workflows/run-style-checks.yml @@ -5,22 +5,16 @@ on: jobs: style: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ['3.8'] - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Install dependencies and local packages run: | - python -m pip install --upgrade pip python -m pip install flake8 python -m pip install flake8-ets - name: Run style checks diff --git a/.github/workflows/run-traits-tests.yml b/.github/workflows/run-traits-tests.yml index ed61ff5bd..356119f90 100644 --- a/.github/workflows/run-traits-tests.yml +++ b/.github/workflows/run-traits-tests.yml @@ -5,7 +5,7 @@ on: - workflow_dispatch env: - # Temporary workaround prior to release of Traits 8.0 + # Temporary workaround prior to release of TraitsUI 8.0 # xref: enthought/traits#1742 ETS_QT4_IMPORTS: 1 @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] runs-on: ${{ matrix.os }} @@ -37,9 +37,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install dependencies and local packages run: | - python -m pip install --upgrade pip python -m pip install .[test] python -m pip install traits-stubs/[test] - name: Create clean test directory diff --git a/.github/workflows/test-documentation-build.yml b/.github/workflows/test-documentation-build.yml index c2d122b68..aa7b55d00 100644 --- a/.github/workflows/test-documentation-build.yml +++ b/.github/workflows/test-documentation-build.yml @@ -5,23 +5,16 @@ on: jobs: docs: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ['3.8'] - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Install dependencies and local packages - run: | - python -m pip install --upgrade pip - python -m pip install ".[docs]" + run: python -m pip install .[docs] - name: Build HTML documentation with Sphinx run: | cd docs diff --git a/.github/workflows/test-from-pypi.yml b/.github/workflows/test-from-pypi.yml index d89e315d0..5850587f9 100644 --- a/.github/workflows/test-from-pypi.yml +++ b/.github/workflows/test-from-pypi.yml @@ -6,12 +6,17 @@ on: # Run at 03:27 UTC on the 8th and 22nd of every month - cron: '27 3 8,22 * *' +env: + # Temporary workaround prior to release of Traits 8.0 + # xref: enthought/traits#1742 + ETS_QT4_IMPORTS: 1 + jobs: test-pypi-sdist: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] python-architecture: [x86, x64] exclude: - os: macos-latest @@ -40,12 +45,15 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.python-architecture }} - - name: Install prerequisites + allow-prereleases: true + - name: Install test dependencies and Traits from PyPI sdist (no PySide6) run: | - python -m pip install --upgrade pip setuptools wheel - - name: Install Traits and test dependencies from PyPI sdist + python -m pip install --no-binary traits Cython numpy Sphinx traits traitsui + if: matrix.python-version == '3.12' || matrix.python-architecture == 'x86' + - name: Install test dependencies and Traits from PyPI sdist (PySide6) run: | - python -m pip install --no-binary traits traits[test] + python -m pip install --no-binary traits Cython numpy PySide6 Sphinx traits traitsui + if: matrix.python-version != '3.12' && matrix.python-architecture != 'x86' - name: Create clean test directory run: | mkdir testdir @@ -60,7 +68,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] python-architecture: [x86, x64] exclude: - os: macos-latest @@ -89,12 +97,15 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.python-architecture }} - - name: Install prerequisites + allow-prereleases: true + - name: Install test dependencies and Traits from PyPI wheel (no PySide6) run: | - python -m pip install --upgrade pip setuptools wheel - - name: Install Traits and test dependencies from PyPI wheel + python -m pip install --only-binary traits Cython numpy Sphinx traits traitsui + if: matrix.python-version == '3.12' || matrix.python-architecture == 'x86' + - name: Install test dependencies and Traits from PyPI wheel (PySide6) run: | - python -m pip install --only-binary traits traits[test] + python -m pip install --only-binary traits Cython numpy PySide6 Sphinx traits traitsui + if: matrix.python-version != '3.12' && matrix.python-architecture != 'x86' - name: Create clean test directory run: | mkdir testdir diff --git a/pyproject.toml b/pyproject.toml index 96043e943..ea061849c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,5 +11,14 @@ profile = 'black' line_length = 79 order_by_type = 'False' +[tool.cibuildwheel] +skip = 'pp*' + +[tool.cibuildwheel.macos] +archs = ['auto', 'universal2'] + +[tool.cibuildwheel.linux] +archs = ['auto', 'aarch64'] + [tool.pytest.ini_options] addopts = '--ignore=traits-stubs' diff --git a/setup.py b/setup.py index a2ef6d7b6..c239618a6 100644 --- a/setup.py +++ b/setup.py @@ -281,6 +281,7 @@ def get_long_description(): Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering Topic :: Software Development @@ -302,10 +303,7 @@ def get_long_description(): extras_require={ "docs": [ "enthought-sphinx-theme", - # Doc builds are hanging with pygments 2.15.0 and 2.15.1. - # Maybe related: https://github.com/pygments/pygments/issues/2427 - "pygments<2.15", - "Sphinx", + "Sphinx>=2.1.0", "sphinx-copybutton", ], "test": [ @@ -313,14 +311,13 @@ def get_long_description(): "flake8", "flake8-ets", "mypy", - "numpy", + # NumPy is not yet available for Python 3.12, but that should be + # fixed soon: https://github.com/numpy/numpy/issues/23808 + "numpy; python_version < '3.12'", "pyface", - # Doc builds are hanging with pygments 2.15.0 and 2.15.1. - # Maybe related: https://github.com/pygments/pygments/issues/2427 - "pygments<2.15", "PySide6; python_version >= '3.7' and python_version < '3.12'", "setuptools", - "Sphinx", + "Sphinx>=2.1.0", "traitsui", ], "examples": [