From 7128b273e87ffbee073dbceeaccf36d41117b1aa Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:44:29 +0000 Subject: [PATCH] Move metapackage shim for combined releases (backport #10530) (#10636) * Move metapackage shim for combined releases (#10530) * Move metapackage shim for combined releases Now that Qiskit 0.44.0 has been released, the Qiskit project is now what was formerly qiskit-terra. However, because Python packaging lacks a clean mechanism to enable one package superseding another we're not able to stop shipping a qiskit-terra package that owns the qiskit python namespace without introducing a lot of potential user friction. So moving forward the qiskit project will release 2 packages an inner qiskit-terra which still contains all the library code and public facing qiskit package which installs that inner package only. To enable this workflow this commit migrates the metapackage setup.py into the terra repository and setups build automation to publish a qiskit package in addition to the inner terra package on each release tag. * some follow up on https://github.com/Qiskit/qiskit-terra/pull/10530 (#19) * some follow up on https://github.com/Qiskit/qiskit-terra/pull/10530 * extend some badges * This Qiskit contains the building blocks for creating and working with quantum circuits, programs, and algorithms. -> This framework allows for building, transforming, and visualizing quantum circuits. * The explanation of the Bell state is moving to IBM Quantun learning platform * I think examples/ should eventually be replaced by proper tutorials * Add StackOverflow as a forum * Remove link to https://github.com/Qiskit/qiskit-tutorials * Update README.md Co-authored-by: Matthew Treinish * Update README.md * Update README.md * broken lines in badges * doi --------- Co-authored-by: Matthew Treinish * Expand lint checks to entire qiskit_pkg dir * Unify extras in terra setup.py * Update CI lint job * Remove unused json imports * Cleanup manifest file * Finish comment --------- Co-authored-by: Luciano Bello (cherry picked from commit 8a180ee8d47d84c7d000a726075d350d0141dcc5) # Conflicts: # README.md * Fix merge conflicts --------- Co-authored-by: Matthew Treinish --- .azure/lint-linux.yml | 4 +- README.md | 49 ++++++------- azure-pipelines.yml | 18 +++++ qiskit_pkg/LICENSE.txt | 1 + qiskit_pkg/MANIFEST.in | 1 + qiskit_pkg/README.md | 1 + qiskit_pkg/setup.py | 73 +++++++++++++++++++ ...-toqm-optional-extra-90e974b64ec4a3bd.yaml | 8 ++ setup.py | 7 +- tox.ini | 10 +-- 10 files changed, 134 insertions(+), 38 deletions(-) create mode 120000 qiskit_pkg/LICENSE.txt create mode 100644 qiskit_pkg/MANIFEST.in create mode 120000 qiskit_pkg/README.md create mode 100644 qiskit_pkg/setup.py create mode 100644 releasenotes/notes/remove-toqm-optional-extra-90e974b64ec4a3bd.yaml diff --git a/.azure/lint-linux.yml b/.azure/lint-linux.yml index 5b79db09ae1b..532c2072ed29 100644 --- a/.azure/lint-linux.yml +++ b/.azure/lint-linux.yml @@ -35,7 +35,7 @@ jobs: set -e source test-job/bin/activate echo "Running black, any errors reported can be fixed with 'tox -eblack'" - black --check qiskit test tools examples setup.py + black --check qiskit test tools examples setup.py qiskit_pkg echo "Running rustfmt check, any errors reported can be fixed with 'cargo fmt'" cargo fmt --check displayName: "Formatting" @@ -44,7 +44,7 @@ jobs: set -e source test-job/bin/activate echo "Running ruff" - ruff qiskit test tools examples setup.py + ruff qiskit test tools examples setup.py qiskit_pkg/setup.py echo "Running pylint" pylint -rn qiskit test tools echo "Running Cargo Clippy" diff --git a/README.md b/README.md index f88d53267771..7ab8b7fbf29d 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,26 @@ -# Qiskit Terra -[![License](https://img.shields.io/github/license/Qiskit/qiskit-terra.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)[![Release](https://img.shields.io/github/release/Qiskit/qiskit-terra.svg?style=popout-square)](https://github.com/Qiskit/qiskit-terra/releases)[![Downloads](https://img.shields.io/pypi/dm/qiskit-terra.svg?style=popout-square)](https://pypi.org/project/qiskit-terra/)[![Coverage Status](https://coveralls.io/repos/github/Qiskit/qiskit-terra/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/qiskit-terra?branch=main)[![Minimum rustc 1.61.0](https://img.shields.io/badge/rustc-1.61.0+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) +# Qiskit +[![License](https://img.shields.io/github/license/Qiskit/qiskit-terra.svg?)](https://opensource.org/licenses/Apache-2.0) +[![Release](https://img.shields.io/github/release/Qiskit/qiskit-terra.svg)](https://github.com/Qiskit/qiskit-terra/releases) +[![Downloads](https://img.shields.io/pypi/dm/qiskit-terra.svg)](https://pypi.org/project/qiskit-terra/) +[![Coverage Status](https://coveralls.io/repos/github/Qiskit/qiskit-terra/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/qiskit-terra?branch=main) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qiskit) +[![Minimum rustc 1.61.0](https://img.shields.io/badge/rustc-1.61.0+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) +[![Downloads](https://pepy.tech/badge/qiskit-terra)](https://pypi.org/project/qiskit-terra/) +[![DOI](https://zenodo.org/badge/161550823.svg)](https://zenodo.org/badge/latestdoi/161550823) **Qiskit** is an open-source framework for working with noisy quantum computers at the level of pulses, circuits, and algorithms. -This library is the core component of Qiskit, **Terra**, which contains the building blocks for creating -and working with quantum circuits, programs, and algorithms. It also contains a compiler that supports +This framework allows for building, transforming, and visualizing quantum circuits. It also contains a compiler that supports different quantum computers and a common interface for running programs on different quantum computer architectures. For more details on how to use Qiskit you can refer to the documentation located here: -https://qiskit.org/documentation/ + ## Installation -We encourage installing Qiskit via ``pip``. The following command installs the core Qiskit components, including Terra. +We encourage installing Qiskit via ``pip``: ```bash pip install qiskit @@ -24,7 +30,7 @@ Pip will handle all dependencies automatically and you will always install the l To install from source, follow the instructions in the [documentation](https://qiskit.org/documentation/contributing_to_qiskit.html#install-install-from-source-label). -## Creating Your First Quantum Program in Qiskit Terra +## Creating Your First Quantum Program in Qiskit Now that Qiskit is installed, it's time to begin working with Qiskit. To do this we create a `QuantumCircuit` object to define a basic quantum program. @@ -37,7 +43,7 @@ qc.cx(0, 1) qc.measure([0,1], [0,1]) ``` -This simple example makes an entangled state, also called a [Bell state](https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html#3.2-Entangled-States-). +This example makes an entangled state, also called a [Bell state](https://en.wikipedia.org/wiki/Bell_state). Once you've made your first quantum circuit, you can then simulate it. To do this, first we need to compile your circuit for the target backend we're going to run @@ -66,12 +72,9 @@ The output from this execution will look similar to this: {'00': 513, '11': 511} ``` -For further examples of using Qiskit you can look at the example scripts in **examples/python**. You can start with -[using_qiskit_terra_level_0.py](examples/python/using_qiskit_terra_level_0.py) and working up in the levels. Also -you can refer to the tutorials in the documentation here: - -https://qiskit.org/documentation/tutorials.html +For further examples of using Qiskit you can look at the tutorials in the documentation here: + ### Executing your code on a real quantum chip @@ -94,22 +97,18 @@ on how to get access and use these systems. ## Contribution Guidelines -If you'd like to contribute to Qiskit Terra, please take a look at our -[contribution guidelines](CONTRIBUTING.md). This project adheres to Qiskit's [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. +If you'd like to contribute to Qiskit, please take a look at our +[contribution guidelines](CONTRIBUTING.md). By participating, you are expected to uphold our [code of conduct](CODE_OF_CONDUCT.md). We use [GitHub issues](https://github.com/Qiskit/qiskit-terra/issues) for tracking requests and bugs. Please -[join the Qiskit Slack community](https://qisk.it/join-slack) -and use our [Qiskit Slack channel](https://qiskit.slack.com) for discussion and simple questions. -For questions that are more suited for a forum we use the `qiskit` tag in the [Stack Exchange](https://quantumcomputing.stackexchange.com/questions/tagged/qiskit). - -## Next Steps +[join the Qiskit Slack community](https://qisk.it/join-slack) for discussion, comments, and questions. +For questions related to running or using Qiskit, [Stack Overflow has a `qiskit`](https://stackoverflow.com/questions/tagged/qiskit). +For questions on quantum computing with Qiskit, use the `qiskit` tag in the [Quantum Computing Stack Exchange](https://quantumcomputing.stackexchange.com/questions/tagged/qiskit) (please, read first the [guidelines on how to ask](https://quantumcomputing.stackexchange.com/help/how-to-ask) in that forum). -Now you're set up and ready to check out some of the other examples from our -[Qiskit Tutorials](https://github.com/Qiskit/qiskit-tutorials) repository. ## Authors and Citation -Qiskit Terra is the work of [many people](https://github.com/Qiskit/qiskit-terra/graphs/contributors) who contribute +Qiskit is the work of [many people](https://github.com/Qiskit/qiskit-terra/graphs/contributors) who contribute to the project at different levels. If you use Qiskit, please cite as per the included [BibTeX file](CITATION.bib). ## Changelog and Release Notes @@ -118,10 +117,10 @@ The changelog for a particular release is dynamically generated and gets written to the release page on Github for each release. For example, you can find the page for the `0.9.0` release here: -https://github.com/Qiskit/qiskit-terra/releases/tag/0.9.0 + The changelog for the current release can be found in the releases tab: -[![Releases](https://img.shields.io/github/release/Qiskit/qiskit-terra.svg?style=popout-square)](https://github.com/Qiskit/qiskit-terra/releases) +[![Releases](https://img.shields.io/github/release/Qiskit/qiskit-terra.svg?style=flat&label=)](https://github.com/Qiskit/qiskit-terra/releases) The changelog provides a quick overview of notable changes for a given release. diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2f04ae2e2ef8..fab49e8bfae1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -277,3 +277,21 @@ stages: env: TWINE_USERNAME: "qiskit" TWINE_PASSWORD: $(TWINE_PASSWORD) + - job: 'qiskit-pkg' + pool: {vmImage: 'ubuntu-latest'} + steps: + - task: UsePythonVersion@0 + - bash: | + set -e + python -m pip install --upgrade pip build + cd qiskit_pkg + python -m build . + - task: PublishBuildArtifacts@1 + inputs: {pathtoPublish: 'dist'} + condition: succeededOrFailed() + - bash: | + python -m pip install --upgrade twine + twine upload dist/* + env: + TWINE_USERNAME: "qiskit" + TWINE_PASSWORD: $(TWINE_PASSWORD) diff --git a/qiskit_pkg/LICENSE.txt b/qiskit_pkg/LICENSE.txt new file mode 120000 index 000000000000..4ab43736a839 --- /dev/null +++ b/qiskit_pkg/LICENSE.txt @@ -0,0 +1 @@ +../LICENSE.txt \ No newline at end of file diff --git a/qiskit_pkg/MANIFEST.in b/qiskit_pkg/MANIFEST.in new file mode 100644 index 000000000000..42eb4101e514 --- /dev/null +++ b/qiskit_pkg/MANIFEST.in @@ -0,0 +1 @@ +include LICENSE.txt diff --git a/qiskit_pkg/README.md b/qiskit_pkg/README.md new file mode 120000 index 000000000000..32d46ee883b5 --- /dev/null +++ b/qiskit_pkg/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/qiskit_pkg/setup.py b/qiskit_pkg/setup.py new file mode 100644 index 000000000000..3db3aa707fd5 --- /dev/null +++ b/qiskit_pkg/setup.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +# This code is part of Qiskit. +# +# (C) Copyright IBM 2018. +# +# 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. + +# This file is the setup.py file for the qiskit package. Because python +# packaging doesn't offer a mechanism to have qiskit supersede qiskit-terra +# and cleanly upgrade from one to the other, there needs to be a separate +# package shim to ensure no matter how people installed qiskit < 0.45.0 the +# upgrade works. + +import os + +from setuptools import setup + +README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md") +with open(README_PATH) as readme_file: + README = readme_file.read() + +requirements = ["qiskit-terra==0.45.0"] + +setup( + name="qiskit", + version="0.45.0", + description="Software for developing quantum computing programs", + long_description=README, + long_description_content_type="text/markdown", + url="https://qiskit.org/", + author="Qiskit Development Team", + author_email="hello@qiskit.org", + license="Apache 2.0", + py_modules=[], + packages=[], + 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.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", + ], + keywords="qiskit sdk quantum", + install_requires=requirements, + project_urls={ + "Bug Tracker": "https://github.com/Qiskit/qiskit/issues", + "Documentation": "https://qiskit.org/documentation/", + "Source Code": "https://github.com/Qiskit/qiskit", + }, + include_package_data=True, + python_requires=">=3.8", + extras_require={ + "qasm3-import": ["qiskit-terra[qasm3-import]"], + "visualization": ["qiskit-terra[visualization]"], + "crosstalk-pass": ["qiskit-terra[crosstalk-pass]"], + "csp-layout-pass": ["qiskit-terra[csp-layout-pass]"], + "all": ["qiskit-terra[all]"], + }, +) diff --git a/releasenotes/notes/remove-toqm-optional-extra-90e974b64ec4a3bd.yaml b/releasenotes/notes/remove-toqm-optional-extra-90e974b64ec4a3bd.yaml new file mode 100644 index 000000000000..3bc6411d73c7 --- /dev/null +++ b/releasenotes/notes/remove-toqm-optional-extra-90e974b64ec4a3bd.yaml @@ -0,0 +1,8 @@ +--- +upgrade: + - | + The ``toqm`` optional setuptools extra that previously enabled running + ``pip install qiskit-terra[topm]`` has been removed as nothing in the + Qiskit code base is currently using that package anymore. If you'd like + to use the qiskit TOQM transpiler plugin you should install the + ``qiskit-toqm`` package directly. diff --git a/setup.py b/setup.py index 92bb16a90e3e..a295f70b3b99 100644 --- a/setup.py +++ b/setup.py @@ -52,9 +52,8 @@ z3_requirements = [ "z3-solver>=4.7", ] -bip_requirements = ["cplex", "docplex"] csp_requirements = ["python-constraint>=1.4"] -toqm_requirements = ["qiskit-toqm>=0.1.0"] + setup( name="qiskit-terra", @@ -89,12 +88,8 @@ extras_require={ "qasm3-import": qasm3_import_extras, "visualization": visualization_extras, - "bip-mapper": bip_requirements, "crosstalk-pass": z3_requirements, "csp-layout-pass": csp_requirements, - "toqm": toqm_requirements, - # Note: 'all' only includes extras that are stable and work on the majority of Python - # versions and OSes supported by Terra. You have to ask for anything else explicitly. "all": visualization_extras + z3_requirements + csp_requirements + qasm3_import_extras, }, project_urls={ diff --git a/tox.ini b/tox.ini index d62dcc9fa6cc..37059659becd 100644 --- a/tox.ini +++ b/tox.ini @@ -24,8 +24,8 @@ commands = [testenv:lint] basepython = python3 commands = - ruff check qiskit test tools examples setup.py - black --check {posargs} qiskit test tools examples setup.py + ruff check qiskit test tools examples setup.py qiskit_pkg + black --check {posargs} qiskit test tools examples setup.py qiskit_pkg pylint -rn qiskit test tools # This line is commented out until #6649 merges. We can't run this currently # via tox because tox doesn't support globbing @@ -39,8 +39,8 @@ commands = basepython = python3 allowlist_externals = git commands = - ruff check qiskit test tools examples setup.py - black --check {posargs} qiskit test tools examples setup.py + ruff check qiskit test tools examples setup.py qiskit_pkg + black --check {posargs} qiskit test tools examples setup.py qiskit_pkg -git fetch -q https://github.com/Qiskit/qiskit-terra.git :lint_incr_latest python {toxinidir}/tools/pylint_incr.py -rn -j4 -sn --paths :/qiskit/*.py :/test/*.py :/tools/*.py python {toxinidir}/tools/pylint_incr.py -rn -j4 -sn --disable='invalid-name,missing-module-docstring,redefined-outer-name' --paths :(glob,top)examples/python/*.py @@ -50,7 +50,7 @@ commands = reno lint [testenv:black] -commands = black {posargs} qiskit test tools examples setup.py +commands = black {posargs} qiskit test tools examples setup.py qiskit_pkg [testenv:coverage] basepython = python3