Refactor trace and result properties#2952
Merged
msoeken merged 2 commits intofeature/qrefrom Feb 17, 2026
Merged
Conversation
brad-lackey
reviewed
Feb 17, 2026
brad-lackey
reviewed
Feb 17, 2026
| ... | ||
|
|
||
| @property | ||
| def memory_qubits(self) -> Optional[int]: |
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
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
brad-lackey
reviewed
Feb 17, 2026
brad-lackey
reviewed
Feb 17, 2026
brad-lackey
reviewed
Feb 17, 2026
brad-lackey
reviewed
Feb 17, 2026
brad-lackey
reviewed
Feb 17, 2026
brad-lackey
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, orstrand does not require a dedicated property class exposed from Rust.Some other changes include