Skip to content

Commit 209acd6

Browse files
committed
Merge remote-tracking branch 'upstream/main' into docs-to-stubs
2 parents 26339e3 + 64b5320 commit 209acd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1646
-685
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- run:
4343
name: Build the Linux wheels.
4444
command: |
45-
pip3 install --user cibuildwheel==2.21.3
45+
pip3 install --user cibuildwheel==2.22.0
4646
PATH="$HOME/.local/bin:$PATH" cibuildwheel --output-dir wheelhouse
4747
4848
- store_artifacts:

.github/workflows/build-debian-multiarch.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,11 @@ jobs:
9696
install: ${{ env.INSTALL_CMD }}
9797

9898
# Build a wheel, install it for running unit tests.
99-
# --no-build-isolation is passed so that preinstalled meson-python can be used
100-
# (done for optimization reasons)
99+
# pip does not know that ninja is installed, and tries to install it again.
100+
# so pass --ignore-dep ninja explicitly
101101
run: |
102-
echo "\nBuilding pygame wheel\n"
103-
pip3 wheel . --no-build-isolation --wheel-dir /artifacts -vvv
104-
echo "\nInstalling wheel\n"
105-
pip3 install --no-index --pre --break-system-packages --find-links /artifacts pygame-ce
102+
echo "\nBuilding and installing pygame wheel\n"
103+
PIP_BREAK_SYSTEM_PACKAGES=1 python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax
106104
echo "\nRunning tests\n"
107105
export SDL_VIDEODRIVER=dummy
108106
export SDL_AUDIODRIVER=disk

.github/workflows/build-macos.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
if: steps.macdep-cache.outputs.cache-hit != 'true'
6565
run: |
6666
export MAC_ARCH="${{ matrix.macarch }}"
67-
brew install coreutils pkg-config
67+
brew install coreutils
6868
cd buildconfig/macdependencies
6969
bash ./build_mac_deps.sh
7070
@@ -104,7 +104,6 @@ jobs:
104104

105105
# Setup macOS dependencies
106106
CIBW_BEFORE_ALL: |
107-
brew install pkg-config
108107
cd buildconfig/macdependencies
109108
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps
110109
bash ./install_mac_deps.sh
@@ -135,10 +134,10 @@ jobs:
135134
- name: Install uv for speed
136135
uses: yezz123/setup-uv@v4
137136
with:
138-
uv-version: "0.4.10"
137+
uv-version: "0.5.4"
139138

140139
- name: Build and test wheels
141-
uses: pypa/cibuildwheel@v2.21.3
140+
uses: pypa/cibuildwheel@v2.22.0
142141

143142
- uses: actions/upload-artifact@v4
144143
with:

.github/workflows/build-manylinux.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ jobs:
6868

6969
- name: Extract metadata (tags, labels) for Docker
7070
id: meta
71-
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
71+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
7272
with:
7373
images: ghcr.io/${{ github.repository }}_${{ matrix.arch }}
7474
tags: type=raw,value=${{ hashFiles('buildconfig/manylinux-build/**') }}
7575

7676
- name: Build and push Docker image
7777
if: steps.inspect.outcome == 'failure'
78-
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
78+
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
7979
with:
8080
context: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base
8181
file: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base/Dockerfile-${{ matrix.arch }}
@@ -91,7 +91,7 @@ jobs:
9191
CIBW_MANYLINUX_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
9292
CIBW_MANYLINUX_PYPY_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
9393

94-
uses: pypa/cibuildwheel@v2.21.3
94+
uses: pypa/cibuildwheel@v2.22.0
9595

9696
# We upload the generated files under github actions assets
9797
- name: Upload dist

.github/workflows/build-on-msys2.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,10 @@ jobs:
6868
# mingw-w64-${{ matrix.env }}-freetype
6969
# mingw-w64-${{ matrix.env }}-portmidi
7070

