Closed issam-seghir closed 2 months ago
Thanks for opening this issue. Can you provide a way to reproduce this for me? I'm interested in:
I had the same problem using those versions. In my case it was that the Ruff VSCode plugin at some point started to treat the ruff.interpreter
config differently. I had to change the value from .venv/bin/python
to ${workspaceFolder}/.venv/bin/python
for this to get fixed.
@lukaspiatkowski Yes, that's resolved in https://github.com/astral-sh/ruff-vscode/pull/553 which provides the context.
i'm on windows , my python path when using poetry env is : .venv/Scripts/python
, so i use this config
"ruff.importStrategy": "fromEnvironment",
"ruff.interpreter": [
"${workspaceFolder}/.venv/Scripts/python"
],
but this does not fix the problem for me :
python log :
2024-09-04 15:55:57.491 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir 'e:\Documents\Vs Code Projects\Chatbot\LLM\.pixi\envs'
at Object.readdirSync (node:fs:1509:26)
at t.readdirSync (node:electron/js2c/node_init:2:11418)
at c:\Users\GAMING\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:586747
at c:\Users\GAMING\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:586938
at Array.map (<anonymous>)
at d.initWatchers (c:\Users\GAMING\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:586656)
at async d.ensureWatchersReady (c:\Users\GAMING\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\out\client\extension.js:2:543067)] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'e:\\Documents\\Vs Code Projects\\Chatbot\\LLM\\.pixi\\envs'
}
2024-09-04 15:55:57.491 [error] Dir "e:\Documents\Vs Code Projects\Chatbot\LLM\.pixi\envs" is not watchable (directory does not exist)
2024-09-04 15:55:57.491 [info] Default formatter is set to charliermarsh.ruff for workspace e:\Documents\Vs Code Projects\Chatbot\LLM
2024-09-04 15:55:57.524 [info] Python interpreter path: .\.venv\Scripts\python.exe
2024-09-04 15:55:58.424 [info] > E:\Apps\scoop\apps\pyenv\current\pyenv-win\bin\pyenv which python
2024-09-04 15:55:58.424 [info] cwd: e:\Documents\Vs Code Projects\Chatbot\LLM
2024-09-04 15:55:58.474 [info] > conda info --json
2024-09-04 15:55:59.017 [info] > ~\.condarc\Scripts\conda.exe info --json
2024-09-04 15:56:09.584 [info] Starting Pylance language server.
2024-09-04 15:57:42.883 [info] Discover tests for workspace name: LLM - uri: e:\Documents\Vs Code Projects\Chatbot\LLM\app\modules\conversation_assistant.py
2024-09-04 15:57:42.924 [info] > pixi --version
2024-09-04 15:57:42.925 [error] Error: spawn pixi ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn pixi',
path: 'pixi',
spawnargs: [ '--version' ]
}
2024-09-04 15:57:42.925 [warning] could not find a pixi interpreter for the interpreter at e:\Documents\Vs Code Projects\Chatbot\LLM\.venv\Scripts\python.exe
2024-09-04 15:57:42.959 [info] > "e:/Documents/Vs Code Projects/Chatbot/LLM/.venv/Scripts/activate.bat" && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.12.3-win32-x64/python_files/printEnvVariables.py
2024-09-04 15:57:42.959 [info] shell: commandPrompt
2024-09-04 15:57:43.883 [warning] could not find a pixi interpreter for the interpreter at e:\Documents\Vs Code Projects\Chatbot\LLM\.venv\Scripts\python.exe
2024-09-04 15:57:43.893 [info] > "e:\Documents\Vs Code Projects\Chatbot\LLM\.venv\Scripts\python.exe" ~\.vscode\extensions\ms-python.python-2024.12.3-win32-x64\python_files\testing_tools\run_adapter.py discover pytest -- --rootdir "e:\Documents\Vs Code Projects\Chatbot\LLM" -s --cache-clear
2024-09-04 15:57:43.893 [info] cwd: e:\Documents\Vs Code Projects\Chatbot\LLM
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
},
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.variableTypes": true,
"python.languageServer": "Pylance",
"python.analysis.logLevel": "Trace",
"python.analysis.typeCheckingMode": "standard",
"python.testing.pytestEnabled": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.fixAll": [
"source.unusedImports"
],
"python.venvFolders": [
"${workspaceFolder}\\.venv"
],
"python.analysis.inlayHints.pytestParameters": true,
"python.analysis.inlayHints.callArgumentNames": "all",
"files.exclude": {
// for python
"**/__pycache__": true,
"**/.cache": true,
"**/.coverage": true,
"**/.coverage.*": true,
"**/.hypothesis": true,
"**/.mypy_cache": true,
"**/.nox": true,
"**/.pytest_cache": true,
"**/.ruff_cache": true,
"**/.tox": true
// "**/node_modules": true
},
"ruff.lineLength": 120,
"ruff.showNotifications": "always",
"ruff.importStrategy": "fromEnvironment",
"ruff.interpreter": [
"${workspaceFolder}/.venv/Scripts/python"
],
"ruff.lint.run": "onSave",
"ruff.nativeServer": "on",
[lint]
select = ["ALL"]
[tool.poetry.group.dev.dependencies]
ruff = "^0.6.2"
pre-commit = "^3.8.0"
mypy = "^1.11.2"
isort = "^5.13.2"
types-ujson = "^5.10.0.20240515"
types-requests = "^2.32.0.20240712"
[tool.ruff]
line-length = 88
exclude = [".git", "__pycache__", ".mypy_cache", ".pytest_cache"]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
# "I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
]
ignore = [
"B904",
"B006",
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]
[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]
[tool.black]
line-length = 88
target-version = [ "py310", "py311" ]
exclude = "((.eggs | .git | .pytest_cache | build | dist))"
[tool.isort]
profile = "black"
[tool.poetry.scripts]
start = "uvicorn app.main:app --reload"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
python log :
These are Python logs. I'm specifically asking for Ruff logs. Here's how to get it:
What's the version of your Ruff extension?
Can you provide the list of extensions that you've installed? You can get that via code --list-extensions
command.
@dhruvmanila, the extension is working after VS Code last update and restarting my computer.
Perfect! Thanks for following up. I'll mark this issue as resolved then.
i have the same problem mentioned in the issue below i'm using the latest version : v2024.42.0 and
ruff = "^0.6.2"
Originally posted by @issam-seghir in https://github.com/astral-sh/ruff-vscode/issues/460#issuecomment-2319382190
system info :
Version: 1.92.2 (user setup) Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9 Date: 2024-08-14T17:29:30.058Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.19045