Skip to content

Support functools.partial in inspection tools#9571

Open
CleanDev-Fix wants to merge 1 commit into
PennyLaneAI:mainfrom
CleanDev-Fix:codex/partial-inspection-9394
Open

Support functools.partial in inspection tools#9571
CleanDev-Fix wants to merge 1 commit into
PennyLaneAI:mainfrom
CleanDev-Fix:codex/partial-inspection-9394

Conversation

@CleanDev-Fix
Copy link
Copy Markdown

Summary

  • unwrap nested functools.partial callables before dispatching qml.draw, qml.draw_mpl, and qml.specs
  • preserve partial-bound positional and keyword arguments when constructing tapes/specs
  • add regression coverage for nested, positional, and call-time-overridden QNode partials, qfunc draw_mpl partials, and Catalyst-marked QJIT partial paths

Fixes #9394.

Tests

  • .venv\Scripts\python -m black --check --target-version py312 pennylane/_partial.py pennylane/drawer/draw.py pennylane/resource/specs.py tests/drawer/test_draw.py tests/drawer/test_draw_mpl.py tests/drawer/test_draw_catalyst.py tests/resource/test_specs.py
  • $env:MPLBACKEND='Agg'; uv run pytest tests/drawer/test_draw.py tests/drawer/test_draw_mpl.py tests/resource/test_specs.py -q

@github-actions github-actions Bot added the external PRs opened by contributors outside the PennyLaneAI organization label Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PRs opened by contributors outside the PennyLaneAI organization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspection tools (qp.specs, qp.draw, qp.draw_mpl) can handle functools.partial wrappers around input circuits

1 participant