At work I work with a relatively large Python code base. Sometimes I find myself accidentally adding circular dependencies between modules. This leads to the classical
shell
ImportError: cannot import name 'A' from partially initialized module 'B'
marui mitigates this problem by finding circular imports before you run your CI suite.
In a Python project (characterized by a pyproject.toml
being present), simply run
shell
$ marui .
In the current version (0.1.0), marui
can only find direct circular imports of Python modules. The plan for the next release is to extend this to finding circular import chains of any length using directed graphs and strongly connected components.
If you have cloned this repository, build and install marui with cargo
:
$ gh repo clone jan-krecke/marui
$ cd marui
$ cargo install --path .
Alternatively, just get marui
directly from crates.io
:
$ cargo add marui
If you want to use this tool and find any problems, feel free to open a PR or an issue :-).