-
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
Remove schedule component #5245
Conversation
c57f25e
to
418119e
Compare
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.
Hello, @wahaj. I apologize for the long delay in my response, my focus was turned away from Qiskit. After a discussion with @lcapelluto, we believe the move to define a root NamedValue
is preemptive since there is parallel work underway to define a universal IR for Qiskit and we do not want to interfere. Therefore, if you could remove NamedValue
and have Instruction
and Schedule
just be root classes this would be excellent. I apologize for the wasted work, but I do believe it was on the right track.
Hi @taalexander, the delay led me to believe that I was to open a new PR. Anyways I'll be removing the PS : Can we remove the channels argument in the ch_start_time channel argument |
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.
I understand and this falls on me, I am sorry. Please do deprecate the channels argument, we can remove it in the following release after warning for an appropriate time. I do not see any additional changes that are required.
5805933
to
2f45747
Compare
qiskit/pulse/schedule.py
Outdated
import copy | ||
import itertools | ||
import multiprocessing as mp | ||
import sys | ||
from typing import List, Tuple, Iterable, Union, Dict, Callable, Set, Optional | ||
|
||
from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType | ||
from qiskit.pulse import 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.
This import is unnecessary and is causing circular import/linting issues. For the type hints just use 'Instruction'.
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.
Thank you for that. Hope it passes this time around
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.
Warning, treated as error:
Cannot resolve forward reference in type annotations of "qiskit.pulse.Schedule": name 'Instruction' is not defined
___________________________________ summary ____________________________________
ERROR: docs: commands failed
This is the error Azure build gives me. The problem is with the forward References in Schedule and Instruction. According to PEP484 forward references section, this would cause a circular dependency either way. Can you help resolve this problem?
2f45747
to
d0f59ad
Compare
Deprecate the ScheduleComponent class and remove it as the base class of Schedule and Instruction. Anywhere that currently accepts a ScheduleComponent should instead accept a Union[Schedule, Instruction]. Propagate the docstrings for the removed properties to Instruction and the Schedule classes themselves. Use Schedule and Instruction type forwardRef of the classes in the typed arguments * deprecate channels argument in ch_start_time method of Instruction Fixes Qiskit#5076
d0f59ad
to
1fe0755
Compare
Hi @taalexander, |
Agreed, the circular references are a byproduct of trying to be both a data structure and have a nice DSL like user interface. I think this was a mistake, and the |
I pushed a commit which should hopefully resolve these issues, lets see :) |
Summary
Deprecate the
ScheduleComponent
interface. Replace allScheduleComponent
occurrences withUnion[Schedule, Instruction]
in typingDetails and comments
Refer to PR #5137
Anywhere that currently accepts a
ScheduleComponent
should instead accept aUnion[Schedule, Instruction]
. The docstrings for the removed properties have been propagated to theInstruction
and theSchedule
classes themselves.Schedule
andInstruction
both now uses a'Schedule'
/'Instruction'
forwardRef of the class in the typed argumentsFixes #5076