Commit Graph

56 Commits

Author SHA1 Message Date
Kevin Krsulich d08d828c97
Run benchmarks in CI, resolve hypothesis errors (#2633)
* Trial job for asv continuous in travis.

* Print circuit QASM during randomized testing.

* Add coverage to python 3.6 job name.

* Suppress hypothesis filter_too_much health check.

* Reducuce random circuit count from 50 to 25.

* Set python version via command line arg rather than sed.
2019-06-20 15:18:58 -04:00
Kevin Krsulich 4f1ecf2ddb Reduce randomize testing timeouts in CI (#2648)
* Increase travis_wait time to 45m for randomized tests.

* Bump hypothesis version.

* Decrease to 50 random circuits and fail on first first found error.

* Disable hypothesis deadlines.
2019-06-18 07:55:03 -04:00
Kevin Krsulich 60c8bba11f Add randomized testing stage to travis (#2620)
* Add randomized testing stage to travis.

* Update report_ci_failure to create an issue for failed random tests.

* Remove randomized tests from unit test and coverage.

* Add hypothesis example database to travis cache.
2019-06-17 10:36:20 -04:00
Matthew Treinish 15e3f0a5c9
Add diff-cover output when coverage is collected (#2631)
* Add diff-cover output when coverage is collected

This commit adds an additional output stage to the python 3.6 job, which
is used for collecting coverage, that runs the diff-cover tool to show
which parts of the diff have test coverage. This is useful for both
reviewers and the commit author to see if the changes being made in a PR
are actually being exercised by the testing we run.

* Fix typo in coverage.xml filename
2019-06-14 12:03:03 -04:00
Matthew Treinish 14f9697367 Add coverage collection to CI (#2625)
* Add coverage collection to CI

This commit adds coverage collection to the CI environment. It adds
reporting back to coveralls for the python 3.6 job. So when that job
finishes executing it will send the collected coverage data to coveralls
so we can track out unit test coverage.

Fixes #771

* Add missing quotes

* Move coveralls to only run on coverage job
2019-06-12 22:24:29 -04:00
Matthew Treinish 5524f56629
Upload wheels to pypi.org instead of test.pypi.org (#2561)
The current wheel build automation uploads the wheel files to
test.pypi.org. The idea behind this was to enable manual verification of
the built wheels prior to pushing the releases for real. However, this
just adds another manual process to the release process and increases
the chance of something going wrong. There also isn't any manual
validation that happens for most of the wheels. When it is done, it
provides no more than what the build automation does already
(running an example script). To simplify the release process and reduce
the chances for errors involved with downloading and re-uploading
this commit switches the build automation to directly upload to
pypi.org. The release workflow with this is now just push a tag for the
release, then build and upload a sdist to pypi. Everything else is
automated.
2019-06-04 09:56:29 -04:00
Matthew Treinish a83ba0ee74 Install twine in wheel build jobs (#2292)
* Install twine in wheel build jobs

The wheel build jobs failed to install twine so when the jobs completed
and went to upload the wheels this failed because the command wasn't
found. This commit fixes the issue by installing twine as part of the
wheel build job set ups so that we can actually upload our built
binaries.

* Pip install -U twine

* Bump cibuildwheel version
2019-05-14 13:23:42 -04:00
Matthew Treinish a59a4d6d15
Update CI post release (#2297)
Now that terra and other qiskit elements have been released we can
tweak how we install packages in CI for running tests. This commit
updates things so we install terra from source, no longer pin the
ibmq-provider, and removes aer (since there are no tests using it
anymore).
2019-05-03 17:26:23 -04:00
Matthew Treinish 7053ee238f Add example for stochastic swap and use to verify wheels (#2251)
* Add example for stochastic swap and use to verify wheels

This commit adds a new example to the examples directory for running the
stochastic swap pass. This is then used by the wheel build automation
to verify the built wheel works as expected. The compiled code (and
complexity in the wheel build) is for the stochastic swap pass so
verifying it functions when installed from the built wheel is important.

* Test wheel build with new script

Comment out branch logic and wheel upload to verify the wheel build this
is just for testing and will be reverted before the PR merges.

* Remove prints from example

* Revert "Test wheel build with new script"

This reverts commit f5edc1c777.
2019-05-01 17:40:16 -04:00
Paul Nation 97cf677137
Copyrights (#2249)
* 2017 cps

* 2018 cps

* 2019 cps
2019-04-30 10:36:47 -04:00
Matthew Treinish 33c7310006
Build wheels automatically in CI environment (#1911)
* Build wheels automatically in CI environment

Right now when it's time to push a relase of qiskit-terra we have to
manually build wheels for all our supported environments because we
included compiled code in the project. This involves setting up a proper
environment with portable librariers and compilers in Linux, Windows,
and Mac OSX with all 3 versions of python we support. Then manually
building the 9 wheels necessary to publish on pypi. However we install
qiskit-terra from source every day multiple times in all these
environments in our CI. There is no reason this manual step needs to
exist and we can just leverage CI to do our wheel building when it's
time to do a release.

This commit adds initial support for building our wheels in travis
(for linux and osx) and appveyor (for windows). It leverages the
cibuildwheel project to automate the wheel building. This will ensure we
setup the proper environment for all 3 python versions on all 3
environments (for example pulling in the manylinux docker container on
linux).

* Add cython to wheel build environment

* Add sudo call to pip

* Skip python 3.4 wheel build

* Fix appveyor syntax

* Setup seperate wheel job on appveyor

* Fix missing quote

* Fix osx env skip typo

* Add wheel tests and twine config to CIBW jobs

This commit adds 2 things. First running tests on the built wheels. This
will enable verifying that the built wheels work by running the unit
tests with terra installed from the wheels. The second is the beginnings
of the twine config. In the next iteration of this patch the wheels will
all be uploaded to test.pypi.org so we can test them locally and then
uploaded them to pypi.org for release on each tag push. (We might bypass
this and go straight to pypi.org in the future) To facilitate this we
need to pass configuration into twine so for when we add twine upload to
the builds it will be able to upload.

* Add missing quotes to test command

* Run tests outside of project directory

* Switch CIBW tests to use unittest instead of stestr

Running tests with stestr assumes you're running inside the python
project for discovery to work. Since we don't want to do that because it
will get confused about whether we mean to run with the installed wheel
or local files. This commit switches to use unittest which will enable
running discovery from any directory so we can run tests against just
the installed wheel to verify that it works correctly.

* Run examples script instead of unittests

The unittests are too coupled to running from inside the repo. Since we
just need to verify the installed wheel works this switches to running
one of the example scripts, teleport.py. This is a good choice because
it will use both python code and cython compiled code to verify the
wheel works as expected.

* Remove unused test requirements

* Fix windows backwards slashes

* Update windows test command

* Add twine upload and only run on tags

* Run wheel build as a deploy on tag in appveyor

* Enable deploy on each run for testing

* Pivot appveyor config to use conditional matrix instead of deploy

* Add twine upload to appveyor
2019-04-24 10:36:35 -04:00
Matthew Treinish 85fe093d52 Add Job names to travis config (#2175)
Right now the jobs listed in travis don't have explicit names. You can
pretty easily figure out which jobs do what based on the OS icon and the
environment variables set for each job. But to make it a bit easier just
name each job with a descriptive human readable name so we're explicit
about which each job is doing.
2019-04-23 14:10:57 -04:00
Diego M. Rodríguez 6c12c8a61d Fix ibmqprovider version in CIs (#2143) 2019-04-17 12:20:09 -04:00
Matthew Treinish 5285d1a537 Add constraints to pin pylint to known working version (#1868)
* Add constraints to pin pylint to known working version

This commit adds a constraints file so we're always running pylint and
astroid at known working version. The 2 are requirements are very coupled
and small changes in one often requires an update in the other.
Unfortunately new versions of pylint often change or add rules which
makes running it unpinned not a good decision. To ensure a consistent
environment for running pylint this commit leverages pip constraints to
make sure we always install the same version of astroid and pylint.

* Pin for broken cryptography release today too
2019-02-27 14:35:01 -05:00
Paul Nation 623b00d098
1000x faster swap mapping and Cython build chain (#1789)
* Add Cython files.

* by error

* Modify swap mapper

* cleanup setup.py

* move cythonize to main setup.py

* fix style and add cython to requirements

* have travis build cython before testing

* disable lint checks that fail due to compiled code

* add cython to requirements (the txt one)

* revert to NumPy RandomState RNG for deterministic random generation

* remove unused import

* update tests

* make Cython build more portable

* move cython to dev requirements

* remove unused code

* turn on warnings, and fix old docstring

* fix import errors

* add cython build to appveyor

* add cython to appveyor

* revert aer changes

* fix "ground truth"

* this should not be here

* this should not be here

* this should not be here

* this should not be here

* this should not be here

* this should not be here

* I have no idea why they are saying they are modified

* Add Cython to setup_requires for setup.py

The setup_requires parameter to the setup() function is used to
specify packages that need to be present in order for the setup script
to run. [1] With the introduction of Cython to the setup.py this is now
required to be installed for setup, so this commit adds Cython to
setup_requires to indicate this.

[1] https://setuptools.readthedocs.io/en/latest/setuptools.html

* add to changelog

* Update Cython version in setup_requires
2019-02-21 13:58:06 -05:00
Diego M. Rodríguez 7757176570 Remove ibmq stage from travis (#1795)
* Remove ibmq stage from travis

* Remove stage
2019-02-12 17:51:51 -05:00
Salvador de la Puente González 510d0763b0 Updating pyenv locally to reduce Travis time (#1726)
* Aggressively caching pyenv directory.

Most of the time spent on iOS instances came from:
  * Updating brew so pyenv is able to install the latest Python
versions.
  * Building the Python versions.

The patch removes the need of brew by installing pyenv directly. This
pyenv is then used to build the three Python interpreters that we
support. Now, we cache these builds. Finally we setup the Python
environment in the same way we did before the patch.

Now the fixing downloads and build the three environments thrice in the
worst case (when there is no cache) and updating a Python version, (which
is expected for Python 7) requires clearing the cache.

* Now each version is responsible of the proper Python version

* Restoring tests
2019-02-12 11:43:12 +01:00
Salvador de la Puente González 9cb0ef28f4 Utility for reporting a CI failure as a GitHub issue. (#1071)
* Utility for reporting a CI failure as a GitHub issue.

This PR adds a new tool for creating an issue on GitHub when the
CI fails. The utility identifies the report with the name of the
branch and commit hash an avoids to open two reports for the same
subject.

* Fixing the master is failing label

* Add automatization in CI
2019-02-11 17:34:20 -05:00
Diego M. Rodríguez 8882982585 Add "make test_ci" target for CIs, simplify "make test" (#1745)
* Add test_ci make target, revert make test

Add a new "test_ci" target to the Makefile, aimed at being used by
the CIs. Update the "test" family of targets in order to revert
back to the behaviour that involves less overhead and complexity
for the users.

* Update travis in order to use test_ci

* Add documentation about test_ci target
2019-02-05 16:28:16 -05:00
Diego M. Rodríguez b8bcd9a6f6 Remove ibmq provider from terra (#1700)
* Remove qiskit/providers/ibmq

* Remove test/python/ibmq

* Remove IBMQ specifics from qiskit.test.mock

* Import IBMQ conditionally in qiskit/__init__

* Update requires_qe_access decorator

* Fix backend_overview and monitor requiring IBMQ

* Update CIs for installing qiskit-ibmq-provider

* Update CHANGELOG
2019-01-21 08:41:42 -05:00
Diego M. Rodríguez a967fcd8e2 Remove travis documentation deploy, other fixes (#1678)
* Remove documentation deploy

Remove documentation script and travis job.

* Remove deploy stage from travis

Remove the "deploy doc and pypi" stage entirely, and revise the
"subclassing" of the osx jobs.

* Fix travis script make invocation

* Fix extra lint script commands

* Pin numpy version to <1.16

Pin the numpy version to <1.16 until the potential incompatibilities
are fixed.

* Remove numpy from whitelist, ignore random instead

Remove `numpy` from the `extension-pkg-whitelist`, and instead manually
ignore the check for the members of  `numpy.random`, as it was the
only place where the check was significant.
2019-01-14 07:03:54 -05:00
Matthew Treinish 4b7f96fb4a
Switch to travis addon for homebrew on osx jobs (#1657)
Currently the osx jobs are failing trying upgrade the pyenv version to the latest (which is needed to install the python versions we test in CI). According to the travis docs the best way to use homebrew on osx jobs is to rely on the travis addon instead of doing it manually in the install scripts. This commit makes this change so we install the latest version of pyenv (and the python 3.7 dependencies) via the addon instead of out of band. This fixes the failure and makes sure we have the latest versions of the homebrew package installed as needed.

* Find working pyenv versions on osx homebrew

* Switch to travis addon for brew

* Rework travis osx config a bit more
2019-01-09 18:00:29 -05:00
Christopher J. Wood 4bf0db919f Remove legacy C++ simulator code (#1644)
* Remove legacy cpp code

* remove legacy cpp sim from make and travis

* Rename decorator and folder for aer provider tests

* remove Cpp simulator for setup.py

* fixup

* Remove all cmake and cleanup travis config

Since we're no longer building any C++ code there is no need to keep
cmake usage around anymore. This commit removes the last cmake remnants
and also cleans up the travis config to simply run make && make test to
install everything and then just invoke the test runner. It also
deduplicates jobs now that there is no distinction between no_compile
and compile jobs.

* Fix some small oversights

* Remove legacysimulator contributing doc section
2019-01-08 17:22:18 -05:00
Jay Gambetta b2bbb3f059 Remove legacy simulators (#1615)
* Removing simulators

* Fixing some test

* Fixing test

* Test

* Email

* Fixing test

* Passing locally

* Hack to get aer

* Diego fix

* Trying to fix windows errors

* Aer to basicaer

* Adding lint

* Removing test around and making aer only on one folder.

* Adding HACK FROM THE DEPTHS OF DESPAIR AS AER DOES NOT WORK ON MAC

* Oops Diego hack I did not implement correctly

* Linting

* do not import Aer at the top of tests

* lint

* two more CHANGELOG lines
2018-12-28 17:32:27 -05:00
Matthew Treinish 5672a3c627 Add draw() method to QuantumCircuit class (#911)
* Add draw() method on QuantumCircuit class (fixes #1004)

Adds a draw() method to the QuantumCircuit class for
visualizing the circuit. This is basically just an alternative interface
to qiskit.tools.visualization._circuit_drawer() but is more convenient
because it's baked into the quantum circuit. This means users don't have
to import an additional module and can just visualize any circuits after
creating them.

* Add __str__ property to call text output draw to quantumcircuit

This commit adds a __str__ method to the quantumcircuit object. This
will enable users to run print(circuit) and have the text visualizer
output be printed from the circuit.
2018-11-15 09:46:12 -05:00
Diego M. Rodriguez eba8b7046c Add new travis stage and IMB Q badge 2018-08-01 20:19:44 +02:00
Salvador de la Puente González 2094900ede
Restoring OSX builds (#656)
Restoring OSX builds
2018-07-20 13:43:41 +01:00
Salvador de la Puente González 0f38f99f9f Fixes final states for `get_status_job()` support (#646)
* Fixes final states for `get_status_job()` support

* Factor out API final states

* Moving job final states to a module level variable to keep consistency with API final states.

* Use Xenial and sudo: true to make Python 3.7 builds to work.
2018-07-13 13:19:35 +02:00
Abdón Rodríguez Davila d4e6585058 Update QISKit to Qiskit (#634)
* Rename QISKit to Qiskit

* More QISKit to Qiskit

* Revert qiskit/ & test/ files to avoid actual PR conflicts

* Add changelog entry
2018-07-11 13:14:15 +02:00
Diego M. Rodríguez d41f9f161f
Temporarily disable travis osx builds (#642)
Disable the travis osx build temporarily, as they are returning an
error while using bottles.
2018-07-11 12:27:38 +02:00
Salvador de la Puente González ab54183620 Python3.7 compatibility (#620)
* Adding Python 3.7 to the Travis Matrix for Linux and OSX.

Waiting for Appveyor to support Python 3.7 natively before adding it to the matrix.

* Used pyenv and venvwrapper for both OSX stages.

* Update OSX Python 3.7 stage key
2018-07-05 23:09:14 +02:00
Diego M. Rodríguez 1d76d534cc
Rename repository to 'qiskit-terra' (#606)
* Rename repository to 'qiskit-terra'

* Update german doc, changelog
2018-07-02 14:44:11 +02:00
Diego M. Rodríguez fb2c7e4703 Use fixed Python version on travis osx (#614)
Use fixed Python version on travis osx

Fix the travis python version to 3.6.5 using `pyenv`, as the current
runs use Python 3.7 which seems to cause some issues in some of the
dependencies.
2018-07-01 12:47:09 -04:00
Abdón Rodríguez Davila 6bbc764534 Consistent license across all the project (#550)
* Consistent license across all the project

* Update license

* Update LICENSE.txt

* Update licenses

* Fix linter
2018-06-08 15:00:58 +02:00
Diego M. Rodríguez 9d061e8fab
Rename repository to 'qiskit-core' (#530)
Rename all references to `qiskit-sdk-py` to the new repository name,
`QISKit/qiskit-core`, including a handful of instances where the
`IBM/qiskit-sdk-py` form was used.
2018-06-05 10:41:18 +02:00
Juan Gomez 72eae89453 CMake improvements! (#468)
* CMake improvements:
* Static linking is not the default anymore.
* Platform Wheel Tag is now configurable via cmake variable.
* Updated documentation
* CI config file updated accordingly
* Added support for Win64 builds on Visual Studio 2017
* Windows C++ Simulator now links with a prebuilt version of
  OpenBLAS (64 bits), so there's no need to link against
  LAPACK anymore
* cmake added as a dependency
* Restored --static-libgcc flag for static MacOS builds so gcc
  can create *semi* static executables again. Clang doesn't have
  static compilation.

* Remove default WHEEL_TAG value so if not specified, the tag is
choosen by the wheel module
2018-05-15 19:04:04 +02:00
Juan Gomez 4b27671c3b Enable MacOS travis tests 2018-04-13 16:16:14 -04:00
Diego M. Rodríguez 2641dffdc5
Disable travis osx build temporarily (#374)
Temporarily disable the osx build on Travis, as they are having a
backlog that might take some time to recover:
https://www.traviscistatus.com/incidents/qkqy13yk55q9
2018-03-28 14:40:06 +02:00
Diego M. Rodriguez d6f9d7663f Fix travis lint stage, deploy stage for non-push
* Fix the travis stage that performs the linting, making it fail if the
  `make style` target fails instead of ignoring it silently.
* Fix the execution of the deploy stages for the jobs that are the
  result of a PR against stable. Now the stages are only executed in the
  job associated to the push.
2018-03-23 15:47:24 +01:00
Luciano de1f66a94b Coverage of the testsuite (#297)
* coverage rule in Makefile

* coverage in cmake

* clean coverage rule

* it looks like there is a proper way to remove the coverage data

* cmake: coverage_erase

* Add coverage target to cmake, fix typo

* Fix travis osx brew python (now upgrade)
2018-03-05 20:38:13 +01:00
Diego M. Rodriguez bad5e631a0 Remove comment and static flag on travis osx 2018-02-22 14:56:21 +01:00
Diego M. Rodriguez c155ef3d9e Use gcc+-6 on travis osx jobs 2018-02-22 14:56:21 +01:00
Diego M. Rodriguez de5a9415e8 Revise travis configuration, using cmake
* Revise the travis configuration for using `cmake` for the several
  targets, and use "stages" instead of parallel jobs:
  * define three stages that are executed if the previous one suceeds:
    1. "linter and pure python test": executes the linter and a test
       without compiling the binaries, with the idea of providing quick
       feedback for PRs.
    2. "test": launch the test, including the compilation of binaries,
       under GNU/Linux Python 3.6 and 3.6; and osx Python 3.6.
    3. "deploy doc and pypi": for the stable branch, deploy the docs
       to the landing page, and when using a specific commit message,
       build the GNU/Linux and osx wheels, uploading them to test.pypi.
  * use yaml anchors and definitions to avoid repeating code (and
    working around travis limitations).
* Modify the `cmake``configuration to accomodate the stages flow:
  * allow conditional creation of compilation and QA targets, mainly
    for saving some time in some jobs.
  * move the tests to `cmake/tests.cmake`.
* Update the tests:
  * add a `requires_qe_access` decorator that retrieves QE_TOKEN and
    QE_URL and appends them to the parameters in an unified manner.
  * add an environment variable `SKIP_ONLINE_TESTS` that allows to
    skip the tests that need network access.
  * replace `TRAVIS_FORK_PULL_REQUEST` with the previous two
    mechanisms, adding support for AppVeyor as well.
  * fix a problem with matplotlib under osx headless, effectively
    skipping `test_visualization.py` during the travis osx jobs.
* Move Sphinx to `requirements-dev.txt`.
2018-02-22 14:56:20 +01:00
Diego M. Rodriguez 331d6b90d0 Add linter/style check to travis
* Relax the pylint output disabling several warnings.
* Reintroduce the linting of qiskit.extensions and qiskit.qasm.node.
* Add a `style` target to the Makefile that performs pycodestyle, and
  reduce the verbosity of `lint` by removing the report.
* Update the Travis configuration in order to add a new step that
  performs linter and style checks via an environment variable.
2017-12-29 10:44:35 +01:00
cclauss 2d2d33f1f7 Use pylint to look for issues on every pull request (#147)
* Use flake8 to find syntax errors & undefined names

flake8 testing of https://github.com/QISKit/qiskit-sdk-py on Python 3.6.3

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./qiskit/dagcircuit/_dagcircuit.py:570:49: F821 undefined name 'n'
            nd = input_circuit.multi_graph.node[n]
                                                ^

./qiskit/tools/visualization.py:463:70: E999 SyntaxError: EOL while scanning string literal
    """Plot the equal angle slice spin Wigner function of an arbitrary
                                                                     ^

./qiskit/tools/qcvv/tomography.py:805:17: E999 IndentationError: expected an indented block
                W[wpt] = W[wpt]+(x[i]/shots)*parity[i]
                ^

2     E999 IndentationError: expected an indented block
1     F821 undefined name 'n'
3
```

* pylint qiskit test --errors-only

* flake8 --exit-zero to treat all issues as warnings

* pylint --extension-pkg-whitelist=numpy, flake8 E999

* Remove flake8 and focus on pylint

Pylint now finds three issues.  I am unable to suggest fixes for the first two.  I have suggested a fix for the last issue at f49975ec6e (commitcomment-25627794)

* Fix F821, no-member and logging-too-few-args

Fix issues raised by pylint on "--errors-only" mode, thanks to cclaus.

* Add numpy to the general pylint configuration
2017-11-15 14:25:28 +01:00
Diego M. Rodríguez b2d6e70229 Check IBMQuantumExperience version at runtime (#115)
* Add runtime check for IBMQuantumExperience version

Add `qiskit._util._check_ibmqe_version()` (invoked on the main import)
for emitting a warning if the installed version of IBMQuantumExperience
does not match the version defined on `setup.py`.

* Rename requires.txt and requires-dev.txt

Rename to "requirements.txt" and "requirements-dev.txt", in order to
conform better to the de-facto practices.
Update the requirements to match the versions specified in setup.py.

* setup.py: OS classifiers, backend, IBMQE version

* Explicitly require IBMQuantumExperience>=1.8.13, as older versions
  might not contain all the functionality needed.
* Include "qiskit.backends" as a package instead of "qiskit.simulators".
* Add trove classifiers for the operative systems supported.
* Fix PEP8 warnings for long description.

* Avoid using __version__ in setup.py due to imports

Revert the change of using "__version__" imported from "__init__.py"
directly on "setup.py", as the current importing of the modules from
"__init__.py" causes the building to fail due to the dependencies not
being available at the time of invocation.
2017-10-25 10:12:04 -04:00
Diego M. Rodriguez 9577982361 Move deploy script to "tools/" 2017-10-02 17:34:34 +02:00
Diego M. Rodriguez 1cabb03286 Add autodeployment of sphinx docs to github pages
Add a "deploy" target to travis that builds the sphinx documentation
and push it to the github pages repository on pushes to the "stable"
branch. A custom script is used that performs the steps (clone the
repository, build the dock, commit the changes, push back) instead of
other solutions (travis-sphinx or travis github pages integration) due
to lacking the features needed for the current setup (pushing to a
specific directory on another repository preserving history).
2017-10-02 17:34:25 +02:00
Diego M. Rodriguez c0f27fda30 Add Python 3.5 to travis.yml 2017-09-21 12:06:42 +02:00
Jesús Pérez 5057f13b0a Fixing the sintax of the last commit. 2017-06-27 11:25:54 +02:00