cool-easter-32542
03/28/2025, 4:57 AMmypy, the __run.sh script for the "Run mypy" process contains an invocation like env -i ... __mypy_runner.sh where the script is not a relative path. This fails with errors like __mypy_runner.sh: No such file or directory.
It is unclear to me why it doesn't fail when Pants runs it, but clearly it does not.
Reproducer:
cd $(mktemp -d)
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.25.0"
backend_packages = [
"pants.backend.python",
"pants.backend.python.typecheck.mypy",
]
local_cache = false
[python]
interpreter_constraints = ["CPython==3.12.*"]
EOF
echo "python_sources(name='src')" > BUILD
touch foo.py
pants --keep-sandboxes=always check :: 2>&1 | tee -a output.txt
# Pick the path out of a line like:
# 155952.14 [INFO] Preserving local process execution dir /private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-3I8qPl for Run MyPy on 1 file.
sandbox=$(sed -n 's/.* Preserving local process execution dir \(.*\) for Run MyPy .*/\1/p' output.txt)
echo "BUG: running __run.sh in $sandbox fails with 'No such file or directory'"
bash "$sandbox"/__run.sh
Running that like bash script.sh shows:
16:03:33.07 [INFO] Initializing scheduler...
...
16:03:38.60 [INFO] Preserving local process execution dir /private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-wfz4FC for Run MyPy on 1 file.
16:03:39.75 [INFO] Completed: Typecheck using MyPy - mypy - mypy succeeded.
16:02:27.71 [INFO] Completed: Typecheck using MyPy - mypy - mypy succeeded.
Success: no issues found in 1 source file
ā mypy succeeded.
BUG: running __run.sh in /private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-wfz4FC fails with 'No such file or directory'
env: __mypy_runner.sh: No such file or directory
Pants version
2.25.0 (and more, probably)
OS
macOS, likely others
Additional info
N/A
pantsbuild/pantscool-easter-32542
03/29/2025, 7:10 AMcool-easter-32542
03/29/2025, 7:10 AM