from module import * binds names that the file does not list

tx0/python:unlisted-star-importrecommendedwarningsmell

What it finds

A star import binds every public name of the module, so a reader cannot see where a name comes from, a later version of the module can shadow names of the file, and tools cannot tell unused or undefined names apart. __init__.py files, which often gather the names of their submodules this way, and stubs are not checked.

From the rule's source, unlisted_star_import.rs.

Example from the rule's tests
from os.path import *tx0 reports: from os.path import * binds names the file does not listfrom os import path
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:unlisted-star-import" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:unlisted-star-import] reason="..."

tx0 explain tx0/python:unlisted-star-import shows the same in the terminal. Found a false positive? Report it.