-
-
Notifications
You must be signed in to change notification settings - Fork 161
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 test for 3rd party imports meaningful again #2270
Conversation
@@ -3,8 +3,7 @@ | |||
# module. | |||
# Original authors: Cirq developers: Xiao Mi, Dave Bacon, Craig Gidney, | |||
# Ping Yeh, Matthew Neely. | |||
# Code URL = ('https://github.com/quantumlib/Cirq/blob/main/cirq-core/cirq/ | |||
# experiments/qubit_characterizations.py'). | |||
# Code URL = ('https://github.com/quantumlib/Cirq/blob/main/cirq-core/cirq/experiments/qubit_characterizations.py'). |
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.
Unrelated to the PR's scope; it just annoyed me that I couldn't Ctrl+Click on that link from my IDE 😄
The build failed because of an issue with codecov unrelated to the PR, see codecov/codecov-action#598 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2270 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 90 90
Lines 4263 4263
=======================================
Hits 4190 4190
Misses 73 73 ☔ View full report in Codecov by Sentry. |
The codecov error in the build was fixed by #2271 but now linkcheck is erroring out 🤦 |
That'll happen, unfortunately. I usually check to ensure the links are not truly broken, and if they work, then just make a note of it being the reason for the red X and continue on. |
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.
Good catch!
We should merge this, but it does make me wonder as something to consider for the future: can we remove cirq
as our main dependency and use cirq-core
instead?
if isinstance(mitiq.QPROGRAM, ABCMeta): | ||
pass # If only Cirq is installed, QPROGRAM is not a typing.Union. | ||
else: | ||
if get_origin(mitiq.QPROGRAM) is Union: |
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.
Nice, this is an easier way to understand that the type of something is a Union
!
That's exactly what I wrote in the last sentence of the description 😬 |
You're right, sorry! |
Docs build fails because of linkcheck getting 403 from iopscience. I inspected those links manually and they work, hence merging. |
Description
(This fix is a prerequisite for working on #746.)
A test was created in #745 to double check that one can import mitiq without any 3rd party integration package installed. However, this was relying on
pip install .
not installing any integration packages, which is no longer the case, sincecirq
is in the mainrequirements.txt
and in turn installspyquil
.In other words, the scenario in which QPROGRAM collapses to the single Circuit type (and not an Union) was never hit. This PR addresses this.
A more elegant fix would imply to only have
cirq-core
in the main requirements, but that requires some deeper redesign of how we integrate 3rd parties packages.Test
I tested this with the awesome act tool (note: it requires Docker) by running
From the output (in the screenshot), one can see that pyquil is found and uninstalled.