-
Notifications
You must be signed in to change notification settings - Fork 56
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native server does not work with Jupyter Notebook without configuration #546
Comments
\cc @dhruvmanila |
Can you provide the contents of the Ruff config in The reason it works for
This doesn't consider the |
You can also enabled debug logs for the native server using:
which outputs:
You can see that it only included the Python file (search for "Included path via") and not the notebook file. But, once you include it in the config: [tool.ruff]
extend-include = ["*.ipynb"] It'll start including the notebook files as well. |
Thank you @dhruvmanila , setting |
Thanks for the tip! I was having the same problem and
solved it for me as well! |
No worries. It makes sense for this change to be documented. I'm thinking of adding it to:
Do you have any other places in mind which will be more visible? |
* make nb ruff astral-sh/ruff-vscode#546 * fix docs * fix quickstart * add types
That's really helpful. Use it as an extension, I would first check the extension readme as you mentioned and then the extension setting. It may benefit users by adding this into extension setting and the notebook feature can be enabled global without need of toml file per project. |
Yeah, I had a similar thought earlier but that would mean that running Ruff from the command-line would give different results compared to the editor. I'm not sure if there are any opinions on this but as the notebook files were always included for linting and formatting via |
Totally agree. Just keep the notebook behaviour similar to |
## Summary Similar to astral-sh/ruff-vscode#547 but for the online docs. Refer to astral-sh/ruff-vscode#546 ## Preview <img width="1728" alt="Screenshot 2024-07-22 at 14 51 40" src="https://github.com/user-attachments/assets/39014278-c868-45b0-9058-42858a060fd8">
## Summary This PR adds a new section in the README to guide users to opt-in for Jupyter Notebook support for the native server. This is required because, unlike `ruff-lsp`, the native server looks at the `include` / `extend-include` setting. Refer #546
We might just include Jupyter Notebooks in Ruff's inclusion by default (astral-sh/ruff#12456). |
I still have difficulties making it work, even when I add .py files in VS Code are being formatted and linted properly. However, jupyer notebooks are not. Tried to restart, reinstall from clean state (VS Code, settings and extensions) to no avail. Any recommendations to make it work again? I noticed that I stopped working a couple of days ago. I use all latest versions of VS Code and extensions. Besides Ruff I have installed Python, Pylance, Python Debugger (all MS), Jupyter, Jupyter Keymap and Jupyter Notebook Renderers. |
I think you'd need to add that in the |
That did the trick! Thanks so much! You saved my day... 🙏☀️ A detail: In my case it was sufficient to create |
|
Got it! Thanks! 😊 |
Upvoting this! Speaking as someone who mainly uses Ruff from within Jupyter notebooks running in VSCode, my experience here was: a few months ago, very happy that I got to replace two slow extensions with one fast one; then recent frustration when the fast one stopped working with no obvious errors. |
Co-authored-by: Alex Waygood <alex.waygood@gmail.com> Closes: #12456 Closes: astral-sh/ruff-vscode#546
Co-authored-by: Alex Waygood <alex.waygood@gmail.com> Closes: #12456 Closes: astral-sh/ruff-vscode#546
Co-authored-by: Alex Waygood <alex.waygood@gmail.com> Closes: #12456 Closes: astral-sh/ruff-vscode#546
* make nb ruff astral-sh/ruff-vscode#546 * fix docs * fix quickstart * add types
* make nb ruff astral-sh/ruff-vscode#546 * fix docs * fix quickstart * add types
Ruff not function in jupyter notebooks when set
ruff.nativeServer
toauto
oron
. It seems there are some communication problem between the nativeserver and notebook. When use ruff-lsp by settingruff.nativeServer
tooff
, all ruff functions works as expected.According to the server log, the nativeserver started normally but receive nothing while I type format command.
The behaviour of setting nativeServer off is:
other ruff setting: all default
ruff version: v2024.34.0
OS: Mac
Python version: 3.10
Mininal example:
The text was updated successfully, but these errors were encountered: