Skip to content
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

Migrate qiskit.util module to qiskit.utils #5420

Merged
merged 6 commits into from
Nov 25, 2020

Conversation

mtreinish
Copy link
Member

Summary

This commit moves the qiskit.util module to live in the qiskit.utils
namespace. There will soon be an import of code that previously lived in
qiskit-aqua that will live in qiskit.utils. To avoid confusing naming
between qiskit.util and qiskit.utils this commit preemptively makes a
utils directory and moves the code from the util module into it. For
backwards compatibility the qiskit.util module will reexport the API
from qiskit.utils which is now deprecated. A release note is added but
no warning is emitted since we can't have module level getattr until
the minimum supported python version is 3.7.

One function in qiskit.util, _has_connection(), was moved to
qiskit.test.decorators. This was done because it's private and not used
anywhere else. The interactive visualizations previously relied on this
to ensure they could connect to the server hosting the javascript, but
that server has since been shutdown and those functions were deprecated
in #4438 and switched to just call the matplotlib equivalent functions
instead.

Details and comments

This commit moves the qiskit.util module to live in the qiskit.utils
namespace. There will soon be an import of code that previously lived in
qiskit-aqua that will live in qiskit.utils. To avoid confusing naming
between qiskit.util and qiskit.utils this commit preemptively makes a
utils directory and moves the code from the util module into it. For
backwards compatibility the qiskit.util module will reexport the API
from qiskit.utils which is now deprecated. A release note is added but
no warning is emitted since we can't have module level __getattr__ until
the minimum supported python version is 3.7.

One function in qiskit.util, _has_connection(), was moved to
qiskit.test.decorators. This was done because it's private and not used
anywhere else. The interactive visualizations previously relied on this
to ensure they could connect to the server hosting the javascript, but
that server has since been shutdown and those functions were deprecated
in Qiskit#4438 and switched to just call the matplotlib equivalent functions
instead.
@mtreinish mtreinish requested review from maddy-tod, nonhermitian and a team as code owners November 20, 2020 20:50
ajavadia
ajavadia previously approved these changes Nov 20, 2020
qiskit/utils/__init__.py Outdated Show resolved Hide resolved
@mergify mergify bot merged commit d9c42fc into Qiskit:master Nov 25, 2020
@mtreinish mtreinish deleted the split_up_utils branch November 26, 2020 15:47
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Dec 11, 2020
In Qiskit#5420 the qiskit.util module was migrated to qiskit/utils to be
consistent with imported code from qiskit-aqua in Qiskit#5422. However, the
backwards compat shim added in that PR has a couple of issues, mainly
around re-exporting the entirety of qiskit.utils which occasionally
causes import cycles and is larger than what functions used to exist in
qiskit.util and should be deprecated. This commit fixes this by changing
the deprecation shim in qiskit.util to only re-export the functions that
previously existed in qiskit.util for backwards compatibility during the
deprecation period.
kdk pushed a commit that referenced this pull request Dec 11, 2020
In #5420 the qiskit.util module was migrated to qiskit/utils to be
consistent with imported code from qiskit-aqua in #5422. However, the
backwards compat shim added in that PR has a couple of issues, mainly
around re-exporting the entirety of qiskit.utils which occasionally
causes import cycles and is larger than what functions used to exist in
qiskit.util and should be deprecated. This commit fixes this by changing
the deprecation shim in qiskit.util to only re-export the functions that
previously existed in qiskit.util for backwards compatibility during the
deprecation period.
@kdk kdk added the Changelog: Deprecation Include in "Deprecated" section of changelog label Mar 31, 2021
ElePT pushed a commit to ElePT/qiskit-algorithms that referenced this pull request Jul 27, 2023
* Migrate qiskit.util module to qiskit.utils

This commit moves the qiskit.util module to live in the qiskit.utils
namespace. There will soon be an import of code that previously lived in
qiskit-aqua that will live in qiskit.utils. To avoid confusing naming
between qiskit.util and qiskit.utils this commit preemptively makes a
utils directory and moves the code from the util module into it. For
backwards compatibility the qiskit.util module will reexport the API
from qiskit.utils which is now deprecated. A release note is added but
no warning is emitted since we can't have module level __getattr__ until
the minimum supported python version is 3.7.

One function in qiskit.util, _has_connection(), was moved to
qiskit.test.decorators. This was done because it's private and not used
anywhere else. The interactive visualizations previously relied on this
to ensure they could connect to the server hosting the javascript, but
that server has since been shutdown and those functions were deprecated
in Qiskit/qiskit#4438 and switched to just call the matplotlib equivalent functions
instead.

* Update qiskit/utils/__init__.py
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.

3 participants