-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Deprecate qiskit.tools #11514
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
Deprecate qiskit.tools #11514
Conversation
One or more of the the following people are requested to review this:
|
This commit deprecates the qiskit.tools module. Most of the functionality in this module will be removed in the Qiskit 1.0.0 release. The sole exception is the qiskit.tools.parallel module and it's associated public function qiskit.tools.parallel_map which has been moved to qiskit.utils.
555363b
to
dc1f521
Compare
if name in _DEPRECATED_NAMES: | ||
module_name = _DEPRECATED_NAMES[name] | ||
warnings.warn( | ||
f"Accessing '{name}' from '{__name__}' is deprecated since Qiskit 0.46.0 " | ||
f"and will be removed in Qiskit 1.0.0. Import from '{module_name}' instead ", | ||
DeprecationWarning, | ||
2, | ||
) | ||
return getattr(importlib.import_module(module_name), name) |
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.
Even with the 0.46 cheat / clever trick, this is technically breaking our deprecation policy, because there's no way to support both 0.45 and 0.46 without getting a warning - this PR is the one that moves them. Other things in 0.46 are deprecations for removals that are effected in the 1.0 release, where the alternative is "don't use this" rather than "use this from somewhere else".
Depending on how strict we want to be about that, we might need to live with qiskit.tools
, but I think for the 1.0 release it's probably fine. Possibly still an edge case of the deprecation policy we ought to clarify.
Alternatively, we could remove parallel_map
from the public API, but I imagine there are users of it, so it's suboptimal.
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.
Yeah, I was weighing the awkwardness of keeping the qiskit.tools
package around with a single module vs violating the deprecation policy a bit in this case. I figured doing this all in 0.46 and violating the rules here was better than keeping qiskit.tools
around in 1.0.0. But I'm not tied to that if people object I'm fine keeping this as qiskit.tools
for the time being.
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'm ok with doing it in this release - I think the set of users who might be using parallel_map
will have a large overlap with the set of people who'll be broken for other reasons by 1.0.
Meant to say: other than that one comment, looks fine. |
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 don't mind merging as-is (unless there's a problem with a qiskit.tools
import that still seems to exist?), though I think we're doing pylint a little disservice here - I think its cyclic-import
warning is valid. That said, I'm sure there's loads of cases where cyclic-import
is being suppressed when we could have done it better, so it doesn't need fixing now.
Summary
This commit deprecates the qiskit.tools module. Most of the functionality in this module will be removed in the Qiskit 1.0.0 release. The sole exception is the qiskit.tools.parallel module and it's associated public function qiskit.tools.parallel_map which has been moved to qiskit.utils.
Details and comments