Skip to content
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
7 changes: 1 addition & 6 deletions .github/workflows/lint-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# Pyright is version and platform sensible
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.11", "3.12", "3.13"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up uv for Python ${{ matrix.python-version }}
Expand All @@ -80,11 +80,6 @@ jobs:
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.13"]
include:
# I had some Qt Wayland issues on 3.12 for ubuntu-22.04
# This should be fixed with QT_QPA_PLATFORM=xcb, but keeping it until next major upgrade
- os: ubuntu-22.04
python-version: "3.11"
steps:
- uses: actions/checkout@v4
# region https://github.com/pyinstaller/pyinstaller/issues/9012
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: pretty-format-ini
args: [--autofix]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.8 # Must match requirements-dev.txt
rev: v0.11.13 # Must match requirements-dev.txt
hooks:
- id: ruff
args: [--fix]
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- markdownlint-disable-next-line MD033 -->

# <img src="res/icon.ico" alt="LiveSplit" height="42" width="42" align="top"/> AutoSplit [![CodeQL](/../../actions/workflows/codeql-analysis.yml/badge.svg)](/../../actions/workflows/codeql-analysis.yml) [![Lint and build](/../../actions/workflows/lint-and-build.yml/badge.svg)](/../../actions/workflows/lint-and-build.yml)

