Skip to content

ICN001 does not allow to import datetime by its nameΒ #29319

Closed

Description

@sandre35

Summary

Code:
import datetime

This raises an error even though no import alias was defined.

I would like this rule not to apply when no alias name is defined

Activity

  1. Daverball commented on Oct 13, 2026

    @Daverball
    Contributor

    This was added as a default convention via #28604

    If you don't want it, then you need to manually define the import conventions you want to follow.

    You can copy the example from lint.flake8-import-conventions.aliases into your configuration and remove the entries you disagree with.

  2. Daverball commented on Oct 13, 2026

    @Daverball
    Contributor

    Although it looks like the example no longer contains all the default values, even though the comment claims it, @ntBre we should probably fix that.

  3. ntBre commented on Oct 13, 2026

    @ntBre
    Contributor

    As I just posted here: #28604 (comment), you can actually override this with extend-aliases rather than redefining aliases, although I think the aliases approach is probably more of the intended route.

    Agreed on updating the example, thanks for pointing that out!

  4. added
    documentationImprovements or additions to public-facing documentation
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to public-facing documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions