Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried to split our geometry primitives into separate files but there are a few interdependencies that seem impossible to avoid, so I ended up leaving
Box
,GeometryGroup
andClipOperation
insidebase.py
.Box
is required as a return type forbounding_box
, which is only defined for the baseGeometry
.GeometryGroup
orClipOperation
, so those also have to be available forGeometry
.Furthermore,
GeometryType
andfrom_shapely
are also problematic and were left on a separate file:utils.py
. This file requires all geometry classes to defineGeometryType
.GeometryType
can only be defined after all classes, but it it used byGeometryGroup
andClipOperation
, so a cycle is inevitable here if we want any file separation.from_shapely
should, ideally, be a method ofGeometry
because it can return different classes based on the shapely geometry, but it requires the construction ofPolySlab
, so it cannot depend only onbase.py
. Because we inevitably have a cyclic import due toGeometryType
, I used the same cycle to definefrom_shapely
outsidebase.py
but wrap it insideGeometry
.The final organization is better than having a single file, but not as good as in the initial split (f08d821), which contained a lot more import cycles.