diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1169d839..f41cf42c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,8 +9,7 @@ jobs: strategy: matrix: # Oldest non-EOL and newest released - # scipy-stubs does not support Python 3.9 - python-version: ["3.10", "3.13"] + python-version: ["3.9", "3.13"] # Tier 1 OSes os: ["ubuntu-latest", "windows-latest", "macos-latest"] fail-fast: false @@ -35,6 +34,12 @@ jobs: - name: Install dependencies run: python -m pip install --group tests + - name: Install scipy-stubs on Python 3.9 + if: ${{ matrix.python-version == '3.9' }} + # scipy-stubs claims to not support Python 3.9 + # Manually install last version claiming Python 3.10 support + run: python -m pip install 'scipy-stubs<1.16' 'optype<0.10' --ignore-requires-python + - name: Run pyright tests uses: jakebailey/pyright-action@v2 with: diff --git a/pyproject.toml b/pyproject.toml index 8bf3c26a..a2af65a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,9 @@ tests = [ "matplotlib >=3.8", "pandas-stubs", "pytest", - "scipy-stubs", + # scipy-stubs claims to not support Python 3.9 + # Manually install it separately (see .github/workflows/test.yml) + "scipy-stubs; python_version >= '3.10'", "types-networkx", "typing_extensions", @@ -30,7 +32,12 @@ tests = [ "sympy", "vispy", ] -dev = [{ include-group = "hygiene" }, { include-group = "tests" }] +dev = [ + { include-group = "hygiene" }, + { include-group = "tests" }, + # Test scripts force a dependency update using pip, which doesn't come bundled in all venvs + "pip", +] # Allow these stubs to be installed from GitHub diff --git a/tests/run_tests.py b/tests/run_tests.py index bd0e6529..8e6c5875 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -8,6 +8,10 @@ def install_requirements() -> None: print("\nInstalling requirements...") subprocess.check_call((sys.executable, "-m", "pip", "install", "pip>=25.1")) subprocess.check_call((sys.executable, "-m", "pip", "install", "--upgrade", "--group", "tests")) + if sys.version_info < (3, 10): + subprocess.check_call( + (sys.executable, "-m", "pip", "install", "scipy-stubs<1.16", "optype<0.10", "--ignore-requires-python") + ) def run_pyright() -> subprocess.CompletedProcess[bytes]: