[code-quality] Detecting circular package dependencies with pylint (or similar tool)

Claudiu Popa pcmanticore at gmail.com
Thu Jul 16 12:47:18 CEST 2015


On Thu, Jul 9, 2015 at 12:32 PM, JuanLeon Lahoz
<juanleon.lahoz at gmail.com> wrote:
> Hi,
>
> Is there any way to make pylint report circular package dependencies with an
> exit code != 0?
>
> Assume code has packages A and B.  A.a1 imports B.b1, and B.b2 imports A.a2.
> While this may work, imho this is a bad smell in design that I want to
> detect as early as possible (same as any other bad smells that pylint
> detects).
>
> I know that pylint can write import dependency graphs, but I could not find
> a trivial way to use them a a check (trivial == no coding required).
>
> Any option that I am missing?
>
> Thanks
> juanleon
>
> _______________________________________________
> code-quality mailing list
> code-quality at python.org
> https://mail.python.org/mailman/listinfo/code-quality
>


Hi Juan,

I'm sorry for the delayed response. Currently it's not possible,
since the circular import detection is pretty simple and it works only
for imports between the analyzed files, so it doesn't go for each other
import in your file and tries to see if that import has circular dependency
on other file. But improvements are welcomed and you could create
at least a bitbucket issue in order to track this improvement.

Thanks,
Claudiu


More information about the code-quality mailing list