qiskit/setup.py

117 lines
4.0 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 -*-
# This code is part of Qiskit.
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
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
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
"The Qiskit Terra setup file."
import os
import sys
from setuptools import setup, find_packages, Extension
try:
from Cython.Build import cythonize
except ImportError:
import subprocess
subprocess.call([sys.executable, '-m', 'pip', 'install', 'Cython>=0.27.1'])
from Cython.Build import cythonize
REQUIREMENTS = [
"jsonschema>=2.6",
"marshmallow>=3,<4",
"marshmallow_polyfield>=5.7,<6",
"networkx>=2.2;python_version>'3.5'",
# Networkx 2.4 is the final version with python 3.5 support.
"networkx>=2.2,<2.4;python_version=='3.5'",
"numpy>=1.13",
2018-06-13 22:21:15 +08:00
"ply>=3.10",
"psutil>=5",
"scipy>=1.0",
"sympy>=1.3",
"dill>=0.3",
]
# Add Cython extensions here
CYTHON_EXTS = ['utils', 'swap_trial']
CYTHON_MODULE = 'qiskit.transpiler.passes.mapping.cython.stochastic_swap'
CYTHON_SOURCE_DIR = 'qiskit/transpiler/passes/mapping/cython/stochastic_swap'
INCLUDE_DIRS = []
# Extra link args
LINK_FLAGS = []
# If on Win and not in MSYS2 (i.e. Visual studio compile)
if (sys.platform == 'win32' and os.environ.get('MSYSTEM') is None):
2019-02-24 21:07:16 +08:00
COMPILER_FLAGS = ['/O2']
# Everything else
else:
COMPILER_FLAGS = ['-O2', '-funroll-loops', '-std=c++11']
if sys.platform == 'darwin':
# These are needed for compiling on OSX 10.14+
COMPILER_FLAGS.append('-mmacosx-version-min=10.9')
LINK_FLAGS.append('-mmacosx-version-min=10.9')
EXT_MODULES = []
# Add Cython Extensions
for ext in CYTHON_EXTS:
mod = Extension(CYTHON_MODULE + '.' + ext,
sources=[CYTHON_SOURCE_DIR + '/' + ext + '.pyx'],
include_dirs=INCLUDE_DIRS,
extra_compile_args=COMPILER_FLAGS,
extra_link_args=LINK_FLAGS,
language='c++')
EXT_MODULES.append(mod)
setup(
name="qiskit-terra",
version="0.12.0",
description="Software for developing quantum computing programs",
long_description="""Terra provides the foundations for Qiskit. It allows the user to write
quantum circuits easily, and takes care of the constraints of real hardware.""",
url="https://github.com/Qiskit/qiskit-terra",
author="Qiskit Development Team",
author_email="qiskit@qiskit.org",
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",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
packages=find_packages(exclude=['test*']),
install_requires=REQUIREMENTS,
setup_requires=['Cython>=0.27.1'],
include_package_data=True,
python_requires=">=3.5",
extras_require={
'visualization': ['matplotlib>=2.1', 'ipywidgets>=7.3.0',
'pydot', "pillow>=4.2.1", "pylatexenc>=1.4",
"seaborn>=0.9.0"],
'full-featured-simulators': ['qiskit-aer>=0.1']
},
project_urls={
"Bug Tracker": "https://github.com/Qiskit/qiskit-terra/issues",
"Documentation": "https://qiskit.org/documentation/",
"Source Code": "https://github.com/Qiskit/qiskit-terra",
},
ext_modules=cythonize(EXT_MODULES),
zip_safe=False
)