|
| 1 | +--- |
| 2 | +jupyter: |
| 3 | + jupytext: |
| 4 | + text_representation: |
| 5 | + extension: .md |
| 6 | + format_name: markdown |
| 7 | + format_version: '1.3' |
| 8 | + jupytext_version: 1.14.0 |
| 9 | + kernelspec: |
| 10 | + display_name: Python 3 (ipykernel) |
| 11 | + language: python |
| 12 | + name: python3 |
| 13 | +--- |
| 14 | + |
| 15 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 16 | +## Sharing scientific tools: script to desktop application |
| 17 | + |
| 18 | +### Background processing with Traits Futures |
| 19 | + |
| 20 | +**Jonathan Rocher, Siddhant Wahal, Jason Chambless, Corran Webster, Prabhu Ramachandran** |
| 21 | + |
| 22 | +**SciPy 2022** |
| 23 | + |
| 24 | +<!-- #endregion --> |
| 25 | + |
| 26 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 27 | +## Traits Futures: |
| 28 | + |
| 29 | +- Common problems with GUI frameworks: |
| 30 | + - GUIs are unresponsive during heavy computation |
| 31 | + - GUI toolkits generally require that widgets are only updated from the |
| 32 | + thread from which they were created |
| 33 | +- Traits Futures solves both these problems: |
| 34 | + - keeping the UI responsive |
| 35 | + - safely update the UI in response to calculation results |
| 36 | +- Dispatching a background task returns a `future` object which provides: |
| 37 | + - information about job status (e.g., job partially finished, completed, |
| 38 | + failed) |
| 39 | + - access to the job result |
| 40 | +- Incoming results arrive as trait changes on the main thread, ensuring thread |
| 41 | + safety |
| 42 | +- Supports simple callbacks, iterations, and progress-reporting functions |
| 43 | +- Supports thread pools (default) and process pools |
| 44 | + |
| 45 | +<!-- #endregion --> |
| 46 | + |
| 47 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 48 | +## Traits Futures |
| 49 | +- Let's dive in with an example |
| 50 | +- Installation: |
| 51 | + - `edm install -e ets_tutorial traits_futures` |
| 52 | + - Conda/pip: Activate virtual environment and `pip install traits_futures` |
| 53 | + |
| 54 | +<!-- #endregion --> |
0 commit comments