-
Notifications
You must be signed in to change notification settings - Fork 392
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
Catch errors when running --pipe black #781
Comments
Ah, I see that black maybe supports exclusions which can be explicitly include in code:
[via] BUT: hmm... no, still get the error. |
Hi @psychemedia , sorry for the late answer. Also more specifically for the example above, did you try adding an |
Ah... good tip.. |
Yes, cells with an Also you're seeing this because Jupytext does not identify the line |
The detections of magics in formatters and linters is a general issue I think, with folk divided as to how that sort of exception should be handled. |
Hi @psychemedia , I expect to have fixed both issues in the development version. Feel free to give it a try, cf. https://jupytext.readthedocs.io/en/latest/developing.html |
Suggestion for how to do this: >>> from IPython.core.inputtransformer2 import TransformerManager
>>> TransformerManager().transform_cell('myvar = %dont_format_me')
"myvar = get_ipython().run_line_magic('dont_format_me', '')\n" Then, using |
If you try to run the
--pipe black
command over a set of notebooks in one or more directories, and black fails for some reason, the pipe fails at that point.Non-runnable illustrative fragment:
In the above case, black failed trying to parse a line that assigned the result of a line magic call to a variable.
It would be useful if the Jupytext pipe did not fail, but did perhaps warn that a file could not be parsed.
Another solution might be to allow a cell to be tagged as
no-black
or similar and be ignored somehow (--ignore-tag no-black
?) (I'm not sure if you apply the formatter at the cell level?)The text was updated successfully, but these errors were encountered: