Skip to content

usage with precommit.ci is broken #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Boria138 opened this issue Apr 14, 2025 · 2 comments
Open

usage with precommit.ci is broken #345

Boria138 opened this issue Apr 14, 2025 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Boria138
Copy link

Boria138 commented Apr 14, 2025

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

@Boria138
Copy link
Author

I add additional_dependencies: ["pyright[nodejs]"]
As written here #334 but it still doesn't work, although the error has changed

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check toml...............................................................Passed
uv-lock..................................................................Passed
ruff.....................................................................Passed
pyright..................................................................Failed
- hook id: pyright
- exit code: 1

⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠋⠙⠹⠸⠼npm error code EAI_AGAIN
⠼npm error syscall getaddrinfo
⠼npm error errno EAI_AGAIN
⠼npm error request to https://registry.npmjs.org/pyright failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
⠼npm error A complete log of this run can be found in: /tmp/npm/_logs/2025-04-14T19_01_10_709Z-debug-0.log
⠼Traceback (most recent call last):
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/bin/pyright", line 8, in <module>
    sys.exit(entrypoint())
             ^^^^^^^^^^^^
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/pyright/cli.py", line 31, in entrypoint
    sys.exit(main(sys.argv[1:]))
             ^^^^^^^^^^^^^^^^^^
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/pyright/cli.py", line 18, in main
    return run(*args, **kwargs).returncode
           ^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/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/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/pyright/_utils.py", line 69, in install_pyright
    node.run(
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/pyright/node.py", line 157, in run
    nodejs_wheel.npm(args, return_completed_process=True, **kwargs),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/nodejs_wheel/executable.py", line 181, in npm
    return call_node(
           ^^^^^^^^^^
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/nodejs_wheel/executable.py", line 78, in call_node
    return _program(
           ^^^^^^^^^
  File "/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/nodejs_wheel/executable.py", line 50, in _program
    complete_process = subprocess.run([os.path.join(bin_dir, name), *args], **kwargs)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/nodejs_wheel/bin/node', '/pc/clone/wzISurbiQu6Vhv0_PjCWag/py_env-python3/lib/python3.12/site-packages/nodejs_wheel/lib/node_modules/npm/bin/npm-cli.js', 'install', '[email protected]']' returned non-zero exit status 1.

Check theme for invalid QSS properties...................................Passed

@RobertCraigie RobertCraigie changed the title how use with precommit.ci usage with precommit.ci is broken May 3, 2025
@RobertCraigie RobertCraigie added bug Something isn't working help wanted Extra attention is needed labels May 3, 2025
@RobertCraigie
Copy link
Owner

Thanks for the report. Unfortunately I no longer use pre-commit so I'm not interested in working on a fix myself but I'd be happy to accept a PR if you figure out how to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants