question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False flags errors from `nbqa isort`

See original GitHub issue

When running nbqa isort on some notebooks which have already been fixed up previously with nbqa isort, false flag errors are being raised. Take a look at the terminal output below. I have a notebook, examples/custom-nodes.ipynb, which does not contain any isort formatting issues, as it was alrady run through nbqa isort. Running nbqa isort with --check-only indicates an error. Running nbqa isort again indicates that changes were made to the file. Running git diff shows that no changes were infact made. Running nbqa isort with --check-only again still reports that there are errors in the file.

$ nbqa isort --check-only examples/custom-nodes.ipynb 
ERROR: /made/up/path/to/examples/custom-nodes.ipynb Imports are incorrectly sorted and/or formatted.
$ nbqa isort examples/custom-nodes.ipynb 
Fixing /made/up/path/to/examples/custom-nodes.ipynb
$ git diff examples/custom-nodes.ipynb
$ nbqa isort --check-only examples/custom-nodes.ipynb 
ERROR: /made/up/path/to/examples/custom-nodes.ipynb Imports are incorrectly sorted and/or formatted.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MarcoGorellicommented, Mar 1, 2022

Sure, tomorrow I’ll post some outputs as I step through the code

Another solution could be to change the return code of nbqa-diff to be 1 if the tool would have modified the notebook and 0 otherwise. Then you could use that in CI in place of isort’s check-only

0reactions
MarcoGorellicommented, Mar 5, 2022

Fixed in version 1.3.0 🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strange docs in "Known Limitations" · Issue #386 · nbQA-dev ...
Hi! I was reading your docs and then I found this: The text says "after trailing comma", but the examples are using trailing...
Read more >
nbQA Documentation
Say you're running nbqa isort on a directory my_directory. ... Fixed bug whereby nbqa was giving the wrong error message when running nbqa...
Read more >
Configuration options for isort
Shows extra quiet output, only errors are outputted. Type: Bool Default: False Config default: false. Python & Config File Name: quiet. CLI Flags:....
Read more >
What is isort and why does it think that it is a incorrect import ...
Quick Fixing it does nothing, but the error disappears until VSCode restart or adding another import.
Read more >
NbQA: Run Isort, Pyupgrade, Mypy,... on Jupyter Notebook
nbqa isort my_notebook.ipynb Fixing my_notebook.ipynb ... level heading -=== +# First level heading To apply these changes, remove the `--nbqa-diff` flag.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found