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

Ensure metapackage is installed during CI and tox #11119

Merged
merged 5 commits into from
Nov 15, 2023

Conversation

jakelishman
Copy link
Member

Summary

This ensures that the local version of the metapackage is also built and installed on all CI runs (and in tox, where it's overridden) so that dependencies on the metapackage in our optionals (e.g. Aer) will not cause the older released version of Terra to be installed.

tox does not like having two local packages under test simultaneously through its default configuration, so this fakes things out by putting the two packages in the run dependencies and setting skip_install.

Details and comments

This should (hopefully) get CI moving again. The necessary changes to tox are indicative of larger developer (but not user) pain, though - installing any downstream Qiskit project on top of an editable install of Terra is liable to reinstall the current release version of Terra via a pin from the qiskit metapackage. To work around this, developers should ensure that they have done pip install ./qiskit_pkg in their dev env, and they may need to rerun that when Terra bumps its version number (editable mode won't affect pip's version resolution).

@jakelishman jakelishman added type: qa Issues and PRs that relate to testing and code quality stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: None Do not include in changelog labels Oct 26, 2023
@jakelishman jakelishman requested a review from a team as a code owner October 26, 2023 16:01
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

This ensures that the local version of the metapackage is also built and
installed on all CI runs (and in `tox`, where it's overridden) so that
dependencies on the metapackage in our optionals (e.g. Aer) will not
cause the older released version of Terra to be installed.

`tox` does not like having two local packages under test simultaneously
through its default configuration, so this fakes things out by putting
the two packages in the run dependencies and setting `skip_install`.
@jakelishman jakelishman force-pushed the fix-ci-aer-requirements branch from 57abe30 to 592c8bc Compare October 26, 2023 17:19
@jakelishman
Copy link
Member Author

I think I got all the relevant locations with this PR, but it's a bit hard to be sure.

.azure/test-linux.yml Outdated Show resolved Hide resolved
.azure/test-linux.yml Outdated Show resolved Hide resolved
@jakelishman
Copy link
Member Author

This PR is now a necessary step on the way to fixing #11240. I can't release a new version of qiskit-qasm3-import with the dependency fixed until this PR is merged, otherwise it'll take down Terra's CI for the same reason Aer 0.13 did. However, I can't put up a PR fixing #11240 without fixing the dependencies of qiskit-qasm3-import, since at the moment it's still depending on qiskit-terra, and removing that package would then cause CI resolution to fail.

The order needs to be:

  • merge this PR
  • release fixed qiskit-qasm3-import
  • remove qiskit-terra package

.azure/lint-linux.yml Outdated Show resolved Hide resolved
.azure/test-linux.yml Outdated Show resolved Hide resolved
# 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
Copy link
Member

Choose a reason for hiding this comment

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

I"m a bit concerned about this, I seem to remember skip_install causing weird behavior in tox >4.0.0, I think with regards to tracking source updates or something, I don't fully remember but I know it caused issues for me on the upgrade to 4.0.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm open to other ideas here, this is just the only thing I could think of to trick tox into letting us put two local packages under test at the same time. I'm moving ever further into the "let's ditch tox" camp.

@jakelishman jakelishman force-pushed the fix-ci-aer-requirements branch from c322d16 to 1dae6a2 Compare November 15, 2023 12:17
@coveralls
Copy link

Pull Request Test Coverage Report for Build 6877155276

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.002%) to 85.917%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 93.76%
crates/qasm2/src/lex.rs 5 91.92%
Totals Coverage Status
Change from base Build 6870747806: -0.002%
Covered Lines: 65953
Relevant Lines: 76764

💛 - Coveralls

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This LGTM, I'm a bit cautious about the tox config but I tested it locally and it seems to work fine. There will probably be some complexity around builds not getting re-triggered correctly because tox isn't tracking things the same way having qiskit in the requirements list, but I'm not sure that mechanism is working correctly without this change either though because of the rust/python split. I think we definitely should look at moving away from tox in parallel to this though. Something like nox will give us more flexibility.

@mtreinish mtreinish added this pull request to the merge queue Nov 15, 2023
Merged via the queue into Qiskit:main with commit f7f6cb1 Nov 15, 2023
14 checks passed
mergify bot pushed a commit that referenced this pull request Nov 15, 2023
* Ensure metapackage is installed during CI and tox

This ensures that the local version of the metapackage is also built and
installed on all CI runs (and in `tox`, where it's overridden) so that
dependencies on the metapackage in our optionals (e.g. Aer) will not
cause the older released version of Terra to be installed.

`tox` does not like having two local packages under test simultaneously
through its default configuration, so this fakes things out by putting
the two packages in the run dependencies and setting `skip_install`.

* Fix sdist build

* Use regular installs for metapackage

* Simplify build requirements install

(cherry picked from commit f7f6cb1)
@jakelishman jakelishman deleted the fix-ci-aer-requirements branch November 15, 2023 16:08
github-merge-queue bot pushed a commit that referenced this pull request Nov 15, 2023
* Ensure metapackage is installed during CI and tox

This ensures that the local version of the metapackage is also built and
installed on all CI runs (and in `tox`, where it's overridden) so that
dependencies on the metapackage in our optionals (e.g. Aer) will not
cause the older released version of Terra to be installed.

`tox` does not like having two local packages under test simultaneously
through its default configuration, so this fakes things out by putting
the two packages in the run dependencies and setting `skip_install`.

* Fix sdist build

* Use regular installs for metapackage

* Simplify build requirements install

(cherry picked from commit f7f6cb1)

Co-authored-by: Jake Lishman <[email protected]>
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Dec 7, 2023
In Qiskit#11119 we removed the use_develop flag in the tox config which was
used to tell tox to use a single editable install for running a job
(avoiding the need to build from sdist on every run) as part of a
temporary refactoring to ensure we installed the metapackage along with
terra. Now that we've standardized the packaging in Qiskit#11271 that was
undone, but the usedevelop flag was not added back. This has caused tox
to rebuild the package from sdist on every run even if there are no code
changes. This commit restores the missing option to fix this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog stable backport potential The bug might be minimal and/or import enough to be port to stable type: qa Issues and PRs that relate to testing and code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants