19 Replies
you can probably add a python debugger from the ide, so you have to configure intellj how to start up solara
@MaartenBreddels do you have an example how to start solara from a .py file? You can select debug on a .py file from intellij
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)
It specifically needs the script file, I haven't found another way yet.
https://stackoverflow.com/questions/60172282/how-to-run-debug-a-streamlit-application-from-an-ide this is a similar issue
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...
python -m solara run <script> also works
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...
I think <script> will be filled in by intellij
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:
the src/ui/main.py has the Page setup
and it does stop there in a breakpoint
The widget is not send to the frontend because the debugger is pauzed maybe?
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
mario has it working now
he'll share his settings
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
Settings reference:
ok, good to know
do you think this should go in the docs?
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
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
But, you still have the mount-id error when running from the cli?
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
it will save people quite some time i think. But maybe this sparse documetnation is already enough