Skip to content

TST: Replace pywin32 with ctypes wrapper - #31358

Merged
timhoffm merged 1 commit into
matplotlib:mainfrom
QuLogic:win32-ctypes
Mar 24, 2026
Merged

timhoffm merged 1 commit into
matplotlib:mainfrom
QuLogic:win32-ctypes

Conversation

@QuLogic

@QuLogic QuLogic commented Mar 24, 2026

Copy link
Copy Markdown
Member

PR summary

We only use pywin32 for one function, and while taking care of all the wrapping is nice, it's easy to just take the information from the MSDN docs [1] and pass it through ctypes instead.

This avoids the dependency entirely, helping to fix package conflicts with pixi [2].

[1] https://learn.microsoft.com/en-us/windows/console/generateconsolectrlevent
[2] #30877 (comment)

AI Disclosure

None

PR checklist

We only use `pywin32` for one function, and while taking care of all the
wrapping is nice, it's easy to just take the information from the MSDN
docs [1] and pass it through `ctypes` instead.

This avoids the dependency entirely, helping to fix package conflicts
with pixi [2].

[1] https://learn.microsoft.com/en-us/windows/console/generateconsolectrlevent
[2] matplotlib#30877 (comment)
@QuLogic

QuLogic commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

Looking at the Azure logs, all Qt backends are skipped, so we have to wait for AppVeyor to confirm.

@QuLogic

QuLogic commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

On AppVeyor, PyQt6, PySide6, and PySide2 are skipped, but not PyQt5. And that passes, so this does appear to have worked.

@QuLogic
QuLogic marked this pull request as ready for review March 24, 2026 01:39
@timhoffm timhoffm added this to the v3.11.0 milestone Mar 24, 2026
@timhoffm
timhoffm merged commit 2d60a3d into matplotlib:main Mar 24, 2026
55 of 56 checks passed
@QuLogic
QuLogic deleted the win32-ctypes branch March 24, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants