Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate Python interpreter version for native server (#516)
## Summary I'm not sure why this check was removed looking back at #431, but this validation should be done for both native server and `ruff-lsp`. Both uses a Python script which requires Python 3.7 or later and `ruff` in general also supports 3.7 and later. Without this change, if someone were to use Python 3.6, the extension would give the following error: ``` 2024-07-05 09:26:21.378 [error] Error while trying to find the Ruff binary: Error: Command failed: /Users/dhruv/.pyenv/versions/3.6.15/bin/python /Users/dhruv/work/astral/ruff-vscode/bundled/tool/find_ruff_binary_path.py Traceback (most recent call last): File "/Users/dhruv/work/astral/ruff-vscode/bundled/tool/find_ruff_binary_path.py", line 33, in <module> ruff_binary_path = find_ruff_binary_path() File "/Users/dhruv/work/astral/ruff-vscode/bundled/tool/find_ruff_binary_path.py", line 20, in find_ruff_binary_path elif sys.platform == "darwin" and sys._framework: AttributeError: module 'sys' has no attribute '_framework' ``` ## Test Plan The above error still occurs and the fix for that is in a follow-up PR (#517). Using the below settings: ```json { "ruff.nativeServer":true, "ruff.interpreter": ["/Users/dhruv/.pyenv/versions/3.6.15/bin/python"] } ``` The logs shows that the version isn't supported: ``` 2024-07-05 09:27:38.086 [error] Python version 3.6 is not supported. 2024-07-05 09:27:38.086 [error] Selected python path: /Users/dhruv/.pyenv/versions/3.6.15/bin/python 2024-07-05 09:27:38.086 [error] Supported versions are 3.7 and above. ```
- Loading branch information