Skip to content

Commit 446d2b4

Browse files
committed
fix: add adaptable python executable path to basedpyright usage in nox session
1 parent cb68ad5 commit 446d2b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

{{cookiecutter.project_name}}/noxfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import shlex
5+
import shutil
56
from pathlib import Path
67
from textwrap import dedent
78
from typing import List
@@ -121,9 +122,10 @@ def typecheck(session: Session) -> None:
121122
"""Run static type checking (Basedpyright) on Python code."""
122123
session.log("Installing type checking dependencies...")
123124
session.install("-e", ".", "--group", "dev")
125+
python_path: Path = Path(shutil.which("python", path=session.bin))
124126

125127
session.log(f"Running Basedpyright check with py{session.python}.")
126-
session.run("basedpyright", "--pythonversion", session.python)
128+
session.run("basedpyright", "--pythonversion", session.python, "--pythonpath", python_path)
127129

128130

129131
@nox.session(python=False, name="security-python", tags=[SECURITY])

0 commit comments

Comments
 (0)