Skip to content

CI Testing Matrix #237

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

Merged
merged 4 commits into from
Dec 7, 2021
Merged

CI Testing Matrix #237

merged 4 commits into from
Dec 7, 2021

Conversation

mpharrigan
Copy link
Collaborator

@mpharrigan mpharrigan commented Dec 4, 2021

Problem overview

We depend on openfermion, pytket, and pytket-cirq; which have historically been over-pinned to a particular cirq version. "Overpinned" means that even if it seems to work with a newer (or older!) cirq version, the install_requires still specifies one version. pip has recently (past year) learned to be strict about satisfying requirements. pip will end up in an infinite loop downloading old versions instead of saying which package is causing a version deadlock

As a developer, I can get things to work by installing dependencies myself and then pip install --no-deps openfermion, cirq, pytket, or recirq so pip can't get in my way.

However, one important use case is supporting colab which must have a simple install script; hopefully just pip install recirq (or, specifically, the git url).

Openfermion relaxation

Cirq has been generally stable across the past couple of releases, especially if one were to go through and fix deprecation warnings. Indeed, I have changed openfermion quantumlib/OpenFermion#755 to not pin in install_requires but to use the CI to test against multiple versions of Cirq.

Towards relaxing ReCirq

This PR aims to head towards the same goal. We test against the previous, current, and next version of Cirq. Testing against the next version of Cirq is particularly important when committing code that depends on unreleased Cirq features. The trick is to attempt the full matrix of versions, and lean heavily on pytest.mark.skipif to make sure tests only run under supported configurations.

In particular, we introduce a script to capture the intricacies of the various test configurations: write-ci-requirements.txt. This lets us pin to a particular cirq version during CI testing but not in install_requires, which we change to a lower bound.

This script has several notable features

  • translate fixed "relative" versions like current, previous, and next to numeric, pypi ones. Otherwise, the numeric versions from the CI matrix will show up in the job names. We want to set the "required checks" setting on GitHub without having it rely on the current cirq versions, which will change over time
  • Hacky pytket logic: don't test the pytket functionality on the next cirq version.

Cirq 0.13

This fixes #224 because pytket and openfermion have compatible versions now.

Cirq 0.14

We'll now be in the regime where we need to fix ReCirq for the next Cirq version before it is released. As such, this PR is based off of #241 .

Per-package testing

This still tests the whole ReCirq repository at once. We can modify write-ci-requirements.py to help simplify a new matrix job that tests each subpackage in isolation. skipif may be a large component to that as well.

@mpharrigan
Copy link
Collaborator Author

rebased off of #241

Change-Id: Ie459837e01de2283a59a89a5d1804d33d954c653
Change-Id: I46059d89717c8eca89b427576264f6d060179c9d
Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

Cool! One step towards a better ecosystem!

'previous': '==0.12.0',
'current': '==0.13.0',
'next': '>=0.14.0.dev',
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we put a note in the requirements.txt file so that people know to go and update this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea, done

from pytket.predicates import CompilationUnit, ConnectivityPredicate
from pytket.routing import GraphPlacement

try:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a quick comment here to explain that this is here for CI tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added:

    # Set the 'RECIRQ_IGNORE_PYTKET' environment variable to treat PyTket as an optional
    # dependency. We do this for CI testing against the next, pre-release Cirq version.

(in general, users could also set this environment variable if they get themselves into hot water managing the pytket dependency)

Change-Id: I1fde0b2d8d621bfcd1c43f503c4b87b8df789c58
Change-Id: I76f5ef0e1c6401760aeb61412dd846b1e10a0fc9
@mpharrigan
Copy link
Collaborator Author

I modified the master branch protection rules to use the new test names. I also added the notebook formatting test, which was never a required test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to Cirq 0.13
2 participants