Replies: 5 comments
-
Thank you for reporting @talsuk5 and I am very happy to hear that you like Polylith 🤩 I am now working on a solution for |
Beta Was this translation helpful? Give feedback.
-
I have published a new version with the output is sorted, and the import sections (bricks and third-party) are no longer repeated/duplicated. I also added some coloring for the types of bricks, to make it easier to understand what kind of brick it is. More details (with screenshots) in #292 I hope that this solves some of the issues. 😄 I haven't added any changes to line-breaks in this version, though. I'm using Rich, and the options I found are not working that well (some options are probably dependent on the type of shell). I will continue looking into the circular references in |
Beta Was this translation helpful? Give feedback.
-
I have tried out adding the # core.py
class A:
pass # b.py
from example.bb.core import C
class B(C):
pass The # core.py
from example import aa
class C(aa.core.A):
pass Polylith will recognize these ones as you write as depending on each other. I added the In my example FastAPI project, I created an instance of one of the classes: # the FastAPI base
from example import bb
bb.core.C() The app can be started and runs fine. So far there are no circular references in the python modules. Then I added an import to the from example.aa import b
class A:
pass This should mean that there are circular references. The result when I try to run the app: I think this could be outside of the scope of Polylith maybe? The double referencing between I'm not sure how to proceed here, do you have any suggestions? |
Beta Was this translation helpful? Give feedback.
-
Thanks @DavidVujic. So the result you're seeing is in runtime right? Of course this is semantic and python being python will sometime "warn" you with a good runtime exception. I could also argue that polylith is a semantic tool, hence the rules that apply to it are totally in the hand of its creators/maintainer. The other alternative for me is to write a script that identifies this behavior and breaks the CI. So I guess it's up to you (or me if I'll ever have the time lol) to decide if this feature is worth it. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your input and ideas about how to improve the Polylith tool, much appreciated ⭐ I will give this some thought, and realize that I need to read up more on circular imports in Python. I will move this issue to Discussions and in the Ideas section. |
Beta Was this translation helpful? Give feedback.
-
First let me start with a big thanks to @DavidVujic for maintaining this awesome library.
My team uses it and we love it. so much that it has become part of our CI and I even made a zsh plugin so it easier to poetry poly around lol (@DavidVujic ping me in private if you want to distribute it somehow, I don't mind sharing).
I have 2 features I would like to discuss:
Is your feature request related to a problem? Please describe.
when using ppc (poetry poly check) -v, each time the order of packages and the order that comes after "is importing" is changed. also for some reason there's a line break if the list exceeds some length, causing tools like
grep
to be harder to apply.let's say I have 2 bricks, aa and bb. aa defines classes A and B and bb defines class C such that
which is perfectly python legal but results in :
which can lead to bad packages includes in the
pyproject.toml
file.Describe the solution you'd like
🤔 Circular dependency detected between aa and bb Error: Process completed with exit code 1.
Describe alternatives you've considered
There's no alternative to polylith. it's really good.
Additional context
Keep up the good work David 👏
Beta Was this translation helpful? Give feedback.
All reactions