Bringing your Python script to more users!

Quick tour from CLI through GUI to Web app with image size reduction script

Takuya Futatsugi

Beginners Command-Line Web Servers and MicroFWs (Flask/Tornado/Nginx/...)

See in schedule Download/View Slides

It is wonderful to automate boring stuffs with Python.
In Japan, new introductory books are being published every month and more and more Pythonistas are working on automation.
A Python script that is useful to you may be useful to others.
So I talk about how to enable others to use your script.

In this talk, I use a simple script which can reduce the width and the height of a specified image in your computer.
I assume someone who's read the introductory book can understand the script.

First, I introduce Command Line Interface (CLI) to solve hardcoding in the sample script.
After implementing CLI, you don't need to edit the script.
Second, I introduce Grafical User Interface (GUI) to make the script more user-friendly.
Finally, I introduce web application so that users can the script without installation. All users have to do is connecting the Internet!

The timeline is supposed to be the following:

# Introduction (3min)
- self-introduction
- motivation of this talk
- sample script (pathlib, Pillow)

# CLI (5min)
- problem: need to edit the script
- introduce argparse module (pass target file path from command line)
- about positional arguments and optional arguments
- check whether a path points an existing file (type parameter of add_argument())

# GUI (9min)
- problem: CLI is not easy to handle than GUI
- introduce eel
- eel's elements: HTML, CSS, JavaScript
- hello world in eel
- file access in eel app
- convert sample script to eel app (user can see which image is specified as target😃)
- how to distribute

# Web app (9min)
- problem: Users need to install
- introduce Web app
- server / client
- actually eel's elements are used in web app (we can recycle codes)
- introduce Flask
- hello world in flask
- static files in web app
- how to deploy (heroku)

# wrap up (1min)
# Q&A (3min)

Type: Talk (30 mins); Python level: Beginner; Domain level: Beginner

Takuya Futatsugi

Work history
- In 2016, started a career as a software engineer
- In 2017 Autumn, started Python as a hobby
- from 2019, engaged in Natural Language Processing at Uzabase, inc. Tokyo, Japan

In Pythonista Community (as nikkie)
- PyCon JP 2019, 2020 staff
- translate [Django Girls Tutorial]( into Japanese