71-
- name: Install additional dependencies
72-
run: |
73-
pip3 install "sphinx-autoapi<=3.3.2"
74-
75-
- name: Building pygame wheel
76-
run: |
77-
pip3 wheel . --wheel-dir /artifacts -vvv --no-build-isolation
78-
79-
- name: Installing wheel
80-
run: pip3 install --no-index --pre --find-links /artifacts pygame-ce
71+
# pip does not know that ninja is installed, and tries to install it again.
72+
# so pass --ignore-dep ninja explicitly
73+
- name: Build and install pygame wheel
74+
run: python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax
8175

8276
- name: Run tests
8377
env:

.github/workflows/build-sdl3.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656

5757
- name: Install pygame deps (linux)
5858
if: matrix.os == 'ubuntu-24.04'
59-
run: sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev
59+
run: |
60+
sudo apt-get update --fix-missing
61+
sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev
6062
6163
- name: Install pygame deps (mac)
6264
if: matrix.os == 'macos-14'
@@ -87,6 +89,11 @@ jobs:
8789
- name: Build with SDL3
8890
run: python3 dev.py build --sdl3
8991

92+
# eventually we need to run all tests, but for now test that importing pygame
93+
# works
94+
- name: Test import works
95+
run: python3 -c 'import pygame'
96+
9097
# - name: Run tests
9198
# env:
9299
# SDL_VIDEODRIVER: "dummy"

.github/workflows/build-windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ jobs:
5959
- name: Install uv for speed
6060
uses: yezz123/setup-uv@v4
6161
with:
62-
uv-version: "0.4.10"
62+
uv-version: "0.5.4"
6363

6464
- name: Build and test wheels
65-
uses: pypa/cibuildwheel@v2.21.3
65+
uses: pypa/cibuildwheel@v2.22.0
6666

6767
- uses: actions/upload-artifact@v4
6868
with:

.github/workflows/release-gh-draft.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
run: echo "VER=${GITHUB_REF_NAME#'release/'}" >> $GITHUB_OUTPUT
6262

6363
- name: Generate release attestation
64-
uses: actions/[email protected].3
64+
uses: actions/[email protected].4
6565
with:
6666
subject-path: "pygame-wheels/*"
6767

README.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
|PyPiVersion| |PyPiLicense|
99
|Python3| |GithubCommits| |BlackFormatBadge|
1010

11-
**English** `简体中文`_ `繁體中文`_ `Français`_ `فارسی`_ `Español`_ `日本語`_ `Italiano`_
11+
**English** `简体中文`_ `繁體中文`_ `Français`_ `فارسی`_ `Español`_ `日本語`_ `Italiano`_ `Русский`_
1212
---------------------------------------------------------------------------------------------------
1313

1414
Pygame_ is a free and open-source cross-platform library
@@ -139,9 +139,9 @@ Dependency versions:
139139

140140

141141
+----------+------------------------+
142-
| CPython | >= 3.8 (Or use PyPy3) |
142+
| CPython | >= 3.9 (Or use PyPy3) |
143143
+----------+------------------------+
144-
| SDL | >= 2.0.10 |
144+
| SDL | >= 2.0.14 |
145145
+----------+------------------------+
146146
| SDL_mixer| >= 2.0.4 |
147147
+----------+------------------------+
@@ -221,3 +221,4 @@ See docs/licenses for licenses of dependencies.
221221
.. _Español: ./docs/readmes/README.es.rst
222222
.. _日本語: ./docs/readmes/README.ja.rst
223223
.. _Italiano: ./docs/readmes/README.it.rst
224+
.. _Русский: ./docs/readmes/README.ru.rst

buildconfig/manylinux-build/docker_base/Dockerfile-aarch64

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pin version on image for CI stability
2-
FROM quay.io/pypa/manylinux2014_aarch64:2024.10.07-1
2+
FROM quay.io/pypa/manylinux2014_aarch64:2024.11.16-1
33
ENV MAKEFLAGS="-j 2"
44
ENV PG_DEP_PREFIX="/usr/local"
55

buildconfig/manylinux-build/docker_base/Dockerfile-i686

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pin version on image for CI stability
2-
FROM quay.io/pypa/manylinux2014_i686:2024.10.07-1
2+
FROM quay.io/pypa/manylinux2014_i686:2024.11.16-1
33
ENV MAKEFLAGS="-j 2"
44
ENV PG_DEP_PREFIX="/usr/local"
55

