<#19778 Errors when running check command with the...
# github-notifications
c
#19778 Errors when running check command with the pyright typecheck backend Issue created by olivercoleman-switchdin Describe the bug This is possibly two separate issues, can separate if need be. I'm getting errors when trying to run
check
with the pyright typecheck backend. The first error I came across was:
Copy code
$ pants check ::
01:36:53.39 [INFO] Initializing scheduler...
01:36:56.76 [INFO] Scheduler initialized.
01:36:56.89 [WARN] DEPRECATED: Not explicitly providing [python-infer].use_rust_parser is scheduled to be removed in version 2.18.0.dev0.

Read the help for [python-infer].use_rust_parser <https://www.pantsbuild.org/v2.17/docs/reference-python-infer#use_rust_parser>, then set the value in pants.toml.
01:37:00.73 [INFO] Completed: Building 7 requirements for requirements.pex from the dev/requirements.lock resolve: attrs==23.1.0, cattrs==23.1.0, frozendict==2.3.8, numpy==1.25.2, pendulum==2.1.2, pytest==7.4.0, static-frame==1.5.... (1 characters truncated)
01:37:02.74 [INFO] Completed: Building requirements_venv.pex
01:37:02.75 [ERROR] 1 Exception encountered:

Engine traceback:
  in `check` goal

KeyError: 'pyright'
Then I happened to put
[tool.pyright]
in the pyproject.toml file (and nothing more), and got a different error:
Copy code
$ pants check ::
02:17:33.39 [ERROR] 1 Exception encountered:

Engine traceback:
  in `check` goal

ProcessExecutionFailure: Process 'Extract node-v16.15.0-linux-x64.tar.xz' failed with exit code 2.
stdout:

stderr:
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/usr/bin/tar: Child returned status 2
/usr/bin/tar: Error is not recoverable: exiting now

Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
Pants version 2.17 OS Linux (in docker container based on
python:3.11.5-slim-bookworm
Additional info pants.toml:
Copy code
[GLOBAL]
pants_version = "2.17.0"

backend_packages = [
    "pants.backend.python",
    "pants.backend.python.lint.black",
    "pants.backend.build_files.fmt.black",  
    "pants.backend.experimental.python.lint.ruff",
    "pants.backend.experimental.python.typecheck.pyright"
]

[source]
root_patterns = [
    "/src",
    "/tests"
]

[python]
interpreter_constraints = ['==%(env.PYTHON_VERSION)s.*']
enable_resolves = true

[python.resolves]
python-default = "dev/requirements.lock"

[anonymous-telemetry]
enabled = true
repo_id = "nothingtoseehere"
pyproject.toml:
Copy code
[tool.black]
line-length = 120


[tool.ruff]
# Enable the pycodestyle (`E`), Pyflakes (`F`), isort (I), pep8-naming (N), pyupgrade (UP) rules by default.
select = ["E", "F", "I", "N", "UP"]

ignore = [
    "E501" # line length, defer to black auto-formatting (which doesn't always wrap comments)
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
    ".git",
    ".pants.d",
    ".ruff_cache",
    "__pypackages__",
    "_build",
    "build",
    "dist"
]
per-file-ignores = {}

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.11
target-version = "py311"


[tool.pyright]
pantsbuild/pants