From 8ecff81c9d4a5619e79f297ca34a69e8b577dd27 Mon Sep 17 00:00:00 2001 From: Qin Yu Date: Tue, 24 Feb 2026 21:12:41 +0000 Subject: [PATCH 1/2] ci: configure tox to pass environment variables for PyTorch tox's isolated environment blocks `USERNAME` by default, causing PyTorch's `torch._inductor` to fail during import when it calls `getpass.getuser()` for cache directory setup. Pass through username and temp directory variables, and set `TORCHINDUCTOR_CACHE_DIR` explicitly to avoid the getpass call. Fixes Windows Python 3.10/3.11 test failures. --- .github/workflows/test_and_deploy.yml | 14 ++++++++++---- tox.ini | 22 +++++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 7657882a..84c04b77 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -3,7 +3,7 @@ name: tests -on: +on: push: branches: - main @@ -14,7 +14,7 @@ on: - main workflow_dispatch: -jobs: +jobs: test: name: ${{ matrix.platform }} py${{ matrix.python-version }} runs-on: ${{ matrix.platform }} @@ -26,10 +26,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -45,21 +47,25 @@ jobs: deploy: # this will run when you have tagged a commit, starting with "v*" - # and requires that you have put your twine API key in your + # and requires that you have put your twine API key in your # github secrets (see readme for details) needs: [test] runs-on: ubuntu-latest if: contains(github.ref, 'tags') + steps: - uses: actions/checkout@v4 + - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -U setuptools setuptools_scm wheel twine + - name: Build and publish env: TWINE_USERNAME: __token__ diff --git a/tox.ini b/tox.ini index b8d88d32..65a0943d 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ python = 3.10: py310 3.11: py311 fail_on_no_env = True - + [gh-actions:env] PLATFORM = ubuntu-latest: linux @@ -16,24 +16,36 @@ PLATFORM = windows-latest: windows [testenv] -platform = +platform = macos: darwin linux: linux windows: win32 -passenv = +passenv = CI GITHUB_ACTIONS DISPLAY,XAUTHORITY NUMPY_EXPERIMENTAL_ARRAY_FUNCTION PYVISTA_OFF_SCREEN + USERNAME + USER + LOGNAME + LNAME + TEMP + TMP + TMPDIR + TORCHINDUCTOR_CACHE_DIR +setenv = + windows: TORCHINDUCTOR_CACHE_DIR = {env:TEMP}{/}torchinductor + macos: TORCHINDUCTOR_CACHE_DIR = {env:TMPDIR}{/}torchinductor + linux: TORCHINDUCTOR_CACHE_DIR = {env:TMPDIR:/tmp}{/}torchinductor extras = gui -deps = +deps = .[gui] py pytest pytest-cov pytest-xvfb # ignoring contrib tests for now -commands = +commands = #linux: apt-get update && apt-get install libgl1 pytest -vv -rA --color=yes --cov=cellpose --cov-report=xml --ignore=tests/contrib --durations=0 From 26c025509342d95f5b697506e652b62f4c2a7c93 Mon Sep 17 00:00:00 2001 From: Michael Rariden <54959329+mrariden@users.noreply.github.com> Date: Mon, 2 Mar 2026 10:07:37 -0500 Subject: [PATCH 2/2] Clean up environment variables in tox.ini Removed unnecessary environment variables from tox.ini. --- tox.ini | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tox.ini b/tox.ini index 65a0943d..28f6ec9e 100644 --- a/tox.ini +++ b/tox.ini @@ -26,10 +26,6 @@ passenv = DISPLAY,XAUTHORITY NUMPY_EXPERIMENTAL_ARRAY_FUNCTION PYVISTA_OFF_SCREEN - USERNAME - USER - LOGNAME - LNAME TEMP TMP TMPDIR