Can autoreload magics be kept above isort output?
See original GitHub issueI have tried to look around, but I am not sure if one of the recent fixed addresses this problem. I am using nbQA
for its isort
functionality and have the following problem.
A notebook which looks like this (MWE)
%load_ext autoreload
%autoreload 2
import sys
import pathlib
is converted by nbqa isort
into
import pathlib
import sys
%load_ext autoreload
%autoreload 2
which actually invalidates the autoreload
extension that must be loaded before any imports. I have tried to use # isort:skip
or put it in a different cell, but to no avail.
Do you know if there’s a fix for this?
Otherwise, thanks for the great hooks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:33 (6 by maintainers)
Top Results From Across the Web
Configuration options for isort
Tells isort to set the known standard library based on the specified Python version. Default is to assume any Python 3 version could...
Read more >autoreload — IPython 8.7.0 documentation
autoreload reloads modules automatically before entering the execution of code typed at the IPython prompt. ... The following magic commands are provided:.
Read more >IPython's magic functions — Mastering JupyterLab
So whether Magics are available is a decision that is made by the kernel developer on a per-kernel basis.
Read more >jurigged - PyPI
jurigged. Jurigged lets you update your code while it runs. Using it is trivial: jurigged your_script.py; Change some function or method with your...
Read more >CSCI 503/490 – Assignment 5
You will be doing your work in Python for this assignment. ... To test your code, you may use the %run magic command...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If your isort config is present in setup.cfg, then create a different file called my_isort.cfg and pass it via the - -nbqa-config flag
Btw, I have found another workaround: I can put the jupyter magic in the startup script of jupyter thus removing it from the nb. It will apply to all notebooks, but for me it is the desired behavior.