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

Circulate import issues in __init__.py prevent debugging configuration in pycharm #135

Closed
arovai opened this issue Apr 17, 2024 · 5 comments

Comments

@arovai
Copy link

arovai commented Apr 17, 2024

Hello!
I would like to play around with the code in pycharm but got stuck when setting up run/debug configuration.
What I have tried is to set the module field to giga_connectome.run and then e.g. have -h in the options field.
Running this and I hit a Circular Import error:

ImportError: cannot import name '__version__' from partially initialized module 'giga_connectome' (most likely due to a circular import)

Note that I have ensured that all the requirements are satisfied in my venv.
Note also that when I install the package locally (essentially: pip install .), then giga_connectome gets added to my PATH and running giga_connectome -h works like a charm.
So I guess I am missing something in the pycharm run/debug configuration, hence this question :-)
Thanks for you help!
AR

@htwangtw
Copy link
Collaborator

thanks for the feedback! I am not a pycharm user nor do I use the debugging function much so I am afraid I cannot help much here

@Remi-Gau
Copy link
Collaborator

@arovai
not a pycharm user either but maybe if you can share the code snippet of what you are trying to do maybe that could give us a clue.

@arovai
Copy link
Author

arovai commented Apr 29, 2024

Well there is strictly speaking no code as this is just a PyCharm configuration to test the code.
You basically specify which module to run (in principle something like giga_connectome.run should work) and PyCharm does that internally for you (which might be the issue...). The only reason I use it is for it's nice debugging features (like debug points and stuff like that). May I ask you what tools you use for debugging?

@htwangtw
Copy link
Collaborator

I mostly do dedicated unit tests and never used breakpoint on this project (hence never noticed these issues), but I had a look into the debugger and noticed two things -
First there are circulate import issues in __init__.py since redefined a lot of relative paths there. It should be fine to remove these and I believe that would fit better with the current packaging recommendation. We can do a PR to resolve this.
Second thing is we do intentionally prevent the run.py to run as a module (see runtime error at the end of the file.). If you run other modules in the debug mode they all should run fine.

@htwangtw htwangtw changed the title Troubles setting up configuration in pycharm Circulate import issues in __init__.py prevent debugging configuration in pycharm May 17, 2024
@htwangtw
Copy link
Collaborator

The circular import problem has been addressed in #145
If you continue to run into issue, please reopen this issue and we can have another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants