From 2f07fcca193e0b0f8b387617b267b55c60eefb2f Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio Date: Thu, 28 Dec 2023 03:10:38 +0000 Subject: [PATCH 1/3] wheel: Remove tmp workaround with pygame version. As discussed in https://github.com/mu-editor/mu/issues/2423 pygame version 2.5.1 should have fixed the issue with older macOS releases. So, we can remove this max version clamp. --- mu/wheels/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mu/wheels/__init__.py b/mu/wheels/__init__.py index f967d47bd..f731cc480 100644 --- a/mu/wheels/__init__.py +++ b/mu/wheels/__init__.py @@ -37,11 +37,7 @@ class WheelsBuildError(WheelsError): # Any additional elements are passed to `pip` for specific purposes # mode_packages = [ - # pygame is a pgzero dependency, but there is currently an issue where - # pygame versions >=2.1.3 have issues in macOS 10.x, so temporarily for - # Mu release 1.2.1 pin the max version here - # https://github.com/mu-editor/mu/issues/2423 - ("pgzero", ("pgzero>=1.2.1", "pygame<2.1.3")), + ("pgzero", ("pgzero>=1.2.1",)), # Lock Werkzeug to < 3.0.0: import flask fails, otherwise. ("flask", ("flask==2.0.3", "Werkzeug<3.0.0")), # The version of ipykernel here should match to the version used by From 9a0f269e982cfd538dd2e7aa285940bd532369c3 Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio Date: Fri, 12 Jan 2024 15:39:37 +0000 Subject: [PATCH 2/3] Upgrade PyQt5, test more Python versions, and macOS arm64. --- .github/workflows/codeql.yml | 2 +- .github/workflows/test.yml | 46 ++++++++++-------------------- Makefile | 4 +-- mu/wheels/__init__.py | 17 ++++-------- setup.py | 54 +++++++++++++++++++----------------- 5 files changed, 51 insertions(+), 72 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3d09e5a64..071233a9f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -15,7 +15,7 @@ jobs: analyze: timeout-minutes: 20 name: Analyze - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 permissions: actions: read contents: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c97a2b29a..ab8a3f0e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,15 +11,15 @@ jobs: timeout-minutes: 30 strategy: matrix: - # macos-13 is x86 and macos-14 is arm64 - os: [ubuntu-20.04, ubuntu-latest, macos-13, windows-2019, windows-latest] - python-version: ['3.5', '3.6', '3.7', '3.8'] + # macos-13 is the last release on x86, and macos-14 is arm64 + os: [ubuntu-20.04, ubuntu-24.04, macos-13, macos-14, windows-2019, windows-latest] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] exclude: - # Python 3.5 and 3.6 not available in the latest Ubuntu runners - - os: ubuntu-latest - python-version: '3.5' - - os: ubuntu-latest - python-version: '3.6' + # These Python versions are not available in macOS arm64 or Ubuntu 24.04 + - os: macos-14 + python-version: '3.7' + - os: ubuntu-24.04 + python-version: '3.7' fail-fast: false runs-on: ${{ matrix.os }} name: Test Py ${{ matrix.python-version }} - ${{ matrix.os }} @@ -29,10 +29,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - env: - # Workaround to issue using Python 3.5 - # https://github.com/actions/setup-python/issues/866 - PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" - name: Display Python info run: | python -c "import sys; print(sys.version)" @@ -42,11 +38,6 @@ jobs: pip --version pip config list pip freeze - - name: Prepare Ubuntu - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libxkbcommon-x11-0 xvfb - name: Install Mu dependencies run: | pip install .[dev] @@ -54,7 +45,7 @@ jobs: timeout-minutes: 10 - name: Run tests if: runner.os == 'Linux' - run: xvfb-run make check + run: QT_QPA_PLATFORM=offscreen python make.py check timeout-minutes: 5 - name: Run tests if: runner.os != 'Linux' @@ -105,7 +96,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - docker-tag: ['stretch-2018-03-13', 'buster-2021-05-28', 'buster-legacy-2023-05-03'] + docker-tag: ['buster-2021-05-28', 'buster-legacy-2023-05-03', 'bullseye-2023-05-03'] fail-fast: false services: rpios: @@ -131,16 +122,6 @@ jobs: git checkout --progress FETCH_HEAD echo "cd ~/mu" > ~/.bashrc_new && cat ~/.bashrc >> ~/.bashrc_new rm ~/.bashrc && mv ~/.bashrc_new ~/.bashrc - # As Pi OS stretch is no longer supported the repository URL was moved and is no longer updated - - name: Update Stretch sources.list - if: ${{ matrix.docker-tag == 'stretch-2018-03-13' }} - uses: appleboy/ssh-action@v1.0.3 - with: - host: rpios - username: pi - password: raspberry - port: ${{ job.services.rpios.ports[5022] }} - script: echo "deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi" | sudo tee /etc/apt/sources.list - name: Install Mu extra apt dependencies uses: appleboy/ssh-action@v1.0.3 with: @@ -159,13 +140,15 @@ jobs: password: raspberry port: ${{ job.services.rpios.ports[5022] }} command_timeout: 25m + # Some compiled packages take a while to be built in piwheels, so to + # avoid intermittent pip install failures we use `--prefer-binary` script: | python3 -m virtualenv ~/mu/.venv -v --python=python3 --system-site-packages echo "source ~/mu/.venv/bin/activate" > ~/.bashrc_new && cat ~/.bashrc >> ~/.bashrc_new rm ~/.bashrc && mv ~/.bashrc_new ~/.bashrc source .venv/bin/activate python -m pip list - python -m pip install ".[dev]" + python -m pip install ."[dev]" --prefer-binary - name: Environment info uses: appleboy/ssh-action@v1.0.3 with: @@ -186,6 +169,5 @@ jobs: username: pi password: raspberry port: ${{ job.services.rpios.ports[5022] }} - # The time out can be decreased to 30 min when Stretch is dropped - command_timeout: 45m + command_timeout: 30m script: xvfb-run python make.py check diff --git a/Makefile b/Makefile index f3cde37ac..022096be6 100644 --- a/Makefile +++ b/Makefile @@ -112,9 +112,9 @@ macos: check # 1. Not really needed. # 2. Previously active venv would be "gone" on venv-pup deactivation. # Installing pup from a fork with the --pip-platform flag proof of concept - # and using it to install wheels for the `macosx_10_12_x86_64` platform + # and using it to install wheels for the `macosx_10_13_x86_64` platform ./venv-pup/bin/pip install git+https://github.com/carlosperate/pup.git@pip-platform - ./venv-pup/bin/pup package --launch-module=mu --nice-name="Mu Editor" --icon-path=./package/icons/mac_icon.icns --license-path=./LICENSE --pip-platform=macosx_10_12_x86_64 . + ./venv-pup/bin/pup package --launch-module=mu --nice-name="Mu Editor" --icon-path=./package/icons/mac_icon.icns --license-path=./LICENSE --pip-platform=macosx_10_13_x86_64 . rm -r venv-pup ls -la ./build/pup/ ls -la ./dist/ diff --git a/mu/wheels/__init__.py b/mu/wheels/__init__.py index f731cc480..6ee32d33c 100644 --- a/mu/wheels/__init__.py +++ b/mu/wheels/__init__.py @@ -42,14 +42,9 @@ class WheelsBuildError(WheelsError): ("flask", ("flask==2.0.3", "Werkzeug<3.0.0")), # The version of ipykernel here should match to the version used by # qtconsole at the version specified in setup.py - # FIXME: ipykernel max ver added for macOS 10.13 compatibility, min taken - # from qtconsole 4.7.7. This is mirrored in setup.py - ("ipykernel", ("ipykernel>=4.1,<6",)), - # FIXME: ipykernel<6 depends on ipython_genutils, but it isn't explicitly - # declared as a dependency. It also depends on traitlets, which - # incidentally brought ipython_genutils, but in v5.1 it was dropped, so as - # a workaround we need to manually specify it here - ("ipython_genutils", ("ipython_genutils>=0.2.0",)), + # ipykernel max ver added for macOS 10.13 compatibility, min taken + # from setup.py. This is version has to mirror the one from setup.py + ("ipykernel", ("ipykernel>=5.5.6,<6",)), ] @@ -62,12 +57,12 @@ def os_compatibility_flags(): an issue to be resolved before doing a Mu release. """ extra_flags = [] - # For macOS the oldest supported version is 10.12 Sierra, as that's the - # oldest version supported by PyQt5 v5.13 + # For macOS the oldest supported version is 10.13 High Sierra, + # as that's the oldest version supported by PyQt5 v5.15 if sys.platform == "darwin": extra_flags.extend( [ - "--platform=macosx_10_12_x86_64", + "--platform=macosx_10_13_x86_64", "--only-binary=:all:", ] ) diff --git a/setup.py b/setup.py index d9b8a911f..919914a3d 100644 --- a/setup.py +++ b/setup.py @@ -25,31 +25,27 @@ # The core 'install_requires' should only be things # which are needed for the main editor to function. # - "PyQt5-sip<=12.13.0" - + ';"arm" not in platform_machine and "aarch" not in platform_machine', - "PyQt5==5.13.2" - + ';"arm" not in platform_machine and "aarch" not in platform_machine', - "QScintilla==2.11.3" - + ';"arm" not in platform_machine and "aarch" not in platform_machine', - "PyQtChart==5.13.1" - + ';"arm" not in platform_machine and "aarch" not in platform_machine', + "PyQt5==5.15.10" + + '; sys_platform != "linux" ' + + 'or ("arm" not in platform_machine and "aarch" not in platform_machine)', + "QScintilla==2.14.1" + + '; sys_platform != "linux" ' + + 'or ("arm" not in platform_machine and "aarch" not in platform_machine)', + "PyQtChart==5.15.6" + + '; sys_platform != "linux" ' + + 'or ("arm" not in platform_machine and "aarch" not in platform_machine)', # FIXME: Needed for qtconsole, this is the latest wheel in armv7l for # Python 3.7 (Buster), otherwise it tries to build from source and fails. "pyzmq<=26.0.3", - # FIXME: jupyter-client added for Py3.5 compatibility, to be dropped after - # Mu v1.1 release. So, qtconsole < 5 and jupyter-client < 6.2 (issue #1444) - "jupyter-client>=4.1,<6.2", - # FIXME: ipykernel max added for macOS 10.13 compatibility, min taken from - # qtconsole 4.7.7. Full line can be removed after Mu v1.1 release. - # Dependency mirrored for user venv in mu/wheels/__init__.py - "ipykernel>=4.1,<6", - # FIXME: ipykernel<6 depends on ipython_genutils, but it isn't explicitly - # declared as a dependency. It also depends on traitlets, which - # incidentally brought ipython_genutils, but in v5.1 it was dropped, so as - # a workaround we need to manually specify it here. - "ipython_genutils>=0.2.0", - "qtconsole==4.7.7", - # + # ipykernel has to be < v6 for macOS 10.13 compatibility (v6 depends on + # debugpy package), v5.5.6 resolves issue ipython/ipykernel#759. + # Full line can be removed after Mu v1.3 release as PyQt6 drops old macOS. + # ipykernel version has to be mirrored in mu/wheels/__init__.py + "ipykernel>=5.5.6,<6", + "qtconsole~=5.4", + # In Python 3.12 the deprecated 'imp' module was removed from the stdlib. + # ipykernel only moved to importlib in v6.10, so this is a "forward-port" + "zombie_imp>=0.0.2;python_version>='3.12'", # adafruit-board-toolkit is used to find serial ports and help identify # CircuitPython boards in the CircuitPython mode. "adafruit-board-toolkit~=1.1", @@ -63,7 +59,7 @@ "flake8 >= 3.8.3", # Clamp click max version to workaround incompatibility with black<22.1.0 "click<=8.0.4", - "black>=19.10b0,<22.1.0;python_version>'3.5'", + "black>=19.10b0,<22.1.0", "platformdirs>=2.0.0,<3.0.0", "semver>=2.8.0", # virtualenv vendors pip, we need at least pip v19.3 to install some @@ -80,6 +76,9 @@ # Needed to resolve an issue with paths in the user virtual environment # "pywin32; sys_platform=='win32'", + # pkg_resources has been removed in Python 3.12, until we move to importlib + # we need it via setuptools: https://github.com/mu-editor/mu/issues/2485 + "setuptools", ] @@ -133,7 +132,7 @@ "mu.modes.api", "mu.wheels", ], - python_requires=">=3.5,<3.9", + python_requires=">=3.7,<3.14", install_requires=install_requires, extras_require=extras_require, package_data={"mu.wheels": ["*.whl", "*.zip"]}, @@ -152,10 +151,13 @@ "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Education", "Topic :: Games/Entertainment", "Topic :: Software Development", From f2bac8a6ad6f8fa5853c081a3b6348c66db18fed Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio Date: Mon, 17 Feb 2025 23:57:53 +0000 Subject: [PATCH 3/3] Try to fix ipython. --- mu/wheels/__init__.py | 4 +--- setup.py | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mu/wheels/__init__.py b/mu/wheels/__init__.py index 6ee32d33c..2d5d03007 100644 --- a/mu/wheels/__init__.py +++ b/mu/wheels/__init__.py @@ -42,9 +42,7 @@ class WheelsBuildError(WheelsError): ("flask", ("flask==2.0.3", "Werkzeug<3.0.0")), # The version of ipykernel here should match to the version used by # qtconsole at the version specified in setup.py - # ipykernel max ver added for macOS 10.13 compatibility, min taken - # from setup.py. This is version has to mirror the one from setup.py - ("ipykernel", ("ipykernel>=5.5.6,<6",)), + ("ipykernel", ("ipykernel>=5.5.6",)), ] diff --git a/setup.py b/setup.py index 919914a3d..b435070ee 100644 --- a/setup.py +++ b/setup.py @@ -37,11 +37,13 @@ # FIXME: Needed for qtconsole, this is the latest wheel in armv7l for # Python 3.7 (Buster), otherwise it tries to build from source and fails. "pyzmq<=26.0.3", - # ipykernel has to be < v6 for macOS 10.13 compatibility (v6 depends on - # debugpy package), v5.5.6 resolves issue ipython/ipykernel#759. - # Full line can be removed after Mu v1.3 release as PyQt6 drops old macOS. + # We are using an internal method of jupyter_client, that changed in v7 + # QtKernelManager._launch_kernel() returning a KernelProvisionerBase + # https://github.com/jupyter/jupyter_client/commit/516d9df270b2e4603ee0ecd986554cb5fe1c2940 + "jupyter-client<7", + # ipykernel v5.5.6 resolves issue ipython/ipykernel#759. # ipykernel version has to be mirrored in mu/wheels/__init__.py - "ipykernel>=5.5.6,<6", + "ipykernel>=5.5.6", "qtconsole~=5.4", # In Python 3.12 the deprecated 'imp' module was removed from the stdlib. # ipykernel only moved to importlib in v6.10, so this is a "forward-port"