From f70c6c83ff2e659bb8bed91c7a7f4ed01a01713b Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Sun, 20 Jun 2021 18:05:08 -0400 Subject: [PATCH 1/2] Blacken stragglers --- Makefile | 8 +- docs/conf.py | 65 ++++++++------- examples/python/circuit_draw.py | 1 + examples/python/ghz.py | 10 +-- examples/python/ibmq/ghz.py | 12 +-- examples/python/ibmq/hello_quantum.py | 17 ++-- examples/python/ibmq/qft.py | 8 +- .../python/ibmq/using_qiskit_terra_level_0.py | 8 +- .../python/ibmq/using_qiskit_terra_level_1.py | 10 +-- .../python/ibmq/using_qiskit_terra_level_2.py | 4 +- examples/python/initialize.py | 13 ++- examples/python/load_qasm.py | 2 +- examples/python/qft.py | 8 +- examples/python/rippleadd.py | 27 ++++++- examples/python/stochastic_swap.py | 4 +- examples/python/teleport.py | 12 ++- examples/python/using_qiskit_terra_level_0.py | 2 +- setup.py | 81 +++++++++++-------- tox.ini | 4 +- 19 files changed, 165 insertions(+), 131 deletions(-) diff --git a/Makefile b/Makefile index b63e3b84045c..044cbd13dc16 100644 --- a/Makefile +++ b/Makefile @@ -46,15 +46,15 @@ env: # Ignoring generated ones with .py extension. lint: pylint -rn qiskit test - tools/verify_headers.py qiskit test tools + tools/verify_headers.py qiskit test tools examples pylint -rn --disable='C0103, C0114, W0621' examples/python/*.py - python tools/find_optional_imports.py + tools/find_optional_imports.py style: - black --check qiskit test tools + black --check qiskit test tools examples setup.py black: - black qiskit test tools + black qiskit test tools examples setup.py # Use the -s (starting directory) flag for "unittest discover" is necessary, # otherwise the QuantumCircuit header will be modified during the discovery. diff --git a/docs/conf.py b/docs/conf.py index bc5904223013..7fcf74a1a8bb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -32,19 +32,20 @@ """ import os + # Set env flag so that we can doc functions that may otherwise not be loaded # see for example interactive visualizations in qiskit.visualization. -os.environ['QISKIT_DOCS'] = 'TRUE' +os.environ["QISKIT_DOCS"] = "TRUE" # -- Project information ----------------------------------------------------- -project = 'Qiskit' -copyright = '2019, Qiskit Development Team' # pylint: disable=redefined-builtin -author = 'Qiskit Development Team' +project = "Qiskit" +copyright = "2019, Qiskit Development Team" # pylint: disable=redefined-builtin +author = "Qiskit Development Team" # The short X.Y version -version = '' +version = "" # The full version, including alpha/beta/rc tags -release = '0.18.0' +release = "0.18.0" # -- General configuration --------------------------------------------------- @@ -56,19 +57,19 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.napoleon', - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', - 'sphinx.ext.mathjax', - 'sphinx.ext.viewcode', - 'sphinx.ext.extlinks', - 'jupyter_sphinx', - 'sphinx_autodoc_typehints', - 'reno.sphinxext', - 'sphinx_panels', + "sphinx.ext.napoleon", + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.mathjax", + "sphinx.ext.viewcode", + "sphinx.ext.extlinks", + "jupyter_sphinx", + "sphinx_autodoc_typehints", + "reno.sphinxext", + "sphinx_panels", ] -html_static_path = ['_static'] -templates_path = ['_templates'] +html_static_path = ["_static"] +templates_path = ["_templates"] html_css_files = [] # ----------------------------------------------------------------------------- @@ -83,7 +84,7 @@ # ----------------------------------------------------------------------------- autodoc_default_options = { - 'inherited-members': None, + "inherited-members": None, } @@ -94,9 +95,7 @@ # A dictionary mapping 'figure', 'table', 'code-block' and 'section' to # strings that are used for format of figure numbers. As a special character, # %s will be replaced to figure number. -numfig_format = { - 'table': 'Table %s' -} +numfig_format = {"table": "Table %s"} # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # @@ -107,10 +106,10 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', '**.ipynb_checkpoints'] +exclude_patterns = ["_build", "**.ipynb_checkpoints"] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'colorful' +pygments_style = "colorful" # A boolean that decides whether module names are prepended to all object names # (for object types where a “module” of some kind is defined), e.g. for @@ -121,7 +120,7 @@ # (e.g., if this is set to ['foo.'], then foo.bar is shown under B, not F). # This can be handy if you document a project that consists of a single # package. Works only for the HTML builder currently. -modindex_common_prefix = ['qiskit.'] +modindex_common_prefix = ["qiskit."] # -- Configuration for extlinks extension ------------------------------------ # Refer to https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html @@ -132,16 +131,16 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'qiskit_sphinx_theme' # use the theme in subdir 'theme' +html_theme = "qiskit_sphinx_theme" # use the theme in subdir 'theme' -#html_sidebars = {'**': ['globaltoc.html']} -html_last_updated_fmt = '%Y/%m/%d' +# html_sidebars = {'**': ['globaltoc.html']} +html_last_updated_fmt = "%Y/%m/%d" html_theme_options = { - 'logo_only': True, - 'display_version': True, - 'prev_next_buttons_location': 'bottom', - 'style_external_links': True, + "logo_only": True, + "display_version": True, + "prev_next_buttons_location": "bottom", + "style_external_links": True, } -autoclass_content = 'both' +autoclass_content = "both" diff --git a/examples/python/circuit_draw.py b/examples/python/circuit_draw.py index 66ef3436aea9..b8efbbef4910 100644 --- a/examples/python/circuit_draw.py +++ b/examples/python/circuit_draw.py @@ -25,6 +25,7 @@ def build_bell_circuit(): qc.measure([0, 1], [0, 1]) return qc + # Create the circuit bell_circuit = build_bell_circuit() diff --git a/examples/python/ghz.py b/examples/python/ghz.py index 3851333e1e5f..469fdd268797 100644 --- a/examples/python/ghz.py +++ b/examples/python/ghz.py @@ -22,20 +22,20 @@ # Make a quantum circuit for the GHZ state. ############################################################### num_qubits = 5 -qc = QuantumCircuit(num_qubits, num_qubits, name='ghz') +qc = QuantumCircuit(num_qubits, num_qubits, name="ghz") # Create a GHZ state qc.h(0) -for i in range(num_qubits-1): - qc.cx(i, i+1) +for i in range(num_qubits - 1): + qc.cx(i, i + 1) # Insert a barrier before measurement qc.barrier() # Measure all of the qubits in the standard basis for i in range(num_qubits): qc.measure(i, i) -sim_backend = BasicAer.get_backend('qasm_simulator') +sim_backend = BasicAer.get_backend("qasm_simulator") job = execute(qc, sim_backend, shots=1024) result = job.result() -print('Qasm simulator : ') +print("Qasm simulator : ") print(result.get_counts(qc)) diff --git a/examples/python/ibmq/ghz.py b/examples/python/ibmq/ghz.py index e5dc1c841755..767113070825 100644 --- a/examples/python/ibmq/ghz.py +++ b/examples/python/ibmq/ghz.py @@ -22,12 +22,12 @@ # Make a quantum circuit for the GHZ state. ############################################################### num_qubits = 5 -qc = QuantumCircuit(num_qubits, num_qubits, name='ghz') +qc = QuantumCircuit(num_qubits, num_qubits, name="ghz") # Create a GHZ state qc.h(0) -for i in range(num_qubits-1): - qc.cx(i, i+1) +for i in range(num_qubits - 1): + qc.cx(i, i + 1) # Insert a barrier before measurement qc.barrier() # Measure all of the qubits in the standard basis @@ -41,10 +41,10 @@ # Second version: real device least_busy_device = least_busy( - provider.backends(simulator=False, - filters=lambda x: x.configuration().n_qubits > 4)) + provider.backends(simulator=False, filters=lambda x: x.configuration().n_qubits > 4) +) print("Running on current least busy device: ", least_busy_device) job = execute(qc, least_busy_device, shots=1024) result = job.result() -print('Physical device (%s) : ' % least_busy_device) +print("Physical device (%s) : " % least_busy_device) print(result.get_counts(qc)) diff --git a/examples/python/ibmq/hello_quantum.py b/examples/python/ibmq/hello_quantum.py index 29cfdca92d3c..63affd35cbbb 100644 --- a/examples/python/ibmq/hello_quantum.py +++ b/examples/python/ibmq/hello_quantum.py @@ -30,7 +30,7 @@ # See a list of available local simulators print("BasicAer backends: ", BasicAer.backends()) -backend_sim = BasicAer.get_backend('qasm_simulator') +backend_sim = BasicAer.get_backend("qasm_simulator") # Compile and run the Quantum circuit on a simulator backend job_sim = execute(qc, backend_sim) @@ -43,9 +43,11 @@ try: provider = IBMQ.load_account() except: - print("""WARNING: No valid IBMQ credentials found on disk. + print( + """WARNING: No valid IBMQ credentials found on disk. You must store your credentials using IBMQ.save_account(token, url). - For now, there's only access to local simulator backends...""") + For now, there's only access to local simulator backends...""" + ) exit(0) # see a list of available remote backends @@ -55,16 +57,17 @@ # Compile and run the Quantum Program on a real device backend # select those with at least 2 qubits try: - least_busy_device = least_busy(provider.backends( - filters=lambda x: x.configuration().n_qubits >= 2, simulator=False)) + least_busy_device = least_busy( + provider.backends(filters=lambda x: x.configuration().n_qubits >= 2, simulator=False) + ) except: print("All devices are currently unavailable.") print("Running on current least busy device: ", least_busy_device) -#running the job +# running the job job_exp = execute(qc, least_busy_device, shots=1024, max_credits=10) result_exp = job_exp.result() # Show the results -print('Counts: ', result_exp.get_counts(qc)) +print("Counts: ", result_exp.get_counts(qc)) diff --git a/examples/python/ibmq/qft.py b/examples/python/ibmq/qft.py index 2731a2b1c154..4d6822528d24 100644 --- a/examples/python/ibmq/qft.py +++ b/examples/python/ibmq/qft.py @@ -27,14 +27,14 @@ def input_state(circ, n): """n-qubit input state for QFT that produces output 1.""" for j in range(n): circ.h(j) - circ.p(-math.pi/float(2**(j)), j) + circ.p(-math.pi / float(2 ** (j)), j) def qft(circ, n): """n-qubit QFT on q in circ.""" for j in range(n): for k in range(j): - circ.cp(math.pi/float(2**(j-k)), j, k) + circ.cp(math.pi / float(2 ** (j - k)), j, k) circ.h(j) @@ -74,8 +74,8 @@ def qft(circ, n): # Second version: real device least_busy_device = least_busy( - provider.backends(simulator=False, - filters=lambda x: x.configuration().n_qubits > 4)) + provider.backends(simulator=False, filters=lambda x: x.configuration().n_qubits > 4) +) print("Running on current least busy device: ", least_busy_device) job = execute([qft3, qft4, qft5], least_busy_device, shots=1024) result = job.result() diff --git a/examples/python/ibmq/using_qiskit_terra_level_0.py b/examples/python/ibmq/using_qiskit_terra_level_0.py index 9ae6b1ddb4c6..49a8c137104b 100644 --- a/examples/python/ibmq/using_qiskit_terra_level_0.py +++ b/examples/python/ibmq/using_qiskit_terra_level_0.py @@ -37,19 +37,19 @@ qc1 = QuantumCircuit(2, 2) qc1.h(0) qc1.cx(0, 1) -qc1.measure([0,1], [0,1]) +qc1.measure([0, 1], [0, 1]) # making another circuit: superpositions qc2 = QuantumCircuit(2, 2) -qc2.h([0,1]) -qc2.measure([0,1], [0,1]) +qc2.h([0, 1]) +qc2.measure([0, 1], [0, 1]) # setting up the backend print("(BasicAER Backends)") print(BasicAer.backends()) # running the job -job_sim = execute([qc1, qc2], BasicAer.get_backend('qasm_simulator')) +job_sim = execute([qc1, qc2], BasicAer.get_backend("qasm_simulator")) sim_result = job_sim.result() # Show the results diff --git a/examples/python/ibmq/using_qiskit_terra_level_1.py b/examples/python/ibmq/using_qiskit_terra_level_1.py index b3673ad1d937..1722b367e1bc 100644 --- a/examples/python/ibmq/using_qiskit_terra_level_1.py +++ b/examples/python/ibmq/using_qiskit_terra_level_1.py @@ -40,18 +40,18 @@ qc1 = QuantumCircuit(2, 2, name="bell") qc1.h(0) qc1.cx(0, 1) -qc1.measure([0,1], [0,1]) +qc1.measure([0, 1], [0, 1]) # Making another circuit: superpositions qc2 = QuantumCircuit(2, 2, name="superposition") -qc2.h([0,1]) -qc2.measure([0,1], [0,1]) +qc2.h([0, 1]) +qc2.measure([0, 1], [0, 1]) # Setting up the backend print("(Aer Backends)") for backend in BasicAer.backends(): print(backend.status()) -qasm_simulator = BasicAer.get_backend('qasm_simulator') +qasm_simulator = BasicAer.get_backend("qasm_simulator") # Compile and run the circuit on a real device backend @@ -87,7 +87,7 @@ sim_job = qasm_simulator.run(qobj) # Getting the result -sim_result=sim_job.result() +sim_result = sim_job.result() # Show the results print(sim_result.get_counts(qc1)) diff --git a/examples/python/ibmq/using_qiskit_terra_level_2.py b/examples/python/ibmq/using_qiskit_terra_level_2.py index ad5b60ca7ff3..edf2ff02d1a9 100644 --- a/examples/python/ibmq/using_qiskit_terra_level_2.py +++ b/examples/python/ibmq/using_qiskit_terra_level_2.py @@ -56,7 +56,7 @@ print("(Aer Backends)") for backend in BasicAer.backends(): print(backend.status()) -qasm_simulator = BasicAer.get_backend('qasm_simulator') +qasm_simulator = BasicAer.get_backend("qasm_simulator") # Compile and run the circuit on a real device backend @@ -97,7 +97,7 @@ pm.append(CXDirection(coupling_map)) # unroll to single qubit gates -pm.append(Unroller(['u1', 'u2', 'u3', 'id', 'cx'])) +pm.append(Unroller(["u1", "u2", "u3", "id", "cx"])) qc1_new = pm.run(qc1) qc2_new = pm.run(qc2) diff --git a/examples/python/initialize.py b/examples/python/initialize.py index 8132941cafbc..b1e6325e2dad 100644 --- a/examples/python/initialize.py +++ b/examples/python/initialize.py @@ -39,7 +39,8 @@ 0, 0, 1 / math.sqrt(4) * complex(1, 0), - 1 / math.sqrt(8) * complex(1, 0)] + 1 / math.sqrt(8) * complex(1, 0), +] circuit.initialize(desired_vector, [0, 1, 2, 3]) @@ -54,17 +55,15 @@ # Desired vector print("Desired probabilities: ") -print(str(list(map(lambda x: format(abs(x * x), '.3f'), desired_vector)))) +print(str(list(map(lambda x: format(abs(x * x), ".3f"), desired_vector)))) # Initialize on local simulator -sim_backend = BasicAer.get_backend('qasm_simulator') +sim_backend = BasicAer.get_backend("qasm_simulator") job = execute(circuit, sim_backend, shots=shots) result = job.result() counts = result.get_counts(circuit) -qubit_strings = [format(i, '0%sb' % 4) for - i in range(2 ** 4)] +qubit_strings = [format(i, "0%sb" % 4) for i in range(2 ** 4)] print("Probabilities from simulator: ") -print([format(counts.get(s, 0) / shots, '.3f') for - s in qubit_strings]) +print([format(counts.get(s, 0) / shots, ".3f") for s in qubit_strings]) diff --git a/examples/python/load_qasm.py b/examples/python/load_qasm.py index 336482255234..d9da1f1dcd58 100644 --- a/examples/python/load_qasm.py +++ b/examples/python/load_qasm.py @@ -19,7 +19,7 @@ print(circ) # See the backend -sim_backend = BasicAer.get_backend('qasm_simulator') +sim_backend = BasicAer.get_backend("qasm_simulator") # Compile and run the Quantum circuit on a local simulator backend diff --git a/examples/python/qft.py b/examples/python/qft.py index 85ea8191a9c2..5849bb3813ae 100644 --- a/examples/python/qft.py +++ b/examples/python/qft.py @@ -26,14 +26,14 @@ def input_state(circ, n): """n-qubit input state for QFT that produces output 1.""" for j in range(n): circ.h(j) - circ.p(-math.pi/float(2**(j)), j) + circ.p(-math.pi / float(2 ** (j)), j) def qft(circ, n): """n-qubit QFT on q in circ.""" for j in range(n): for k in range(j): - circ.cp(math.pi/float(2**(j-k)), j, k) + circ.cp(math.pi / float(2 ** (j - k)), j, k) circ.h(j) @@ -66,8 +66,8 @@ def qft(circ, n): print(qft4) print(qft5) -print('Qasm simulator') -sim_backend = BasicAer.get_backend('qasm_simulator') +print("Qasm simulator") +sim_backend = BasicAer.get_backend("qasm_simulator") job = execute([qft3, qft4, qft5], sim_backend, shots=1024) result = job.result() print(result.get_counts(qft3)) diff --git a/examples/python/rippleadd.py b/examples/python/rippleadd.py index ebfabb92c490..6036e3d79f4c 100644 --- a/examples/python/rippleadd.py +++ b/examples/python/rippleadd.py @@ -23,9 +23,30 @@ # Set the backend name and coupling map. ############################################################### backend = BasicAer.get_backend("qasm_simulator") -coupling_map = [[0, 1], [0, 8], [1, 2], [1, 9], [2, 3], [2, 10], [3, 4], [3, 11], - [4, 5], [4, 12], [5, 6], [5, 13], [6, 7], [6, 14], [7, 15], [8, 9], - [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15]] +coupling_map = [ + [0, 1], + [0, 8], + [1, 2], + [1, 9], + [2, 3], + [2, 10], + [3, 4], + [3, 11], + [4, 5], + [4, 12], + [5, 6], + [5, 13], + [6, 7], + [6, 14], + [7, 15], + [8, 9], + [9, 10], + [10, 11], + [11, 12], + [12, 13], + [13, 14], + [14, 15], +] ############################################################### # Make a quantum program for the n-bit ripple adder. diff --git a/examples/python/stochastic_swap.py b/examples/python/stochastic_swap.py index 3e617c3c7bf8..c07cc0731a8b 100644 --- a/examples/python/stochastic_swap.py +++ b/examples/python/stochastic_swap.py @@ -18,8 +18,8 @@ from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit coupling = CouplingMap([[0, 1], [1, 2], [1, 3]]) -qr = QuantumRegister(4, 'q') -cr = ClassicalRegister(4, 'c') +qr = QuantumRegister(4, "q") +cr = ClassicalRegister(4, "c") circ = QuantumCircuit(qr, cr) circ.cx(qr[1], qr[2]) circ.cx(qr[0], qr[3]) diff --git a/examples/python/teleport.py b/examples/python/teleport.py index 6cd496aa8c19..507a142ae9df 100644 --- a/examples/python/teleport.py +++ b/examples/python/teleport.py @@ -64,18 +64,16 @@ ############################################################### # First version: not mapped -initial_layout = {q[0]: 0, - q[1]: 1, - q[2]: 2} -job = execute(qc, backend=backend, coupling_map=None, shots=1024, - initial_layout=initial_layout) +initial_layout = {q[0]: 0, q[1]: 1, q[2]: 2} +job = execute(qc, backend=backend, coupling_map=None, shots=1024, initial_layout=initial_layout) result = job.result() print(result.get_counts(qc)) # Second version: mapped to 2x8 array coupling graph -job = execute(qc, backend=backend, coupling_map=coupling_map, shots=1024, - initial_layout=initial_layout) +job = execute( + qc, backend=backend, coupling_map=coupling_map, shots=1024, initial_layout=initial_layout +) result = job.result() print(result.get_counts(qc)) # Both versions should give the same distribution diff --git a/examples/python/using_qiskit_terra_level_0.py b/examples/python/using_qiskit_terra_level_0.py index 3bae3601bc81..ad20728341a5 100644 --- a/examples/python/using_qiskit_terra_level_0.py +++ b/examples/python/using_qiskit_terra_level_0.py @@ -41,7 +41,7 @@ print(BasicAer.backends()) # running the job -job_sim = execute([qc1, qc2], BasicAer.get_backend('qasm_simulator')) +job_sim = execute([qc1, qc2], BasicAer.get_backend("qasm_simulator")) sim_result = job_sim.result() # Show the results diff --git a/setup.py b/setup.py index 325f759b8e81..9fe36923de71 100755 --- a/setup.py +++ b/setup.py @@ -16,66 +16,73 @@ import re 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']) + + subprocess.call([sys.executable, "-m", "pip", "install", "Cython>=0.27.1"]) from Cython.Build import cythonize -with open('requirements.txt') as f: +with open("requirements.txt") as f: REQUIREMENTS = f.read().splitlines() # Add Cython extensions here CYTHON_EXTS = { - 'qiskit/transpiler/passes/routing/cython/stochastic_swap/utils': - 'qiskit.transpiler.passes.routing.cython.stochastic_swap.utils', - 'qiskit/transpiler/passes/routing/cython/stochastic_swap/swap_trial': - 'qiskit.transpiler.passes.routing.cython.stochastic_swap.swap_trial', - 'qiskit/quantum_info/states/cython/exp_value': - 'qiskit.quantum_info.states.cython.exp_value', + "qiskit/transpiler/passes/routing/cython/stochastic_swap/utils": ( + "qiskit.transpiler.passes.routing.cython.stochastic_swap.utils" + ), + "qiskit/transpiler/passes/routing/cython/stochastic_swap/swap_trial": ( + "qiskit.transpiler.passes.routing.cython.stochastic_swap.swap_trial" + ), + "qiskit/quantum_info/states/cython/exp_value": "qiskit.quantum_info.states.cython.exp_value", } 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): - COMPILER_FLAGS = ['/O2'] +if sys.platform == "win32" and os.environ.get("MSYSTEM") is None: + COMPILER_FLAGS = ["/O2"] # Everything else else: - COMPILER_FLAGS = ['-O2', '-funroll-loops', '-std=c++11'] - if sys.platform == 'darwin': + 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') + COMPILER_FLAGS.append("-mmacosx-version-min=10.9") + LINK_FLAGS.append("-mmacosx-version-min=10.9") EXT_MODULES = [] # Add Cython Extensions for src, module in CYTHON_EXTS.items(): - ext = Extension(module, - sources=[src + '.pyx'], - include_dirs=INCLUDE_DIRS, - extra_compile_args=COMPILER_FLAGS, - extra_link_args=LINK_FLAGS, - language='c++') + ext = Extension( + module, + sources=[src + ".pyx"], + include_dirs=INCLUDE_DIRS, + extra_compile_args=COMPILER_FLAGS, + extra_link_args=LINK_FLAGS, + language="c++", + ) EXT_MODULES.append(ext) # Read long description from README. -README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), - 'README.md') +README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md") with open(README_PATH) as readme_file: README = re.sub( - '.*', '', - readme_file.read(), flags=re.S | re.M) + ".*", + "", + readme_file.read(), + flags=re.S | re.M, + ) setup( name="qiskit-terra", version="0.18.0", description="Software for developing quantum computing programs", long_description=README, - long_description_content_type='text/markdown', + long_description_content_type="text/markdown", url="https://github.com/Qiskit/qiskit-terra", author="Qiskit Development Team", author_email="hello@qiskit.org", @@ -96,18 +103,24 @@ "Topic :: Scientific/Engineering", ], keywords="qiskit sdk quantum", - packages=find_packages(exclude=['test*']), + packages=find_packages(exclude=["test*"]), install_requires=REQUIREMENTS, - setup_requires=['Cython>=0.27.1'], + setup_requires=["Cython>=0.27.1"], include_package_data=True, python_requires=">=3.6", extras_require={ - 'visualization': ['matplotlib>=2.1', 'ipywidgets>=7.3.0', - 'pydot', "pillow>=4.2.1", "pylatexenc>=1.4", - "seaborn>=0.9.0", "pygments>=2.4"], - 'classical-function-compiler': ['tweedledum>=1.0,<2.0'], - 'full-featured-simulators': ['qiskit-aer>=0.1'], - 'crosstalk-pass': ['z3-solver>=4.7'], + "visualization": [ + "matplotlib>=2.1", + "ipywidgets>=7.3.0", + "pydot", + "pillow>=4.2.1", + "pylatexenc>=1.4", + "seaborn>=0.9.0", + "pygments>=2.4", + ], + "classical-function-compiler": ["tweedledum>=1.0,<2.0"], + "full-featured-simulators": ["qiskit-aer>=0.1"], + "crosstalk-pass": ["z3-solver>=4.7"], }, project_urls={ "Bug Tracker": "https://github.com/Qiskit/qiskit-terra/issues", @@ -115,5 +128,5 @@ "Source Code": "https://github.com/Qiskit/qiskit-terra", }, ext_modules=cythonize(EXT_MODULES), - zip_safe=False + zip_safe=False, ) diff --git a/tox.ini b/tox.ini index ffade992072b..66fd09dc1784 100644 --- a/tox.ini +++ b/tox.ini @@ -22,9 +22,9 @@ commands = envdir = .tox/lint basepython = python3 commands = - black --check {posargs} qiskit test tools + black --check {posargs} qiskit test tools examples pylint -rn qiskit test - {toxinidir}/tools/verify_headers.py qiskit test + {toxinidir}/tools/verify_headers.py qiskit test tools examples {toxinidir}/tools/find_optional_imports.py reno lint From 14114325fe9b1502dd7913cba6beab2cb95406a3 Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Mon, 21 Jun 2021 13:07:03 -0400 Subject: [PATCH 2/2] fix tox.ini and azure-pipelines.yml --- azure-pipelines.yml | 2 +- tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a9eff49dab0d..27de03ce99c8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -272,7 +272,7 @@ stages: - bash: | set -e source test-job/bin/activate - black --check qiskit test tools + black --check qiskit test tools examples setup.py pylint -rn qiskit test tools/verify_headers.py qiskit test python tools/find_optional_imports.py diff --git a/tox.ini b/tox.ini index 66fd09dc1784..953d71ba2b46 100644 --- a/tox.ini +++ b/tox.ini @@ -22,7 +22,7 @@ commands = envdir = .tox/lint basepython = python3 commands = - black --check {posargs} qiskit test tools examples + black --check {posargs} qiskit test tools examples setup.py pylint -rn qiskit test {toxinidir}/tools/verify_headers.py qiskit test tools examples {toxinidir}/tools/find_optional_imports.py @@ -30,7 +30,7 @@ commands = [testenv:black] envdir = .tox/lint -commands = black {posargs} qiskit test tools +commands = black {posargs} qiskit test tools examples setup.py [testenv:coverage] basepython = python3