0

So I decided to clean up my package, which has many modules. To that end I commented every single module import statement, and then when running the code I was just loading what I needed. However, this quickly became a nightmare where I find myself trying to solve for cyclic imports, and I have absolutely no idea on how I can solve this. What's the most straightforward manner of cleaning up a package? I don't think I'll get anywhere this way.

aaragon
  • 2,314
  • 4
  • 26
  • 60
  • Possible duplicate of [Circular import dependency in Python](https://stackoverflow.com/questions/1556387/circular-import-dependency-in-python) – Łukasz Rogalski Jul 07 '17 at 15:33
  • Not the same package, so that answer doesn't help. – aaragon Jul 07 '17 at 15:34
  • Use flake8 it will indicate unused modules. Only remove those. – Anthon Jul 07 '17 at 15:35
  • @Anthon the thing is that I moved files from the file directory, so my code doesn't run any longer... and as I understand, I should use flake8 with a functioning code, shouldn't I? – aaragon Jul 07 '17 at 15:37
  • You'll have more false warnings if it doesn't run, but you'll get those when running the code as well if imports are no longer correct because of the moving around. – Anthon Jul 07 '17 at 16:00
  • @Anthon do you have a link to a tutorial or something where I can learn how to do what you suggest? – aaragon Jul 07 '17 at 16:02
  • http://flake8.pycqa.org/en/latest/ – Anthon Jul 07 '17 at 16:53

0 Answers0