seddonym / import-linter

Import Linter allows you to define and enforce rules for the internal and external imports within your Python project.
https://import-linter.readthedocs.io/
BSD 2-Clause "Simplified" License
664 stars 45 forks source link

Automatic of ignoring type checking imports #198

Closed seddonym closed 10 months ago

seddonym commented 10 months ago

This feature would be about allowing Import Linter to automatically ignore imports within a type checking guard. Grimp 3.1 now allows the graph to be built using an exclude_type_checking_imports=True parameter (although note the documentation build is currently broken) so it's not documented on Read the docs yet.

The way this should is as an optional entry in the top level configuration like so:

[importlinter]
root_package = mypackage
exclude_type_checking_imports = true

That can get passed directly through to grimp.build_graph.