qiskit/setup.py

125 lines
4.1 KiB
Python
Raw Normal View History

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 -*-
# 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
#
# 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
import os
import platform
from distutils.command.build import build
from multiprocessing import cpu_count
from subprocess import call
from setuptools import setup, find_packages
from setuptools.dist import Distribution
requirements = [
"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",
"networkx>=2.2",
2018-06-13 22:21:15 +08:00
"numpy>=1.13",
"ply>=3.10",
Copy IBMQuantumExperience 2.0.4 into terra (#1198) * 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
2018-11-07 04:55:54 +08:00
"requests>=2.19",
"requests-ntlm>=1.1.0",
"scipy>=0.19,!=0.19.1",
2018-06-13 22:21:15 +08:00
"sympy>=1.0",
"pillow>=4.2.1",
"psutil>=5",
"nxpd>=0.2"
]
# C++ components compilation
class QasmSimulatorCppBuild(build):
def run(self):
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()
try:
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.
print('WARNING: Qiskit cpp simulator is meant to be built with these '
'platforms: {}. We will support other platforms soon!'
.format(supported_platforms))
return
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('..')
cmd_make = ['make', 'pypi_package_copy_qasm_simulator_cpp']
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)
self.execute(compile_simulator, [], 'Compiling C++ QASM Simulator')
except Exception as e:
print(str(e))
print("WARNING: Seems like the cpp simulator can't be built, Qiskit will "
"install anyway, but won't have this simulator support.")
# Restore working directory.
os.chdir(current_directory)
# This is for creating wheel specific platforms
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
setup(
name="qiskit",
version="0.7.0",
description="Software for developing quantum computing programs",
long_description="""Qiskit is a software development kit for writing
quantum computing experiments, programs, and applications. Works with
Python 3.5 and 3.6""",
url="https://github.com/Qiskit/qiskit-terra",
author="Qiskit Development Team",
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",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
packages=find_packages(exclude=['test*']),
install_requires=requirements,
include_package_data=True,
python_requires=">=3.5",
cmdclass={
'build': QasmSimulatorCppBuild,
},
distclass=BinaryDistribution
)