Skip to content

Commit 0e6a682

Browse files
authored
Bump PyInstaller to 6.12, Ruff to 0.9.6, and simplify UV build workaround (#316)
1 parent 5e21312 commit 0e6a682

File tree

8 files changed

+696
-651
lines changed

8 files changed

+696
-651
lines changed

.github/workflows/lint-and-build.yml

+13-18
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ on:
1212
branches:
1313
- main
1414
paths:
15-
- "**.py"
16-
- "**.ui"
1715
- ".github/workflows/lint-and-build.yml"
18-
- "**/requirements.txt"
16+
- "src/**"
17+
- "scripts/**"
18+
- "*.toml"
19+
- "uv.lock"
1920
pull_request:
2021
branches:
2122
- main
2223
paths:
23-
- "**.py"
24-
- "**.pyi"
25-
- "**.ui"
2624
- ".github/workflows/lint-and-build.yml"
27-
- "**/requirements*.txt"
25+
- "src/**"
26+
- "scripts/**"
27+
- "*.toml"
28+
- "uv.lock"
2829

2930
env:
3031
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
@@ -35,7 +36,7 @@ concurrency:
3536
cancel-in-progress: true
3637

3738
jobs:
38-
ruff:
39+
Ruff:
3940
runs-on: ubuntu-22.04
4041
steps:
4142
- uses: actions/checkout@v4
@@ -83,25 +84,19 @@ jobs:
8384
python-version: "3.11"
8485
steps:
8586
- uses: actions/checkout@v4
87+
# region https://github.com/pyinstaller/pyinstaller/issues/9012
8688
- name: Set up uv for Python ${{ matrix.python-version }}
87-
if: ${{ matrix.os == 'windows-latest' }}
88-
uses: astral-sh/setup-uv@v5
89-
with:
90-
enable-cache: true
91-
cache-dependency-glob: "uv.lock"
92-
python-version: ${{ matrix.python-version }}
93-
# https://github.com/pyinstaller/pyinstaller/issues/9012
94-
- name: Set up uv
95-
if: ${{ matrix.os == 'ubuntu-22.04' }}
9689
uses: astral-sh/setup-uv@v5
9790
with:
9891
enable-cache: true
9992
cache-dependency-glob: "uv.lock"
93+
python-version: ${{ !startsWith(matrix.os, 'ubuntu') && matrix.python-version || null }}
10094
- name: Set up Python for PyInstaller tk issue
101-
if: ${{ matrix.os == 'ubuntu-22.04' }}
95+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
10296
uses: actions/setup-python@v5
10397
with:
10498
python-version: ${{ matrix.python-version }}
99+
# endregion
105100
- run: scripts/install.ps1
106101
shell: pwsh
107102
- run: scripts/build.ps1

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: pretty-format-ini
2020
args: [--autofix]
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.8.5 # Must match requirements-dev.txt
22+
rev: v0.9.6 # Must match requirements-dev.txt
2323
hooks:
2424
- id: ruff
2525
args: [--fix]

pyproject.toml

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies = [
77
"Levenshtein >=0.25",
88
"PyAutoGUI >=0.9.52",
99
"PyWinCtl >=0.0.42", # py.typed
10-
"keyboard",
10+
"keyboard", # [see tool.uv.sources]
1111
"numpy >=2.1", # Python 3.13 support
1212
"opencv-python-headless >=4.10", # NumPy 2 support
1313
"packaging >=20.0", # py.typed
@@ -21,7 +21,7 @@ dependencies = [
2121

2222
#
2323
# Build and compile resources
24-
"pyinstaller >=6.10.0", # Python 3.13 support
24+
"pyinstaller >=6.12.0", # Build fix for built-in _tkinter (splash screen)
2525

2626
#
2727
# https://peps.python.org/pep-0508/#environment-markers
@@ -51,19 +51,19 @@ dev = [
5151
"qt6-applications >=6.5.0",
5252
#
5353
# Linters & Formatters
54-
"mypy >=1.14",
54+
"mypy[faster-cache] >=1.14",
5555
"pyright[nodejs] >=1.1",
56-
"ruff >=0.8.5",
56+
"ruff >=0.9.6",
5757
#
58-
# Types (pins based on implementation version)
58+
# Types
5959
"scipy-stubs >=1.14.1.1",
60-
"types-PyAutoGUI >=0.9.3",
61-
"types-PyScreeze >=1.0.0; sys_platform == 'linux'",
62-
"types-keyboard >=0.13.2",
63-
"types-psutil >=6.0.0",
64-
"types-pyinstaller >=6.10.0",
65-
"types-python-xlib >=0.33; sys_platform == 'linux'",
66-
"types-pywin32 >=307; sys_platform == 'win32'",
60+
"types-PyAutoGUI",
61+
"types-PyScreeze; sys_platform == 'linux'",
62+
"types-keyboard",
63+
"types-psutil",
64+
"types-pyinstaller",
65+
"types-python-xlib; sys_platform == 'linux'",
66+
"types-pywin32 >=306.0.0.20240130; sys_platform == 'win32'",
6767
]
6868
[tool.uv]
6969
dependency-metadata = [

ruff.toml

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ ignore = [
6464
# Conflict with formatter (you can remove this section if you don't use Ruff as a formatter)
6565
###
6666
"COM812", # missing-trailing-comma
67-
"ISC001", # single-line-implicit-string-concatenation
6867
"RUF028", # invalid-formatter-suppression-comment, Is meant for the formatter, but false-positives
6968

7069
###

scripts/build.ps1

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
& "$PSScriptRoot/compile_resources.ps1"
22

3+
$SupportsSplashScreen = [System.Convert]::ToBoolean($(uv run python -c "import _tkinter; print(hasattr(_tkinter, '__file__'))"))
4+
35
$arguments = @(
46
"$PSScriptRoot/../src/AutoSplit.py",
57
'--onefile',
68
'--windowed',
79
'--additional-hooks-dir=Pyinstaller/hooks',
8-
'--icon=res/icon.ico',
9-
'--splash=res/splash.png')
10+
'--icon=res/icon.ico')
11+
if ($SupportsSplashScreen) {
12+
# https://github.com/pyinstaller/pyinstaller/issues/9022
13+
$arguments += @('--splash=res/splash.png')
14+
}
1015
if ($IsWindows) {
1116
$arguments += @(
1217
# Hidden import by winrt.windows.graphics.imaging.SoftwareBitmap.create_copy_from_surface_async
1318
'--hidden-import=winrt.windows.foundation')
1419
}
15-
if ($IsLinux) {
16-
$arguments += @(
17-
# Required on the CI for PyWinCtl
18-
'--hidden-import pynput.keyboard._xorg',
19-
'--hidden-import pynput.mouse._xorg')
20-
}
2120

22-
Start-Process -Wait -NoNewWindow uv -ArgumentList $(@("run", "pyinstaller")+$arguments)
21+
Start-Process -Wait -NoNewWindow uv -ArgumentList $(@('run', 'pyinstaller') + $arguments)
2322

2423
If ($IsLinux) {
2524
Move-Item -Force $PSScriptRoot/../dist/AutoSplit $PSScriptRoot/../dist/AutoSplit.elf

scripts/lint.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ else {
1515
Write-Host "`nRunning Ruff format ..."
1616
uv run ruff format
1717

18-
$pyrightVersion = $(uv run pyright --version).replace("pyright ", "")
18+
$pyrightVersion = $(uv run pyright --version).replace('pyright ', '')
1919
Write-Host "`nRunning Pyright $pyrightVersion ..."
2020
$Env:PYRIGHT_PYTHON_FORCE_VERSION = $pyrightVersion
2121
uv run pyright src/

src/menu_bar.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
)
4949

5050

51-
class __AboutWidget(QtWidgets.QWidget, about.Ui_AboutAutoSplitWidget): # noqa: N801 # Private class
51+
class __AboutWidget(QtWidgets.QWidget, about.Ui_AboutAutoSplitWidget):
5252
"""About Window."""
5353

5454
def __init__(self):
@@ -65,7 +65,7 @@ def open_about(autosplit: "AutoSplit"):
6565
autosplit.AboutWidget = __AboutWidget()
6666

6767

68-
class __UpdateCheckerWidget(QtWidgets.QWidget, update_checker.Ui_UpdateChecker): # noqa: N801 # Private class
68+
class __UpdateCheckerWidget(QtWidgets.QWidget, update_checker.Ui_UpdateChecker):
6969
def __init__(
7070
self,
7171
latest_version: str,
@@ -119,7 +119,7 @@ def view_help():
119119
webbrowser.open(f"https://github.com/{GITHUB_REPOSITORY}/blob/main/docs/tutorial.md")
120120

121121

122-
class __CheckForUpdatesThread(QtCore.QThread): # noqa: N801 # Private class
122+
class __CheckForUpdatesThread(QtCore.QThread):
123123
def __init__(self, autosplit: "AutoSplit", *, check_on_open: bool):
124124
super().__init__()
125125
self._autosplit_ref = autosplit
@@ -159,7 +159,7 @@ def check_for_updates(autosplit: "AutoSplit", *, check_on_open: bool = False):
159159
autosplit.CheckForUpdatesThread.start()
160160

161161

162-
class __SettingsWidget(QtWidgets.QWidget, settings_ui.Ui_SettingsWidget): # noqa: N801 # Private class
162+
class __SettingsWidget(QtWidgets.QWidget, settings_ui.Ui_SettingsWidget):
163163
def __init__(self, autosplit: "AutoSplit"):
164164
super().__init__()
165165
self.__video_capture_devices: list[CameraInfo] = []

0 commit comments

Comments
 (0)