Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI and workflows for Python 3.12 support #1757

Merged
merged 9 commits into from
Sep 11, 2023
2 changes: 1 addition & 1 deletion .github/workflows/release-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: python -m pip install twine

- name: Build wheels
uses: pypa/cibuildwheel@v2.9.0
uses: pypa/cibuildwheel@v2.15.0

- name: Check and upload wheels
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run-core-traits-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -21,6 +21,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows setup-python to install a Python 3.12 pre-release, and avoids the need to change these workflows again once Python 3.12.0 is released.

- name: Install local package
run: |
# Uninstall setuptools so that the tests will catch any accidental
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/run-traits-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix while we're touching this file, unrelated to the rest of the PR.

# xref: enthought/traits#1742
ETS_QT4_IMPORTS: 1

Expand All @@ -14,13 +14,13 @@ 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 }}

steps:
- uses: actions/checkout@v3
- name: Install Linux packages for Qt 5 support
- name: Install Linux packages for Qt support
run: |
sudo apt-get update
sudo apt-get install libegl1
Expand All @@ -37,6 +37,7 @@ 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 .[test]
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/test-from-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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
Expand All @@ -27,7 +27,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Install Linux packages for Qt 5 support
- name: Install Linux packages for Qt support
run: |
sudo apt-get update
sudo apt-get install libegl1
Expand All @@ -45,14 +45,15 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}
allow-prereleases: true
- name: Install test dependencies and Traits from PyPI sdist (no PySide6)
run: |
python -m pip install --no-binary traits Cython numpy Sphinx traits traitsui
if: matrix.python-version == '3.11' || matrix.python-architecture == 'x86'
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 Cython numpy PySide6 Sphinx traits traitsui
if: matrix.python-version != '3.11' && matrix.python-architecture != 'x86'
if: matrix.python-version != '3.12' && matrix.python-architecture != 'x86'
- name: Create clean test directory
run: |
mkdir testdir
Expand All @@ -67,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
Expand All @@ -78,7 +79,7 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Install Linux packages for Qt 5 support
- name: Install Linux packages for Qt support
run: |
sudo apt-get update
sudo apt-get install libegl1
Expand All @@ -96,14 +97,15 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}
allow-prereleases: true
- name: Install test dependencies and Traits from PyPI wheel (no PySide6)
run: |
python -m pip install --only-binary traits Cython numpy Sphinx traits traitsui
if: matrix.python-version == '3.11' || matrix.python-architecture == 'x86'
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 Cython numpy PySide6 Sphinx traits traitsui
if: matrix.python-version != '3.11' && matrix.python-architecture != 'x86'
if: matrix.python-version != '3.12' && matrix.python-architecture != 'x86'
- name: Create clean test directory
run: |
mkdir testdir
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ['setuptools<65.2', 'wheel']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should be able to verify that the original issue (#1722) got resolved by simply creating an edm environment and pip installing traits locally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this. Yes, that should work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And FWIW, it works for me locally:

mdickinson@mirzakhani traits % edm shell -e bob
Starting new shell in EDM environment 'bob'.
Type 'exit' or 'Ctrl+D' to return.
mdickinson@mirzakhani traits % pip install .
Processing /Users/mdickinson/Enthought/ETS/traits
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: traits
  Building wheel for traits (pyproject.toml) ... done
  Created wheel for traits: filename=traits-7.0.0.dev1851-cp38-cp38-macosx_10_14_x86_64.whl size=5035351 sha256=cbd45aee56f93007374dcb2c7330d9f1707f852c1a1add1b90cfbda84db196e4
  Stored in directory: /private/var/folders/07/jbbjv8b53bs5y9xyjdyn1zgw0000gn/T/pip-ephem-wheel-cache-1i0m0er8/wheels/80/64/db/3f6e4e87e7ce87ed7ce15857cd598e38271c06a101e37b45bb
Successfully built traits
Installing collected packages: traits
Successfully installed traits-7.0.0.dev1851

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep yep it worked for me locally on python 3.11.4 edm

requires = ['setuptools', 'wheel']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Older versions of setuptools break with Python 3.12, so it was necessary to remove this restriction.

build-backend = 'setuptools.build_meta'

[tool.black]
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,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
Expand Down Expand Up @@ -316,9 +317,11 @@ 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",
"PySide6; python_version >= '3.7' and python_version < '3.11'",
"PySide6; python_version >= '3.7' and python_version < '3.12'",
"setuptools",
"Sphinx>=2.1.0",
"traitsui",
Expand Down