Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

importStrategy: fromEnvironment fallback doesn't work if the environment's Ruff is too old #323

Open
woodruffw opened this issue Nov 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@woodruffw
Copy link

Hello! I've said it before, but thanks again for Ruff (and also for this excellent VS Code extension) 馃檪

I'm filing this just in case it isn't the intended behavior, although I can see a strong argument for it being fine. Please close with extreme prejudice if it's working as intended!

Actual Behavior

I noticed this behavior while trying to trying to use ruff-vscode across a few different repositories and virtual environments, both with and without ruff installed.

With importStrategy: fromEnvironment:

  • If I use ruff-vscode with an activated venv that does not have ruff inside of it, the extension works as expected (falls back to its bundled copy of ruff)
  • If I use ruff-vscode with an activated venv that does have ruff (but a too-old ruff, like 0.0.254), the extension produces a warning telling me that the local ruff is too old:
Screenshot 2023-11-01 at 6 13 13鈥疨M

With that warning, no formatting is performed.

Expected Behavior

In this situation, I expected ruff-vscode to fall back on its bundled version after detecting that the virtual environment's version is too old. However, I can see an argument for this being too clever, especially given the workarounds below.

Workarounds

The following workarounds work:

  • Just using importStrategy: fromBundle. This works as expected!
  • Upgrading my venv's copy of ruff, which I should have done a while ago.

Other information

Host information (I believe this isn't a factor in this case, but for completeness):

  • Current Ruff versions: 0.1.2 (bundled) and 0.0.254 (in venv when I noticed this)
  • OS: macOS Sonoma, Python 3.12.0
@charliermarsh charliermarsh added the bug Something isn't working label Nov 2, 2023
@charliermarsh
Copy link
Member

Thanks for the clear issue :) I think it'd be nice to fall back to the bundled version here. (It could also be nice to warn the user.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants