those who prefer to read in text In Japanese gihyo.jp Python Monthly Topics April 2024 Building Desktop Applications with Python Web UI Frameworks https://gihyo.jp/article/2024/04/monthly-python-2404
Outline • What is a Python Web UI Framework? • Comparison of Python Web UI Frameworks • How to Create a Streamlit Application • Applying to Multi-platform Desktop Application • About the Build Environment Slide
寺田 学 (Manabu TERADA) • CEO of CMS Communications Inc. • PyCon JP Association Board member • Python Asia Organization Founder and Board member • PSF Fellow
is Python Web UI Framework? Features • Composed only of Python code • No knowledge of front-end (HTML/CSS/JavaScript) • No knowledge of back-end APIs, communications, etc. • Interactive, from form input to result display • Interactive display of graphical representations, etc.
Application Comparison Web UI Frameworks • Python Code Only • Masking the front-end • Hiding communication details • Limited flexibility Server side Frameworks • Separate front-end • Decide on communication method • Often works with RDB • High degree of freedom vs
of Python Web UI Frameworks • Quickly create web apps • Can be created using only Python code • Easy to convert JupyterLab and other code into web apps • Easy hosting and no complicated configuration
of Python Web UI Frameworks • There are more than 10 projects • Last year was like a festival of Web UI frameworks • Find one you like and give it a try!
Overview • Standard Tools ML Models from PoC to Automation Developed by Snowflake Inc. Official Site https://streamlit.io/ PyPI https://pypi.org/project/streamlit/ Latest Version 1.42.0 Server side Tornado Front-end React License Apache Software License
Overview • Popular in AI systems From AI/ML demos to apps Developed by Hugging Face Official Site https://www.gradio.app/ PyPI https://pypi.org/project/gradio/ Latest Version 5.16.0 Server side FastAPI Front-end Svelte License Apache Software License
Overview • Popular on dashboards Data stream support Developed by Plotly Official Site https://plotly.com/dash/ PyPI https://pypi.org/project/dash/ Latest Version 2.18.2 Server side Flask Front-end React License MIT License
Overview • PyData-based development Panel application for data systems Developed by Holoviz Official Site https://panel.holoviz.org/ PyPI https://pypi.org/project/panel/ Latest Version 1.6.1 Server side Tornado Front-end React License BSD License
a Streamlit Sample Application sample app • Name:st-matrix-chart • Goal: Displaying a 2D matrix with Streamlit • Function: ◦ Select columns from Excel data and create a two-dimensional visualization such as a priority matrix • Repo: ◦ https://github.com/terapyon/st-matrix-chart
Application Conversion Methods for Desktop Application Conversion • Tool: @stlite/desktop ◦ https://github.com/whitphx/stlite/blob/main/packages/desktop/README.md • Using Pyodide to run Python code inside a web browser • Bundled as an Electron app • Configuration: Writing package.json ◦ https://github.com/terapyon/st-matrix-chart/blob/main/package.json
application commands $ npm install Build and Starting command $ npm run dump st_matrix_chart -- -r requirements.txt $ npm run serve The application will be launched.
Environment Build with GitHub Actions • Local environment is difficult to support multiple OS • Convenient to build in the cloud • Configuration: build.yml ◦ https://github.com/terapyon/st-matrix-chart/blob/main/.github/workflows/build.yml • Put the file in a GitHub release