Skip to content

Remove the qp.qaoa module - #10249

Merged
JerryChen97 merged 5 commits into
mainfrom
jerrychen97-remove-qaoa-module
Oct 2, 2026
Merged

JerryChen97 merged 5 commits into
mainfrom
jerrychen97-remove-qaoa-module

Conversation

@JerryChen97

@JerryChen97 JerryChen97 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Context:

Part of the ongoing removal of classic PennyLane modules for PennyLane2, following
the same pattern as qp.fourier (#10212), qp.noise (#10214), qp.qcut (#10235)
and qp.qnn (#10247).

Description of the Change:

Removes the pennylane.qaoa module:

  • Deleted pennylane/qaoa/ (cost.py, cycle.py, layers.py, mixers.py, __init__.py)
    and tests/test_qaoa.py.
  • Dropped from pennylane import qaoa from pennylane/__init__.py.
  • Removed the pennylane.qaoa module block from tach.toml.
  • Deleted doc/code/qp_qaoa.rst and its doc/index.rst toctree entry.
  • Removed the --ignore=pennylane/qaoa rule from documentation-tests.yml.
  • Added entries to doc/development/deprecations.rst and doc/releases/changelog-dev.md.

This covers the mixer Hamiltonians (x_mixer, xy_mixer, bit_flip_mixer), the cost
Hamiltonians (maxcut, max_independent_set, min_vertex_cover, max_clique,
max_weight_cycle, bit_driver, edge_driver), the ansatz layers (cost_layer,
mixer_layer) and the pennylane.qaoa.cycle helpers.

Deliberately left alone:

  • QAOAEmbedding is a template under pennylane/templates/embeddings/, not part of this
    module, and is unaffected.
  • rustworkx / networkx stay as dependencies; both are used elsewhere in the package.
  • Unlike qp.qcut, qp.qaoa had no pytest marker, no dedicated CI job and no extras
    group, so there is nothing to remove from pytest.ini, conftest.py or pyproject.toml.

Benefits:

Less surface area to maintain and migrate to Operator2 / PennyLane2.

Possible Drawbacks:

Breaking change for anyone using qp.qaoa. There is no in-tree replacement.

Related GitHub Issues:
[sc-132149]

Authored with assistance from an AI coding assistant; all changes reviewed by a human.

JerryChen97 and others added 2 commits October 1, 2026 16:29
Removes `pennylane/qaoa` (cost, cycle, layers, mixers) along with its
tests, API docs page, `tach.toml` module entry and the documentation-tests
ignore rule. `QAOAEmbedding` is a template and is unaffected.

Authored with assistance from an AI coding assistant.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JerryChen97
JerryChen97 marked this pull request as ready for review October 1, 2026 20:35
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.40%. Comparing base (a222dc9) to head (03d2491).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10249      +/-   ##
==========================================
- Coverage   99.41%   99.40%   -0.01%     
==========================================
  Files         603      598       -5     
  Lines       66975    66593     -382     
==========================================
- Hits        66580    66200     -380     
+ Misses        395      393       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrijapau andrijapau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What (if any) demos are affected by this?

@JerryChen97

Copy link
Copy Markdown
Contributor Author

What (if any) demos are affected by this?

Searched PennyLaneAI/demos @ master. Five demos import the module directly:

Demo APIs used
tutorial_qaoa_intro edge_driver, min_vertex_cover, cost_layer, mixer_layer
tutorial_falqon max_clique, cost_layer, mixer_layer
braket-parallel-gradients maxcut, cost_layer, mixer_layer
learning2learn maxcut, cost_layer, mixer_layer
qnspsa maxcut, cost_layer, mixer_layer

@JerryChen97
JerryChen97 requested a review from andrijapau October 2, 2026 18:37
@andrijapau

Copy link
Copy Markdown
Contributor

What (if any) demos are affected by this?

Searched PennyLaneAI/demos @ master. Five demos import the module directly:
Demo APIs used
tutorial_qaoa_intro edge_driver, min_vertex_cover, cost_layer, mixer_layer
tutorial_falqon max_clique, cost_layer, mixer_layer
braket-parallel-gradients maxcut, cost_layer, mixer_layer
learning2learn maxcut, cost_layer, mixer_layer
qnspsa maxcut, cost_layer, mixer_layer

Can we add a story to this iteration to make sure we fix those?

@JerryChen97
JerryChen97 enabled auto-merge October 2, 2026 20:08
@JerryChen97
JerryChen97 added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit 1429cae Oct 2, 2026
54 checks passed
@JerryChen97
JerryChen97 deleted the jerrychen97-remove-qaoa-module branch October 2, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants