Skip to content
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/build-sdl3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:

steps:
- uses: actions/[email protected]
- uses: actions/setup-python@v6
with:
python-version: '3.14'

- name: Install pygame deps (linux)
if: matrix.os == 'ubuntu-24.04'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/run-ubuntu-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ jobs:
os: [ ubuntu-24.04 ]
# check our min python (minor) version and our max python (minor) version
python: [
3.9.23,
3.13.5,
3.14.0rc1
3.10.17,
3.14.0,
]

env:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Dependency versions:


+----------+------------------------+
| CPython | >= 3.9 (Or use PyPy3) |
| CPython | >= 3.10 (Or use PyPy3) |
+----------+------------------------+
| SDL | >= 2.0.14 |
+----------+------------------------+
Expand Down
9 changes: 3 additions & 6 deletions buildconfig/stubs/pygame/_debug.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from collections.abc import Callable
from typing import Optional, Union

ImportResult = tuple[str, bool, Optional[Callable]]

def str_from_tuple(version_tuple: Union[tuple[int, int, int], None]) -> str: ...
def str_from_tuple(version_tuple: tuple[int, int, int] | None) -> str: ...
def attempt_import(
module: str, function_name: str, output_str: str = ""
) -> ImportResult: ...
def print_debug_info(filename: Optional[str] = None) -> None: ...
) -> tuple[str, bool, Callable | None]: ...
def print_debug_info(filename: str | None = None) -> None: ...
26 changes: 12 additions & 14 deletions buildconfig/stubs/pygame/_render.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterable
from typing import Any, Optional, Protocol, Union, final
from typing import Any, Protocol, final

from pygame.color import Color
from pygame.rect import Rect
Expand All @@ -9,9 +9,7 @@ from pygame.window import Window

class _DrawableClass(Protocol):
# Object that has the draw method that accepts area and dest arguments
def draw(
self, area: Optional[RectLike] = None, dest: Optional[RectLike] = None
): ...
def draw(self, area: RectLike | None = None, dest: RectLike | None = None): ...

@final
class Renderer:
Expand All @@ -25,9 +23,9 @@ class Renderer:
) -> None: ...
def blit(
self,
source: Union["Texture", "Image", _DrawableClass],
dest: Optional[RectLike] = None,
area: Optional[RectLike] = None,
source: "Texture" | "Image" | _DrawableClass,
dest: RectLike | None = None,
area: RectLike | None = None,
special_flags: int = 0,
) -> Rect: ...
def clear(self) -> None: ...
Expand All @@ -43,9 +41,9 @@ class Renderer:
def coordinates_to_window(self, point: Point) -> tuple[float, float]: ...
def coordinates_from_window(self, point: Point) -> tuple[float, float]: ...
def present(self) -> None: ...
def set_viewport(self, area: Optional[RectLike]) -> None: ...
def set_viewport(self, area: RectLike | None) -> None: ...
def to_surface(
self, surface: Optional[Surface] = None, area: Optional[RectLike] = None
self, surface: Surface | None = None, area: RectLike | None = None
) -> Surface: ...
@property
def draw_blend_mode(self) -> int: ...
Expand Down Expand Up @@ -84,7 +82,7 @@ class Texture:
static: bool = False,
streaming: bool = False,
target: bool = False,
scale_quality: Optional[int] = None,
scale_quality: int | None = None,
) -> None: ...
@property
def alpha(self) -> int: ...
Expand All @@ -108,10 +106,10 @@ class Texture:
def from_surface(cls, renderer: Renderer, surface: Surface) -> Texture: ...
def draw(
self,
srcrect: Optional[RectLike] = None,
dstrect: Optional[RectLike] = None,
srcrect: RectLike | None = None,
dstrect: RectLike | None = None,
angle: float = 0.0,
origin: Optional[Iterable[int]] = None,
origin: Iterable[int] | None = None,
flip_x: bool = False,
flip_y: bool = False,
) -> None: ...
Expand Down Expand Up @@ -143,7 +141,7 @@ class Texture:
p4_mod: ColorLike = (255, 255, 255, 255),
) -> None: ...
def get_rect(self, **kwargs: Any) -> Rect: ...
def update(self, surface: Surface, area: Optional[RectLike] = None) -> None: ...
def update(self, surface: Surface, area: RectLike | None = None) -> None: ...

@final
class Image:
Expand Down
3 changes: 1 addition & 2 deletions buildconfig/stubs/pygame/_sdl2/controller_old.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections.abc import Mapping
from typing import Optional

from pygame.joystick import JoystickType

Expand All @@ -11,7 +10,7 @@ def get_eventstate() -> bool: ...
def update() -> None: ...
def get_count() -> int: ...
def is_controller(index: int) -> bool: ...
def name_forindex(index: int) -> Optional[str]: ...
def name_forindex(index: int) -> str | None: ...

class Controller:
def __init__(self, index: int) -> None: ...
Expand Down
4 changes: 1 addition & 3 deletions buildconfig/stubs/pygame/_sdl2/sdl2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

INIT_TIMER: int
INIT_AUDIO: int
INIT_VIDEO: int
Expand All @@ -11,6 +9,6 @@ INIT_NOPARACHUTE: int
INIT_EVERYTHING: int

class error(RuntimeError):
def __init__(self, message: Optional[str] = None) -> None: ...
def __init__(self, message: str | None = None) -> None: ...

def init_subsystem(flags: int) -> None: ...
4 changes: 2 additions & 2 deletions buildconfig/stubs/pygame/_sdl2/touch.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, TypedDict
from typing import TypedDict

class _FingerDict(TypedDict):
id: int
Expand All @@ -9,4 +9,4 @@ class _FingerDict(TypedDict):
def get_num_devices() -> int: ...
def get_device(index: int, /) -> int: ...
def get_num_fingers(device_id: int, /) -> int: ...
def get_finger(touchid: int, index: int) -> Optional[_FingerDict]: ...
def get_finger(touchid: int, index: int) -> _FingerDict | None: ...
36 changes: 18 additions & 18 deletions buildconfig/stubs/pygame/_sdl2/video.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Generator, Iterable
from typing import Any, Optional, Union
from typing import Any

from pygame.color import Color
from pygame.rect import Rect
Expand All @@ -26,11 +26,11 @@ class RendererDriverInfo:
max_texture_height: int

def get_drivers() -> Generator[RendererDriverInfo, None, None]: ...
def get_grabbed_window() -> Optional[Window]: ...
def get_grabbed_window() -> Window | None: ...
def messagebox(
title: str,
message: str,
window: Optional[Window] = None,
window: Window | None = None,
info: bool = False,
warn: bool = False,
error: bool = False,
Expand All @@ -48,7 +48,7 @@ class Texture:
static: bool = False,
streaming: bool = False,
target: bool = False,
scale_quality: Optional[int] = None,
scale_quality: int | None = None,
) -> None: ...
@staticmethod
def from_surface(renderer: Renderer, surface: Surface) -> Texture: ...
Expand All @@ -65,10 +65,10 @@ class Texture:
def get_rect(self, **kwargs: Any) -> Rect: ...
def draw(
self,
srcrect: Optional[RectLike] = None,
dstrect: Optional[RectLike] = None,
srcrect: RectLike | None = None,
dstrect: RectLike | None = None,
angle: float = 0.0,
origin: Optional[Iterable[int]] = None,
origin: Iterable[int] | None = None,
flip_x: bool = False,
flip_y: bool = False,
) -> None: ...
Expand Down Expand Up @@ -99,20 +99,20 @@ class Texture:
p3_mod: Iterable[int] = (255, 255, 255, 255),
p4_mod: Iterable[int] = (255, 255, 255, 255),
) -> None: ...
def update(self, surface: Surface, area: Optional[RectLike] = None) -> None: ...
def update(self, surface: Surface, area: RectLike | None = None) -> None: ...

