Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into docs-to-stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
zoldalma999 committed Dec 3, 2024
2 parents 26339e3 + 64b5320 commit 209acd6
Show file tree
Hide file tree
Showing 108 changed files with 1,646 additions and 685 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- run:
name: Build the Linux wheels.
command: |
pip3 install --user cibuildwheel==2.21.3
pip3 install --user cibuildwheel==2.22.0
PATH="$HOME/.local/bin:$PATH" cibuildwheel --output-dir wheelhouse
- store_artifacts:
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/build-debian-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ jobs:
install: ${{ env.INSTALL_CMD }}

# Build a wheel, install it for running unit tests.
# --no-build-isolation is passed so that preinstalled meson-python can be used
# (done for optimization reasons)
# pip does not know that ninja is installed, and tries to install it again.
# so pass --ignore-dep ninja explicitly
run: |
echo "\nBuilding pygame wheel\n"
pip3 wheel . --no-build-isolation --wheel-dir /artifacts -vvv
echo "\nInstalling wheel\n"
pip3 install --no-index --pre --break-system-packages --find-links /artifacts pygame-ce
echo "\nBuilding and installing pygame wheel\n"
PIP_BREAK_SYSTEM_PACKAGES=1 python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax
echo "\nRunning tests\n"
export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=disk
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
if: steps.macdep-cache.outputs.cache-hit != 'true'
run: |
export MAC_ARCH="${{ matrix.macarch }}"
brew install coreutils pkg-config
brew install coreutils
cd buildconfig/macdependencies
bash ./build_mac_deps.sh
Expand Down Expand Up @@ -104,7 +104,6 @@ jobs:

# Setup macOS dependencies
CIBW_BEFORE_ALL: |
brew install pkg-config
cd buildconfig/macdependencies
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps
bash ./install_mac_deps.sh
Expand Down Expand Up @@ -135,10 +134,10 @@ jobs:
- name: Install uv for speed
uses: yezz123/setup-uv@v4
with:
uv-version: "0.4.10"
uv-version: "0.5.4"

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

- uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ jobs:

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

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

uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0

# We upload the generated files under github actions assets
- name: Upload dist
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/build-on-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,10 @@ jobs:
# mingw-w64-${{ matrix.env }}-freetype
# mingw-w64-${{ matrix.env }}-portmidi

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

- name: Run tests
env:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/build-sdl3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ jobs:

- name: Install pygame deps (linux)
if: matrix.os == 'ubuntu-24.04'
run: sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev
run: |
sudo apt-get update --fix-missing
sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev
- name: Install pygame deps (mac)
if: matrix.os == 'macos-14'
Expand Down Expand Up @@ -87,6 +89,11 @@ jobs:
- name: Build with SDL3
run: python3 dev.py build --sdl3

# eventually we need to run all tests, but for now test that importing pygame
# works
- name: Test import works
run: python3 -c 'import pygame'

# - name: Run tests
# env:
# SDL_VIDEODRIVER: "dummy"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
- name: Install uv for speed
uses: yezz123/setup-uv@v4
with:
uv-version: "0.4.10"
uv-version: "0.5.4"

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

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-gh-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: echo "VER=${GITHUB_REF_NAME#'release/'}" >> $GITHUB_OUTPUT

- name: Generate release attestation
uses: actions/[email protected].3
uses: actions/[email protected].4
with:
subject-path: "pygame-wheels/*"

Expand Down
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
|PyPiVersion| |PyPiLicense|
|Python3| |GithubCommits| |BlackFormatBadge|

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

Pygame_ is a free and open-source cross-platform library
Expand Down Expand Up @@ -139,9 +139,9 @@ Dependency versions:


+----------+------------------------+
| CPython | >= 3.8 (Or use PyPy3) |
| CPython | >= 3.9 (Or use PyPy3) |
+----------+------------------------+
| SDL | >= 2.0.10 |
| SDL | >= 2.0.14 |
+----------+------------------------+
| SDL_mixer| >= 2.0.4 |
+----------+------------------------+
Expand Down Expand Up @@ -221,3 +221,4 @@ See docs/licenses for licenses of dependencies.
.. _Español: ./docs/readmes/README.es.rst
.. _日本語: ./docs/readmes/README.ja.rst
.. _Italiano: ./docs/readmes/README.it.rst
.. _Русский: ./docs/readmes/README.ru.rst
2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-aarch64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_aarch64:2024.10.07-1
FROM quay.io/pypa/manylinux2014_aarch64:2024.11.16-1
ENV MAKEFLAGS="-j 2"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-i686
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_i686:2024.10.07-1
FROM quay.io/pypa/manylinux2014_i686:2024.11.16-1
ENV MAKEFLAGS="-j 2"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-x86_64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_x86_64:2024.10.07-1
FROM quay.io/pypa/manylinux2014_x86_64:2024.11.16-1
ENV MAKEFLAGS="-j 2"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down
7 changes: 4 additions & 3 deletions buildconfig/stubs/pygame/_debug.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Tuple, Union, Optional, Callable
from collections.abc import Callable
from typing import Union, Optional

