Skip to content

Commit

Permalink
Merge branch 'main' into docs-to-stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar authored Dec 31, 2024
2 parents 2c36fc9 + 71d8b23 commit d9c1c0e
Show file tree
Hide file tree
Showing 36 changed files with 429 additions and 108 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Test for Mac Deps cache hit
id: macdep-cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
# The hash of all files in buildconfig manylinux-build and macdependencies is
Expand Down Expand Up @@ -118,14 +118,14 @@ jobs:
- uses: actions/[email protected]

- name: pip cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: ~/Library/Caches/pip # This cache path is only right on mac
key: pip-cache-${{ matrix.macarch }}-${{ matrix.os }}

- name: Fetch Mac deps
id: macdep-cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build-sdl3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ jobs:
cmake --build . --config Release --parallel
sudo cmake --install . --config Release
- name: Install SDL3_image
if: matrix.os != 'windows-latest'
run: |
git clone https://github.com/libsdl-org/SDL_image
cd SDL_image
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release --parallel
sudo cmake --install . --config Release
- name: Build with SDL3
run: python3 dev.py build --sdl3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:

- name: Test typestubs
run: |
pip3 install mypy
pip3 install mypy==1.13.0
python3 buildconfig/stubs/stubcheck.py
# We upload the generated files under github actions assets
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/attest-build-provenance@v1.4.4
uses: actions/attest-build-provenance@v2.1.0
with:
subject-path: "pygame-wheels/*"

