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
692 stars 49 forks source link

Automatic of ignoring type checking imports #198

Closed seddonym closed 1 year ago

seddonym commented 1 year 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.