From 20ef4870f4791df2af5b251f05691e8cd594076e Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 25 Oct 2024 00:44:09 -0400 Subject: [PATCH] Add support for Python 3.13 (#298) --- .github/workflows/lint-and-build.yml | 9 ++++++--- .vscode/launch.json | 6 +++--- mypy.ini | 1 + scripts/build.ps1 | 3 ++- scripts/install.ps1 | 6 +++--- scripts/requirements.txt | 20 +++++++++----------- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/lint-and-build.yml b/.github/workflows/lint-and-build.yml index 414cc845..0ca3caff 100644 --- a/.github/workflows/lint-and-build.yml +++ b/.github/workflows/lint-and-build.yml @@ -46,7 +46,7 @@ jobs: # Ruff is version and platform sensible matrix: os: [windows-latest, ubuntu-22.04] - python-version: ["3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] steps: - name: Checkout ${{ github.repository }}/${{ github.ref }} uses: actions/checkout@v4 @@ -66,7 +66,7 @@ jobs: # Pyright is version and platform sensible matrix: os: [windows-latest, ubuntu-22.04] - python-version: ["3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] steps: - name: Checkout ${{ github.repository }}/${{ github.ref }} uses: actions/checkout@v4 @@ -99,7 +99,10 @@ jobs: # Only the Python version we plan on shipping matters. matrix: os: [windows-latest, ubuntu-22.04] - python-version: ["3.11", "3.12"] + python-version: ["3.12", "3.13"] + include: + - os: ubuntu-22.04 + python-version: "3.11" # I had some Qt Wayland issues on 3.12 for ubuntu-22.04 iirc. TODO: test it steps: - name: Checkout ${{ github.repository }}/${{ github.ref }} uses: actions/checkout@v4 diff --git a/.vscode/launch.json b/.vscode/launch.json index 957b8d50..270f80e1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "Python: AutoSplit (debug non-user code)", - "type": "python", + "type": "debugpy", "request": "launch", "preLaunchTask": "Compile resources", "program": "src/AutoSplit.py", @@ -15,7 +15,7 @@ }, { "name": "Python: AutoSplit", - "type": "python", + "type": "debugpy", "request": "launch", "preLaunchTask": "Compile resources", "program": "src/AutoSplit.py", @@ -24,7 +24,7 @@ }, { "name": "Python: AutoSplit --auto-controlled", - "type": "python", + "type": "debugpy", "request": "launch", "preLaunchTask": "Compile resources", "program": "src/AutoSplit.py", diff --git a/mypy.ini b/mypy.ini index 1a57757e..7a8a4815 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,7 @@ ; We don't run mypy in the CI. This is just to help anyone who would like to use it manually. ; Namely, the mypy_primer tool. [mypy] +python_version = 3.11 show_column_numbers = true mypy_path = $MYPY_CONFIG_FILE_DIR/typings implicit_reexport = true diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 3d416c9f..3dd62f23 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -21,7 +21,8 @@ if ($IsWindows) { $arguments += @( # Installed by PyAutoGUI '--exclude=pyscreeze' - # Installed by D3DShot + # Sometimes installed by other automation/image libraries. + # Keep this exclusion even if nothing currently installs it, to stay future-proof. '--exclude=PIL') } if ($IsLinux) { diff --git a/scripts/install.ps1 b/scripts/install.ps1 index f7bd1bcd..ef55a7ea 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -50,12 +50,12 @@ If ($IsLinux) { # PyAutoGUI: We only use it for hotkeys &"$python" -m pip install PyAutoGUI --no-deps --upgrade -# Uninstall optional dependencies if PyAutoGUI or D3DShot was installed outside this script +# Uninstall optional dependencies if PyAutoGUI was installed outside this script # PyScreeze -> pyscreenshot -> mss deps call SetProcessDpiAwareness, used to be installed on Windows -# Pillow, pygetwindow, pymsgbox, pytweening, MouseInfo are picked up by PySide6 +# pygetwindow, pymsgbox, pytweening, MouseInfo are picked up by PyInstaller # (also --exclude from build script, but more consistent with unfrozen run) &"$python" -m pip uninstall pyscreenshot mss pygetwindow pymsgbox pytweening MouseInfo -y -If ($IsWindows) { &"$python" -m pip uninstall PyScreeze Pillow -y } +If ($IsWindows) { &"$python" -m pip uninstall PyScreeze -y } # Don't compile resources on the Build CI job as it'll do so in build script If ($dev) { diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 69d458a5..ad83222b 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -5,30 +5,28 @@ # Dependencies: git+https://github.com/boppreh/keyboard.git#egg=keyboard # Fix install on macos and linux-ci https://github.com/boppreh/keyboard/pull/568 Levenshtein>=0.25 -# Some modules used by OpenCV are not compiled for Numpy 2 yet on Linux. Error happens on import at runtime -numpy>=1.26,<2.0 # Python 3.12 support -opencv-python-headless>=4.9.0.80 # Typing fixes +numpy>=2.1 # Python 3.13 support +opencv-python-headless>=4.10 # NumPy 2 support packaging -psutil>=5.9.6 # Python 3.12 fixes -# PyAutoGUI # See install.ps1 +psutil>=6.0.0 # Python 3.13 support +# PyAutoGUI # See install.ps1 PyWinCtl>=0.0.42 # py.typed # When needed, dev builds can be found at https://download.qt.io/snapshots/ci/pyside/dev?C=M;O=D -PySide6-Essentials>=6.6.0 # Python 3.12 support -scipy>=1.11.2 # Python 3.12 support +PySide6-Essentials>=6.8.0.2 # Python 3.13 support +scipy>=1.14.1 # Python 3.13 support tomli-w>=1.1.0 # Typing fixes typing-extensions>=4.4.0 # @override decorator support # # Build and compile resources -pyinstaller>=5.13 # Python 3.12 support +pyinstaller>=6.10.0 # Python 3.13 support # # https://peps.python.org/pep-0508/#environment-markers # # Windows-only dependencies: -comtypes<1.4.5 ; sys_platform == 'win32' # https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/807 pygrabber>=0.2 ; sys_platform == 'win32' # Completed types -pywin32>=301 ; sys_platform == 'win32' +pywin32>=307 ; sys_platform == 'win32' # Python 3.13 support typed-D3DShot[numpy]>=1.0.1 ; sys_platform == 'win32' winrt-Windows.Foundation>=2.2.0 ; sys_platform == 'win32' # Python 3.13 support winrt-Windows.Graphics.Capture>=2.3.0 ; sys_platform == 'win32' # Python 3.13 support @@ -42,5 +40,5 @@ winrt-Windows.Graphics.Imaging>=2.3.0 ; sys_platform == 'win32' # Python 3.13 s # # Linux-only dependencies PyScreeze ; sys_platform == 'linux' -pillow ; sys_platform == 'linux' # Necessary for PyScreeze. For unknown reasons it's not pulled in on CI +pillow>=11.0 ; sys_platform == 'linux' # Python 3.13 support # Necessary for PyScreeze. For unknown reasons it's not pulled in on CI python-xlib ; sys_platform == 'linux'