ImportResult = Tuple[str, bool, Optional[Callable]]
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: Union[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: ...
4 changes: 2 additions & 2 deletions buildconfig/stubs/pygame/_sdl2/audio.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable, List
from collections.abc import Callable

AUDIO_U8: int
AUDIO_S8: int
Expand All @@ -20,7 +20,7 @@ AUDIO_ALLOW_FORMAT_CHANGE: int
AUDIO_ALLOW_CHANNELS_CHANGE: int
AUDIO_ALLOW_ANY_CHANGE: int

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

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

from pygame.joystick import JoystickType

Expand Down Expand Up @@ -27,7 +28,7 @@ class Controller:
def as_joystick(self) -> JoystickType: ...
def get_axis(self, axis: int) -> int: ...
def get_button(self, button: int) -> bool: ...
def get_mapping(self) -> Dict[str, str]: ...
def get_mapping(self) -> dict[str, str]: ...
def set_mapping(self, mapping: Mapping[str, str]) -> int: ...
def rumble(
self, low_frequency: float, high_frequency: float, duration: int
Expand Down
4 changes: 2 additions & 2 deletions buildconfig/stubs/pygame/_sdl2/touch.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Dict, Union
from typing import Union

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) -> Dict[str, Union[int, float]]: ...
def get_finger(touchid: int, index: int) -> dict[str, Union[int, float]]: ...
10 changes: 5 additions & 5 deletions buildconfig/stubs/pygame/_sdl2/video.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Generator, Iterable, Optional, Tuple, Union
from collections.abc import Generator, Iterable
from typing import Any, Optional, Union

from pygame.color import Color
from pygame.rect import Rect
Expand Down Expand Up @@ -34,7 +35,7 @@ def messagebox(
info: bool = False,
warn: bool = False,
error: bool = False,
buttons: Tuple[str, ...] = ("OK",),
buttons: tuple[str, ...] = ("OK",),
return_button: int = 0,
escape_button: int = 0,
) -> int: ...
Expand All @@ -47,7 +48,7 @@ class Texture:
static: bool = False,
streaming: bool = False,
target: bool = False,
scale_quality: Optional[int] =None
scale_quality: Optional[int] = None,
) -> None: ...
@staticmethod
def from_surface(renderer: Renderer, surface: Surface) -> Texture: ...
Expand All @@ -61,7 +62,6 @@ class Texture:
def color(self) -> Color: ...
@color.setter
def color(self, value: ColorLike) -> None: ...

def get_rect(self, **kwargs: Any) -> Rect: ...
def draw(
self,
Expand Down Expand Up @@ -176,5 +176,5 @@ class Renderer:
) -> Surface: ...
@staticmethod
def compose_custom_blend_mode(
color_mode: Tuple[int, int, int], alpha_mode: Tuple[int, int, int]
color_mode: tuple[int, int, int], alpha_mode: tuple[int, int, int]
) -> int: ...
7 changes: 4 additions & 3 deletions buildconfig/stubs/pygame/base.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Tuple, Callable
from collections.abc import Callable
from typing import Any

__version__: str

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

def init() -> Tuple[int, int]: ...
def init() -> tuple[int, int]: ...
def quit() -> None: ...
def get_init() -> bool: ...
def get_error() -> str: ...
def set_error(error_msg: str, /) -> None: ...
def get_sdl_version(linked: bool = True) -> Tuple[int, int, int]: ...
def get_sdl_version(linked: bool = True) -> tuple[int, int, int]: ...
def get_sdl_byteorder() -> int: ...
def register_quit(callable: Callable[[], Any], /) -> None: ...

Expand Down
4 changes: 2 additions & 2 deletions buildconfig/stubs/pygame/bufferproxy.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Any, Dict, overload
from typing import Any, overload

class BufferProxy:
parent: Any
length: int
raw: bytes
# possibly going to be deprecated/removed soon, in which case these
# typestubs must be removed too
__array_interface__: Dict[str, Any]
__array_interface__: dict[str, Any]
__array_struct__: Any
@overload
def __init__(self) -> None: ...
Expand Down
14 changes: 7 additions & 7 deletions buildconfig/stubs/pygame/camera.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from abc import ABC, abstractmethod
from typing import List, Optional, Tuple, Union, Literal
from typing import Optional, Union, Literal

from pygame.typing import IntPoint

from pygame.surface import Surface

def get_backends() -> List[str]: ...
def get_backends() -> list[str]: ...
def init(backend: Optional[str] = None) -> None: ...
def quit() -> None: ...
def list_cameras() -> List[str]: ...
def list_cameras() -> list[str]: ...
def colorspace(
surface: Surface, color: Literal["YUV", "HSV"], dest_surface: Surface = ..., /
) -> Surface: ...
Expand All @@ -21,7 +21,7 @@ class AbstractCamera(ABC):
@abstractmethod
def stop(self) -> None: ...
@abstractmethod
def get_size(self) -> Tuple[int, int]: ...
def get_size(self) -> tuple[int, int]: ...
@abstractmethod
def query_image(self) -> bool: ...
@abstractmethod
Expand All @@ -41,14 +41,14 @@ class Camera(AbstractCamera):
) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
def get_controls(self) -> Tuple[bool, bool, int]: ...
def get_controls(self) -> tuple[bool, bool, int]: ...
def set_controls(
self,
hflip: bool = ...,
vflip: bool = ...,
brightness: int = ...,
) -> Tuple[bool, bool, int]: ...
def get_size(self) -> Tuple[int, int]: ...
) -> 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_raw(self) -> bytes: ...
Loading

0 comments on commit 209acd6

Please sign in to comment.