NOAA-GFDL/pace

Refactor local import in Quantity

Opened this issue · 0 comments

Floating point precision lead to introducing a rather ugly pace.dsl.typing import Float locally to Quantity.__init__ to break a circular import

This include so deep in pace.util can lead to circular include. Since Quantity builds should not be in the critical path, this is "fine" for now but requires to be refactored out.
Strategies that seems obvious (but aren't):

  • Move Float in a separate file, e.g. pace.dsl.typing_float. Problem: circular dependency is on the import of anything under pace.dsl here
  • Remove boundary import (the culprit of circular). Problem: it's a legit need of Communicator which is also a legit need
    upstream
  • Make the Float a parameter to the __init__ of Quantity. Probably the actual way to fix this, lots of changes might have
    heavy side-effect and be bug prone.

Apologies to whoever works on this. If it's future me... I deserved it.

More broadly, there's imports of pace.dsl in pace.util which breaks the dependency cycle of the repository