question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Forbid transitive imports

See original GitHub issue

Hi!

I am thing about if this is on scope of this project. I really dislike transitive imports in my projects.

Like:

# module.py
from a import b

And then:

from module import b  # ???

What do you think about it?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
sobolevncommented, Jul 28, 2019

It would be awesome to have this contract. Something like this:

[importlinter:contract:no-transitive]
name = Forbids to import anything from transitive modules
type = transitive

source = 
  wemake_python_styleguide
  tests

It really helps to untangle your module dependencies and forces you to refactor better. I know that my project contains a lot of transitive imports, but I just can’t find them by my eyes.

Sad, that it is not on the roadmap. I hope that other users will support me here: it should be! 🙂

(For anyone interested in this, please, put 👍 icon to this reply)

0reactions
seddonymcommented, Aug 28, 2019

Great, thanks @sobolevn!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should webpack forbid directly importing transitive ... - GitHub
Directly depending on a transitive dependencies is bad practice and as far as I know, there isn't a use case for it. Forbidding...
Read more >
disallow import of some transitive maven dependencies
How to disallow import and use of some transitive maven dependencies? So that code will not be accessing different layers of our stack....
Read more >
Apache Maven Enforcer Built-In Rules – Banned Dependencies
This rule checks the dependencies and fails if any of the matching excludes are found. The following parameters are supported by this rule:....
Read more >
Hiding internal product dependencies from consumers in a ...
Implementation‐only imports only prevent a dependency from being ... All dependencies—both direct and transitive—end up in the import and ...
Read more >
This seems more suitable to a capability-based security model ...
The reason to disallow importing transitive dependencies is that we can write packages which use that functionality, but only expose a safer/restricted form ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found