-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove common package #6755
Remove common package #6755
Conversation
98b7309
to
b5a0d1c
Compare
f4240de
to
c1742a1
Compare
c72023a
to
ebc1d44
Compare
I have mixed feelings about this change. On the one side, it makes code structure simpler, which is a good thing, as the Specifically, we have a question: "what exactly the GUI modules should be able to import from the Core modules" and the previous answer was "nothing". With this change, we should answer this question differently, and it may be "something" (which I don't like) or "everything". Consider the abstract module I can imagine the following scenario a year later: some developer is working on a core-related feature. He wants to use some helper function in module from tribler_core.y import helper_function After this new import is added, the GUI process starts importing the module
In the current code, this scenario is impossible: a developer cannot add an import of The scenario with abstract modules So, in my opinion, this PR makes the directory structure simpler, and the dependency graph more complex. We can merge it if we agree that for the question "what exactly the GUI modules should be able to import from the Core modules" the answer is "everything". In this case, requirement files should also be changed: |
Agree, that GUI should be able to import any module from the core.
Agree it is a possibility (as well all consequences that you are mentioned). But this is true for every single import. |
The difference is that with the current project structure
So, when After this PR, |
Agree, but do we have any good reason to create and maintain a separate package to satisfy this? |
Agree, I'll add a commit with the requested changes a bit later :) |
Probably not, I just want to be sure that we don't miss any currently important reason why we wanted to prevent imports from Core to GUI. As we don't have plans to distribute |
61dca6f
to
2c2c7ec
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, I just want to be sure that we don't miss any currently important reason why we wanted to prevent imports from Core to GUI.
The main reason we introduce the intermediate common
package was to avoid accidentally importing stuff in the GUI (e.g., libtorrent
). These imports can really mess with the logic of the GUI so having an intermediate common
package has worked well as a safeguard against this (as @kozlovsky also identified). Additionally, the moment we introduce the tribler_common
package, our goal was to improve the structure of our project and avoid duplicate code. Even though we could have directly imported code from the core, we believed it was cleaner to import from an intermediate package. And we also had plans to ship separate packages for the Tribler Core and GUI, since running Tribler without GUI was (and still is) a popular request.
When we directly import modules from the core, it quickly becomes challenging to track which parts we are importing in the GUI. So I don’t think we can, nor should answer the question: “which parts of the core should be imported by the GUI”. It can be everything. And the import chain can escalate and pollute the module namespace of the GUI. We had these kinds of problems a few times in the past so I liked the fact that the common
package helped to prevent this.
If I have to give my opinion, I would vote to keep it. But I also see the arguments in favour of removing it (simplicity and the fact that we never pursued the idea of shipping packages in Tribler). We all discussed and agreed on #6505 so if this is part of the deal, I’ll accept it :)
Minor note: this PR might affect the relevance of #5645.
The reason is clear, but the presence of the #5645 shows that the intermediate common package doesn't protect us against "accidentally importing stuff in the GUI".
This is also clear, but the presence of the Imagine the situation in which a developer creates a new feature in the GUI module. The difference in just 1 search attempt seems to be insignificant, but I believe it could lead to the situation in which the developer could end his search at the first attempt and the deduplication will not be implemented properly.
The merging |
If the import of |
This PR is a part of #6505.
It moves all files from the
common
package to thecore
package and removes thecommon
package completely.The new folder structure: https://github.com/drew2a/tribler/tree/refactoring/remove_common_package/src
@drew2a: I've changed Jenkins' jobs regarding the changes as well.
Closes #5645