Heading image


  1. Familiarity with Pipenv. See here for my post on Pipenv.

Getting started

Let’s create the hello-fire directory and install python-fire.

The CLI script

For our demo example, we are going to take a slightly modified version of grouping commands script to demo how to run subcommands.

Adding the code

We set the base commands through the Pipeline class and the subcommands through their own class that is initiated as properties of the Pipeline class.

Running the script

To run the script, we need to ensure we are running the Pipenv virtual environment.


Today’s post demonstrated how to use the python-fire package to write easier CLI scripts with their own subcommands and instance-managed state.

Resources and further reading

  1. The ABCs of Pipenv for the minimum you will need.
  2. Hello, JupyterLab.
  3. Python Fire
  4. Pipenv




Senior Engineer @ UsabilityHub. Formerly Culture Amp.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The World of Sol Zombie NFT

Dev Team Performance and Burnout — Everything You Need to Know

My ULTIMATE Developer Workstation Setup — CodeWithMike

Cloud-Native Batch and Streaming Applications

Packaging PyQt application using pyqtdeploy for both Linux and Android

Effective habits for budding web developers

Barrel Internal Surface Control System

Morphological image processing operations- Dilation, Erosion, Opening and Closing with and without…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dennis O'Keeffe

Dennis O'Keeffe

Senior Engineer @ UsabilityHub. Formerly Culture Amp.

More from Medium

Uploading python packages to be used by anyone with python


Statement Control by Python

One Great Idea to Rescue Your Great Idea

How these 2 python libraries are making our lives easier