support using existing Node installations
Description
I would like to use basedpyright with an external nodejs installation (coming from Nix).
Because basedpyright always bundles the nodejs wheel (it's a required dependency) extra measures have to be taken in order to prevent it from using the bundled binary.
This may also be an upstream issue with nodejs-wheel: perhaps it would benefit from an environment variable that could be used to override the default nodejs location?
does installing the basedpyright npm package instead of the pypi one work for you?
No, I want to do the following:
- install
nodejswith Nix- it's going to be available at
/nix/store/nodejs-v1.2.3-<basically-random-hash> - it's going to be built against system libraries located at
/nix/storeas well - only this
nodejsinstallation will reliably work in a pure Nix environment (Nix can be used on NixOS or on other distros as well).
- it's going to be available at
- install
basedpyrightfrom PyPI as usual- this would work fine if
basedpyrightornodejs-wheelrespectedPATH, maybeLD_LIBRARY_PATH(or other paths that node ecosystem uses? I know nothing about it), or at least a custom environment variable such asNODEJS_WHEEL_NODEJS_PATH
- this would work fine if
I understand that the whole point of bundling NodeJS via nodejs-wheel is to simplify the workflow in most scenarios. However, I think there should be an escape hatch for platforms that turn out to be incompatible with the bundled NodeJS. I guess they are trying to support as many as they can, but (1) there can be exceptions and (2) pure Nix environments cannot be supported from other package managers in principle.
If you're curious, my use case is a project that needs to integrate with a lot of other systems (mostly databases) and it's very convenient to install all of them with Nix. This works locally with basedpyright on NixOS due to some escape hatches that NixOS implements exactly for these situations.
However, these escape hatches are not available when using Nix on other distros: most importantly, on Ubuntu in GitHub Actions, where I would like to have an identical Nix environment with all of these databases available. This Nix environment, unlike the local one on NixOS, has to be pure. Because it's pure there are no more escape hatches and the bundled nodejs fails.
i guess we could add an option to specify the node version in the pypi package.
(related issue for the bundled version in the vscode extenssion: #1008)
My guess is that maybe a better solution would be to do it upstream instead.
Then all the packages using bundled nodejs would benefit from the same standardized environment variable.