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

Animating Sprites in Unity

Parallel Processing with RxJava

5 Powerful Ways To Use Artificial Intelligence In eCommerce

Running Minio as a pod in Kubernetes

FutureBuilder and StreamBuilder in Flutter

Cloud computing fundamentals

Enterprise Microservices Design [Part 2: Inner Architecture Zone]

Bacon Driven Development in Kotlin with Spek

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

Python Virtual Environments

Supercharge your Python CLI apps with plugin modules

Python virtual environments & libraries

Organize Files the Lazy Man’s way Using Python