Skip to content

Split Target / PyTarget#15857

Draft
raynelfss wants to merge 16 commits intoQiskit:mainfrom
raynelfss:target-split-new
Draft

Split Target / PyTarget#15857
raynelfss wants to merge 16 commits intoQiskit:mainfrom
raynelfss:target-split-new

Conversation

@raynelfss
Copy link
Contributor

Summary

Based on top of #14308 and #15349.

Details and comments

This is the first part of the effort to split the Python version of Target from the Rust version, this PR does the internal split between PyTarget (PyO3) and Target (Rust).

The next step is to prevent the Python target from subclassing the Rust version of it. A better approach might end up just moving all of the functionality to the PyO3 struct since they are so intertwined.

To-do list:

  • Clean up code
  • Decide on whether to move the rest of functionality to PyO3.
  • Update PR message.

raynelfss and others added 14 commits January 14, 2026 12:50
- Add detailed docstrings with warnings about where not to use them.
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
The following commits remove the redundant mappings `gate_name_map` and `angle_bounds` in favor of one mapping with a struct that contains all of that data. This results in a much lighter `Target` going from 504 (0x1F8) bytes to 288 bytes.

The new struct called `TargetProperties` is currently internal-only. And contains three fields.
- `properties` containing the mapping of the qargs and instruction properties (originally the `gate_map`).
- `instruction` containing the `TargetOperation` (originally the `gate_name_map`).
- `angle_bounds`: Optionally containing the angle bounds for the ``Target`` (originally `angle_bounds`.)

This is the first effort to more efficiently use the ``Target`` in Rust with upcoming efforts focusing on its behavior on Python.

Fix: Remove clippy unused
- Remove duplicate methods in Python.
- Revert changes to `Target` python class subclassing.
@raynelfss raynelfss added this to the 2.5.0 milestone Mar 23, 2026
@raynelfss raynelfss added on hold Can not fix yet Changelog: None Do not include in the GitHub Release changelog. mod: transpiler Issues and PRs related to Transpiler labels Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: None Do not include in the GitHub Release changelog. mod: transpiler Issues and PRs related to Transpiler on hold Can not fix yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant