Skip to content

stdlib-module-shadowing (A005)

Derived from the flake8-builtins linter.

What it does

Checks for modules that use the same names as Python standard-library modules.

Why is this bad?

Reusing a standard-library module name for the name of a module increases the difficulty of reading and maintaining the code, and can cause non-obvious errors. Readers may mistake the first-party module for the standard-library module and vice versa.

Standard-library modules can be marked as exceptions to this rule via the lint.flake8-builtins.builtins-allowed-modules configuration option.

This rule is not applied to stub files, as the name of a stub module is out of the control of the author of the stub file. Instead, a stub should aim to faithfully emulate the runtime module it is stubbing.

Options