* Add python 3.8 support and deprecate python 3.5
This commit adds support for running terra under python 3.8. It does
this by adding the trove classifiers to the package metadata and adding
a test job for python 3.8 (only travis for now this can be expanded in
the future when azure pipelines adds it to their image). At the same
time this commit starts the deprecation window for python 3.5. Python
3.5 goes end of life by upstream python in Sept. 2020. We should give
our users running with python 3.5 (which is about 10% of our users based
on pypi data) fair notice that when upstream python stops supporting it
we do as well.
* Fix lint
* Add back empty cache detection
As part of the refactors the empty stestr timing cache removal code was
removed from the travis config, but the cache wasn't removed. Adding the
python 3.8 job causes a failure because travis has no cached timing data
but still creates the empty directory which triggers
mtreinish/stestr#266. This adds back the empty cache removal to
workaround it so we can use the timing data for scheduling in future
runs.
* Add azure-pipelines python 3.8 jobs too
* Fix python 3.8 dictionary keys changed error
Starting in python 3.8 a new RuntimeError is raised, RuntimeError:
dictionary keys changed during iteration. This is caused by modifying an
iterator while looping over it. We were doing that in the
optimize_swap_before_measure pass. This commit fixes this by wrapping
the iterator in list() to make a copy of it for looping. This way we
don't modify the contents of what we're iterating over in the pass.
* Revert "Add azure-pipelines python 3.8 jobs too"
The missing matplotlib wheels are blockers for windows and osx
environment. Since we do not have the necessary dependencies installed
in those ci envs to compile matplotlib from source. We'll rely on just
travis for 3.8 testing until the matplotlib 3.2.0 release is pushed so
we don't have to compile it.
This reverts commit 40157621b1.
* Add skip for failing matplotlib test
The image comparison tests which are quite flaky are failing with
matplotlib compiled on 3.8. Looking at the image output from these
failures are very subtle (looks like resolution differences) again
questioning the value of these tests. This commit just skips the test
that is failing here to unblock the PR.
* Add azure 3.8 test jobs
* Pin to pre-release mpl for python 3.8
* Add spawn guard for python3.8 osx in examples
When running examples with execute, transpile, or any other calls using
parallel_map() the new default for spawn instead of fork requires that
scripts have a __name__ == "__main__" check in them to function
properly. If not calls to parallel_map fail errors around the
bootstrapping phase. To avoid this in the ci jobs this commit adds the
necessary checks to the example scripts we run in ci as part of
test_examples.
* Remove cryptography pin from constraints file
We pinned the cryptography package version back during the cryptography
2.6 release which broke our ci. It was a temporary step to avoid a
packaging issue in CI that was blocking development. However, when the
issue was resolved we never circled back to fix the issue. Now trying to
enable python 3.8 support to terra cryptography >=2.8 is needed for
python 3.8 on windows (to get a precompiled binary). This commit removes
the unecessary pin to unblock windows 3.8 ci.
* Bump cibuildwheel version to build 3.8 wheels
cibuildwheel 1.0.0 was released in early November [1] and added support
for building python 3.8 wheels. This commit bumps the cibuildwheel
version we use in the wheel build jobs at release time to also build 3.8
wheels for upload to pypi.
* Add skip and release note about macos py38 issues
This commit adds a skip for the failing python 3.8 test on osx and
windows so that we don't block everything over a small issue in the
tests. It also add a release note documenting the limitation with python
3.8 on macos with regardess to parallel_map/multiprocessing. Since this
limitation is new for this release (being the first release with python
3.8 support) we should document it as a known issue in the release
notes, especially since it likely won't be resolved until a python 3.8.1
release.
* Revert "Add spawn guard for python3.8 osx in examples"
While we can fix the tests to work on osx python3.8 by adjusting the
example scripts to only call functions using parallel_map from inside a
block run via if __name__ == '__main__': this unecessarily changes the
scripts for the quirks of a single environment. This commit reverts the
example scripts back to their original form and instead just skips the
unittest that executes them on python 3.8 macOS. We already have
documented this limitation in the release notes. When/if we have an
alternative solution for how we launch additional processes in python
3.8 on macOS that does not require this workaround we can look at
removing the skip.
This reverts commit 76ae197631.
* Apply suggestions from code review
Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
Now that qiskit-terra 0.11.0 is out the door we should bump the version
string on master to show the source version we're installing is newer
than what's been released.
* Rewrite dag drawer to not use nxpd
The nxpd library is quite stale and hasn't seen an update in 3 years.
The most recent release of networkx 2.4 is incompatible with nxpd now
because nxpd was using deprecated (and now removed) api calls from
networkx. Additionally, the functionality provided by nxpd already
exists in networkx so there is no reason to rely on an additional
library outside of networkx and pydot. This commit updates the dag
drawer to no longer use nxpd and uses networkx's drawing features
instead.
* Cap networkx for python 3.5
In the networkx release notes for 2.4 [1] it states clearly that the 2.4
release is the last release with python 3.5 support. Since the release
timeline is not fixed and we may end up support python 3.5 in terra
longer than networkx this adds a capped version of networkx on 2.4 for
python 3.5.
[1] https://networkx.github.io/documentation/stable/release/release_2.4.html
* Adjust python 3.5 cap
Since networkx 2.4 is seemingly relying on the guaranteed insertion
ordering for dicts introduced in 3.6 for how we're using topological
sort this adjusts the cap previously introduced to be <2.4 instead of
<=2.4. This should avoid the failures related to this on python 3.5 and
networx 2.4.
* Avoid duplicate requirements with cap
* split!
* passes()
* max_iteration
* replace
* some RunningPassManager clean up
* callback support
* property_set result
* lint
* cleaning up runninpassmanager
* docstring
* args
* parallel
* test
* parallelize using dill
* dill in requirements.txt
* lint
* runningpassmanager style
* dill in setup
* fix the drawer with the new format from passes
* new refs
* Update qiskit/visualization/pass_manager_visualization.py
Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* no label for linear
* refs
* _pass_sets
* pass set in a docstring
* lint
* different circuits
* circuit_or_circuits -> circuits
* Remove sympy from everywhere
This commit removes all the sympy usage from qiskit-terra. Sympy is very
slow, not just to perform computations, but also to just import (being
the second slowest import in terra, only behind qiskit.version which
calls git and pip in a subprocess) and doesn't actually provide us any
real advantages inside terra. None of the expressions or calculations
terra is doing need to be done symbolically, and using sympy as just an
output formatter (to get pretty output for things like pi) is overkill.
* Fix lint
* Fixes from running openqasm conformance tests
* Import sympy lazily for circuit Parameters.
* Add back sympy to requirements
While sympy has been removed from most places in the repo as of this
point, it is still used internally in the Parameter and
ParameterExpansion classes. The imports there have been made runtime to
remove the import performance impact and they are self contained in
those classes as of this commit. We can remove sympy from the
requirements in the future when we come up with way to replace the
parameter classes' use of sympy we can remove it from the requirements
lists.
* Make type warning a deprecation warning
* Fix rebase issue (and unnecessary runtime import)
* Update instruction parameter type handling
This commit updates some issues found during code review with the
parameter handling. Now instead of casting string parameters as a float
incorrectly, this uses them to create a new symbolic parameter. Also for
numpy number types that are not caught by the earlier type checks item()
is called as was the previous behavior.
* Revert switch from Node.sym->Node.num()
For ast Node parameter types that were passed as parameters for an
instruction the method call to get the value was incorrectly changed
to num() from sym(), which doesn't exist. This was a sloppy regex find
replace that did it by accident. This commit reverts that mistake and
restores the functionality.
* Deprecate not remove sympy.basic and sympy.matrix params
This commit adds back support, albeit it deprecated form, for passing in
instruction parameters as sympy.basic and sympy.matrix objects. It also
updates the release notes to reflect this change.
* Add deprecation for sympy.Expr instruction param too
* Update release notes
* Remove sympy types usage from unit tests
This commit removes the usage of sympy types from unit tests. There were
several cases of unit tests that were using sympy's pi or similar
constants for no particular reason. Since this usage is now deprecated
it is better to remove this. The only sympy usage that remains in the
tests now are for test cases that are explicitly testing behavior with
sympy. These will remain until the sympy support has been removed since
we need to verify that the deprecated feature still works as is until
removal.
* Update release of deprecation to 0.11.0
* Update changed error exception class
* lint
Now that qiskit-terra 0.10.0 is out the door we should bump the version
string on master to show the source version we're installing is newer
than what's been released.
* Remove silencing ChangedInMarshmallow3Warning
* Fix passing missing when required=True
* Handle unknown keys via unknown=INCLUDE
* Update ModelValidationError
* Update qiskit.validation.fields
* Add **kwargs to different functions
* Remove explicit strict parameter
* Update imports and other tweaks
* Remove load_additional_data from base
Remove the load_additional_data hook, as it is handled by the `unknown`
mechanism.
* Update kwargs for base
* Update dump and load expected return
* Updates and tweaks to fields
* Fix wrong `Mapping` import introduced in an eaerlier commit.
* Expand the `ByType` catching of unserializable/undeserializable fields
as exceptions are no longer swallowed.
* Adjust to renamed `container` member.
* Use make_error instead of fail
* Wrap serialize errors into dict
During a field's `_serialize`, the exceptions raised did not contain
the nested structure that allows identifying the field. This commit
updates `InstructionParameter` so the message is nested.
* Use pre_load for qobj.type and qobj.schema_version
* Lint and kwargs fixes
* Bump marshmallow and marshmallow_polyfield version
* Revert extra import
We have had the jsonschema version capped since it was introduced as a
requirement into terra. There is no clear reason for this and it limits
interoperability with other python packages. Especially because
jsonschema is commonly used library across the python ecosystem. The
version we were capping to was also quite old being release 2.5 years
ago. This commit removes the cap so that people can run terra in
environments where newer jsonschema is required.
Now that qiskit-terra 0.9.0 is out the door we should bump the version
string on master to show the source version we're installing is newer
than what's been released.
Enhance appearance and correctness of Q-sphere visualization in the following ways:
- All complementary basis states are antipodal
- Phase is indicated by color of line and marker on sphere's surface
- Probability is indicated by translucency of line and volume of marker on sphere's surface
There is one new required dependency, seaborn, for color palettes for associating colors to phases in the Q-sphere plot as well as its legend.
Fixes#2932
* Q-sphere plot enhancements. Note that requirement for seaborn module has been added.
* CHANGELOG update for Q-sphere plot enhancements (#2932)
* lint fixes
* add seaborn to visualization req
* remove seaborn from requirements
* add seaborn to dev req
* Make pylatexenc and pillow optional
The pylatexenc and pillow requirements are only used in the latex and
latex_source circuit drawers. Since this isn't used by everyone and is a
non-default circuit drawer there is no reason we should force our users
to install these by default. This commit updates the requirements list
and setup.py to make these 2 requirements optional and included in the
visualization setuptools extras to ease installation. If the packages
are not installed it will raise an ImportError with a detailed exception
explaining how to install the missing dependency.
Fixes#2417
* Fix lint
* Fix lint again
Right now when you try to build terra >=0.8.0 and you don't have Cython
installed it will fail. This is because we rely on cython being present
to build the stochastic swap code. While we have a setuptools
setup_requires defining this dependency it doesn't work because the
dependency on cython is needed before setuptools can resolve that for
us. PEP518 provides a solution for this problem by adding the concept of
a pyproject.toml file which can be used to outline build requirements
which are build time depdencies needed before the setup.py is run. With
this file present when you run:
pip install git+https://github.com/Qiskit/qiskit-terra
(or running on a local checkout)
and cython isn't installed pip will acquire it and use it for building
the sdist.
The setup.py for terra has grown organically as we've added and removed
different functionality from the repo. This has led to some pieces in
there which were out of date, others which weren't actually used, or
some missing metadata. This commit goes through the code in the setup.py
and removes unused or things not needed anymore and updates some of the
metadata for when we push future releases to pypi.
Now that qiskit-terra 0.8.0 is out the door we should bump the version
string on master to show the source verrsion we're installing is newer
than what's been released.
* Use pylatexenc utf8tolatex for gate names in latex drawer
When the latex drawer goes to draw custom gates they can be named and
valid unicode string. That's because the gate name attribute is a
string. However, latex doesn't know how to handle all utf8 characters
and requires escaping or custom libraries to render many of them.
Instead of trying to handle every edge case this commit uses the
pylatexenc lib (which is a MIT licensed lib with no additional
dependencies) which contains a mapping of all the unicode characters
with the latex equivalent. This means that things like '_' in custom
gate names will render properly now.
Partially Addresses #2235
* Fix lint
* Remove numpy max version cap
The version cap was put in place to prevent a potential incompatibility
but removing doesn't seem to cause any issues. Having it in place on
terra will cause an issue with ignis which requires numpy>=1.16.0 to
work as expected. While they're both co-installable because pip doesn't
have a depedency solver this only works if ignis is installed second.
(as installing terra second pip will use it's requirements with the
version cap, instead of ignis which has already been installed). To
avoid any potential confusion just removing the version cap is easiest.
* Disable misbehaving pylint checks
* 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
* 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.
Since #1644 we've removed all the C++ code from the terra repository.
That commit updated the setup.py and build process to not assume we're
compiling code to build the simulators. However we missed a lot of
parameters imports and other code in the setup.py which are not needed
or don't apply anymore now that terra is just python code. This commit
cleans that all up so we minimize what we include in the setup.py.
* 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
* 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
* Add setuptools extras for installing matplotlib
This commit adds a setuptools extras [1] entry for optionally installing
matplotlib. This enables users to just run:
'pip install qiskt[visualization]' and instlal qiskit and the
visualization dependencies in one command. Right now this is only
matplotlib, but it will likely also include nxpd too in the near future.
[1] https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
* Add installation docs for new extras
* Add skeleton models and schemas in qiskit.models
Add `qiskit.models`, with the basis for defining objects (models) that
are used for interfacing with terra and formally defined in the specs
(schema). The classes in `base` are meant to be subclasses for each
entity - an example is included in `backend_status`.
* Update requirements
* Add tests for qiskit.models
* Adding validator decorator and moving to Marshmallow 2 (#7)
* Adding validator decorator and moving to Marshmallow 2
* Adding docstrings
* Documenting returns
* Feature/polyfields (#8)
* Moving validation infrastructure to qiskit.validation
* Providing a PolyField basic implementation
* The decorators raises when trying to bind the same schema twice.
* Better PolyField building blocks
* Move fields to own file, tweak and document
Move the Fields related code to `qiskit.validation.fields`, for clarity.
Update `BasePolyField` and `TryFrom` with tweaks to match the expected
functionality, linter and add documentation. Add tests, reorganizing
them slightly into TestCases.
* Revise validation documentation
* Add ByAttribute polymorphic field, fixes
Add the `ByAttribute` polymorphic field, allowing to chose an schema
based on the presence of an attribute. Fix the `to_dict_selector`s in
order to use inspection on the Models directly. Add tests.
* Remove BackendStatusSchema
Remove the `BackendStatusSchema` implementation, in order to introduce
it in future PRs along with its usage.
* Allow for top-level validation in instantiation (#9)
* Allow for top-level validation in instantiation
Update the instantation of a `Model` from kwargs in order to perform
a validation of the regular, top-level fields but not full validation
of the compound fields via a `schemalite` attribute.
* Update top-level validation during instantiation
Fix top-level validation during instantiation, making it take into
account other types of fields. Update tests and style and naming
tweaks.
* Rename test_models to test_validation
For consistency with the module name `qiskit.validation`.
* Updates to validation.base from review
* Copy IBMQuantumExperience 2.0.4 into ibmq
Copy the `IBMQuantumExperience` files (version 2.0.4, 2ab2401) into
the `qiskit.backends.ibmq.api` package. The credit for the code is for
@pacomf with the help of contributors in the original repository [1].
[1] https://github.com/Qiskit/qiskit-api-py
* Lint and style fixes for IBMQuantumExperience
* Linter warnings for IBMQuantumExperience
Less trivial fixes for linter warnings:
* simplify run_experiment return logic
* add `requests.codes.ok` to list of generated members, as they are
populated dynamically
* disable a spurious urllib3 import
* Rename IBMQuantumExperience to IBMQConnector
* Replace IBMQuantumExperience usages
Replace the usages of `IBMQuantumExperience` with usages of
`qiskit.backends.ibmq.api.IBMQConnector`, updating docstrings and
text in the process.
Update the dependencies accordingly.
* Remove functions from qiskit._util
Remove or move several functions from `qiskit._util`:
* remove `_check_ibmqx_version`, as it has been rendered obsolete
* move `_dict_merge` to qiskit.backends.ibmq
* remove `_parse_ibmq_credentials`, as it was unused
* Add IBMQConnector tests
Add tests for IBMQConnector, copying them from the original repository
and adjusting for style and conformance to Terra testing structure.
Original work by @pacomf and contributors at qiskit-api-py.
* Disable api.run_experiment tests
Disable the tests related to api.run_experiment(), as the function is
not used in terra.
* Remove test_util
* Update CHANGELOG
* Replace API calls with lightweight status calls
In `IBMQJob`, replace the calls for listing jobs and retrieving a
previous job with the new endpoints that provide enough info for
recreating a `Job` based on them. The side effect is that the results
are not consumed until `job.result()` is called.
* Use API status in IBMQJob constructor
Allow passing the API status field to the IBMQJob constructor in order
to avoid extra API calls when constructing an already sent job.
Not having a setup.py causes all sorts of headaches for anyone trying to
use the package from source. Having cmake generate one is kind of absurd
when all it really does is add a version string. There are other ways to
do that (if the burden of updating a version string is too high) in an
automatic fashion (see pbr for an example that uses git tags to
autogenerate the version number). But for right now this just adds the
setup.py back so people will be able to install just the python code
easily, and use tools that expect a python repo to be installable on a
clean checkout without any additional steps.
* CMake integration:
* Qiskit simulator now builds on/for Linux 64, Win64 and Darwin
* Added support for creating pip distributable packages (sdist
and wheels) for Linux, Windows and MacOS
* Added support for testing and lintering via CMake
* Added Windows lib/dll dependencies for C++ simulator
* Added support for building when installing via Pip from source
distribution, so non-supported platforms have a chance to build
the C++ code
* Documentation updated, but still a WIP.
* Fix .rst formatting issues
* Restore qiskit-simulator latest changes
* Remove garbage file
* CMake integration:
* Added make "doc" target for Sphinx documentation
* Added both sdist and bdist_wheel distribution packages builds
* CMake integration:
* Setup.py.in now generates the correct platform tag for wheels
distribution package
* CMake integration:
* 'make clean' target now removes all custom generated files and
directories.
* Fxied 'make pypi_package' to not include binaries in the source
distribution package (sdist)
* CMake integration: Addressing review comments
* Git-ignoring some autogenerated files
* Changed linter target name to "lint"
* Improved documentation
* CMake integration: Adressing review comments (2)
* Added qiskit/backends/qiskit_simulator to .gitignore
* Bumped to version: 0.4.6
* Upgraded external dependencies
* Make graph code in QISKit compatible with NetworkX 2.0
NetworkX 1.11 which is required by qiskit uses some deprecated
functions for plotting that generate a warning with matplotlib. The
proposed changes make QISKit compatible with both versions of NetworkX.
In a second step we should upgrade the code to use only NetworkX 2.0
and later since some functions were added that make things more
elegant. See
https://networkx.github.io/documentation/stable/release/migration_guide_from_1.x_to_2.0.html
* Reintroduce AppVeyor (#252)
Re-enable the AppVeyor CI, as the conflicts with the version were
hopefully solved after bumping the scipy dependency and others.
* * Added support for Windows cpp simulator
* Bumped version to: 0.4.5
* * Bumped to version: 0.4.5 on qiskit/__init__.py too.
* Remove -static flag!!
* Making peace with my beloved linter.
Revise the dependencies in order to:
* drop `requests`, as it is not needed directly by the SDK
* for several packages, test that the most recent *major* versions of
them work with QISKit, and adjust the comparators accordingly.
* fix a test that was failing due to the precision.
Revise the dependencies in order to:
* drop `requests`, as it is not needed directly by the SDK
* for several packages, test that the most recent *major* versions of
them work with QISKit, and adjust the comparators accordingly.
* fix a test that was failing due to the precision.