ansys / pyedb-core

Ansys Electronics Database Python Client Package
https://edb.core.docs.pyansys.com/
MIT License
2 stars 1 forks source link

Restructure imports to remove circular imports #398

Closed drewm102 closed 2 months ago

drewm102 commented 3 months ago

📝 Description of the feature

The current structure of imports in pyedb-core results in circular imports in some scenarios. This can be avoided by switching to module level imports.

💡 Steps for implementing the feature

  1. In the package __init__.py files (definition.__init__.py, layout.__init__.py, net.__init__.py, etc.), remove all imports
  2. In each module, adjust imports to do module level imports rather that object level imports
    • For example, from ansys.edb.core.layer import LayerCollection becomes import ansys.edb.core.layer.layer_collection as layer_collection
  3. Remove all delayed imports
    • Note: Try searching for from (with whitespace) to find delayed imports

🔗 Useful links and references

For testing, try running the tests.e2e.integration_tests.test_spiral_inductor unit tests. As a brute force test, you could also create a python file that just imports all the modules