Python CLI apps on Fire

By Jared Trog

Elevator Pitch

Do you write python? Do you write CLI apps? Do want to write cleaner apps that provide nice command line options and flags? Come listen to me talk about building python CLI applications using the python-fire library from Google. If the talk is no good at least you were looking at python!

Description

Command Line Interface (CLI) applications are a core part of any sysadmin/devops/developer’s toolkit. Writing cli tools that are intuitive to use is critical whether checking the VMware cluster for storage volumes that are low on space, figuring out if backups ran last night, or finally fixing user provisioning on that one systems that we won’t spend the money to buy the AD integration for…

Python is a simple and expressive language with an active ecosystem of tools, plugins, and integrations that make it a critical component of any technologist toolbox. Whether you’re writing code for infrastructure operations, ci/cd, data science, or raspberry pi, a clean CLI interface can make a world of difference.

Agenda:

  • Create a python virtual environment (pipenv)
    • Who uses virtual envirionments?
    • Who uses pipenv?
    • Poetry?
    • Other?
  • Write a simple python app.
  • Set it on Fire with python-fire.
    • Simple function
    • Class
    • Class with init arguments
    • Custom Fire invocation
  • Other CLI parsing utilities
    • Invoke
    • argparse
    • Click
    • Others?
  • Q&A

Notes

This talk is applicable to sysadmins, devops engineers, data science administrators or engineers, and developers who write python scripts or use python scripts built by others. The topic is such that it can easily fill a 30 - 45 minute session with hands on demonstration, discussion around other options available to build python CLI applications, and Q&A or be compressed to fit nicely into a lightning talk with premade examples.