Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular import error when importing terminal #312

Closed
2 tasks done
SMoraisAnsys opened this issue Nov 10, 2023 · 5 comments
Closed
2 tasks done

Circular import error when importing terminal #312

SMoraisAnsys opened this issue Nov 10, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@SMoraisAnsys
Copy link
Contributor

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 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 importing from utils.fixtures import * . before from 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

Not relevant
@SMoraisAnsys SMoraisAnsys added the bug Something isn't working label Nov 10, 2023
@SMoraisAnsys
Copy link
Contributor Author

SMoraisAnsys commented Nov 10, 2023

@hiro727 I'll look into fixing that bug as part of the process of making the repo public (I'm working on it).

@SMoraisAnsys
Copy link
Contributor Author

SMoraisAnsys commented Nov 10, 2023

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.

@SMoraisAnsys
Copy link
Contributor Author

SMoraisAnsys commented Nov 10, 2023

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

@SMoraisAnsys
Copy link
Contributor Author

Following #313 discsussion, I recommend following the commentary #313 (comment) which results from a discussion with @hiro727 and @drewm102 on the approach to solve the problem.

@chenchienjacklin
Copy link
Collaborator

@drewm102 This issue should already be resolved in this PR. 2cabcff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants