-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make python-constraint optional #7733
Conversation
Pull Request Test Coverage Report for Build 2392360390
💛 - Coveralls |
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.
The benchmark suite in Qiskit/qiskit directly imports CSPLayout
from Terra, so that's one case where we going to need to handle this issue of defining a new extra and immediately moving previously required functionality into it. For the benchmark suite in particular, we don't need to synchronise CI because it doesn't matter if the benchmark run fails, but it's more indicative of the potential issue.
Since Qiskit#7213 we no longer have been using the CSPLayout pass by default in the preset passmanagers or transpile(). This is because it has been superseded by the VF2Layout pass which is now used everywhere. While we will keep the CSPLayout pass around for the forseeable future there is no need to install python-constraint by default anymore since it's only user is the CSPLayout pass, which isn't going to be commonly used anymore now that it's not used in the default compilation path anymore. This commit removes the python-constraint library from the requirements list and makes it an optional dependency. Fixes Qiskit#7726
This commit splits the custom solver class definition out into a separate private module that is not imported until runtime. This enables us to avoid a module level import for python-constraint meaning we only try to import if something is actually using CSPLayout.
1fd7f65
to
32140bf
Compare
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.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.
Nitpicky documentation comment aside, this looks good to me.
* Make python-constraint optional Since Qiskit/qiskit#7213 we no longer have been using the CSPLayout pass by default in the preset passmanagers or transpile(). This is because it has been superseded by the VF2Layout pass which is now used everywhere. While we will keep the CSPLayout pass around for the forseeable future there is no need to install python-constraint by default anymore since it's only user is the CSPLayout pass, which isn't going to be commonly used anymore now that it's not used in the default compilation path anymore. This commit removes the python-constraint library from the requirements list and makes it an optional dependency. Fixes Qiskit/qiskit#7726 * Add docstring for HAS_CONSTRAINT * Add private module to avoid module level optional import This commit splits the custom solver class definition out into a separate private module that is not imported until runtime. This enables us to avoid a module level import for python-constraint meaning we only try to import if something is actually using CSPLayout. * Fix rebase issue * Fix lint * Fix typo in release note Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> * Alphabetize optionals list Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Summary
Since #7213 we no longer have been using the CSPLayout pass by default
in the preset passmanagers or transpile(). This is because it has been
superseded by the VF2Layout pass which is now used everywhere. While we
will keep the CSPLayout pass around for the forseeable future there is
no need to install python-constraint by default anymore since it's only
user is the CSPLayout pass, which isn't going to be commonly used
anymore now that it's not used in the default compilation path anymore.
This commit removes the python-constraint library from the requirements
list and makes it an optional dependency.
Details and comments
Fixes #7726