Skip to content

[BUG] This doesn't seem to work for the %run magic command #286

Answered by s-weigand
jencake asked this question in Q&A
Discussion options

You must be logged in to vote

@jencake This is a general limitation when using jupyter magic syntax that manipulates the ipython kernel state at runtime and using static linters.
The problem is that magic commands aren't regular python code, so it does not translate to the equivalent python AST that flake8 uses to lint code.
The only way to fix this would require flake8 to use a different AST parser that supports jupyter magic syntax, which I'm not aware even exists and even if I don't see flake8 changing to it.

Pretty much the same issue was opened and closed for nbQA and I have the same suggestion as @MarcoGorelli to use # noqa either as comment inline or via cell tags.

The other way to solve this would be to conver…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by s-weigand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
2 participants
Converted from issue

This discussion was converted from issue #284 on February 03, 2023 20:46.