S
Solara12mo ago
Iftah

I m using IntelliJ

I'm using IntelliJ
19 Replies
MaartenBreddels
MaartenBreddels12mo ago
you can probably add a python debugger from the ide, so you have to configure intellj how to start up solara
mariobuikhuizen
mariobuikhuizen12mo ago
@MaartenBreddels do you have an example how to start solara from a .py file? You can select debug on a .py file from intellij
MaartenBreddels
MaartenBreddels12mo ago
but you should be able to tell intellij how to add a new way to start a program right, like normally you say it to run some specific python because, we don't have a solara.run method (yet)
mariobuikhuizen
mariobuikhuizen12mo ago
It specifically needs the script file, I haven't found another way yet.
MaartenBreddels
MaartenBreddels12mo ago
Stack Overflow
How to run/debug a streamlit application from an IDE
I really like streamlit as an environment for research. Mixing a notebook/dashboard-like output I can design quickly with pure code for its definition (no cells etc.) as well as the ability to infl...
MaartenBreddels
MaartenBreddels12mo ago
python -m solara run <script> also works
MaartenBreddels
MaartenBreddels12mo ago
https://stackoverflow.com/a/73328328/5397207 this answer describes it i think
Stack Overflow
How to run/debug a streamlit application from an IDE
I really like streamlit as an environment for research. Mixing a notebook/dashboard-like output I can design quickly with pure code for its definition (no cells etc.) as well as the ability to infl...
mariobuikhuizen
mariobuikhuizen12mo ago
I think <script> will be filled in by intellij
Iftah
Iftah12mo ago
I have it almost working, intelliJ is running Solara, and it loads the module, the breakpoint stops - all is well except... it doesn't work. The browser shows: "A widget with mount-id="solara-main" should go here" This is the shell execution that IntelliJ is running:
/Users/iftah/.virtualenvs/play/bin/python /Users/iftah/Library/Application Support/JetBrains/IntelliJIdea2022.3/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 62236 --file /Users/iftah/.virtualenvs/play/bin/solara run /Users/iftah/devel/play_project/src/ui/main.py
/Users/iftah/.virtualenvs/play/bin/python /Users/iftah/Library/Application Support/JetBrains/IntelliJIdea2022.3/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 62236 --file /Users/iftah/.virtualenvs/play/bin/solara run /Users/iftah/devel/play_project/src/ui/main.py
the src/ui/main.py has the Page setup and it does stop there in a breakpoint
mariobuikhuizen
mariobuikhuizen12mo ago
The widget is not send to the frontend because the debugger is pauzed maybe?
Iftah
Iftah12mo ago
I'll try to run without the breakpoint no, same thing when it runs without breakpoints I can use pdb and good old print() meanwhile, but I really prefer to use the IDE so I'll come back to it later
MaartenBreddels
MaartenBreddels12mo ago
mario has it working now he'll share his settings
Iftah
Iftah12mo ago
ahhh sorry, my bad! now I see I have the same error when I run the script from the terminal. I've been blaming IntelliJ for no reason
mariobuikhuizen
mariobuikhuizen12mo ago
Settings reference:
No description
MaartenBreddels
MaartenBreddels12mo ago
ok, good to know do you think this should go in the docs?
Iftah
Iftah12mo ago
thanks Mario and Maarten I still don't know why I get the "A widget with mount-id="solara-main" should go here" but it has nothing to do with the debugger setup and the browser console showed me my error 🤦‍♂️ Regarding the adding to the docs - I think it can be helpful for beginners, but it's also simple enough to leave out of the docs... your call.
I am not a beginner myself but I was just stupid and unlucky to cause an error just as I was trying to set it up and blamed the wrong thing for the error
mariobuikhuizen
mariobuikhuizen12mo ago
But, you still have the mount-id error when running from the cli?
MaartenBreddels
MaartenBreddels12mo ago
https://github.com/widgetti/solara/pull/184 I've opened this PR, maybe you can take a look and possibly add a description to the section
MaartenBreddels
MaartenBreddels12mo ago
it will save people quite some time i think. But maybe this sparse documetnation is already enough