Skip to content

Other useful features

Skip Import

Leave ‘# unimport: skip’ or ‘# noqa’ at the end of the line to skip imports for example:

import x # unimport:skip
from x import ( # noqa
  t, y,
  f, r
)

If version of your python is 3.8+ Unimport support multiple skip like below. It doesn’t matter which line you put the comment on.

from package import (
    module,
    module1,
)  # unimport:skip

or

from package import (
    module, # unimport:skip
    module1,
)

File Wide Skips

To skip a file by typing # unimport: skip_file anywhere in that file for example:

# unimport: skip_file

import x

or

import x

# unimport: skip_file

Exit code behavior

Exit code 1 if there is a syntax error Exit code 0 if unused import versa and auto removed for all other cases exit code 1 Exit code 0 if there is no unused import.


Last update: April 3, 2023
Created: April 3, 2023