Replies: 2 comments 2 replies
-
Syntax errors aren't suppressible because Ruff can't parse the file and, as a result, can't perform any analysis or formatting on top of it. I suggest to exclude the file in your ruff configuration (this has the same effect). @dhruvmanila do I remember it correctly that there's currently no option to allow ipython syntax within python files? |
Beta Was this translation helpful? Give feedback.
2 replies
-
A solution to your problems is to do this programatically. Replace your magic commands with the following according to this solution: # %% Autoreload setup
from IPython.core.getipython import get_ipython
from IPython.core.interactiveshell import InteractiveShell
ipython: InteractiveShell | None = get_ipython()
if ipython is not None:
ipython.run_line_magic("load_ext", "autoreload")
ipython.run_line_magic("autoreload", "2")
# %% Now your code is valid Python and Ruff should play nice. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I've got some databricks/IPython code in a file called test.py with some magic commands that's giving me a syntax error
And as you can see I've tried putting the generic noqa line that I thought would ignore the all errors on the line, but its still giving me a syntax error. Am I right in thinking that ruff should ignore that line? Is there another way of getting it to be ignored?
Beta Was this translation helpful? Give feedback.
All reactions