From 5b253a254a70fbde97beca19b6e4ba416d966dee Mon Sep 17 00:00:00 2001 From: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:27:40 -0400 Subject: [PATCH] Test older versions of pandas, torch (#2682) * test pandas, torch 1.X * add yarn command testMinimumPythonReqs * use torch 1.12 to avoid libcublas errors * update jobs * Update extensions/positron-python/package.json Co-authored-by: Wasim Lorgat Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> * try out noxfile * install nox into ci * rearrange nox call * split into own action * vendor * only run 1x rather than 4x * Delete min-supported.txt Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> * min matrix * Update .github/workflows/positron-python-ci.yml Co-authored-by: Wasim Lorgat Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> * updates from review --------- Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> Co-authored-by: Wasim Lorgat --- .github/workflows/positron-python-ci.yml | 54 +++++++++---------- .../positron-python/noxfile-positron.py | 22 ++++++++ extensions/positron-python/package.json | 11 ++-- .../positron/data-science-requirements.txt | 7 --- 4 files changed, 54 insertions(+), 40 deletions(-) create mode 100644 extensions/positron-python/noxfile-positron.py delete mode 100644 extensions/positron-python/python_files/positron/data-science-requirements.txt diff --git a/.github/workflows/positron-python-ci.yml b/.github/workflows/positron-python-ci.yml index f077fbc4e23..a39a4cd617a 100644 --- a/.github/workflows/positron-python-ci.yml +++ b/.github/workflows/positron-python-ci.yml @@ -180,31 +180,14 @@ jobs: include: - os: 'ubuntu-latest' python: '3.8' - time-elapsed: '' - os: 'macos-latest' python: '3.9' - time-elapsed: '' - os: 'windows-latest' python: '3.10' - time-elapsed: '' - os: 'ubuntu-latest' python: '3.11' - time-elapsed: '' - os: 'ubuntu-latest' python: '3.12' - time-elapsed: '' - # - os: 'ubuntu-latest' - # python: '3.10' - # time-elapsed: '3 months' - # - os: 'ubuntu-latest' - # python: '3.10' - # time-elapsed: '6 months' - # - os: 'ubuntu-latest' - # python: '3.10' - # time-elapsed: '9 months' - # - os: 'ubuntu-latest' - # python: '3.10' - # time-elapsed: '1 year' steps: - name: Checkout @@ -222,20 +205,35 @@ jobs: - name: Install Positron IPyKernel test requirements run: python -m pip install --prefer-binary --upgrade -r python_files/positron/pinned-test-requirements.txt - - name: Get date for older dependencies - if: ${{ matrix.time-elapsed != '' }} - run: | - echo "SNAPSHOT_DATE=$(date -d '-${{ matrix.time-elapsed }}' --iso-8601)" >> $GITHUB_ENV + - name: Run Positron IPyKernel unit tests + run: pytest python_files/positron + + python-minimum-dependencies: + name: Test Minimum Positron IPyKernel Dependencies + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + # currently only running on oldest supported Python version + - os: 'ubuntu-latest' + python: '3.8' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python ${{ matrix.python }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + cache: 'pip' - - name: Get older PyPI snapshot - if: ${{ matrix.time-elapsed != '' }} + - name: Install testing requirements run: | - python -m pip config set global.index-url https://packagemanager.posit.co/pypi/${{ env.SNAPSHOT_DATE }}/simple - python -m pip config set global.trusted-host packagemanager.posit.co - python -m pip install --prefer-binary --force-reinstall -r python_files/positron/data-science-requirements.txt + python scripts/vendor.py + python -m pip install nox - - name: Run Positron IPyKernel unit tests - run: pytest python_files/positron + - name: Run tests + run: yarn positron:testMinimumPythonReqs typescript-tests: name: Test TypeScript diff --git a/extensions/positron-python/noxfile-positron.py b/extensions/positron-python/noxfile-positron.py new file mode 100644 index 00000000000..02fc1bf09cb --- /dev/null +++ b/extensions/positron-python/noxfile-positron.py @@ -0,0 +1,22 @@ +# +# Copyright (C) 2024 Posit Software, PBC. All rights reserved. +# + + +import nox + + +@nox.session() +@nox.parametrize('pandas', ['1.5.3']) +@nox.parametrize('torch', ['1.12.1']) +def test_minimum_reqs(session, pandas, torch): + session.install("-r", "python_files/positron/pinned-test-requirements.txt") + session.install('--force-reinstall', f'pandas=={pandas}') + session.install('--force-reinstall', f'torch=={torch}') + + if session.posargs: + test_args = session.posargs + else: + test_args = [] + + session.run('pytest', *test_args) diff --git a/extensions/positron-python/package.json b/extensions/positron-python/package.json index 90f6d39b896..a2da4e1a71e 100644 --- a/extensions/positron-python/package.json +++ b/extensions/positron-python/package.json @@ -1265,10 +1265,10 @@ ], "menus": { "issue/reporter": [ - { - "command": "python.reportIssue" - } - ], + { + "command": "python.reportIssue" + } + ], "commandPalette": [ { "category": "Python", @@ -1613,7 +1613,8 @@ "addExtensionPackDependencies": "gulp addExtensionPackDependencies", "updateBuildNumber": "gulp updateBuildNumber", "verifyBundle": "gulp verifyBundle", - "webpack": "webpack" + "webpack": "webpack", + "positron:testMinimumPythonReqs": "nox --noxfile noxfile-positron.py -- python_files/positron" }, "dependencies": { "@iarna/toml": "^2.2.5", diff --git a/extensions/positron-python/python_files/positron/data-science-requirements.txt b/extensions/positron-python/python_files/positron/data-science-requirements.txt deleted file mode 100644 index cad010f85b6..00000000000 --- a/extensions/positron-python/python_files/positron/data-science-requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -pandas -polars -matplotlib -numpy -torch -fastapi -sqlalchemy