seddonym / grimp

Builds a graph of a Python project's internal dependencies.
https://grimp.readthedocs.io
BSD 2-Clause "Simplified" License
51 stars 10 forks source link

Add the possibility to ignore "Type checking" imports #130

Closed yakMM closed 8 months ago

yakMM commented 9 months ago

Closes https://github.com/seddonym/grimp/issues/64

~Sorry for the noise in the diff file, I had to change the order of classes and github is lost~

Task list:

yakMM commented 8 months ago

@seddonym Added some doc and caching and updated the code according to your first review.

If I'm not mistaken only the tests for the new import scanner and build graph features are missing.

yakMM commented 8 months ago

Ready on my side, tell me if something is missing or if I should write deeper tests

yakMM commented 8 months ago

Thanks for the review, I'd love to have black added to tox. I can remove the @overload if you don't like them, it's mostly used to make everything explicit (usually used in strongly typed context).

Here it's used to make the type of the ASTnode and the type of the node parser match (Import node and ImportNodeParser or ImportFrom node and ImportFromNodeParser, but no mix

It's really not essential, especially since it's internal implem

yakMM commented 8 months ago

Removed the @overload and trimmed out the formatting noise

yakMM commented 8 months ago

Alright that makes sense.

I would like to avoid the rebase if possible, formatting changes are really annoying to deal with, and I already purged any formatting change on my side so the PR looks smooth.

It would save a lot of time if you could merge this before running black on the whole repo (is reverting temporarily the black changes on master an option?)

Let me know what you think