diff --git a/.azure/lint-linux.yml b/.azure/lint-linux.yml index 532c2072ed29..692b8d5d695b 100644 --- a/.azure/lint-linux.yml +++ b/.azure/lint-linux.yml @@ -26,7 +26,10 @@ jobs: -c constraints.txt \ -r requirements.txt \ -r requirements-dev.txt \ + -e ./qiskit_pkg \ -e . + # Build and install both qiskit and qiskit-terra so that any optionals + # depending on `qiskit` will resolve correctly. displayName: 'Install dependencies' env: SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" diff --git a/.azure/test-linux.yml b/.azure/test-linux.yml index c97d4f693975..4d8d90834319 100644 --- a/.azure/test-linux.yml +++ b/.azure/test-linux.yml @@ -70,15 +70,18 @@ jobs: # Use stable Rust, rather than MSRV, to spot-check that stable builds properly. rustup override set stable source test-job/bin/activate - python -m pip install -U pip setuptools wheel + python -m pip install -U pip setuptools wheel build # Install setuptools-rust for building sdist python -m pip install -U -c constraints.txt setuptools-rust - python setup.py sdist + python build --sdist . + python build --sdist qiskit_pkg python -m pip install -U \ -c constraints.txt \ -r requirements.txt \ -r requirements-dev.txt \ - dist/qiskit-terra*.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" - ${{ if eq(parameters.installFromSdist, false) }}: @@ -89,7 +92,10 @@ jobs: -c constraints.txt \ -r requirements.txt \ -r requirements-dev.txt \ + -e ./qiskit_pkg \ -e . + # Build and install both qiskit and qiskit-terra so that any optionals + # depending on `qiskit` will resolve correctly. displayName: "Install Terra directly" env: SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" diff --git a/.azure/test-macos.yml b/.azure/test-macos.yml index 2b195afbdae3..0db06d818bdc 100644 --- a/.azure/test-macos.yml +++ b/.azure/test-macos.yml @@ -43,7 +43,10 @@ jobs: -c constraints.txt \ -r requirements.txt \ -r requirements-dev.txt \ + -e ./qiskit_pkg \ -e . + # Build and install both qiskit and qiskit-terra so that any optionals + # depending on `qiskit` will resolve correctly. pip check displayName: 'Install dependencies' env: diff --git a/.azure/test-windows.yml b/.azure/test-windows.yml index 30591a5dadbe..8a5bcab70708 100644 --- a/.azure/test-windows.yml +++ b/.azure/test-windows.yml @@ -42,7 +42,10 @@ jobs: -c constraints.txt \ -r requirements.txt \ -r requirements-dev.txt \ + -e ./qiskit_pkg \ -e . + # Build and install both qiskit and qiskit-terra so that any optionals + # depending on `qiskit` will resolve correctly. pip check displayName: 'Install dependencies' env: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index de3485c5fdce..454abb2323dc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 . + run: python -m pip install -c constraints.txt -e . -e ./qiskit_pkg env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-Cinstrument-coverage" diff --git a/.github/workflows/slow.yml b/.github/workflows/slow.yml index 62fa9ec19c62..2805cb79244b 100644 --- a/.github/workflows/slow.yml +++ b/.github/workflows/slow.yml @@ -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 . + python -m pip install -c constraints.txt -e . -e ./qiskit_pkg python -m pip install "qiskit-aer" "z3-solver" "cplex" -c constraints.txt env: SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" diff --git a/tox.ini b/tox.ini index fa6d1017d3e2..0c799d28ba9a 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,10 @@ envlist = py38, py39, py310, py311, lint-incr isolated_build = true [testenv] -usedevelop = True +# 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} @@ -15,9 +18,12 @@ setenv = QISKIT_TEST_CAPTURE_STREAMS=1 QISKIT_PARALLEL=FALSE passenv = RAYON_NUM_THREADS, OMP_NUM_THREADS, QISKIT_PARALLEL, RUST_BACKTRACE, SETUPTOOLS_ENABLE_FEATURES, QISKIT_TESTS, QISKIT_IN_PARALLEL -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 +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} @@ -50,6 +56,9 @@ commands = reno lint [testenv:black] +skip_install = true +deps = + -r requirements-dev.txt commands = black {posargs} qiskit test tools examples setup.py qiskit_pkg [testenv:coverage] @@ -57,17 +66,15 @@ basepython = python3 setenv = {[testenv]setenv} PYTHON=coverage3 run --source qiskit --parallel-mode -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/requirements-dev.txt - -r{toxinidir}/requirements-optional.txt +deps = + {[testenv]deps} + -r{toxinidir}/requirements-optional.txt commands = stestr run {posargs} coverage3 combine coverage3 report [testenv:docs] -# Editable mode breaks macOS: https://github.com/sphinx-doc/sphinx/issues/10943 -usedevelop = False basepython = python3 setenv = {[testenv]setenv} @@ -75,15 +82,9 @@ setenv = RUST_DEBUG=1 # Faster to compile. passenv = {[testenv]passenv}, QISKIT_DOCS_BUILD_TUTORIALS, QISKIT_CELL_TIMEOUT, DOCS_PROD_BUILD deps = - setuptools_rust # This is work around for the bug of tox 3 (see #8606 for more details.) - -r{toxinidir}/requirements-dev.txt + {[testenv]deps} -r{toxinidir}/requirements-optional.txt -r{toxinidir}/requirements-tutorials.txt - # Some optionals depend on Terra. We want to make sure pip satisfies that requirement from a local - # installation, not from PyPI. But Tox normally doesn't install the local installation until - # after `deps` is installed. So, instead, we tell pip to do the local installation at the same - # time as the optionals. See https://github.com/Qiskit/qiskit-terra/pull/9477. - . commands = sphinx-build -W -j auto -T --keep-going -b html docs/ docs/_build/html {posargs}