[![SemVer](https://badgen.net/badge/_/SemVer%20compliant/grey?label)](https://semver.org/)
Expand Down Expand Up @@ -48,7 +49,7 @@ To understand how to use AutoSplit and how it works in-depth, please read the [t
- Should work on Ubuntu 20.04+ (Only tested on Ubuntu 22.04)
- Wayland is not currently supported
- WSL2/WSLg requires an additional Desktop Environment, external X11 server, and/or systemd
- Python 3.11+ (Not required for normal use. Refer to the [build instructions](/docs/build%20instructions.md) if you'd like run the application directly in Python).
- If you'd like to run the project directly in Python from the source code, refer to the [build instructions](/docs/build%20instructions.md).

## Timer Integration

Expand Down Expand Up @@ -130,6 +131,6 @@ Not a developer? You can still help through the following methods:

## Donate

If you enjoy using the program, please consider donating. Thank you!
If you enjoy using the program, please consider donating. Thank you!

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=BYRHQG69YRHBA&item_name=AutoSplit+development&currency_code=USD&source=url)
9 changes: 9 additions & 0 deletions docs/build instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ export UV_PROJECT_ENVIRONMENT=$(python3 -c "import sysconfig; print(sysconfig.ge

Read more: <https://docs.astral.sh/uv/concepts/projects/config/#project-environment-path>

Or you can create a separate environment then activate it:

```shell
uv venv .venv-linux
source .venv-linux/bin/activate
```

All scripts pass the `--active` flag to make sure the active environment is used.

### All platforms

- [uv](https://docs.astral.sh/uv/getting-started/installation/)
Expand Down
3 changes: 2 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ disallow_incomplete_defs = false
; exclude mypyc build
exclude = .*(build)/.*

python_version = 3.11
mypy_path = $MYPY_CONFIG_FILE_DIR/typings
implicit_reexport = true
allow_redefinition_new = true
local_partial_types = true

; Auto-generated code, not much we can do there
[mypy-gen.*]
Expand Down
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "AutoSplit"
dynamic = ["version"]
requires-python = " >=3.11"
version = "0"
requires-python = ">=3.13"
dependencies = [
# Dependencies:
"Levenshtein >=0.25",
Expand All @@ -16,7 +16,6 @@ dependencies = [
# "PySide6-Essentials >=6.8.2", # Fixed typing issue with QMessageBox.warning
"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
Expand Down Expand Up @@ -50,9 +49,9 @@ dev = [
"qt6-applications >=6.5.0",
#
# Linters & Formatters
"mypy[faster-cache] >=1.14",
"mypy[faster-cache] >=1.16",
"pyright[nodejs] >=1.1.400", # reportPrivateImportUsage behaviour change
"ruff >=0.11.8",
"ruff >=0.11.13", # Must match .pre-commit-config.yaml
#
# Types
"scipy-stubs >=1.14.1.1",
Expand All @@ -64,6 +63,11 @@ dev = [
"types-pywin32 >=306.0.0.20240130; sys_platform == 'win32'",
]
[tool.uv]
environments = [
# AutoSplit does not currently support macOS
"sys_platform == 'linux'",
"sys_platform == 'win32'",
]
dependency-metadata = [
# PyAutoGUI installs extra libraries we don't want. We only use it for hotkeys
# PyScreeze -> pyscreenshot -> mss deps calls SetProcessDpiAwareness on Windows
Expand All @@ -76,7 +80,6 @@ keyboard = { git = "https://github.com/boppreh/keyboard.git" } # Fix install on
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
[tool.pyright]
typeCheckingMode = "strict"
pythonVersion = "3.11"
# Prefer `pyright: ignore`
enableTypeIgnoreComments = false

Expand Down
4 changes: 4 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ ignore = [
"SIM105", # flake8-simplify: use-contextlib-suppress
# Negative performance impact and more verbose https://github.com/astral-sh/ruff/issues/7871
"UP038", # non-pep604-isinstance
# Not colored correctly in Pylance https://github.com/microsoft/pylance-release/issues/6942
"UP047", # non-pep695-generic-function
# Checked by type-checker (pyright/mypy)
"ANN", # flake-annotations
"PGH003", # blanket-type-ignore
Expand Down Expand Up @@ -113,6 +115,8 @@ allow-multiline = false
[lint.isort]
combine-as-imports = true
split-on-trailing-comma = false
# When ran through pre-commit, the src-based layout detection differs
known-third-party = ["gen"]

# https://docs.astral.sh/ruff/settings/#mccabe
[lint.mccabe]
Expand Down
5 changes: 2 additions & 3 deletions src/AutoSplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@
from copy import deepcopy
from time import time
from types import FunctionType
from typing import NoReturn
from typing import NoReturn, override

import cv2
from cv2.typing import MatLike
from gen import about, design, settings, update_checker
from PySide6 import QtCore, QtGui
from PySide6.QtTest import QTest
from PySide6.QtWidgets import QApplication, QFileDialog, QLabel, QMainWindow, QMessageBox
from typing_extensions import override

import error_messages
import user_profile
from AutoControlledThread import AutoControlledThread
from AutoSplitImage import START_KEYWORD, AutoSplitImage, ImageType
from capture_method import CaptureMethodBase, CaptureMethodEnum
from gen import about, design, settings, update_checker
from hotkeys import (
HOTKEYS,
KEYBOARD_GROUPS_ISSUE,
Expand Down
2 changes: 1 addition & 1 deletion src/capture_method/BitBltCaptureMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
if sys.platform != "win32":
raise OSError
import ctypes
from typing import override

import numpy as np
import pywintypes
import win32con
import win32gui
import win32ui
from cv2.typing import MatLike
from typing_extensions import override

from capture_method.CaptureMethodBase import CaptureMethodBase
from utils import BGRA_CHANNEL_COUNT, get_window_bounds, is_valid_hwnd, try_delete_dc
Expand Down
3 changes: 1 addition & 2 deletions src/capture_method/DesktopDuplicationCaptureMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

if sys.platform != "win32":
raise OSError
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, override

import cv2
import d3dshot
import win32api
import win32con
import win32gui
from typing_extensions import override

from capture_method.BitBltCaptureMethod import BitBltCaptureMethod
from utils import GITHUB_REPOSITORY, get_window_bounds
Expand Down
6 changes: 2 additions & 4 deletions src/capture_method/Screenshot using QT attempt.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# ruff: noqa: RET504
import sys

if sys.platform != "linux":
raise OSError
from typing import cast
from typing import cast, override

import numpy as np
from cv2.typing import MatLike
from PySide6.QtCore import QBuffer, QIODeviceBase
from PySide6.QtGui import QGuiApplication
from typing_extensions import override

from capture_method.CaptureMethodBase import CaptureMethodBase

Expand All @@ -33,4 +31,4 @@ def get_frame(self):
frame = np.frombuffer(cast(MatLike, b), np.uint8).reshape((200, 200, 3))

# frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
return frame
return frame # noqa: RET504
3 changes: 2 additions & 1 deletion src/capture_method/ScrotCaptureMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
if sys.platform != "linux":
raise OSError

from typing import override

import cv2
import numpy as np
import pyscreeze
from pywinctl import getWindowsWithTitle
from typing_extensions import override
from Xlib.display import Display
from Xlib.error import BadWindow

Expand Down
3 changes: 1 addition & 2 deletions src/capture_method/VideoCaptureDeviceCaptureMethod.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from threading import Event, Thread
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, override

import cv2
import cv2.Error
import numpy as np
from cv2.typing import MatLike
from typing_extensions import override

from capture_method.CaptureMethodBase import CaptureMethodBase
from error_messages import CREATE_NEW_ISSUE_MESSAGE, exception_traceback
Expand Down
3 changes: 1 addition & 2 deletions src/capture_method/WindowsGraphicsCaptureMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
if sys.platform != "win32":
raise OSError
import asyncio
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, cast, override

import numpy as np
import win32gui
from cv2.typing import MatLike
from typing_extensions import override
from winrt.windows.graphics import SizeInt32
from winrt.windows.graphics.capture import Direct3D11CaptureFramePool, GraphicsCaptureSession
from winrt.windows.graphics.capture.interop import create_for_window
Expand Down
3 changes: 2 additions & 1 deletion src/capture_method/XcbCaptureMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
if sys.platform != "linux":
raise OSError

from typing import override

import cv2
import numpy as np
from PIL import ImageGrab
from pywinctl import getWindowsWithTitle
from typing_extensions import override
from Xlib.display import Display
from Xlib.error import BadWindow

Expand Down
4 changes: 1 addition & 3 deletions src/capture_method/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from dataclasses import dataclass
from enum import EnumMeta, StrEnum, auto, unique
from itertools import starmap
from typing import TYPE_CHECKING, Never, TypedDict, cast

from typing_extensions import override
from typing import TYPE_CHECKING, Never, TypedDict, cast, override

from capture_method.CaptureMethodBase import CaptureMethodBase
from capture_method.VideoCaptureDeviceCaptureMethod import VideoCaptureDeviceCaptureMethod
Expand Down
5 changes: 2 additions & 3 deletions src/menu_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import sys
import webbrowser
from functools import partial
from typing import TYPE_CHECKING, Any, Literal, cast
from typing import TYPE_CHECKING, Any, Literal, cast, override
from urllib.error import URLError
from urllib.request import urlopen

from gen import about, design, settings as settings_ui, update_checker
from packaging.version import parse as version_parse
from PySide6 import QtCore, QtWidgets
from PySide6.QtCore import Qt
from PySide6.QtGui import QBrush, QPalette
from PySide6.QtWidgets import QFileDialog
from typing_extensions import override

import error_messages
import user_profile
Expand All @@ -22,7 +22,6 @@
change_capture_method,
get_all_video_capture_devices,
)
from gen import about, design, settings as settings_ui, update_checker
from hotkeys import HOTKEYS, HOTKEYS_WHEN_AUTOCONTROLLED, CommandStr, set_hotkey
from utils import AUTOSPLIT_VERSION, GITHUB_REPOSITORY, ONE_SECOND, decimal, fire_and_forget

Expand Down
3 changes: 1 addition & 2 deletions src/region_selection.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import sys
from math import ceil
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, override

import cv2
import numpy as np
from cv2.typing import MatLike, Point
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtTest import QTest
from pywinctl import getTopWindowAt
from typing_extensions import override

import error_messages
from capture_method import Region
Expand Down
2 changes: 1 addition & 1 deletion src/split_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __value_from_filename(
delimiters: str,
default_value: T,
) -> T:
if len(delimiters) != 2: # noqa: PLR2004
if len(delimiters) != 2:
raise ValueError("delimiters parameter must contain exactly 2 characters")
try:
string_value = filename.split(delimiters[0], 1)[1].split(delimiters[1])[0]
Expand Down
6 changes: 3 additions & 3 deletions src/user_profile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import os
import tomllib
from copy import deepcopy
from typing import TYPE_CHECKING, NoReturn, TypedDict, cast
from typing import TYPE_CHECKING, NoReturn, TypedDict, cast, override
from warnings import deprecated

import tomli_w
from gen import design
from PySide6 import QtCore, QtWidgets
from typing_extensions import deprecated, override

import error_messages
from capture_method import CAPTURE_METHODS, CaptureMethodEnum, Region, change_capture_method
from gen import design
from hotkeys import HOTKEYS, CommandStr, Hotkey, remove_all_hotkeys, set_hotkey
from menu_bar import open_settings
from utils import auto_split_directory
Expand Down
Loading