Search code examples
pythonvisual-studio-codeautopep8

Are there any flags for autopep8 (vscode), to allow multiple import in the same line?


I know that you can pass "python.formatting.autopep8Args": ["--max-line-length=200"] in .vscode/settings.json to override the max 79 length for a line, are there any flags for allow multiple line imports. What I want:

import json, os, h5py, pyperclip

this is just an example, usually I'd group modules with similar function in the code. Its more of a preference thing ;).

Edit: I could always do something like

# fmt: off
import json, os, h5py, pyperclip
# fmt: on

but I want a solution that is just pure vs-code settings based, like for the max-line-length I explained above.


Solution

  • "python.formatting.autopep8Args": ["--ignore", "E401"],
    

    And this is the official docs, you can find how to configure it with the suitable configurations.