Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace qiskit metapackage with qiskit-terra #11271

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .azure/lint-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
Expand All @@ -38,7 +37,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 qiskit_pkg
black --check qiskit test tools examples setup.py
echo "Running rustfmt check, any errors reported can be fixed with 'cargo fmt'"
cargo fmt --check
displayName: "Formatting"
Expand All @@ -47,7 +46,7 @@ jobs:
set -e
source test-job/bin/activate
echo "Running ruff"
ruff qiskit test tools examples setup.py qiskit_pkg/setup.py
ruff qiskit test tools examples setup.py
echo "Running pylint"
pylint -rn qiskit test tools
echo "Running Cargo Clippy"
Expand Down
4 changes: 1 addition & 3 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ jobs:
python -m pip install -U pip
python -m pip install -U build
python -m build --sdist .
python -m build --sdist qiskit_pkg
python -m pip install -U \
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
dist/qiskit*.tar.gz
dist/qiskit-*.tar.gz
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
displayName: "Install Terra from sdist"
Expand All @@ -92,7 +91,6 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
Expand Down
1 change: 0 additions & 1 deletion .azure/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
Expand Down
1 change: 0 additions & 1 deletion .azure/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
-c constraints.txt \
-r requirements.txt \
-r requirements-dev.txt \
./qiskit_pkg \
-e .
# Build and install both qiskit and qiskit-terra so that any optionals
# depending on `qiskit` will resolve correctly.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: python -m pip install -c constraints.txt --upgrade pip setuptools wheel

- name: Build and install qiskit-terra
run: python -m pip install -c constraints.txt -e . ./qiskit_pkg
run: python -m pip install -c constraints.txt -e .
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Cinstrument-coverage"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/neko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ jobs:
- uses: Qiskit/qiskit-neko@main
with:
test_selection: terra
repo_install_command: "pip install -c constraints.txt ."
# We have to forcibly uninstall any old version of qiskit or qiskit-terra during the
# changeover, because it's not possible to safely upgrade an existing installation to 1.0.
repo_install_command: "pip uninstall qiskit qiskit-terra && pip install -c constraints.txt ."
2 changes: 1 addition & 1 deletion .github/workflows/slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements.txt -c constraints.txt
python -m pip install -U -r requirements-dev.txt -c constraints.txt
python -m pip install -c constraints.txt -e . ./qiskit_pkg
python -m pip install -c constraints.txt -e .
python -m pip install "qiskit-aer" "z3-solver" "cplex" -c constraints.txt
env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
Expand Down
30 changes: 1 addition & 29 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
with:
packages-dir: wheelhouse/
sdist:
name: Build and publish terra sdist
name: Build and publish sdist
runs-on: ${{ matrix.os }}
needs: ["upload_shared_wheels"]
environment: release
Expand All @@ -190,31 +190,3 @@ jobs:
run: python -m build . --sdist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
metapackage:
name: Build and publish terra sdist
runs-on: ${{ matrix.os }}
needs: ["sdist"]
environment: release
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'
- name: Install deps
run: pip install -U build
- name: Build packages
run: |
set -e
cd qiskit_pkg
python -m build .
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: qiskit_pkg/dist
1 change: 0 additions & 1 deletion qiskit_pkg/LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion qiskit_pkg/MANIFEST.in

This file was deleted.

1 change: 0 additions & 1 deletion qiskit_pkg/README.md

This file was deleted.

74 changes: 0 additions & 74 deletions qiskit_pkg/setup.py

This file was deleted.

29 changes: 29 additions & 0 deletions releasenotes/notes/terra-nullius-7ef598626d8118c1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
critical:
- |
You cannot upgrade in place to Qiskit 1.0. You must begin a new virtual environment.

From Qiskit 1.0, Qiskit is comprised of exactly one Python package: ``qiskit``. Previously,
as a legacy of the "component elements" of early Qiskit, the ``qiskit`` package was a
dependency-only "metapackage", and the core code of Qiskit was in a package called ``qiskit-terra``.
As Qiskit grew, the other elements split off into their own packages (such as ``qiskit-aer``)
until only the core was left in the metapackage. For Qiskit 1.0, we are removing the metapackage
entirely, and replacing it with the actual Qiskit code.

This means that you cannot upgrade an existing installation to Qiskit 1.0. Instead, you must
create a new Python virtual environment. Using the built-in ``venv`` module, you can do (Linux
and Mac):

