Metadata-Version: 2.1
Name: streamlit-process-manager
Version: 0.0.1a0
Summary: Manage the heck out of long-running processes in streamlit
Author-email: Alexander Martin <fauxjunk-1@yahoo.com>
License: MIT
Project-URL: Homepage, https://github.com/Asaurus1/streamlit-process-manager
Project-URL: Issues, https://github.com/Asaurus1/streamlit-process-manager/issues
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Shells
Classifier: Topic :: Utilities
Requires-Python: !=3.9.7,>=3.8
Description-Content-Type: text/markdown
Requires-Dist: psutil>=5.9.8
Requires-Dist: streamlit>=1.30.0
Provides-Extra: dev
Requires-Dist: tox>=4.14.2; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=8.1.1; extra == "test"
Provides-Extra: lint
Requires-Dist: mypy>=1.9.0; extra == "lint"
Requires-Dist: pylint>=3.1.0; extra == "lint"
Requires-Dist: pandas-stubs>=2.0.2.230605; extra == "lint"
Requires-Dist: types-Pillow>=10.2.0.20240324; extra == "lint"
Requires-Dist: types-cachetools>=5.3.0.7; extra == "lint"
Requires-Dist: types-colorama>=0.4.15.20240311; extra == "lint"
Requires-Dist: types-jsonschema>=4.21.0.20240311; extra == "lint"
Requires-Dist: types-protobuf>=4.24.0.20240311; extra == "lint"
Requires-Dist: types-psutil>=5.9.5.20240316; extra == "lint"
Requires-Dist: types-pycurl>=7.45.2.20240311; extra == "lint"
Requires-Dist: types-toml>=0.10.8.20240310; extra == "lint"
Requires-Dist: types-openpyxl>=3.1.0.20240311; extra == "lint"

# Streamlit Process Manager
![Streamlit Process Monitor Animation](.github/ProcessMonitor.gif)

Let's be honest, trying to manage external processes or subprocesses from a [Streamlit](https://github.com/streamlit/streamlit) app is tricky. The execution model makes it difficult to keep track of which processes are supposed to be running and which ones aren't. Half the time you end up spawning twenty different processes all trying to access the same file and stomping all over one another.

Streamlit Process Manager attempts to make a that a bit easier. It looks something like this:

```python
import streamlit_process_manager as spm

# Get the global ProcessManager
pm = spm.get_manager()

# Configure the Process and start it
my_program = ["python", "my_program.py"]
output_file = "program_output.txt"
process = pm.single(spm.Process(my_program, output_file))
process.start_safe()

# Run the process and monitor it in streamlit!
spm.st_process_monitor(process).loop_until_finished()
```

> ⚠️ **DISCLAIMER** ⚠️
>
> Runing processes on your machine from a public-facing
  application like a Streamlit app can be _incredibly_ risky and comes
  with all sorts of security considerations. Use this project on public apps
  at your own risk, and **never** inject user-provided values or arguments
  into your processes without serious consideration of all the possible injection
  attacks you might be opening your server up to.

## Installation

`pip install streamlit-process-monitor`

Requires
* `Python 3.8.*` or above
* `Streamlit 1.30.*` or above
* `psutil 5.9.8` or above


## Development

This project uses [`pdm`](https://pdm-project.org/) for most of its development tooling. Ensure you have `python3.8` installed, then run

```
pip install pdm
pdm venv create 3.8
pdm install --dev --group test --group lint
```

to get started, then run

```
pdm check
```

to verify that everything is set up and ready to go.

> If you must use Python 3.12 or greater, you may have issues with numpy 1.24 needing to be
  built from source since it only supports python versions up to 3.11.

### Testing with tox

If you have multiple versions of Python available on your system you can use `tox` to run tests
on all of them at once. `tox` should be installed when you install the `--dev` dependencies so
you can just run it. Any Python's not available on your system will be skipped.

```
pdm run tox
```
