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-13 05:11:28 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2018-06-08 21:00:58 +08:00
|
|
|
# Copyright 2017, IBM.
|
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-13 05:11:28 +08:00
|
|
|
#
|
2018-06-08 21:00:58 +08:00
|
|
|
# This source code is licensed under the Apache License, Version 2.0 found in
|
|
|
|
# the LICENSE.txt file in the root directory of this source tree.
|
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-13 05:11:28 +08:00
|
|
|
|
2018-01-04 23:55:27 +08:00
|
|
|
import os
|
2018-02-15 20:04:43 +08:00
|
|
|
import platform
|
2018-01-04 23:55:27 +08:00
|
|
|
from distutils.command.build import build
|
|
|
|
from multiprocessing import cpu_count
|
|
|
|
from subprocess import call
|
2018-02-15 20:04:43 +08:00
|
|
|
|
2018-05-07 18:40:59 +08:00
|
|
|
from setuptools import setup, find_packages
|
2018-02-15 20:04:43 +08:00
|
|
|
from setuptools.dist import Distribution
|
2017-08-23 22:40:43 +08:00
|
|
|
|
2017-12-20 17:40:09 +08:00
|
|
|
|
|
|
|
requirements = [
|
2018-09-04 00:37:20 +08:00
|
|
|
"jsonschema>=2.6,<2.7",
|
Add auto-validated objects machinery (#1249)
* 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
2018-11-14 18:40:41 +08:00
|
|
|
"marshmallow>=2.16.3,<3",
|
|
|
|
"marshmallow_polyfield>=3.2,<4",
|
2018-09-27 17:27:42 +08:00
|
|
|
"matplotlib>=2.1",
|
2018-11-14 17:30:21 +08:00
|
|
|
"networkx>=2.2",
|
2018-06-13 22:21:15 +08:00
|
|
|
"numpy>=1.13",
|
|
|
|
"ply>=3.10",
|
2018-11-07 04:55:54 +08:00
|
|
|
"requests>=2.19",
|
|
|
|
"requests-ntlm>=1.1.0",
|
2018-09-13 13:38:30 +08:00
|
|
|
"scipy>=0.19,!=0.19.1",
|
2018-06-13 22:21:15 +08:00
|
|
|
"sympy>=1.0",
|
2018-09-21 15:46:52 +08:00
|
|
|
"pillow>=4.2.1",
|
2018-10-10 22:19:36 +08:00
|
|
|
"psutil>=5",
|
|
|
|
"nxpd>=0.2"
|
2017-12-20 17:40:09 +08:00
|
|
|
]
|
|
|
|
|
2017-11-27 18:09:59 +08:00
|
|
|
|
2018-01-04 23:55:27 +08:00
|
|
|
# C++ components compilation
|
2018-05-01 02:36:48 +08:00
|
|
|
class QasmSimulatorCppBuild(build):
|
2018-01-04 23:55:27 +08:00
|
|
|
def run(self):
|
2018-02-15 20:04:43 +08:00
|
|
|
super().run()
|
|
|
|
# Store the current working directory, as invoking cmake involves
|
|
|
|
# an out of source build and might interfere with the rest of the steps.
|
|
|
|
current_directory = os.getcwd()
|
2018-01-04 23:55:27 +08:00
|
|
|
|
|
|
|
try:
|
2018-02-15 20:04:43 +08:00
|
|
|
supported_platforms = ['Linux', 'Darwin', 'Windows']
|
|
|
|
current_platform = platform.system()
|
|
|
|
if current_platform not in supported_platforms:
|
|
|
|
# TODO: stdout is silenced by pip if the full setup.py invocation is
|
|
|
|
# successful, unless using '-v' - hence the warnings are not printed.
|
2018-07-11 19:14:15 +08:00
|
|
|
print('WARNING: Qiskit cpp simulator is meant to be built with these '
|
2018-02-15 20:04:43 +08:00
|
|
|
'platforms: {}. We will support other platforms soon!'
|
|
|
|
.format(supported_platforms))
|
|
|
|
return
|
2018-01-04 23:55:27 +08:00
|
|
|
|
2018-02-15 20:04:43 +08:00
|
|
|
cmd_cmake = ['cmake', '-vvv']
|
|
|
|
if 'USER_LIB_PATH' in os.environ:
|
|
|
|
cmd_cmake.append('-DUSER_LIB_PATH={}'.format(os.environ['USER_LIB_PATH']))
|
|
|
|
if current_platform == 'Windows':
|
|
|
|
# We only support MinGW so far
|
|
|
|
cmd_cmake.append("-GMinGW Makefiles")
|
|
|
|
cmd_cmake.append('..')
|
2018-01-04 23:55:27 +08:00
|
|
|
|
2018-04-13 22:26:18 +08:00
|
|
|
cmd_make = ['make', 'pypi_package_copy_qasm_simulator_cpp']
|
2018-02-15 20:04:43 +08:00
|
|
|
|
|
|
|
try:
|
|
|
|
cmd_make.append('-j%d' % cpu_count())
|
|
|
|
except NotImplementedError:
|
|
|
|
print('WARNING: Unable to determine number of CPUs. Using single threaded make.')
|
|
|
|
|
|
|
|
def compile_simulator():
|
|
|
|
self.mkpath('out')
|
|
|
|
os.chdir('out')
|
|
|
|
call(cmd_cmake)
|
|
|
|
call(cmd_make)
|
|
|
|
|
2018-04-13 22:26:18 +08:00
|
|
|
self.execute(compile_simulator, [], 'Compiling C++ QASM Simulator')
|
2018-02-15 20:04:43 +08:00
|
|
|
except Exception as e:
|
|
|
|
print(str(e))
|
2018-01-08 00:15:23 +08:00
|
|
|
print("WARNING: Seems like the cpp simulator can't be built, Qiskit will "
|
|
|
|
"install anyway, but won't have this simulator support.")
|
2018-02-15 20:04:43 +08:00
|
|
|
|
|
|
|
# Restore working directory.
|
|
|
|
os.chdir(current_directory)
|
|
|
|
|
2018-01-08 00:15:23 +08:00
|
|
|
|
2018-02-05 22:42:10 +08:00
|
|
|
# This is for creating wheel specific platforms
|
|
|
|
class BinaryDistribution(Distribution):
|
|
|
|
def has_ext_modules(self):
|
|
|
|
return True
|
2018-01-04 23:55:27 +08:00
|
|
|
|
2018-02-15 20:04:43 +08:00
|
|
|
|
2017-08-23 22:40:43 +08:00
|
|
|
setup(
|
|
|
|
name="qiskit",
|
2018-10-05 06:54:13 +08:00
|
|
|
version="0.7.0",
|
2017-08-23 22:40:43 +08:00
|
|
|
description="Software for developing quantum computing programs",
|
2018-07-11 19:14:15 +08:00
|
|
|
long_description="""Qiskit is a software development kit for writing
|
2017-10-25 22:12:04 +08:00
|
|
|
quantum computing experiments, programs, and applications. Works with
|
|
|
|
Python 3.5 and 3.6""",
|
2018-07-11 19:14:15 +08:00
|
|
|
url="https://github.com/Qiskit/qiskit-terra",
|
|
|
|
author="Qiskit Development Team",
|
2017-08-23 22:40:43 +08:00
|
|
|
author_email="qiskit@us.ibm.com",
|
|
|
|
license="Apache 2.0",
|
|
|
|
classifiers=[
|
|
|
|
"Environment :: Console",
|
|
|
|
"License :: OSI Approved :: Apache Software License",
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
"Intended Audience :: Science/Research",
|
2017-10-25 22:12:04 +08:00
|
|
|
"Operating System :: Microsoft :: Windows",
|
|
|
|
"Operating System :: MacOS",
|
|
|
|
"Operating System :: POSIX :: Linux",
|
2017-08-23 22:40:43 +08:00
|
|
|
"Programming Language :: Python :: 3.5",
|
2017-08-25 02:36:53 +08:00
|
|
|
"Programming Language :: Python :: 3.6",
|
|
|
|
"Topic :: Scientific/Engineering",
|
2017-08-23 22:40:43 +08:00
|
|
|
],
|
|
|
|
keywords="qiskit sdk quantum",
|
2018-05-07 18:40:59 +08:00
|
|
|
packages=find_packages(exclude=['test*']),
|
2017-08-23 22:40:43 +08:00
|
|
|
install_requires=requirements,
|
2017-08-25 17:15:48 +08:00
|
|
|
include_package_data=True,
|
2017-08-23 22:40:43 +08:00
|
|
|
python_requires=">=3.5",
|
2018-01-04 23:55:27 +08:00
|
|
|
cmdclass={
|
2018-05-01 02:36:48 +08:00
|
|
|
'build': QasmSimulatorCppBuild,
|
2018-02-05 22:42:10 +08:00
|
|
|
},
|
2018-06-12 17:38:05 +08:00
|
|
|
distclass=BinaryDistribution
|
2017-08-23 22:40:43 +08:00
|
|
|
)
|