Skip to content

Refactor trace and result properties#2952

Merged
msoeken merged 2 commits intofeature/qrefrom
msoeken/properties
Feb 17, 2026
Merged

Refactor trace and result properties#2952
msoeken merged 2 commits intofeature/qrefrom
msoeken/properties

Conversation

@msoeken
Copy link
Copy Markdown
Member

@msoeken msoeken commented Feb 14, 2026

This PR cleans up the way properties are handled for traces and results. Trace properties can be assigned by application generators and trace transforms and are stored in optimal resource estimation results. The Python API automatically detects whether the property value is bool, int, float, or str and does not require a dedicated property class exposed from Rust.

Some other changes include

  • Fixes a deadlock due to the Python GIL
  • Allows parallel trace generation from application generators
  • Reorganizes code around Q# application generators
  • Sets up resource estimation for memory qubits

...

@property
def memory_qubits(self) -> Optional[int]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a bit inconsistant with the general form of set_property/get_property below. It looks like this should be named get_memory_qubits, which is syntactic sugar for composin a conditional based on has_memory_qubits() followed by returning the number.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is consistent with all the other getters, like compute_qubits, resource_states, depth. In contrast, get_property is a function because we must pass a property key. In a code example it's as follows:

trace = get_a_trace_from_somewhere()
c = trace.compute_qubits
m = trace.memory_qubits
r = trace.resource_states
name = trace.get_property("name")

What we could do to enhance consistency is returning all properties and then querying them.

name = trace.properties["name"]
has_name = "name" in trace.properties

@msoeken msoeken merged commit 80ec786 into feature/qre Feb 17, 2026
15 checks passed
@msoeken msoeken deleted the msoeken/properties branch February 17, 2026 18:51
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.

2 participants