class Image:
def __init__(
self,
texture_or_image: Union[Texture, Image],
srcrect: Optional[RectLike] = None,
texture_or_image: Texture | Image,
srcrect: RectLike | None = None,
) -> None: ...
def get_rect(self) -> Rect: ...
def draw(
self, srcrect: Optional[RectLike] = None, dstrect: Optional[RectLike] = None
self, srcrect: RectLike | None = None, dstrect: RectLike | None = None
) -> None: ...
angle: float
origin: Optional[Iterable[float]]
origin: Iterable[float] | None
flip_x: bool
flip_y: bool
alpha: float
Expand Down Expand Up @@ -144,17 +144,17 @@ class Renderer:
def clear(self) -> None: ...
def present(self) -> None: ...
def get_viewport(self) -> Rect: ...
def set_viewport(self, area: Optional[RectLike]) -> None: ...
def set_viewport(self, area: RectLike | None) -> None: ...
logical_size: Iterable[int]
def coordinates_to_window(self, point: Point) -> tuple[float, float]: ...
def coordinates_from_window(self, point: Point) -> tuple[float, float]: ...
scale: Iterable[float]
target: Optional[Texture]
target: Texture | None
def blit(
self,
source: Union[Texture, Image],
dest: Optional[RectLike] = None,
area: Optional[RectLike] = None,
source: Texture | Image,
dest: RectLike | None = None,
area: RectLike | None = None,
special_flags: int = 0,
) -> Rect: ...
def draw_line(self, p1: Point, p2: Point) -> None: ...
Expand All @@ -166,7 +166,7 @@ class Renderer:
def draw_quad(self, p1: Point, p2: Point, p3: Point, p4: Point) -> None: ...
def fill_quad(self, p1: Point, p2: Point, p3: Point, p4: Point) -> None: ...
def to_surface(
self, surface: Optional[Surface] = None, area: Optional[RectLike] = None
self, surface: Surface | None = None, area: RectLike | None = None
) -> Surface: ...
@staticmethod
def compose_custom_blend_mode(
Expand Down
10 changes: 5 additions & 5 deletions buildconfig/stubs/pygame/camera.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from abc import ABC, abstractmethod
from typing import Literal, Optional, Union
from typing import Literal

from pygame.surface import Surface
from pygame.typing import IntPoint

def get_backends() -> list[str]: ...
def init(backend: Optional[str] = None) -> None: ...
def init(backend: str | None = None) -> None: ...
def quit() -> None: ...
def list_cameras() -> list[str]: ...
def colorspace(
Expand All @@ -24,7 +24,7 @@ class AbstractCamera(ABC):
@abstractmethod
def query_image(self) -> bool: ...
@abstractmethod
def get_image(self, dest_surf: Optional[Surface] = None) -> Surface: ...
def get_image(self, dest_surf: Surface | None = None) -> Surface: ...
@abstractmethod
def get_raw(self) -> bytes: ...
# set_controls and get_controls are not a part of the AbstractCamera ABC,
Expand All @@ -34,7 +34,7 @@ class AbstractCamera(ABC):
class Camera(AbstractCamera):
def __init__(
self,
device: Union[str, int] = 0,
device: str | int = 0,
size: IntPoint = (640, 480),
format: str = "RGB",
) -> None: ...
Expand All @@ -49,5 +49,5 @@ class Camera(AbstractCamera):
) -> tuple[bool, bool, int]: ...
def get_size(self) -> tuple[int, int]: ...
def query_image(self) -> bool: ...
def get_image(self, surface: Optional[Surface] = None) -> Surface: ...
def get_image(self, surface: Surface | None = None) -> Surface: ...
def get_raw(self) -> bytes: ...
6 changes: 3 additions & 3 deletions buildconfig/stubs/pygame/color.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from collections.abc import Collection, Iterator
from typing import Any, ClassVar, SupportsIndex, Union, overload
from typing import Any, ClassVar, SupportsIndex, overload

from pygame.typing import ColorLike
from typing_extensions import deprecated # added in 3.13
Expand Down Expand Up @@ -47,8 +47,8 @@ class Color(Collection[int]):
def __index__(self) -> int: ...
def __invert__(self) -> Color: ...
def __contains__(self, other: int) -> bool: ... # type: ignore[override]
def __getattribute__(self, name: str) -> Union[Color, tuple[int, ...]]: ...
def __setattr__(self, name: str, value: Union[Color, tuple[int, ...]]) -> None: ...
def __getattribute__(self, name: str) -> Color | tuple[int, ...]: ...
def __setattr__(self, name: str, value: Color | tuple[int, ...]) -> None: ...
@overload
@classmethod
def from_cmy(cls, object: tuple[float, float, float], /) -> Color: ...
Expand Down
28 changes: 14 additions & 14 deletions buildconfig/stubs/pygame/cursors.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from collections.abc import Iterator
from typing import Any, Literal, Union, overload
from typing import Any, Literal, TypeAlias, overload

from pygame.surface import Surface
from pygame.typing import FileLike, IntPoint, SequenceLike

_Small_string = tuple[
_SmallString: TypeAlias = tuple[
str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str
]
_Big_string = tuple[
_BigString: TypeAlias = tuple[
str,
str,
str,
Expand Down Expand Up @@ -40,11 +40,11 @@ broken_x: Cursor
tri_left: Cursor
tri_right: Cursor
ball: Cursor
thickarrow_strings: _Big_string
sizer_x_strings: _Small_string
sizer_y_strings: _Big_string
sizer_xy_strings: _Small_string
textmarker_strings: _Small_string
thickarrow_strings: _BigString
sizer_x_strings: _SmallString
sizer_y_strings: _BigString
sizer_xy_strings: _SmallString
textmarker_strings: _SmallString

def compile(
strings: SequenceLike[str],
Expand Down Expand Up @@ -79,11 +79,11 @@ class Cursor:
def __len__(self) -> int: ...
def __copy__(self) -> Cursor: ...
def __hash__(self) -> int: ...
def __getitem__(self, index: int) -> Union[int, IntPoint, Surface]: ...
def __getitem__(self, index: int) -> int | IntPoint | Surface: ...
def copy(self) -> Cursor: ...
type: Literal["system", "color", "bitmap"]
data: Union[
tuple[int],
tuple[tuple[int, int], tuple[int, int], tuple[int, ...], tuple[int, ...]],
tuple[IntPoint, Surface],
]
data: (
tuple[int]
| tuple[tuple[int, int], tuple[int, int], tuple[int, ...], tuple[int, ...]]
| tuple[IntPoint, Surface]
)
Loading
Loading