Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python dev.py stubs fails locally in stubcheck #3298

Closed
aatle opened this issue Jan 20, 2025 · 1 comment · Fixed by #3300
Closed

python dev.py stubs fails locally in stubcheck #3298

aatle opened this issue Jan 20, 2025 · 1 comment · Fixed by #3300
Labels
bug Not working as intended

Comments

@aatle
Copy link
Contributor

aatle commented Jan 20, 2025

Environment (2):
main branch, at commit: 565cae6

Windows 11

Platform:               Windows-11-10.0.22631-SP0
System:                 Windows
System Version:         10.0.22631
Processor:              Intel64 Family 6 Model 167 Stepping 1, GenuineIntel     SSE2: Yes       AVX2: Yes       NEON: No
Architecture:           Bits: 64bit     Linkage: WindowsPE

Python:                 CPython 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)]
pygame version:         2.5.3.dev1
SDL versions:           Linked: 2.30.11 Compiled: 2.30.11
SDL Mixer versions:     Linked: 2.8.0   Compiled: 2.8.0
SDL Font versions:      Linked: 2.24.0  Compiled: 2.24.0
SDL Image versions:     Linked: 2.9.0   Compiled: 2.9.0
Freetype versions:      Linked: 2.11.1  Compiled: 2.11.1

Display Driver:         Display Not Initialized
Mixer Driver:           Mixer Not Initialized

Linux (Fedora 41)

Platform:           	Linux-6.11.5-300.t2.fc41.x86_64-x86_64-with-glibc2.40
System:             	Linux
System Version:     	#1 SMP PREEMPT_DYNAMIC Fri Oct 25 05:44:11 UTC 2024
Processor:                  	SSE2: Yes   	AVX2: Yes   	NEON: No
Architecture:       	Bits: 64bit 	Linkage: ELF

Python:             	CPython 3.13.1 (main, Dec  9 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)]
pygame version:     	2.5.3.dev1
SDL versions:       	Linked: 2.30.11 Compiled: 2.30.11
SDL Mixer versions: 	Linked: 2.8.0   Compiled: 2.8.0
SDL Font versions:  	Linked: 2.22.0  Compiled: 2.22.0
SDL Image versions: 	Linked: 2.8.4   Compiled: 2.8.4
Freetype versions:  	Linked: 2.13.3  Compiled: 2.13.3

Display Driver:     	Display Not Initialized
Mixer Driver:       	Mixer Not Initialized

Current behavior:

Locally running python dev.py stubs (and by extension, python dev.py all) may give an error about stub vs implementation discrepancies.
pygame-ce was installed with pip install .
The stub issues causing the fail seem to be valid, and are only inside of _sdl2 modules.

Expected behavior:

There are no discrepancies and the checks pass.
Or, the checks fail in CI checks on GitHub because of the discrepancies.

Steps to reproduce:

  1. Clone the pygame-ce repo or a fork, locally. Open the directory
  2. Create a venv with python -m venv .venv
  3. Install pygame-ce with pip install ., using the venv interpreter.
  4. Run python dev.py stubs
  5. Observe the errors, and check that they are correct
Stack trace/error output/other error logs Windows
$ python dev.py stubs
[dev.py] Using python 'C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe'
[dev.py] Checking pip version
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m pip -V
pip 24.2 from C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\pip (python 3.13)

[dev.py] Determined pip version: 24.2
[dev.py] Installing dependencies
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m pip install -v numpy mypy==1.13.0
Using pip 24.2 from C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\pip (python 3.13)
Requirement already satisfied: numpy in c:\users\user\development\pygame-ce\.venv\lib\site-packages (2.2.1)
Requirement already satisfied: mypy==1.13.0 in c:\users\user\development\pygame-ce\.venv\lib\site-packages (1.13.0)
Requirement already satisfied: typing-extensions>=4.6.0 in c:\users\user\development\pygame-ce\.venv\lib\site-packages (from mypy==1.13.0) (4.12.2)
Requirement already satisfied: mypy-extensions>=1.0.0 in c:\users\user\development\pygame-ce\.venv\lib\site-packages (from mypy==1.13.0) (1.0.0)

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
[dev.py] Generating and testing type stubs (with mypy)
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe buildconfig/stubs/gen_stubs.py
pygame-ce \ 2.5.3.dev1 (SDL 2.30.11, Python 3.13.0)
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe buildconfig/stubs/stubcheck.py
Using mypy invocation: `C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m mypy typing_sample_app.py` (version: mypy 1.13.0 (compiled: yes))
Success: no issues found in 1 source file
Using stubtest invocation: `C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m mypy.stubtest` (version: stubtest.py 1.13.0)
error: pygame._sdl2.controller.Controller.stop_rumble is inconsistent, runtime does not have argument "low_frequency"
Stub: in file C:\Users\user\development\pygame-ce\buildconfig\stubs\pygame\_sdl2\controller.pyi:29
def (self: pygame._sdl2.controller.Controller, low_frequency: builtins.float, high_frequency: builtins.float, duration: builtins.int) -> builtins.bool
Runtime:
def (self, /)

error: pygame._sdl2.controller.Controller.stop_rumble is inconsistent, runtime does not have argument "high_frequency"
Stub: in file C:\Users\user\development\pygame-ce\buildconfig\stubs\pygame\_sdl2\controller.pyi:29
def (self: pygame._sdl2.controller.Controller, low_frequency: builtins.float, high_frequency: builtins.float, duration: builtins.int) -> builtins.bool
Runtime:
def (self, /)