Expand Down
32 changes: 24 additions & 8 deletions buildconfig/download_win_prebuilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ def get_urls(x86=True, x64=True):
url_sha1 = []
url_sha1.extend([
[
'https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-devel-2.30.9-VC.zip',
'd89a2ad46b98ba08db5ec5877cb2fde46e127825',
'https://github.com/libsdl-org/SDL/releases/download/release-2.30.10/SDL2-devel-2.30.10-VC.zip',
'42378fd090d547d03dca8c9df584ba8f38555809',
],
[
'https://github.com/libsdl-org/SDL/releases/download/preview-3.1.6/SDL3-devel-3.1.6-VC.zip',
'7a3b9ed85cfe735c7e106d98c4b6395a113e5d7e'
],
[
'https://github.com/pygame-community/SDL_image/releases/download/2.8.2-pgce/SDL2_image-devel-2.8.2-VCpgce.zip',
'983484dd816abf25cdd5bce88ac69dbca1ea713a'
'https://github.com/pygame-community/SDL_image/releases/download/2.8.3-pgce/SDL2_image-devel-2.8.3-VCpgce.zip',
'71ad2b5aacbc934a39e390ad733421313dd5d059'
],
[
'https://github.com/libsdl-org/SDL_image/releases/download/preview-3.1.0/SDL3_image-devel-3.1.0-VC.zip',
'8538fea0cc4aabba2fc64db06196f1bb76a2785f'
],
[
'https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-devel-2.22.0-VC.zip',
Expand Down Expand Up @@ -205,14 +209,26 @@ def copy(src, dst):
copy(
os.path.join(
temp_dir,
'SDL2_image-devel-2.8.2-VCpgce/SDL2_image-2.8.2'
'SDL2_image-devel-2.8.3-VCpgce/SDL2_image-2.8.3'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2_image-2.8.3'
)
)
copy(
os.path.join(
temp_dir,
'SDL3_image-devel-3.1.0-VC/SDL3_image-3.1.0'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2_image-2.8.2'
'SDL3_image-3.1.0'
)
)

copy(
os.path.join(
temp_dir,
Expand All @@ -238,12 +254,12 @@ def copy(src, dst):
copy(
os.path.join(
temp_dir,
'SDL2-devel-2.30.9-VC/SDL2-2.30.9'
'SDL2-devel-2.30.10-VC/SDL2-2.30.10'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2-2.30.9'
'SDL2-2.30.10'
)
)
copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ set -e -x

cd $(dirname `readlink -f "$0"`)

SDL2_VER="2.30.9"
SDL2_VER="2.30.10"
SDL2="SDL2-$SDL2_VER"
IMG2_VER="2.8.2"
IMG2_VER="2.8.3"
IMG2="SDL2_image-$IMG2_VER"
TTF2_VER="2.22.0"
TTF2="SDL2_ttf-$TTF2_VER"
Expand Down
4 changes: 2 additions & 2 deletions buildconfig/manylinux-build/docker_base/sdl_libs/sdl2.sha512
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
30dfa86fcced174fef0ed78ffa53476a31765e19cdcdf8233ab92876445b4dedaa758fc42a3ec332324d13faa2daafcadcc44fc0f536a2969ef836162ec3cd36 SDL2-2.30.9.tar.gz
0ff345824f95158dfa72f83f9d4a540601c178cd759334bf849c14a2920b5330d0763413b58c08b3deba8d3a4ccb6ea2a8159f87efe4cbb0e8ea850f63d09454 SDL2_image-2.8.2.tar.gz
bcb220749cd3b0874288d617419e622701138bcb8fe55e9b665e8843c65afda031d01afe0d11e308a9608724ed151f342e5f5670c84204b36943cb323ced41da SDL2-2.30.10.tar.gz
b49e466494a4bebcacc09e3fe2afbe5edbae636c007cd26e7e04301bf8fe54db6751258b750a79656e5aa261869900d39703f1311df4c63ef415ae443f62295f SDL2_image-2.8.3.tar.gz
5ddbc4b0b5fad2e0844a503daa79564b912654192599ef8fa7698531f08323ce01801f6bb17b2b3905020a3df362a967b7566ae725eb085da991578cc0807aad SDL2_mixer-2.8.0.tar.gz
34a1d210d8f1b1e802139d65ba47e36033bb7881e75a8862c1b1c515565bef85e3d81ee42e952aa664de043debef387ba60088a9cf3ba3297413db39a13af912 SDL2_ttf-2.22.0.tar.gz
1 change: 1 addition & 0 deletions buildconfig/stubs/pygame/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ from .constants import (
BLENDMODE_ADD as BLENDMODE_ADD,
BLENDMODE_BLEND as BLENDMODE_BLEND,
BLENDMODE_MOD as BLENDMODE_MOD,
BLENDMODE_MUL as BLENDMODE_MUL,
BLENDMODE_NONE as BLENDMODE_NONE,
BLEND_ADD as BLEND_ADD,
BLEND_ALPHA_SDL2 as BLEND_ALPHA_SDL2,
Expand Down
1 change: 1 addition & 0 deletions buildconfig/stubs/pygame/constants.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BIG_ENDIAN: int
BLENDMODE_ADD: int
BLENDMODE_BLEND: int
BLENDMODE_MOD: int
BLENDMODE_MUL: int
BLENDMODE_NONE: int
BLEND_ADD: int
BLEND_ALPHA_SDL2: int
Expand Down
8 changes: 5 additions & 3 deletions buildconfig/stubs/pygame/display.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ def set_mode(
display: int = 0,
vsync: int = 0,
) -> Surface: ...
def get_surface() -> Surface: ...
def get_surface() -> Optional[Surface]: ...
def flip() -> None: ...
@overload
def update() -> None: ...
@overload
def update(
rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]] = None, /
rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]], /
) -> None: ...
@overload
def update(x: int, y: int, w: int, h: int, /) -> None: ...
def update(x: float, y: float, w: float, h: float, /) -> None: ...
@overload
def update(xy: Point, wh: Point, /) -> None: ...
def get_driver() -> str: ...
Expand Down
1 change: 1 addition & 0 deletions buildconfig/stubs/pygame/locals.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BIG_ENDIAN: int
BLENDMODE_ADD: int
BLENDMODE_BLEND: int
BLENDMODE_MOD: int
BLENDMODE_MUL: int
BLENDMODE_NONE: int
BLEND_ADD: int
BLEND_ALPHA_SDL2: int
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/stubcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def stubs_check():
continue

cmd = " ".join(stubtest)
print(f"Using stubtest invokation: `{cmd}` (version: {version})")
print(f"Using stubtest invocation: `{cmd}` (version: {version})")
prev_dir = os.getcwd()
try:
os.chdir(STUBS_BASE_DIR)
Expand Down
1 change: 0 additions & 1 deletion dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

SDL3_ARGS = [
"-Csetup-args=-Dsdl_api=3",
"-Csetup-args=-Dimage=disabled",
"-Csetup-args=-Dmixer=disabled",
"-Csetup-args=-Dfont=disabled",
]
Expand Down
6 changes: 5 additions & 1 deletion docs/reST/ref/display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ required).

| :sl:`Get a reference to the currently set display surface`
| :sg:`get_surface() -> Surface`
| :sg:`get_surface() -> None`
Return a reference to the currently set display Surface. If no display mode
has been set this will return None.
Expand All @@ -272,7 +273,10 @@ required).
.. function:: update

