Closed SMoraisAnsys closed 20 hours ago
@hiro727 I'll look into fixing that bug as part of the process of making the repo public (I'm working on it).
I'm struggling with imports coming from everywhere but I found out that adding from ansys.edb.layout.layout import Layout
before from ansys.edb.core import terminal
made the imports back on track.
I wanted to track the import responsible of the side effect but I'm not sure I'll succeed as there are tons of global imports in __init__.py
file.
Note: adding any of the following before from ansys.edb.core import terminal
triggers the side effect
import ansys.edb.definition
import ansys.edb.definition.solder_ball_property
import ansys.edb.definition.material_def
import ansys.edb.definition.padstack_def
import ansys.edb.definition.dielectric_material_model
import ansys.edb.definition.material_property_thermal_modifier
import ansys.edb.definition.port_property
import ansys.edb.definition.die_property
import ansys.edb.definition.component_def
import ansys.edb.definition.component_pin
import ansys.edb.definition.ic_component_property
import ansys.edb.definition.io_component_property
import ansys.edb.layout
import ansys.edb.definition.rlc_component_property
import ansys.edb.layout.cell
import ansys.edb.definition.djordjecvic_sarkar_model
import ansys.edb.definition.component_property
import ansys.edb.layout.layout
import ansys.edb.layout.voltage_regulator
import ansys.edb.definition.debye_model
import ansys.edb.definition.dataset_def
import ansys.edb.definition.package_def
import ansys.edb.definition.multipole_debye_model
import ansys.edb.definition.padstack_def_data
import ansys.edb.definition.component_model
import ansys.edb.definition.bondwire_def
import ansys.edb.layout.mcad_model
Following #313 discsussion, I recommend following the commentary https://github.com/ansys/pyedb-core/pull/313#discussion_r1393663133 which results from a discussion with @hiro727 and @drewm102 on the approach to solve the problem.
@drewm102 This issue should already be resolved in this PR. https://github.com/ansys/pyedb-core/commit/2cabcff0741aab7b4bd2f2aa20cfdb48cd1c7d78
🔍 Before submitting the issue
🐞 Description of the bug
I just installed pyedb-core and wanted to look at the tests (good job on that part btw).
When paying with "mock/test_terminals.py" I ended up catching a circular import with the simple command
from ansys.edb.core import terminal
. The current test file seem to work because of side effects related to importingfrom utils.fixtures import *
. beforefrom ansys.edb.core import terminal
.📝 Steps to reproduce
Launch from anywhere to see the error
python -c "from ansys.edb.core import terminal"
Launch from the project (to be able to call the second import) to see the side effect
python -c "from tests.mock.utils.fixtures import *; from ansys.edb.core import terminal"
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
2023.R2 but not relevant for this problem
🐍 Which Python version are you using?
3.10
📦 Installed packages