Skip to content

Remove circular dependencies

What does the merge request do?

Remove some circular dependencies from Inkex, and remove the corresponding non-toplevel imports.

The only remaining non-toplevel import from within Inkex is between elements._base and elements._polygons due to ShapeElement.to_path_element, which creates a PathElement, which derives from ShapeElement. No idea how to fix this except moving both classes into one file.

Also some non-toplevel imports of tween remain, which was discussed below.

Implementation notes

  • There are now interfaces for BaseElement and SvgDocumentElement so when only used for isinstance, not the entire module is needed
  • Some utilities have been moved into their own modules (deprecated_meta, svg_parser, css)
  • The most problematic module was tween because it imported a lot of elements, but the elements also imported tween to define an interpolate method. This will be deprecated at some point after 1.2 since using tween directly is a one-liner as well.

Summary for release notes

Code cleanups.

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by Jonathan Neuhauser

Merge request reports