.. code-block:: bash

# Create the new environment (only once).
python -m venv ~/qiskit-1.0-venv
# Activate the environment (every session).
source ~/qiskit-1.0-venv/bin/activate
# Install Qiskit (only once).
pip install 'qiskit>=1.0'

On Windows, replace ``source <venv>/bin/activate`` with ``source <venv>/Scripts/activate``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On Windows, replace ``source <venv>/bin/activate`` with ``source <venv>/Scripts/activate``.
On Windows, replace ``source <venv>/bin/activate`` with ``source <venv>\Scripts\activate``.

Although I guess it really depends on which windows shell you're using it'd be <venv>\Scripts\activate.bat if you're using cmd.exe or PS <venv>\Scripts\Activate.ps1 if you're using powershell. This would work if you're using bash on windows I guess though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true, I forgot people used things other than bash-likes. Shall we do something more here? I'm not sure what to write without going too overboard - I don't really know how most Windows users interact with venv.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I'm debugging something on windows personally I either do it via git bash (so what you had would work) or via cmd.exe and call the activate.bat file. It often depends on what I'm debugging as either shell might be needed to reproduce an issue if it involves output or default character encoding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it might be better to refer to the stdlib python docs here https://docs.python.org/3/library/venv.html#how-venvs-work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea - done in 6f5b066.


If you are a library author, or have code that depends on Qiskit, you should update any old
dependencies on ``qiskit-terra`` to instead depend on ``qiskit``.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@


setup(
name="qiskit-terra",
name="qiskit",
version="1.0.0",
description="Software for developing quantum computing programs",
long_description=README,
Expand Down
5 changes: 3 additions & 2 deletions tools/deploy_translatable_strings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ rm -rf \
echo "+ 'cp' wanted files from source to target"
# Copy the new rendered files and add them to the commit.
cp -r "$SOURCE_PO_DIR/." "$TARGET_PO_DIR"
# Copy files necessary to build the Qiskit metapackage.
cp "$SOURCE_REPO_ROOT/qiskit_pkg/setup.py" "${TARGET_REPO_ROOT}"
# Copy files necessary to build the Qiskit package.
cp "$SOURCE_REPO_ROOT/setup.py" "${TARGET_REPO_ROOT}"
cp "$SOURCE_REPO_ROOT/pyproject.toml" "${TARGET_REPO_ROOT}"
cat "$SOURCE_REPO_ROOT/requirements-dev.txt" "$SOURCE_REPO_ROOT/requirements-optional.txt" \
> "${TARGET_REPO_ROOT}/requirements-dev.txt"
cp "$SOURCE_REPO_ROOT/constraints.txt" "${TARGET_REPO_ROOT}"
Expand Down
16 changes: 5 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ envlist = py38, py39, py310, py311, py312, lint-incr
isolated_build = true

[testenv]
# We pretend that we're not actually installing the package, because we need tox to let us have two
# packages ('qiskit' and 'qiskit-terra') under test at the same time. For that, we have to stuff
# them into 'deps'.
skip_install = true
install_command = pip install -c{toxinidir}/constraints.txt -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
Expand All @@ -22,16 +18,14 @@ deps =
setuptools_rust # This is work around for the bug of tox 3 (see #8606 for more details.)
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-dev.txt
-e .
-e ./qiskit_pkg
commands =
stestr run {posargs}

[testenv:lint]
basepython = python3
commands =
ruff check qiskit test tools examples setup.py qiskit_pkg
black --check {posargs} qiskit test tools examples setup.py qiskit_pkg
ruff check qiskit test tools examples setup.py
black --check {posargs} qiskit test tools examples setup.py
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
Expand All @@ -45,8 +39,8 @@ commands =
basepython = python3
allowlist_externals = git
commands =
ruff check qiskit test tools examples setup.py qiskit_pkg
black --check {posargs} qiskit test tools examples setup.py qiskit_pkg
ruff check qiskit test tools examples setup.py
black --check {posargs} qiskit test tools examples setup.py
-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
Expand All @@ -59,7 +53,7 @@ commands =
skip_install = true
deps =
-r requirements-dev.txt
commands = black {posargs} qiskit test tools examples setup.py qiskit_pkg
commands = black {posargs} qiskit test tools examples setup.py

[testenv:coverage]
basepython = python3
Expand Down
Loading