error: pygame._sdl2.controller.Controller.stop_rumble is inconsistent, runtime does not have argument "duration"
Stub: in file C:\Users\user\development\pygame-ce\buildconfig\stubs\pygame\_sdl2\controller.pyi:29
def (self: pygame._sdl2.controller.Controller, low_frequency: builtins.float, high_frequency: builtins.float, duration: builtins.int) -> builtins.bool
Runtime:
def (self, /)

error: pygame._sdl2.touch.get_device is inconsistent, stub argument "index" should be positional-only (rename with a leading double underscore, i.e. "__object")
Stub: in file C:\Users\user\development\pygame-ce\buildconfig\stubs\pygame\_sdl2\touch.pyi:4
def (index: builtins.int) -> builtins.int
Runtime:
def (object, /)

error: pygame._sdl2.touch.get_num_fingers is inconsistent, stub argument "device_id" should be positional-only (rename with a leading double underscore, i.e. "__object")
Stub: in file C:\Users\user\development\pygame-ce\buildconfig\stubs\pygame\_sdl2\touch.pyi:5
def (device_id: builtins.int) -> builtins.int
Runtime:
def (object, /)

Found 5 errors (checked 177 modules)
[dev.py] Process exited with error code 1

Linux

(.venv) ↪ python dev.py stubs
[dev.py] Using python '/home/user/development/pygame-ce/.venv/bin/python'
[dev.py] Checking pip version
[dev.py] > /home/user/development/pygame-ce/.venv/bin/python -m pip -V
pip 24.3.1 from /home/user/development/pygame-ce/.venv/lib64/python3.13/site-packages/pip (python 3.13)
[dev.py] Determined pip version: 24.3.1
[dev.py] Installing dependencies
[dev.py] > /home/user/development/pygame-ce/.venv/bin/python -m pip install -v numpy mypy==1.13.0
Using pip 24.3.1 from /home/user/development/pygame-ce/.venv/lib64/python3.13/site-packages/pip (python 3.13)
Requirement already satisfied: numpy in ./.venv/lib64/python3.13/site-packages (2.2.2)
Requirement already satisfied: mypy==1.13.0 in ./.venv/lib64/python3.13/site-packages (1.13.0)
Requirement already satisfied: typing-extensions>=4.6.0 in ./.venv/lib64/python3.13/site-packages (from mypy==1.13.0) (4.12.2)
Requirement already satisfied: mypy-extensions>=1.0.0 in ./.venv/lib64/python3.13/site-packages (from mypy==1.13.0) (1.0.0)
[dev.py] Generating and testing type stubs (with mypy)
[dev.py] > /home/user/development/pygame-ce/.venv/bin/python buildconfig/stubs/gen_stubs.py
pygame-ce 2.5.3.dev1 (SDL 2.30.11, Python 3.13.1)
[dev.py] > /home/user/development/pygame-ce/.venv/bin/python buildconfig/stubs/stubcheck.py
Using mypy invocation: `/home/user/development/pygame-ce/.venv/bin/python -m mypy typing_sample_app.py` (version: mypy 1.13.0 (compiled: yes))
Success: no issues found in 1 source file
Using stubtest invocation: `/home/user/development/pygame-ce/.venv/bin/python -m mypy.stubtest` (version: stubtest.py 1.13.0)
error: pygame._sdl2.controller.Controller.stop_rumble is inconsistent, runtime does not have argument "low_frequency"
Stub: in file /home/user/development/pygame-ce/buildconfig/stubs/pygame/_sdl2/controller.pyi:29
def (self: pygame._sdl2.controller.Controller, low_frequency: builtins.float, high_frequency: builtins.float, duration: builtins.int) -> builtins.bool
Runtime:
def (self, /)

error: pygame._sdl2.controller.Controller.stop_rumble is inconsistent, runtime does not have argument "high_frequency"
Stub: in file /home/user/development/pygame-ce/buildconfig/stubs/pygame/_sdl2/controller.pyi:29
def (self: pygame._sdl2.controller.Controller, low_frequency: builtins.float, high_frequency: builtins.float, duration: builtins.int) -> builtins.bool
Runtime:
def (self, /)

error: pygame._sdl2.controller.Controller.stop_rumble is inconsistent, runtime does not have argument "duration"
Stub: in file /home/user/development/pygame-ce/buildconfig/stubs/pygame/_sdl2/controller.pyi:29
def (self: pygame._sdl2.controller.Controller, low_frequency: builtins.float, high_frequency: builtins.float, duration: builtins.int) -> builtins.bool
Runtime:
def (self, /)

error: pygame._sdl2.touch.get_device is inconsistent, stub argument "index" should be positional-only (rename with a leading double underscore, i.e. "__object")
Stub: in file /home/user/development/pygame-ce/buildconfig/stubs/pygame/_sdl2/touch.pyi:4
def (index: builtins.int) -> builtins.int
Runtime:
def (object, /)

error: pygame._sdl2.touch.get_num_fingers is inconsistent, stub argument "device_id" should be positional-only (rename with a leading double underscore, i.e. "__object")
Stub: in file /home/user/development/pygame-ce/buildconfig/stubs/pygame/_sdl2/touch.pyi:5
def (device_id: builtins.int) -> builtins.int
Runtime:
def (object, /)

Found 5 errors (checked 177 modules)
[dev.py] Process exited with error code 1
@aatle aatle added the bug Not working as intended label Jan 20, 2025
@ankith26
Copy link
Member

Thanks for the bug report! These seem to be actually valid issues that are correctly caught by stubtest on your end. I could not reproduce these fails locally for reasons beyond me, and neither could CI.

I have put up a PR to fix the issue, please review and check if that fixes the errors raised on your end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants