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

Try building on Python 3.12 #257

Merged
merged 6 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/lint-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"]
Avasam marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sonar.python.version=3.10, 3.11
sonar.python.version=3.10, 3.11, 3.12
14 changes: 10 additions & 4 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 12 additions & 3 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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])'
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions scripts/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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
Expand Down
19 changes: 10 additions & 9 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading