cool-easter-32542
04/19/2024, 4:11 PMpants check :: in root dir, it does not work because it can't find pyproject.toml
This is different from pants' ruff integration where it is able to work with the pyproject.toml with no issues.
@bugzpodder ➜ /workspaces/example-python/helloworld (main) $ pyright
0 errors, 0 warnings, 0 informations
@bugzpodder ➜ /workspaces/example-python/helloworld (main) $ cd ..
@bugzpodder ➜ /workspaces/example-python (main) $ pants check
@bugzpodder ➜ /workspaces/example-python (main) $ pants check ::
16:05:24.63 [INFO] Completed: Force venv to materialize
16:05:29.04 [INFO] Completed: Run Pyright on 8 files.
16:05:29.04 [ERROR] Completed: Typecheck using Pyright - pyright - pyright failed (exit code 1).
helloworld/greet/greeting_test.py
helloworld/greet/greeting_test.py:9:26 - error: Argument of type "Literal['test']" cannot be assigned to parameter "name" of type "int" in function "greet"
"Literal['test']" is incompatible with "int" (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations
✕ pyright failed.
If you check the sandbox, you'll see it added pyrightconfig.json but it did not pick up pyproject.toml in helloworld
@bugzpodder ➜ /workspaces/example-python (main) $ ls /tmp/pants-sandbox-OCpc9c
__node helloworld requirements_venv.pex
__run.sh pyrightconfig.json requirements_venv.pex_bin_python_shim.sh
_binary_shims_d71438cc82ac7616b94db5246abc83b636b9bc4e66183a6ff021d42bf26ed483 requirements.pex requirements_venv.pex_pex_shim.sh
@bugzpodder ➜ /workspaces/example-python (main) $ ls /tmp/pants-sandbox-OCpc9c/helloworld/
__init__.py greet main.py translator
Pants version
2.20
OS
MacOS locally, the repo above is from a VSCode sandbox (linux)
Additional info
for running pyright outside of pants, it only recognizes the pyproject.toml in cwd (the place you run it in).
pantsbuild/pants