buildconfig/manylinux-build/docker_base/Dockerfile-x86_64

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pin version on image for CI stability
2-
FROM quay.io/pypa/manylinux2014_x86_64:2024.10.07-1
2+
FROM quay.io/pypa/manylinux2014_x86_64:2024.11.16-1
33
ENV MAKEFLAGS="-j 2"
44
ENV PG_DEP_PREFIX="/usr/local"
55

buildconfig/stubs/pygame/_debug.pyi

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from typing import Tuple, Union, Optional, Callable
1+
from collections.abc import Callable
2+
from typing import Union, Optional
23

3-
ImportResult = Tuple[str, bool, Optional[Callable]]
4+
ImportResult = tuple[str, bool, Optional[Callable]]
45

5-
def str_from_tuple(version_tuple: Union[Tuple[int, int, int], None]) -> str: ...
6+
def str_from_tuple(version_tuple: Union[tuple[int, int, int], None]) -> str: ...
67
def attempt_import(module: str, function_name: str, output_str: str = "") -> ImportResult: ...
78
def print_debug_info(filename: Optional[str] = None) -> None: ...

buildconfig/stubs/pygame/_sdl2/audio.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable, List
1+
from collections.abc import Callable
22

33
AUDIO_U8: int
44
AUDIO_S8: int
@@ -20,7 +20,7 @@ AUDIO_ALLOW_FORMAT_CHANGE: int
2020
AUDIO_ALLOW_CHANNELS_CHANGE: int
2121
AUDIO_ALLOW_ANY_CHANGE: int
2222

23-
def get_audio_device_names(iscapture: bool = False) -> List[str]: ...
23+
def get_audio_device_names(iscapture: bool = False) -> list[str]: ...
2424

