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

Feature request: symlink to latest version in cache

Open tekumara opened this issue 2 years ago • 3 comments

pyright-python maintains a cache of versions, eg:

❯ ls ~/.cache/pyright-python/
1.1.296 1.1.298

It would be nice to have a stable latest symlink to to the latest version, eg:

❯ ls -al ~/.cache/pyright-python/
total 0
drwxr-xr-x   5 tekumara  staff  160 13 Mar 09:49 .
drwxr-xr-x  15 tekumara  staff  480 13 Mar 09:48 ..
drwxr-xr-x   5 tekumara  staff  160  6 Mar 12:13 1.1.296
drwxr-xr-x   5 tekumara  staff  160 13 Mar 09:48 1.1.298
lrwxr-xr-x   1 tekumara  staff    7 13 Mar 09:49 latest -> 1.1.298

A stable symlink could be used globally, from any bash script/Makefile commands, or for interactive usage.

(It also avoids going through the python interpreter and so has a lower startup time).

tekumara avatar Mar 12 '23 23:03 tekumara

I'd be happy to raise a PR for this if you think it worthwhile.

tekumara avatar Mar 12 '23 23:03 tekumara

Yeah this seems pretty reasonable.

I'm curious what your exact use case is though? This cache isn't intended to be part of the public API.

for interactive usage

What do you mean by this exactly? Is there something interactive that isn't working in the main wrapper?

RobertCraigie avatar Mar 13 '23 13:03 RobertCraigie

Thank you for considering this!

The main wrapper works well. By interactive usage I mean someone running pyright on the command line and waiting for results as opposed to CI or elsewhere.

With interactive usage I notice the ~100ms startup delay from the python interpreter when going via the main wrapper, rather than via eg: $HOME/.cache/pyright-python/latest/node_modules/pyright/index.js.

I appreciate this may be a niche concern though 😂 And you make a good point that it's not part of the public API.

tekumara avatar Mar 13 '23 22:03 tekumara