Metadata-Version: 2.4
Name: st-launch
Version: 0.1.0
Summary: Run any Streamlit script from the IDE green Run button — no terminal, no ScriptRunContext warning, breakpoints still work.
Keywords: streamlit,pycharm,run,launch,debugger,ide
Author: Peter
Author-email: Peter <pwmbax@gmail.com>
License-Expression: MIT
Requires-Dist: streamlit>=1.30
Requires-Python: >=3.10
Project-URL: Homepage, https://pypi.org/project/st-launch/
Description-Content-Type: text/markdown

# st-launch

Run any **Streamlit** script straight from your IDE's green Run button.

The green Run button runs a file as plain `python yourscript.py`. A Streamlit
script run that way draws nothing and floods the log with *"missing
ScriptRunContext"*. `st-launch` fixes that with **two lines** at the top of your
script.

## Install

```sh
uv add st-launch
```

## Use

Put these two lines at the very top of any Streamlit script, before other code:

```python
from st_launch import launch
launch()

import streamlit as st

st.title("It works")
st.write("Pressed the green Run button — no terminal needed.")
```

Now press the green Run button. `st_launch` notices there is no Streamlit server,
starts one, and runs your file as a real app — **in the same process**, so the
debugger and breakpoints still work, and the warning never appears.

Both ways of running work:

```sh
uv run streamlit run app.py   # the normal way
# ...or just press Run in the IDE
```

## Why a function, not just `import st_launch`

The server call **blocks**. If it ran during the import, Python would hold the
import lock while the server runs, and Streamlit's re-run of the file would wait
on that lock forever — a deadlock (the page frame loads but nothing draws).
Importing only *defines* `launch`; the blocking happens when you *call* it, after
the import is finished and the lock is released.

## License

MIT
