RobertCraigie / RobertCraigie/pyright-python

usage with precommit.ci is broken

Open
#345 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
Python
Stars
277
Forks
31
Avg merge
4h 22m
Merged PRs (30d)
3

Description

pyright..................................................................Failed
- hook id: pyright
- exit code: 1

Traceback (most recent call last):
  File "/usr/lib/python3.12/urllib/request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.12/http/client.py", line 1336, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
    self.send(msg)
  File "/usr/lib/python3.12/http/client.py", line 1035, in send
    self.connect()
  File "/usr/lib/python3.12/http/client.py", line 1470, in connect
    super().connect()
  File "/usr/lib/python3.12/http/client.py", line 1001, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/socket.py", line 828, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/nodeenv.py", line 1548, in <module>
    main()
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/nodeenv.py", line 1119, in main
    args.node = get_last_stable_node_version()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/nodeenv.py", line 1052, in get_last_stable_node_version
    return _get_versions_json()[0]['version'].lstrip('v')
           ^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/nodeenv.py", line 1028, in _get_versions_json
    response = urlopen('%s/index.json' % src_base_url)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/nodeenv.py", line 652, in urlopen
    return urllib2.urlopen(req)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 1392, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
Traceback (most recent call last):
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/node.py", line 93, in _install_node_env
    subprocess.run(args, check=True)
  File "/usr/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/bin/python', '-m', 'nodeenv', '/tmp/cache/pyright-python/nodeenv']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/bin/pyright", line 8, in <module>
    sys.exit(entrypoint())
             ^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/cli.py", line 31, in entrypoint
    sys.exit(main(sys.argv[1:]))
             ^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/cli.py", line 18, in main
    return run(*args, **kwargs).returncode
           ^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/cli.py", line 22, in run
    pkg_dir = install_pyright(args, quiet=None)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/_utils.py", line 69, in install_pyright
    node.run(
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/node.py", line 138, in run
    strategy = _resolve_strategy(target)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/node.py", line 130, in _resolve_strategy
    return NodeenvStrategy(type='nodeenv', path=_ensure_node_env(target))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/node.py", line 54, in _ensure_node_env
    _install_node_env()
  File "/pc/clone/PU06frWhScaPwInYqQXEcg/py_env-python3/lib/python3.12/site-packages/pyright/node.py", line 95, in _install_node_env
    raise RuntimeError(
RuntimeError: nodeenv failed; for more reliable node.js binaries try `pip install pyright[nodejs]`

Here are my pre commit settings

# See https://pre-commit.com for more information
# See https://pre-commit.ci/ for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
  autofix_prs: false
  autoupdate_schedule: quarterly
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-toml

  - repo: https://github.com/astral-sh/uv-pre-commit
    rev: 0.6.14
    hooks:
      - id: uv-lock

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.11.5
    hooks:
      - id: ruff
        args: [--fix]

  - repo: https://github.com/RobertCraigie/pyright-python
    rev: v1.1.399
    hooks:
      - id: pyright

  - repo: local
    hooks:
      - id: check-qss-properties
        name: Check theme for invalid QSS properties
        entry: ./dev-scripts/check_qss_properties.py
        language: system
        types: [file]
        files: \.py$
        pass_filenames: false

Locally everything works, but after connecting pre commit ci, the checks in the repository no longer run

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pre-commit configuration shown, especially the pyright hook and its execution in precommit.ci. Reproduce the nodeenv and DNS failure in the CI environment, then trace how pyright obtains Node.js there. Done means the configured repository checks run successfully through precommit.ci rather than failing during Node.js setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, python
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.