Skip to content

Commit

Permalink
Merge branch 'main' into unitary-synthesis-unroll
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish authored Jul 28, 2021
2 parents ead0803 + be0ed5f commit 89f4c1a
Show file tree
Hide file tree
Showing 799 changed files with 22,455 additions and 12,250 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,9 @@ docs/stubs/*
test/ipynb/mpl/*.png
test/ipynb/mpl/*.zip
test/ipynb/mpl/result_test.json
test/ipynb/mpl/circuit/*.png
test/ipynb/mpl/circuit/*.zip
test/ipynb/mpl/circuit/result_test.json
test/ipynb/mpl/graph/*.png
test/ipynb/mpl/graph/*.zip
test/ipynb/mpl/graph/result_test.json
72 changes: 64 additions & 8 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,84 @@
#
Abdón Rodríguez Davila <a@abdonrd.com> <a@abdonrd.com>
Abigail J. Cross <across@us.ibm.com>
Adrien Suau <adrien.suau@cerfacs.fr>
Albert Frisch <albert.frisch@de.ibm.com>
Albert Frisch <albert.frisch@de.ibm.com> <alfr@de.ibm.com>
Ali Javadi-Abhari <ali.javadi@ibm.com> <ajavadia@users.noreply.github.com>
Ali Javadi-Abhari <ali.javadi@ibm.com> <ajavadia@princeton.edu>
Alejandro Pozas-Kerstjens <physics@alexpozas.com> <apozas@users.noreply.github.com>
Almudena Carrera Vazquez <acv@zurich.ibm.com> <almudenacarreravazquez@hotmail.com>
Andrew W. Cross <awcross@us.ibm.com>
Andrew W. Cross <awcross@us.ibm.com> Andrew Cross <awcross@Andrews-MacBook-Pro.local>
Andrew W. Cross <awcross@us.ibm.com> Andrew Cross <awcross@andrews-mbp.watson.ibm.com>
Anna Phan <9410731+attp@users.noreply.github.com> <anna.phan@au1.ibm.com>
Annanay Kapila <k.annanay@gmail.com>
Antonio D. Córcoles-Gonzales <adcorcol@us.ibm.com>
Antonio Mezzacapo <30698465+antoniomezzacapo@users.noreply.github.com> <amezzac@us.ibm.com>
Arijit Saha <59946663+Arijit02@users.noreply.github.com>
Atsushi Matsuo <47442626+a-matsuo@users.noreply.github.com>
Aziz Ngoueya <49644465+AzizNgoueya@users.noreply.github.com>
Ben Rosand <brosand@gmail.com>
Bhargav Vishnu <38890773+Bhargavishnu@users.noreply.github.com>
Carmen Recio Valcarce <car_rv@outlook.es> <49230820+carmenrv@users.noreply.github.com>
Chris Culver <chris.cb.culver@gmail.com>
Christa Zoufal <40824883+Zoufalc@users.noreply.github.com>
Christa Zoufal <40824883+Zoufalc@users.noreply.github.com> <ouf@zurich.ibm.com>
Christian Clauss <cclauss@me.com> <cclauss@bluewin.ch>
Christophe Vuillot <c.vuillot@tudelft.nl>
Christopher J. Wood <cjwood@us.ibm.com>
Corey Mendell <corey.mendell@gmail.com>
Daniel Egger <38065505+eggerdj@users.noreply.github.com>
Davide Facoetti <dfacoet@gmail.com>
Davide Ferrari <20130061+DavideFrr@users.noreply.github.com>
Dennis Liu <54714046+dennis-liu-1@users.noreply.github.com>
Dimitar Trenev <64981310+dtrenev@users.noreply.github.com>
Dhruv Bhatnagar <61590679+dhruvbhq@users.noreply.github.com>
Donny Greenberg <dongreenberg2@gmail.com>
Donny Greenberg <dongreenberg2@gmail.com> <donny@ibm.com>
Diego M. Rodríguez <diego.plan9@gmail.com>
Drew Risinger <drewrisinger@users.noreply.github.com>
Dmitri Maslov <34778124+dmitrimaslov@users.noreply.github.com>
Edwin Navarro <enavarro@comcast.net>
Erick Winston <ewinston@us.ibm.com>
Farai Mazhandu <35575882+faraimazh@users.noreply.github.com>
Fran Cabrera <francabrera@users.noreply.github.com> <fcabrera@us.ibm.com>
Fran Cabrera <francabrera@users.noreply.github.com> Fran Cabrera <francabrera@Frans-MacBook-Pro.local>
Franck Chevallier <fchevallier10@gmail.com>
Freya Shah <28627285+fs1132429@users.noreply.github.com>
Gadi Aleksandrowicz <gadial@gmail.com>
Gabriele Agliardi <72732327+gabrieleagl@users.noreply.github.com>
Gawel Kus <gawel.kus@ibm.com>
Gawel Kus <gawel.kus@ibm.com> <gawel@oc7832844175.ibm.com>
Georgios Tsilimigkounakis <45130028+georgios-ts@users.noreply.github.com>
Hiroshi Horii <horii@jp.ibm.com> <HORII@jp.ibm.com>
Hiroshi Horii <horii@jp.ibm.com> <hhorii@users.noreply.github.com>
Ian Gould <iangould@IANs-MacBook.local>
Igor Olegovich Sokolov <iso@zurich.ibm.com> <ISO@zurich.ibm.com>
Ismael Faro Sertage <ismael.faro1@ibm.com> <ismael.faro.sertage@gmail.com>
Ismael Faro Sertage <ismael.faro1@ibm.com> <ismael.faro1@ibm.com>
Ismail Yunus Akhalwaya <ismaila@za.ibm.com>
Ismail Yunus Akhalwaya <ismaila@za.ibm.com> <30803146+ismaila-at-za-ibm@users.noreply.github.com>
Jack J. Woehr <4604036+jwoehr@users.noreply.github.com>
Jake Lishman <jake.lishman@ibm.com> <jake@binhbar.com>
James Seaward <58116376+JamesSeaward@users.noreply.github.com>
Jan Müggenburg <jan.mueggenburg@ibm.com>
Jan Müggenburg <jan.mueggenburg@ibm.com> <jan@oc6058543760.ibm.com>
Jay M. Gambetta <jay.gambetta@us.ibm.com>
Jerry M. Chow <chowmj@us.ibm.com>
Jessica Wilson <jessicalostinspace@gmail.com>
Jesús Pérez <jesusper@us.ibm.com> <jesusprubio@gmail.com>
Johannes Weidenfeller <54772951+Knabberjoe@users.noreply.github.com>
Jonathan A. Wildstrom <34069155+jwildstr-ibm@users.noreply.github.com>
Jonathan A. Wildstrom <34069155+jwildstr-ibm@users.noreply.github.com> <jwildstr@us.ibm.com>
Jonathan Shoemaker <Jonathan-Shoemaker@ibm.com>
Jordan Connor <jordanhconnor@gmail.com>
Jorge Carballo <carballo@us.ibm.com> <jelcaf@gmail.com>
Juan Cruz-Benito <juan.cruz@ibm.com>
Juan Gomez-Mosquera <atilag@gmail.com>
Juan Gomez-Mosquera <atilag@gmail.com> <Juan.Gomez1@ibm.com>
Julien Gacon <jul@zurich.ibm.com>
Julien Gacon <jul@zurich.ibm.com> <jules.gacon@googlemail.com>
Kevin Krsulich <kevin.krsulich@ibm.com> <kevin@krsulich.net>
Lev S. Bishop <18673315+levbishop@users.noreply.github.com>
Luciano Bello <luciano.bello@ibm.com> <lbello@gmail.com>
Expand All @@ -63,12 +106,16 @@ Mathieu Tillet <50137038+mtillet@users.noreply.github.com>
Matthew Treinish <mtreinish@kortar.org>
Matt Stypulkoski <50181769+Matt-Stypulkoski@users.noreply.github.com>
Max Reuter <Max.Reuter@ibm.com>
Max Rossmannek <rmax@ethz.ch>
Mingi Ryu <mingiryu@msn.com>
Naoki Kanazawa <39517270+nkanazawa1989@users.noreply.github.com>
Nathan Shammah <nathan.shammah@gmail.com>
Ninad Sathaye <sathayen@users.noreply.github.com>
Nick Bronn <nick.bronn@gmail.com>
Oluwatobi Ogunbayo <tobyogunbayo@gmail.com>
Paco Martín Fernández <fmartinfdez@gmail.com>
Panagiotis Barkoutsos <bpa@zurich.ibm.com>
Panagiotis Barkoutsos <bpa@zurich.ibm.com> <pbarkoutsos@gmail.com>
Patrick Neuweiler <npatrick@ethz.ch> <56123073+neupat@users.noreply.github.com>
Paul Nation <nonhermitian@gmail.com>
Peng Liu <34400304+liupibm@users.noreply.github.com>
Expand All @@ -84,35 +131,44 @@ Raphaël Lambert <49641842+rfclambert@users.noreply.github.com>
Renier Morales <renier@users.noreply.github.com>
Richard Chen <chunfuchen@users.noreply.github.com>
Raphaël Lambert <49641842+rfclambert@users.noreply.github.com>
Romain Moyard <36766072+rmoyard@users.noreply.github.com>
Rudy Raymond <rudyhar@jp.ibm.com> <rudyhar@jp.ibm.com>
Ryan Wood <ryanwood1193@gmail.com>
Salvador de la Puente González <neo.salvador@gmail.com> <salva@unoyunodiez.com>
Samuel Bosch <BoschSamuel@users.noreply.github.com>
Scott Kelso <scottkelso07@hotmail.com>
Scott Lawrence <bytbox@gmail.com>
Sean Dague <sean@dague.net>
Seif Mostafa <csseifms@gmail.com>
Seyon Sivarajah <seyon.sivarajah@cambridgequantum.com>
Shaohan Hu <shaohan.hu@ibm.com>
Shaohan Hu <shaohan.hu@ibm.com> <Shaohan.Hu@ibm.com>
Soolu Thomas <soolu.thomas@ibm.com> <soolu.elto@gmail.com>
Srujan Meesala <srujanm@gmail.com>
Stefan Woerner <wor@zurich.ibm.com> <stefan@swoerner.de>
Stefan Woerner <wor@zurich.ibm.com> <41292468+stefan-woerner@users.noreply.github.com>
Stephen Wood <40241007+woodsp-ibm@users.noreply.github.com> <woodsp@us.ibm.com>
Sumit Puri <er.sumitpuri@gmail.com>
Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Tharrmashastha SAPV <51048173+TharrmashasthaPV@users.noreply.github.com>
Ninad Sathaye <sathayen@users.noreply.github.com>
Thomas Alexander <talexander@ibm.com> <thomasalexander2718@gmail.com>
Toshinari Itoko <itoko@jp.ibm.com>
Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Vismai Khanderao <59114226+Vismai-Khanderao@users.noreply.github.com>
Vojtech Havlicek <Vojtech.Havlicek@ibm.com>
Wei Hu <weihu@cs.virginia.edu>
Wes Turner <wes.turner@gmail.com>
Will Bang <will.h.bang@gmail.com>
Yael Ben-Haim <yaelbh@il.ibm.com>
Yukio Siraichi <sir.yukio@gmail.com>
Yunho Maeng <yunho.maeng.dc@gmail.com>
Yunong Shi <synisnot@gmail.com>
bcamorrison <54222891+bcamorrison@users.anoreply.github.com>
brandhsn <sebastian.brandhofer@gmail.com>
dime10 <dime10@users.noreply.github.com>
drholmie <animesh.leo@gmail.com>
faisaldebouni <faisal@megoapps.com>
gruu <guruhegde1308@gmail.com>
toural <toural@es.ibm.com>
Sebastian Brandhofer <sebastian.brandhofer@gmail.com>
Animesh N Dangwal <animesh.leo@gmail.com>
Faisal Debouni <faisal@megoapps.com>
Juan Luis Sánchez Toural <toural@es.ibm.com>
yang.luh <34480044+LuhangYang@users.noreply.github.com>
yotamvakninibm <52409900+yotamvakninibm@users.noreply.github.com>
Yotam Vaknin <Yotam.Vaknin@Ibm.com> <52409900+yotamvakninibm@users.noreply.github.com>
Yotam Vaknin <Yotam.Vaknin@Ibm.com> <yotamvak@lnx-quantum.openstack.haifa.ibm.com>
Łukasz Herok <lukasz.herok@gmail.com>
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ pull_request_rules:
actions:
backport:
branches:
- stable/0.17
- stable/0.18
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ unsafe-load-any-extension=no
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
extension-pkg-whitelist=retworkx, numpy, tweedledum


[MESSAGES CONTROL]
Expand Down Expand Up @@ -297,7 +297,7 @@ ignore-mixin-members=yes
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=matplotlib.cm,numpy.random,retworkx
ignored-modules=

# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
Expand Down
55 changes: 44 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,38 +327,38 @@ we used in our CI systems more closely.

### Snapshot Testing for Visualizations

If you are working on code that makes changes to any matplotlib visualisations
you will need to check that your changes don't break any snapshot tests, and add
If you are working on code that makes changes to any matplotlib visualisations
you will need to check that your changes don't break any snapshot tests, and add
new tests where necessary. You can do this as follows:

1. Make sure you have pushed your latest changes to your remote branch.
2. Go to link: `https://mybinder.org/v2/gh/<github_user>/<repo>/<branch>?urlpath=apps/test/ipynb/mpl_tester.ipynb`. For example, if your GitHub username is `username`, your forked repo has the same name the original, and your branch is `my_awesome_new_feature`, you should visit https://mybinder.org/v2/gh/username/qiskit-terra/my_awesome_new_feature?urlpath=apps/test/ipynb/mpl_tester.ipynb.
This opens a Jupyter Notebook application running in the cloud that automatically runs
This opens a Jupyter Notebook application running in the cloud that automatically runs
the snapshot tests (note this may take some time to finish loading).
3. Each test result provides a set of 3 images (left: reference image, middle: your test result, right: differences). In the list of tests the passed tests are collapsed and failed tests are expanded. If a test fails, you will see a situation like this:

<img width="995" alt="Screenshot_2021-03-26_at_14 13 54" src="https://user-images.githubusercontent.com/23662430/112663508-d363e800-8e50-11eb-9478-6d665d0ff086.png">
4. Fix any broken tests. Working on code for one aspect of the visualisations
can sometimes result in minor changes elsewhere to spacing etc. In these cases
4. Fix any broken tests. Working on code for one aspect of the visualisations
can sometimes result in minor changes elsewhere to spacing etc. In these cases
you just need to update the reference images as follows:
- download the mismatched images (link at top of Jupyter Notebook output)
- unzip the folder
- copy and paste the new images into `qiskit-terra/test/ipynb/mpl/references`,
- copy and paste the new images into `qiskit-terra/test/ipynb/mpl/references`,
replacing the existing reference images
- add, commit and push your changes, then restart the Jupyter Notebook app in your browser. The
- add, commit and push your changes, then restart the Jupyter Notebook app in your browser. The
tests should now pass.
5. Add new snapshot tests covering your new features, extensions, or bugfixes.
- add your new snapshot tests to `test/ipynb/mpl/test_circuit_matplotlib_drawer.py`
, where you can also find existing tests to use as a guide.
- commit and push your changes, restart the Jupyter Notebook app in your browser.
As this is the first time you run your new tests there won't be any reference
images to compare to. Instead you should see an option in the list of tests
- commit and push your changes, restart the Jupyter Notebook app in your browser.
As this is the first time you run your new tests there won't be any reference
images to compare to. Instead you should see an option in the list of tests
to download the new images, like so:

<img width="1002" alt="Screenshot_2021-03-26_at_15 38 31" src="https://user-images.githubusercontent.com/23662430/112665215-b9c3a000-8e52-11eb-89e7-b18550718522.png">

- download the new images, then copy and paste into `qiskit-terra/test/ipynb/mpl/references`
- add, commit and push your changes, restart the Jupyter Notebook app in your browser. The
- add, commit and push your changes, restart the Jupyter Notebook app in your browser. The
new tests should now pass.

Note: If you have run `test/ipynb/mpl_tester.ipynb` locally it is possible some file metadata has changed, **please do not commit and push changes to this file unless they were intentional**.
Expand All @@ -379,6 +379,12 @@ run `tox -eblack` to automatically update the code formatting to conform to
the style. However, if `pylint` returns any error you will have to fix these
issues by manually updating your code.

Because `pylint` analysis can be slow, there is also a `tox -elint-incr` target, which only applies
`pylint` to files which have changed from the source github. On rare occasions this will miss some
issues that would have been caught by checking the complete source tree, but makes up for this by
being much faster (and those rare oversights will still be caught by the CI after you open a pull
request).

## Development Cycle

The development cycle for qiskit-terra is all handled in the open using
Expand Down Expand Up @@ -423,6 +429,33 @@ the following steps:
The `stable/*` branches should only receive changes in the form of bug
fixes.

## Adding deprecation warnings
The qiskit-terra code is part of Qiskit and, therefore, the [Qiskit Deprecation Policy](https://qiskit.org/documentation/contributing_to_qiskit.html#deprecation-policy) fully applies here. Additionally, qiskit-terra does not allow `DeprecationWarning`s in its testsuite. If you are deprecating code, you should add a test to use the new/non-deprecated method (most of the time based on the existing test of the deprecated method) and alter the existing test to check that the deprecated method still works as expected, [using `assertWarns`](https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertWarns). The `assertWarns` context will silence the deprecation warning while checking that it raises.

For example, if `Obj.method1` is being deprecated in favour of `Obj.method2`, the existing test (or tests) for `method1` might look like this:

```python
def test_method1(self):
result = Obj.method1()
self.assertEqual(result, <expected>)
```

Deprecating `method1` means that `Obj.method1()` now raises a deprecation warning and the test will not pass. The existing test should be updated and a new test added for `method2`:


```python
def test_method1_deprecated(self):
with self.assertWarns(DeprecationWarning):
result = Obj.method1()
self.assertEqual(result, <expected>)

def test_method2(self):
result = Obj.method2()
self.assertEqual(result, <expected>)
```

`test_method1_deprecated` can be removed after `Obj.method1` is removed (following the [Qiskit Deprecation Policy](https://qiskit.org/documentation/contributing_to_qiskit.html#deprecation-policy)).

## Dealing with the git blame ignore list

In the qiskit-terra repository we maintain a list of commits for git blame
Expand Down
70 changes: 0 additions & 70 deletions Make.bat

This file was deleted.

24 changes: 17 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ else
CONCURRENCY := $(shell echo "$(NPROCS) 2" | awk '{printf "%.0f", $$1 / $$2}')
endif

.PHONY: env lint test test_ci
.PHONY: default env lint lint-incr style black test test_randomized pytest pytest_randomized test_ci coverage coverage_erase clean

default: style lint-incr test ;

# Dependencies need to be installed on the Anaconda virtual environment.
env:
Expand All @@ -45,16 +47,24 @@ env:

# Ignoring generated ones with .py extension.
lint:
pylint -rn qiskit test
tools/verify_headers.py qiskit test tools
pylint -rn --disable='C0103, C0114, W0621' examples/python/*.py
python tools/find_optional_imports.py
pylint -rn qiskit test tools
tools/verify_headers.py qiskit test tools examples
pylint -rn --disable='invalid-name, missing-module-docstring, redefined-outer-name' examples/python/*.py
tools/find_optional_imports.py

# Only pylint on files that have changed from origin/main. Also parallelize (disables cyclic-import check)
lint-incr:
-git fetch -q https://github.com/Qiskit/qiskit-terra.git :lint_incr_latest
tools/pylint_incr.py -j4 -rn -sn --paths :/qiskit/*.py :/test/*.py :/tools/*.py
tools/pylint_incr.py -j4 -rn -sn --disable='invalid-name, missing-module-docstring, redefined-outer-name' --paths ':(glob,top)examples/python/*.py'
tools/verify_headers.py qiskit test tools examples
tools/find_optional_imports.py

style:
black --check qiskit test tools
black --check qiskit test tools examples setup.py

black:
black qiskit test tools
black qiskit test tools examples setup.py

# Use the -s (starting directory) flag for "unittest discover" is necessary,
# otherwise the QuantumCircuit header will be modified during the discovery.
Expand Down
Loading

0 comments on commit 89f4c1a

Please sign in to comment.