2525
class AudioDevice:
2626
def __init__(

buildconfig/stubs/pygame/_sdl2/controller_old.pyi

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Dict, Mapping, Optional
1+
from collections.abc import Mapping
2+
from typing import Optional
23

34
from pygame.joystick import JoystickType
45

@@ -27,7 +28,7 @@ class Controller:
2728
def as_joystick(self) -> JoystickType: ...
2829
def get_axis(self, axis: int) -> int: ...
2930
def get_button(self, button: int) -> bool: ...
30-
def get_mapping(self) -> Dict[str, str]: ...
31+
def get_mapping(self) -> dict[str, str]: ...
3132
def set_mapping(self, mapping: Mapping[str, str]) -> int: ...
3233
def rumble(
3334
self, low_frequency: float, high_frequency: float, duration: int
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from typing import Dict, Union
1+
from typing import Union
22

33
def get_num_devices() -> int: ...
44
def get_device(index: int) -> int: ...
55
def get_num_fingers(device_id: int) -> int: ...
6-
def get_finger(touchid: int, index: int) -> Dict[str, Union[int, float]]: ...
6+
def get_finger(touchid: int, index: int) -> dict[str, Union[int, float]]: ...

buildconfig/stubs/pygame/_sdl2/video.pyi

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Generator, Iterable, Optional, Tuple, Union
1+
from collections.abc import Generator, Iterable
2+
from typing import Any, Optional, Union
23

34
from pygame.color import Color
45
from pygame.rect import Rect
@@ -34,7 +35,7 @@ def messagebox(
3435
info: bool = False,
3536
warn: bool = False,
3637
error: bool = False,
37-
buttons: Tuple[str, ...] = ("OK",),
38+
buttons: tuple[str, ...] = ("OK",),
3839
return_button: int = 0,
3940
escape_button: int = 0,
4041
) -> int: ...
@@ -47,7 +48,7 @@ class Texture:
4748
static: bool = False,
4849
streaming: bool = False,
4950
target: bool = False,
50-
scale_quality: Optional[int] =None
51+
scale_quality: Optional[int] = None,
5152
) -> None: ...
5253
@staticmethod
5354
def from_surface(renderer: Renderer, surface: Surface) -> Texture: ...
@@ -61,7 +62,6 @@ class Texture:
6162
def color(self) -> Color: ...
6263
@color.setter
6364
def color(self, value: ColorLike) -> None: ...
64-
6565
def get_rect(self, **kwargs: Any) -> Rect: ...
6666
def draw(
6767
self,
@@ -176,5 +176,5 @@ class Renderer:
176176
) -> Surface: ...
177177
@staticmethod
178178
def compose_custom_blend_mode(
179-
color_mode: Tuple[int, int, int], alpha_mode: Tuple[int, int, int]
179+
color_mode: tuple[int, int, int], alpha_mode: tuple[int, int, int]
180180
) -> int: ...

buildconfig/stubs/pygame/base.pyi

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Tuple, Callable
1+
from collections.abc import Callable
2+
from typing import Any
23

34
__version__: str
45

@@ -8,12 +9,12 @@ class BufferError(Exception): ...
89
# Always defined
910
HAVE_NEWBUF: int = 1
1011

11-
def init() -> Tuple[int, int]: ...
12+
def init() -> tuple[int, int]: ...
1213
def quit() -> None: ...
1314
def get_init() -> bool: ...
1415
def get_error() -> str: ...
1516
def set_error(error_msg: str, /) -> None: ...
16-
def get_sdl_version(linked: bool = True) -> Tuple[int, int, int]: ...
17+
def get_sdl_version(linked: bool = True) -> tuple[int, int, int]: ...
1718
def get_sdl_byteorder() -> int: ...
1819
def register_quit(callable: Callable[[], Any], /) -> None: ...
1920

buildconfig/stubs/pygame/bufferproxy.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from typing import Any, Dict, overload
1+
from typing import Any, overload
22

33
class BufferProxy:
44
parent: Any
55
length: int
66
raw: bytes
77
# possibly going to be deprecated/removed soon, in which case these
88
# typestubs must be removed too
9-
__array_interface__: Dict[str, Any]
9+
__array_interface__: dict[str, Any]
1010
__array_struct__: Any
1111
@overload
1212
def __init__(self) -> None: ...

buildconfig/stubs/pygame/camera.pyi

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from abc import ABC, abstractmethod
2-
from typing import List, Optional, Tuple, Union, Literal
2+
from typing import Optional, Union, Literal
33

44
from pygame.typing import IntPoint
55

66
from pygame.surface import Surface
77

8-
def get_backends() -> List[str]: ...
8+
def get_backends() -> list[str]: ...
99
def init(backend: Optional[str] = None) -> None: ...
1010
def quit() -> None: ...
11-
def list_cameras() -> List[str]: ...
11+
def list_cameras() -> list[str]: ...
1212
def colorspace(
1313
surface: Surface, color: Literal["YUV", "HSV"], dest_surface: Surface = ..., /
1414
) -> Surface: ...
@@ -21,7 +21,7 @@ class AbstractCamera(ABC):
2121
@abstractmethod
2222
def stop(self) -> None: ...
2323
@abstractmethod
24-
def get_size(self) -> Tuple[int, int]: ...
24+
def get_size(self) -> tuple[int, int]: ...
2525
@abstractmethod
2626
def query_image(self) -> bool: ...
2727
@abstractmethod
@@ -41,14 +41,14 @@ class Camera(AbstractCamera):
4141
) -> None: ...
4242
def start(self) -> None: ...
4343
def stop(self) -> None: ...
44-
def get_controls(self) -> Tuple[bool, bool, int]: ...
44+
def get_controls(self) -> tuple[bool, bool, int]: ...
4545
def set_controls(
4646
self,
4747
hflip: bool = ...,
4848
vflip: bool = ...,
4949
brightness: int = ...,
50-
) -> Tuple[bool, bool, int]: ...
51-
def get_size(self) -> Tuple[int, int]: ...
50+
) -> tuple[bool, bool, int]: ...
51+
def get_size(self) -> tuple[int, int]: ...
5252
def query_image(self) -> bool: ...
5353
def get_image(self, surface: Optional[Surface] = None) -> Surface: ...
5454
def get_raw(self) -> bytes: ...

0 commit comments

Comments
 (0)