In my case isort is not sorting the way I'd like to to be sorted.
Here's MWE:
import numpy as np
import pandas as pd
import seaborn as sea_bor_nnnn
import matplotlib.pyplot as plt
import torch
import os
after saving the file I get the following output
import os
# why is it inserting an empty line here?
import numpy as np
import torch
import pandas as pd
import seaborn as sea_bor_nnnn
import matplotlib.pyplot as plt
# here inserts only 1 blank line instead of 2
#actual code goes here
dfdf
dfdfd
ddf
My preferred format would be the following
import os
import torch
import numpy as np
import pandas as pd
import seaborn as sea_bor_nnnn
import matplotlib.pyplot as plt
# actual code goes here
Notice how all imports are sorted according to length without empty lines in between and that actual code starts after 2 empty lines from the module imports.
Any ideas how to achieve that in vscode? Maybe using using isort
in combination with autopep8
or flake8
instead of black
"python.sortImports.args"
. Another alternative that I am using is thepre-commit
withisort
– Canaille