pyright-python icon indicating copy to clipboard operation
pyright-python copied to clipboard

bundle node and pyright with the pypi package

Open DetachHead opened this issue 2 years ago • 2 comments

having the pypi package download both node and the npm package when you first run the pyright command causes some issues:

  • we have a docker image where all the dependencies are installed, but when the pyright job runs in our CI, it can fail because the runner cannot access npm (due to corporate proxy nonsense). to work around this, we had to put this command in our dockerfile:
    # installs node & pyright
    RUN pyright --version
    
  • #225
  • npm is incredibly slow and unreliable on PCs at my work

i think bundling the npm package and node in the pypi package would be a much more reliable solution. that's how the playwright pypi package works for example

DetachHead avatar Nov 15 '23 04:11 DetachHead

I've solved this problem in basedpyright

DetachHead avatar Feb 15 '24 20:02 DetachHead

Here's another example of issues caused by trying to install a node environment on first run: https://github.com/python/typeshed/pull/11575#pullrequestreview-1938595099

According to @jakebailey, https://github.com/python/typeshed/pull/11575#issuecomment-2000065260

[...] It also could skip npm, but I can understand wanting to leverage npm to do version resolution (though doing it just with the registry is not super hard and IMO would be worth it to avoid the dep).

Also relates to #209

Avasam avatar Mar 15 '24 17:03 Avasam

Didn't intent to close this yet, the next release will add support for

pip install pyright[nodejs]

which will download the Node.js binaries at install time using nodejs-wheel instead of using nodeenv at runtime.

RobertCraigie avatar Sep 22 '24 10:09 RobertCraigie