-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command/Instruction unification #3862
Command/Instruction unification #3862
Conversation
…will migrate into the new instructions submodule of pulse. This begins by moving only the Instruction class. The Instruction ``command`` attribute is deprecated in favor of ``operands``, and references to commands are updated.
ebccc75
to
409d94b
Compare
…ommands/__init__ can have a deprecation warning after the rest is implemented
… now just 'duration', and any other operands only exist for an instruction instance
Fix up hash function
releasenotes/notes/unify-instructions-and-commands-aaa6d8724b8a29d3.yaml
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! I've noted a couple of things I might change, but I am of course open to discussion 😄 .
Co-Authored-By: Thomas Alexander <thomasalexander2718@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! A good start! Looking forward to seeing the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some comments from a quick skimming of the release notes
@@ -0,0 +1,22 @@ | |||
--- | |||
prelude: > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be either feature
or upgrade
(probably feature)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was this one prelude message and then the following 6 PRs would be a list of upgrades with specific details, for example DelayInstruction(Delay(time), channel) => Delay(time, channel)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I'll defer to your opinion
There has been a significant simplification to the style in which Pulse | ||
instructions are built. | ||
|
||
With the previous style, ``Command`` s were called with channels to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to use:
With the previous style, ``Command`` s were called with channels to make | |
With the previous style, :class:`qiskit.pulse.Command`s were called with channels to make |
here and in other places were you reference a class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for Command because it wants to disappear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instruction should though
…om:lcapelluto/qiskit-terra into issue-3750-unify-commands-and-instructions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for updating the release note
…om:lcapelluto/qiskit-terra into issue-3750-unify-commands-and-instructions
0bc4163
* Begin command and instruction unification within Pulse. Instructions will migrate into the new instructions submodule of pulse. This begins by moving only the Instruction class. The Instruction ``command`` attribute is deprecated in favor of ``operands``, and references to commands are updated. * Remove deprecation warning from commands/instruction.py because the commands/__init__ can have a deprecation warning after the rest is implemented * Revert commands/__init__ because changes there are not necessary. * Fill in first positional argument in instruction. What was command is now just 'duration', and any other operands only exist for an instruction instance * Continue adding documentation and notes Fix up hash function * Fix type hint from List[Channel] to Channel * Update repr to match new init signature * Update qiskit/pulse/instructions/__init__.py Co-Authored-By: Thomas Alexander <thomasalexander2718@gmail.com> * Update init file for the instruction module to be more clear about the operands * Make Instruction an ABC * update instruction comment * Update docs * Update year in copyright header * Revert Instruction as ABC because the Instructions which haven't been migrated yet do not support the abstractmethods * Update __eq__ to support both styles until migration is complete * Update __hash__ to support both styles until migration is complete * Fixup style * Update TODO comment * Use self.command instead of init arg if the first arg is a command, for readability * Make repr unchanged for nonmigrated commands * Small bugfix * Update instructions documentation * Relax requirement for channel operand * API reference to Instruction in release notes * Fix releasenote * Silly reno style Co-authored-by: Thomas Alexander <thomasalexander2718@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
First part of #3750
Begin command and instruction unification within Pulse. Instructions will migrate into the new instructions submodule of pulse. This begins by moving only the Instruction class. The Instruction
command
attribute is deprecated in favor ofoperands
, and references to commands are updated.This is the first of a series of 7 (anticipated) PRs to implement this migration. All other PRs depend on this one.
TODO:
operands
Details and comments
https://github.com/Qiskit/rfcs/pull/12/files?short_path=990963a#diff-990963ad1ab66f8d85311258e904239a
For the reviewer: I made comments near the functions in
instructions.py
that are altered from the original file.