Use pygraphviz to render pass manager drawings (step 1 of #16544) - #16675
Use pygraphviz to render pass manager drawings (step 1 of #16544)#16675VedantMahadik-qc wants to merge 1 commit into
Conversation
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
|
Vedant seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
AI/LLM disclosure
Implements step 1 of the plan @1ucian0 outlined in #16544: adds 'pygraphviz' as a new optional dependency and removes the requirement for a manually installed system Graphviz when drawing pass managers.
Changes
Windows wheel confirmation
On Windows 11 / Python 3.11 with no system Graphviz installed, 'pip install pygraphviz' fetched the prebuilt 'pygraphviz-2.0.1-cp311-win_amd64' wheel, and 'pass_manager_drawer' rendered successfully end-to-end – which is the platform confirmation step 1 is meant to provide.
Also fixes a latent Windows bug
Testing this path exposed a pre-existing issue: 'make_output' called 'os.remove' on the temporary PNG while 'PIL.Image.open's' lazy file handle was still open, raising 'PermissionError' on Windows. The image is now loaded via a context manager and copied in-memory. (This predates this PR but was unreachable in practice, since the drawer previously required a system Graphviz install that Windows users rarely had.)
'test_pass_manager_drawer.py' passes 2/2 locally on Windows — these tests were previously always skipped on this platform.
The rustworkx-based call sites ('dag_visualization.py', 'gate_map.py', etc.) still legitimately require 'HAS_GRAPHVIZ', so that tester is unchanged. If this goes beyond step 1, I'm happy to trim it back.
Part of #16544 (step 2 - moving off pydot/dot-calls to follow separately).