diff --git a/.github/workflows/lint-and-build.yml b/.github/workflows/lint-and-build.yml index 0f0050fc..a5dcd70e 100644 --- a/.github/workflows/lint-and-build.yml +++ b/.github/workflows/lint-and-build.yml @@ -45,7 +45,7 @@ jobs: fail-fast: false # Ruff is version and platform sensible matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout ${{ github.repository }}/${{ github.ref }} uses: actions/checkout@v3 @@ -64,7 +64,7 @@ jobs: fail-fast: false # Pyright is version and platform sensible matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout ${{ github.repository }}/${{ github.ref }} uses: actions/checkout@v3 @@ -87,7 +87,7 @@ jobs: fail-fast: false # Only the Python version we plan on shipping matters. matrix: - python-version: ["3.11"] + python-version: ["3.11", "3.12"] steps: - name: Checkout ${{ github.repository }}/${{ github.ref }} uses: actions/checkout@v3 diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 4a69364d..56192197 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1 +1 @@ -sonar.python.version=3.10, 3.11 +sonar.python.version=3.10, 3.11, 3.12 diff --git a/scripts/build.ps1 b/scripts/build.ps1 index b0ed2844..bd6e3be9 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -5,13 +5,19 @@ $arguments = @( '--onefile', '--windowed', '--additional-hooks-dir=Pyinstaller/hooks', - # Optional packages installed by PyAutoGUI + '--icon=res/icon.ico', + '--splash=res/splash.png', + # The install script should ensure that these are not installed + # But we'll still include unused dependencies that would be picked up by PyInstaller + # if requirements.txt was used directly to help ensure consistency when buildign locally. + # + # Installed by PyAutoGUI + '--exclude=pyscreeze', '--exclude=pygetwindow', '--exclude=pymsgbox', '--exclude=pytweening', + '--exclude=mouseinfo', # Used by imagehash.whash - '--exclude=pywt', - '--icon=res/icon.ico', - '--splash=res/splash.png') + '--exclude=pywt') Start-Process -Wait -NoNewWindow pyinstaller -ArgumentList $arguments diff --git a/scripts/install.ps1 b/scripts/install.ps1 index eda5612f..140af292 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -3,10 +3,16 @@ $dev = If ($Env:GITHUB_JOB -eq 'Build') { '' } Else { '-dev' } # Ensures installation tools are up to date. This also aliases pip to pip3 on MacOS. python -m pip install wheel pip setuptools --upgrade pip install -r "$PSScriptRoot/requirements$dev.txt" --upgrade +# These libraries install extra requirements we don't want +# Open suggestion for support in requirements files: https://github.com/pypa/pip/issues/9948 & https://github.com/pypa/pip/pull/10837 +# PyAutoGUI: We only use it for hotkeys +# ImageHash: uneeded + broken on Python 3.12 PyWavelets install +# scipy: needed for ImageHash +pip install PyAutoGUI ImageHash scipy --no-deps --upgrade # Patch libraries so we don't have to install from git -# Prevent pyautogui and pywinctl from setting Process DPI Awareness, which Qt tries to do then throws warnings about it. +# Prevent PyAutoGUI and pywinctl from setting Process DPI Awareness, which Qt tries to do then throws warnings about it. # The unittest workaround significantly increases build time, boot time and build size with PyInstaller. # https://github.com/asweigart/pyautogui/issues/663#issuecomment-1296719464 $libPath = python -c 'import pyautogui as _; print(_.__path__[0])' @@ -18,8 +24,11 @@ $libPath = python -c 'import pymonctl as _; print(_.__path__[0])' $libPath = python -c 'import pywinbox as _; print(_.__path__[0])' (Get-Content "$libPath/_pywinbox_win.py").replace('ctypes.windll.shcore.SetProcessDpiAwareness(2)', 'pass') | Set-Content "$libPath/_pywinbox_win.py" -# Uninstall optional dependencies that PyInstaller picks up -python -m pip uninstall pyscreeze mouseinfo pyperclip -y +# Uninstall optional dependencies if PyAutoGUI was installed outside this script +# pyscreeze -> pyscreenshot -> mss deps call SetProcessDpiAwareness +# pygetwindow, pymsgbox, pytweening, MouseInfo are picked up by PySide6 +# (also --exclude from build script, but more consistent with unfrozen run) +python -m pip uninstall pyscreeze pyscreenshot mss pygetwindow pymsgbox pytweening MouseInfo -y # Don't compile resources on the Build CI job as it'll do so in build script diff --git a/scripts/requirements-dev.txt b/scripts/requirements-dev.txt index 1f7aadf4..ffdc1ed1 100644 --- a/scripts/requirements-dev.txt +++ b/scripts/requirements-dev.txt @@ -3,6 +3,11 @@ # If you're having issues with the libraries, you might want to first run: # pip uninstall -y -r ./scripts/requirements-dev.txt # +# Tools +# Run `./scripts/designer.ps1` to quickly open the bundled Qt Designer. +# Can also be downloaded externally as a non-python package +# qt6-applications +# # Dependencies -r requirements.txt # @@ -11,9 +16,6 @@ add-trailing-comma>=3.1.0 # Must match .pre-commit-config.yaml autopep8>=2.0.4 # Must match .pre-commit-config.yaml ruff>=0.1.1 # New checks # Must match .pre-commit-config.yaml # -# Run `./scripts/designer.ps1` to quickly open the bundled Qt Designer. -# Can also be downloaded externally as a non-python package -# qt6-applications # Types types-D3DShot ; sys_platform == 'win32' types-keyboard diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 11dea0e7..a0782294 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -4,28 +4,29 @@ # # Dependencies: certifi -ImageHash>=4.3.1 # Contains type information + setup as package not module +ImageHash>=4.3.1 ; python_version < '3.12' # Contains type information + setup as package not module # PyWavelets install broken on Python 3.12 git+https://github.com/boppreh/keyboard.git#egg=keyboard # Fix install on macos and linux-ci https://github.com/boppreh/keyboard/pull/568 -numpy>=1.23.2 # Python 3.11 wheels +numpy>=1.26 # Python 3.12 support opencv-python-headless>=4.8.1.78 # Typing fixes packaging -Pillow>=9.2 # gnome-screeshot checks -psutil +Pillow>=10.0 # Python 3.12 support +psutil>=5.9.6 # Python 3.12 fixes PyAutoGUI PyWinCtl>=0.0.42 # py.typed -PySide6-Essentials>=6.5.1 # fixes incomplete tuple return types https://bugreports.qt.io/browse/PYSIDE-2285 -requests<=2.28.1 # 2.28.2 has issues with PyInstaller https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/534 +# When needed, dev builds can be found at https://download.qt.io/snapshots/ci/pyside/dev +PySide6-Essentials>=6.6.0 # Python 3.12 support +requests>=2.28.2 # charset_normalizer 3.x update toml typing-extensions>=4.4.0 # @override decorator support # # Build and compile resources -pyinstaller>=5.5 # Python 3.11 support -pyinstaller-hooks-contrib>=2022.9 # opencv-python 4.6 support. Changes for pywintypes and comtypes +pyinstaller>=5.13 # Python 3.12 support +pyinstaller-hooks-contrib>=2022.15 # charset-normalizer fix https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/534 # # https://peps.python.org/pep-0508/#environment-markers # # Windows-only dependencies: pygrabber>=0.2 ; sys_platform == 'win32' # Completed types pywin32>=301 ; sys_platform == 'win32' -winsdk>=v1.0.0b7 ; sys_platform == 'win32' # Python 3.11 support +winsdk>=1.0.0b10 ; sys_platform == 'win32' # Python 3.12 support git+https://github.com/ranchen421/D3DShot.git#egg=D3DShot ; sys_platform == 'win32' # D3DShot from PyPI with Pillow>=7.2.0 will install 0.1.3 instead of 0.1.5