Skip to content

Conversation

mtreinish
Copy link
Member

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

@mtreinish mtreinish added the Changelog: Deprecation Include in "Deprecated" section of changelog label Jan 8, 2024
@mtreinish mtreinish added this to the 0.46.0 milestone Jan 8, 2024
@mtreinish mtreinish requested review from woodsp-ibm and a team as code owners January 8, 2024 17:22
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

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.
Comment on lines +46 to +54
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)
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

@jakelishman
Copy link
Member

Meant to say: other than that one comment, looks fine.

Copy link
Member

@jakelishman jakelishman left a 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.

This was referenced Jan 10, 2024
@jakelishman jakelishman enabled auto-merge January 30, 2024 22:58
@jakelishman jakelishman added this pull request to the merge queue Jan 31, 2024
Merged via the queue into Qiskit:stable/0.46 with commit 323a330 Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Deprecation Include in "Deprecated" section of changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants