-
Notifications
You must be signed in to change notification settings - Fork 92
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
Test older versions of pandas, torch #2682
Conversation
@@ -0,0 +1,2 @@ | |||
pandas==1.5.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is currently testing both of these package versions at the same time, since I don't believe they should interfere with each other. we can split them out if we want, though.
older-versions: false | ||
- os: 'ubuntu-latest' | ||
python: '3.9' | ||
older-versions: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One alternative approach would be to put the pandas / torch / other library versions here instead of in a requirements file. That would make it a bit easier to write down an explicit matrix of library combinations. You would have to have an override step for each supported library (like "Install older pandas version", "Install older torch version", etc.). It wouldn't work for the gulpfile, though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petetronic had previously mentioned that we may want to ensure that our CI tasks are easily reproducible locally, and I agree that it would be helpful to debug these when they fail on CI.
Since the current matrix is simple, I think this is fine, but if we need more flexibility we could consider using something like nox.
It lets you parametrize sessions, and creates a separate virtual environment for each set of parameters (you can opt out of using a venv with @nox.session(python=False)
. Very roughly, our noxfile would look like:
@nox.session
@nox.parametrize('pandas', ['1.5.3', 'latest'])
@nox.parametrize('torch', ['1'.12.1, 'latest'])
def tests(session, pandas, torch):
# TODO: install positron_ipykernel and its dependencies
# TODO: install base test requirements
if pandas != 'latest':
session.install(f'pandas=={pandas}')
if torch != 'latest':
session.install(f'torch=={torch}')
Then you could run nox --session tests
to run the full matrix, or nox --session "tests(pandas='1.5.3', torch='1.12.1')"
for just that case, and so on. The GitHub action could also use a matrix that passes its arguments down to a nox --session
call.
There is a noxfile from upstream too, but I'd suggest creating our own specifically for the positron_ipykernel
package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, nox seems like it might be the best of both worlds. The matrix is much easier to parse, and it would easily be put in a gulpfile. Let me see if I can get that set up, since I think it would set us up better long-term.
python -m pip install --prefer-binary --force-reinstall -r pythonFiles/positron/data-science-requirements.txt | ||
- name: Install minimum supported versions | ||
if: ${{ matrix.older-versions }} | ||
run: python -m pip install --no-deps -r pythonFiles/positron/min-supported.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does --no-deps
mean that we could end up with a pandas version as well as incompatible dependencies of pandas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was under the impression that it just did not give an error if a dependency couldn't be resolved, but it looks like it would not downgrade dependencies as we need it to. I'll use --force-reinstall
instead!
}); | ||
|
||
// run the tests | ||
await spawnAsync(pythonCommand, pytestArgs).catch((ex) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference would be to repurpose this task to only install the requirements and rename it to installMinSupportedPythonRequirements
, then change the package.json script to: gulp installMinSupportedPythonRequirements && pytest pythonFiles/positron
. Since IIUC gulp swallows any extra args but yarn passes them through, so I could e.g. do yarn testMinimumPythonReqs --pdb
to enable the pytest debugger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh cool! I didn't know that yarn passed through args. That is super useful for testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good step! I'm unsure about the --no-deps
arg and left a few other nits/thoughts.
Co-authored-by: Wasim Lorgat <[email protected]> Signed-off-by: Isabel Zimmerman <[email protected]>
Signed-off-by: Isabel Zimmerman <[email protected]>
Signed-off-by: Isabel Zimmerman <[email protected]>
|
||
|
||
@nox.session() | ||
@nox.parametrize('pandas', ['1.5.3']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sort of prefer to have the desired matrix here, and then always run in CI:
yarn positron:testMinimumPythonReqs
but we can also list latest
as a version and use
yarn positron:testMinimumPythonReqs --session "tests(torch='1.12.1', pandas='1.5.3')"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, neat to be trying out nox too! A few more nits - will let you decide whether to implement them
Co-authored-by: Wasim Lorgat <[email protected]> Signed-off-by: Isabel Zimmerman <[email protected]>
Intent
Instead of time travel, which might be erratic, specifically choose older major versions of packages to run against.
Versions of packages for which we have specific inspectors:
related to #2302 #2597
Approach
I've changed the name of the requirements file and specifically pinned older versions of packages. These are both the last release of 1.X versions.
QA Notes
You should be able to test this locally with
yarn testMinimumPythonReqs
. Note that you must use Python 3.9 or lower, since torch 1.X cannot be installed on later versions.