Skip to content

Commit eade6d5

Browse files
authored
Merge branch 'main' into clean-surface-docs-3
2 parents 4afd45d + 6703c3a commit eade6d5

26 files changed

+1626
-103
lines changed

.github/workflows/build-ubuntu-sdist.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
sudo apt-get update --fix-missing
5151
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev
5252
pip3 install --upgrade pip
53-
pip3 install build numpy>=1.21.0
53+
pip3 install build numpy
5454
5555
- name: Make sdist and install it
5656
run: |
@@ -62,11 +62,10 @@ jobs:
6262
SDL_VIDEODRIVER: "dummy"
6363
SDL_AUDIODRIVER: "disk"
6464
run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
65+
working-directory: ${{ github.workspace }}/..
6566

6667
- name: Test typestubs
67-
run: |
68-
pip3 install mypy==1.13.0
69-
python3 buildconfig/stubs/stubcheck.py
68+
run: python3 dev.py stubs
7069

7170
# We upload the generated files under github actions assets
7271
- name: Upload sdist

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
repos:
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v5.0.0
9+
rev: v6.0.0
1010
hooks:
1111
- id: end-of-file-fixer
1212
exclude: |
@@ -26,7 +26,7 @@ repos:
2626
)$
2727
2828
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: v0.11.12
29+
rev: v0.14.0
3030
hooks: # See pyproject.toml for configuration options.
3131
- id: ruff
3232
name: ruff-sort-imports
@@ -35,7 +35,7 @@ repos:
3535
types_or: [ python, pyi, jupyter ]
3636

3737
- repo: https://github.com/pre-commit/mirrors-clang-format
38-
rev: v20.1.5
38+
rev: v21.1.2
3939
hooks:
4040
- id: clang-format
4141
exclude: |

buildconfig/stubs/gen_stubs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def get_all(mod: Any):
9494
return [i for i in dir(mod) if not i.startswith("_")]
9595

9696

97+
def fmt_list(seq: list[str]):
98+
inner = "\n".join(f' "{i}",' for i in seq)
99+
return f"[\n{inner}\n]\n"
100+
101+
97102
# store all imports of __init__.pyi
98103
pygame_all_imports = {"pygame": PG_AUTOIMPORT_SUBMODS}
99104
for k, v in PG_AUTOIMPORT_CLASSES.items():
@@ -121,6 +126,8 @@ def get_all(mod: Any):
121126
constant_type = getattr(pygame.constants, element).__class__.__name__
122127
f.write(f"{element}: {constant_type}\n")
123128

129+
f.write("__all__ = " + fmt_list(pygame.constants.__all__))
130+
124131

125132
# write __init__.pyi file
126133
init_file = pathlib.Path(__file__).parent / "pygame" / "__init__.pyi"
@@ -157,6 +164,8 @@ def get_all(mod: Any):
157164
constant_type = getattr(pygame.locals, element).__class__.__name__
158165
f.write(f"{element}: {constant_type}\n")
159166

167+
f.write("__all__ = " + fmt_list(pygame.locals.__all__))
168+
160169
# copy typing.py to typing.pyi for type checkers
161170
typing_py_file = pathlib.Path(__file__).parent.parent.parent / "src_py" / "typing.py"
162171
typing_stub_file = pathlib.Path(__file__).parent / "pygame" / "typing.pyi"

buildconfig/stubs/pygame/bufferproxy.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ class BufferProxy:
1717
if sys.version_info >= (3, 12):
1818
def __buffer__(self, flags: int, /) -> memoryview[int]: ...
1919
def __release_buffer__(self, view: memoryview[int], /) -> None: ...
20-
def __init__(self, parent: Any) -> None: ... # TODO: parent: TypedDict | Protocol
20+
def __new__(
21+
cls, parent: Any
22+
) -> BufferProxy: ... # TODO: parent: TypedDict | Protocol
2123
def write(
2224
self,
2325
buffer: str | bytes, # Any "read-only bytes-like-object" is valid

0 commit comments

Comments
 (0)