| :sl:`Update all, or a portion, of the display. For non-OpenGL displays.`
| :sg:`update(rectangle=None, /) -> None`
| :sg:`update() -> None`
| :sg:`update(rectangle, /) -> None`
| :sg:`update(x, y, w, h, /) -> None`
| :sg:`update((x, y), (w, h), /) -> None`
| :sg:`update(rectangle_iterable, /) -> None`
For non OpenGL display Surfaces, this function is very similar to
Expand Down
4 changes: 2 additions & 2 deletions docs/reST/ref/draw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ object around the draw calls (see :func:`pygame.Surface.lock` and

.. versionchangedold:: 2.0.0 Added support for keyword arguments.
.. versionchanged:: 2.4.0 Removed deprecated 'blend' argument
.. versionchanged:: 2.5.0 ``blend`` argument readded for backcompat, but will always raise a deprecation exception when used
.. versionchanged:: 2.5.0 ``blend`` argument re-added for backcompat, but will always raise a deprecation exception when used
.. versionchanged:: 2.5.3 Added line width

.. ## pygame.draw.aaline ##
Expand Down Expand Up @@ -533,7 +533,7 @@ object around the draw calls (see :func:`pygame.Surface.lock` and

.. versionchangedold:: 2.0.0 Added support for keyword arguments.
.. versionchanged:: 2.4.0 Removed deprecated ``blend`` argument
.. versionchanged:: 2.5.0 ``blend`` argument readded for backcompat, but will always raise a deprecation exception when used
.. versionchanged:: 2.5.0 ``blend`` argument re-added for backcompat, but will always raise a deprecation exception when used

.. ## pygame.draw.aalines ##
Expand Down
4 changes: 2 additions & 2 deletions docs/reST/ref/image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ following formats.

.. note:: The use of this function is recommended over :func:`tostring` as of pygame 2.1.3.
This function was introduced so it matches nicely with other
libraries (PIL, numpy, etc), and with people's expectations.
libraries (PIL, NumPy, etc), and with people's expectations.

.. versionadded:: 2.1.3
.. versionchanged:: 2.2.0 Now supports keyword arguments.
Expand Down Expand Up @@ -290,7 +290,7 @@ following formats.

.. note:: The use of this function is recommended over :func:`fromstring` as of pygame 2.1.3.
This function was introduced so it matches nicely with other
libraries (PIL, numpy, etc), and with people's expectations.
libraries (PIL, NumPy, etc), and with people's expectations.

.. versionadded:: 2.1.3
.. versionadded:: 2.1.4 Added a 'pitch' argument and support for keyword arguments.
Expand Down
14 changes: 5 additions & 9 deletions docs/reST/ref/mixer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
| :sl:`pygame module for loading and playing sounds`
This module contains classes for loading Sound objects and controlling
playback. The mixer module is optional and depends on SDL_mixer. Your program
should test that :mod:`pygame.mixer` is available and initialized before using
it.
playback.

The mixer module has a limited number of channels for playback of sounds.
Usually programs tell pygame to start playing audio and it selects an available
Expand All @@ -30,9 +28,7 @@ streams the music from the files without loading music at once into memory.

The mixer module must be initialized like other pygame modules, but it has some
extra conditions. The ``pygame.mixer.init()`` function takes several optional
arguments to control the playback rate and sample size. Pygame will default to
reasonable values, but pygame cannot perform Sound resampling, so the mixer
should be initialized to match the values of your audio resources.
arguments to control the playback rate and sample size.

``NOTE``: For less laggy sound use a smaller buffer size. The default
is set to reduce the chance of scratchy sounds on some computers. You can
Expand Down Expand Up @@ -91,7 +87,7 @@ The following file formats are supported
the next nearest power of 2).

The devicename parameter is the name of sound device to open for audio
playback. Allowed device names will vary based on the host system.
playback. Allowed device names will vary based on the host system.
If left as ``None`` then a sensible default will be chosen for you.

Some platforms require the :mod:`pygame.mixer` module to be initialized
Expand Down Expand Up @@ -331,7 +327,7 @@ The following file formats are supported
:rtype: tuple

.. note::
The linked and compile version numbers should be the same.
The linked and compiled version numbers should be the same.

.. versionaddedold:: 2.0.0

Expand Down Expand Up @@ -368,7 +364,7 @@ The following file formats are supported
it and the Sound object.

For now buffer and array support is consistent with ``sndarray.make_sound``
for Numeric arrays, in that sample sign and byte order are ignored. This
for NumPy arrays, in that sample sign and byte order are ignored. This
will change, either by correctly handling sign and byte order, or by raising
an exception when different. Also, source samples are truncated to fit the
audio sample size. This will not change.
Expand Down
1 change: 1 addition & 0 deletions docs/reST/ref/sndarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ one.
DEPRECATED: Uses the requested array type for the module functions. The
only supported arraytype is ``'numpy'``. Other values will raise ValueError.
Using this function will raise a ``DeprecationWarning``.

.. ## pygame.sndarray.use_arraytype ##
.. function:: get_arraytype
Expand Down
2 changes: 1 addition & 1 deletion docs/reST/ref/surface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
object and dest is its destination position on this Surface. It draws each source Surface
fully (meaning that unlike `blit()` you cannot pass an "area" parameter to represent
a smaller portion of the source Surface to draw) on this Surface with the same blending
mode specified by special_flags. The sequence must have at least one (source, dest) pair.
mode specified by special_flags.

:param blit_sequence: a sequence of (source, dest)
:param special_flags: the flag(s) representing the blend mode used for each surface.
Expand Down
2 changes: 1 addition & 1 deletion docs/reST/ref/surfarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ specific pixel value of a color. Integer pixel values can only be used directly
between surfaces with matching pixel layouts (see :class:`pygame.Surface`).

All functions that refer to "array" will copy the surface information to a new
numpy array. All functions that refer to "pixels" will directly reference the
NumPy array. All functions that refer to "pixels" will directly reference the
pixels from the surface and any changes performed to the array will make changes
in the surface. As this last functions share memory with the surface, this one
will be locked during the lifetime of the array.
Expand Down
2 changes: 1 addition & 1 deletion docs/reST/ref/window.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@

.. attribute:: utility

| :sl:`Get if the windos is an utility window (**read-only**)`
| :sl:`Get if the window is an utility window (**read-only**)`
| :sg:`utility -> bool`
``True`` if the window doesn't appear in the task bar, ``False`` otherwise.
Expand Down
Loading

0 comments on commit d9c1c0e

Please sign in to comment.