r/Python • u/AutoModerator • Jun 04 '26
Showcase Showcase Thread
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
27
Upvotes
r/Python • u/AutoModerator • Jun 04 '26
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
1
u/Top-Strategy-2522 Jun 09 '26
What My Project Does
knot is a zero-dependency CLI that finds circular imports in a Python project. It analyzes your code statically with the standard-library
astmodule — it never imports or runs your code — builds the internal module dependency graph, and reports every import cycle with a concrete example path:It can output plain text, JSON, or a Mermaid diagram of the import graph, and it exits non-zero when it finds a cycle, so it drops straight into CI or a pre-commit hook.
Install:
pip install knot-imports· Code + demo: https://github.com/gazzycodes/knotTarget Audience
Developers maintaining growing Python codebases or libraries who want to catch circular imports before they cause runtime
ImportErrors or "partially initialized module" failures. It's built to be usable in production as a CI gate (deterministic, fast, no deps), not just a toy — though it's an early v0.1.0, so feedback is welcome.Comparison
vs. pylint (
cyclic-import): pylint can flag cyclic imports, but it's a heavy, full-codebase linter. knot is single-purpose and dependency-free, prints the exact cycle path, and can export the graph as Mermaid.vs. pydeps: pydeps focuses on visualizing dependencies and needs Graphviz installed. knot is cycle-detection-first, runs with zero external tools, and still gives you a graph view.
vs. import-linter: import-linter enforces architecture contracts you define in config. knot needs no config — point it at a folder and it finds cycles out of the box.
vs. an IDE inspection or just running the code: knot is static (never executes your code) and headless with an exit code, so it's reproducible and automatable in CI rather than a one-off manual check.
It's MIT-licensed. I'd especially love feedback on import-resolution edge cases (namespace packages, conditional imports) and what you'd want it to do next.