๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐
pip uninstall pygame (if previously installed, to avoid package conflicts)
pip install pygame-ce --upgrade
๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐๐๐ก๏ธ๐ฅ๐ฅ๐
Hello all! We are pleased to announce the first pygame-ce release of 2025.
Since last release, our underlying library SDL (Simple DirectMedia Layer) has released SDL3, with tons of shiny new features and lots of breaking changes. Our goal is to get our existing API fully working on top of SDL3, then focus on a pygame-ce 3.0 release with SDL3 + cool SDL3 features + a few minor backwards compatibility tweaks-- nothing crazy but more than we would feel comfortable changing in a release normally. See #2760 for a discussion of potential pygame-ce 3.0 API changes. To that end, significant effort this release went to getting things more ready for SDL3, but we still have a ways to go. And this plan may change, just wanted to share what we're thinking.
Before we get into the meat of the changes,
- This release drops support for Python 3.8, as it is end of life. (Contributed by @ankith26 in #3143)
- This release raises the minimum SDL2 version to 2.0.14 (Contributed by @ankith26 in #3213)
Enhancements
- @gresm added an option for
pygame.Window
s to not show up in the taskbar, for "utility windows".pygame.Window(utility=True)
. Added in #3226. - @damusss Added "erase" and "repeat" options for
Surface.scroll
in #2855. - @damusss Expanded color type support (not just tuples, but also color strings like other APIs accept) for mask.from_threshold. He also fixed the type stubs for PixelArray methods to correctly indicate they don't have the expanded color type support. See #3164.
- @MrRedstone058 added
Line
methods andlength
attribute to the experimental geometry module in #3179.
Bugfixes
- @Matiiss Added runtime support for type hinting sprite Groups like other Python containers. E.g.
group: pygame.sprite.Group[MySpriteClass] = pygame.sprite.Group()
tells type hinters that this is a sprite group of MySpriteClass instances. Contributed in #3053. - @ankith26 Fixed a bug in saving Surfaces as TGA images, where they could overrun allocated memory and crash, in #3169.
- @yunline Added the missing BLENDMODE_MUL (relevant to the experimental _sdl2.video module) in #3258.
- @ankith26, @MyreMylar, and @zoldalma999 all worked together (we love to see it) to straighten out event.peek behavior between implementation, type hints, and documentation, in #3283. Classifying this as a bugfix because the previous behavior was a mistake and has been fixed.
Peformance improvements
- @Starbuck5 removed unnecessary calls to PyNumber_Index, PyLong_Check-- speeding up
x = rect[0]
andrect[0] = x
7-9% percent-- in #3242. - @Starbuck5 optimized an internal function that converts pairs of Python numbers into C integers or floats. This function is used all over the place, but is only significant for functions that were pretty quick anyways. Rect.move_ip and Rect.collidepoint were tested to be 19% and 17% faster, respectively. Contributed in #3214.
- @ankith26 and @damusss improved the speed of color parsing for color names (e.g
"green"
) and string hex values (e.g."#FF00FF"
) by more than 2x, by adding a fast path before stranger arguments are considered. Contributed in #3297 and #3302.
Deprecations
- @ankith26 deprecated
Window
'sforeign
kwarg andWindow.focus
'sinput_only
kwarg in #3234 - @Starbuck5 marked old type aliases as deprecated (SurfaceType, RectType --- just use Surface and Rect!) #3288
Docs and Types
- @zoldalma999 began implementation of a new documentation system where we generate the docs from a unified representation in the type hints. This will allow editors to see and display the documentation of each function as the user uses it. Currently this is only implemented for the time and cursors modules, it is planned to roll out to other modules in future releases. See #3188.
- @aatle improved the type hints, especially around Color, Rect, display, and geometry. See #3172, #3183, #3248, and #3264.
- @gavinmorrow fixed a grammar mistake in the Window docs in #3194.
- @Starbuck5 corrected some older docs content and some recent invalid formatting that got through, in #3204, #3205, #3266, #3272, and #3316.
- @ankith26 improved the type hints around the experimental geometry and _sdl2 modules, as well as the freetype module, in #3212, #3300, #3301.
- @damusss expanded the type hints for
pygame.Window
init keyword arguments to make them easier to discover in editors/IDEs, see #3295. - @XORandom and @noahcse worked on Russian and Traditional Chinese readmes, respectively, in #3138 and #3113.
- @GabrieleLS added a note to the mixer documentation about different meanings of the word "channel" in #3228.
- @JovialKnoll did a grammar fix and removed incorrect information from the Surface docs in #3231 and #3263
- @yunline fixed a formatting mistake in sndarray.rst and cursors.rst in #3257
- @Matiiss documented how volume is stored internally for
(get|set)_volume
functions/methods (129-value scale) in #3091
Tests and Examples
- @damusss Added
__name__ == "__main__"
guards to the examples, so they can't be accidentally run on import. People occasionally import them on accident, like in this case. Contributed in #3181. - @Akaracy added a test for draw.arc in #3230.
- @MyreMylar renamed TestTags so it doesn't get confused for a test in #3276.
- @MyreMylar fixed most of the Deprecation Warnings in surfarray_test in #3274.
SDL 3 porting
- @Starbuck5 put in several PRs to getting modules compiling or get modules closer to compiling, focusing on modules failing because of SDL3's pixelformat changes. See #3166, #3171, #3278, #3294, #3308, #3307.
- @ankith26 put in a bunch of PRs as well, getting time, surflock, constants, event, imageext, window, key, and mouse all compiling for SDL3. See #3206, #3217, #3262, #3251, #3207.
Maintenance
- @ankith26 added a new
dev.py
file to help pygame-ce devs run necessary commands and do editable builds very smoothly, as a spiritual successor tosetup.py
which is seemingly being phased out in the Python packaging ecosystem. See #3128. - @ankith26 and @Starbuck5 kept us up to date with SDL2 (and SDL3 releases/prereleases for our experimental support). We've pulled in the new SDL 2.30.12, SDL_image 2.8.4, and SDL_ttf 2.24.0. Contributed in #3203, #3261, #3271, #3286, #3304, #3279, and #3322.
- @ankith26 kept our transitive dependencies up to date on Linux in #3322.
- @ankith26 bumped build dependencies and used
dev.py
on msys2/multiarch CI in #3211. - @ankith26 fixed latest SDL3 and MSYS2 fails in #3201.
- @bilhox implemented a better meson error on Windows when library versions are not correct in #3178.
- @ankith26 added ignores for new new gcc version mask array bounds warning in #3186.
- @Starbuck5 Batched memory allocations and adding some missing error checks in #3224.
- @ankith26 fixed SDL3 CI apt issues in #3233.
- @sonotopes updated 'in' operator for sys.platform linux check in pygame.camera in #3246.
- @ankith26 dropped circleci, moved us to GitHub Actions for ARM manylinux in #3293.
- @Starbuck5 removed an unnecessary lock in gfxdraw in #3280.
- @MightyJosip moved the get_rect helper to c_api in #3303.
- @MyreMylar pinned mypy to 1.13.0 to avoid
__all__
duplication in #3277.
New Contributors
- @gavinmorrow made their first contribution in #3194
- @XORandom made their first contribution in #3138
- @GabrieleLS made their first contribution in #3228
- @JovialKnoll made their first contribution in #3231
- @sonotopes made their first contribution in #3246
- @Akaracy made their first contribution in #3230
- @noahcse made their first contribution in #3113
Community Shoutouts
- The Hooman library ("pygame for humans") now supports pygame-ce, by not explicitly requiring pygame. Check it out: https://github.com/Abdur-rahmaanJ/hooman
- "My Keyboard is Full of Ants!" won 1st place in the Ludum Dare 56 Compo, using pygame-ce and pygbag to be playable on the web. Check it out: https://plasmastarfish.itch.io/my-keyboard-is-full-of-ants