Learn how to create beautiful prompts in Python

Kevin Tewouda
13 min readJan 28, 2024

Enhance your command line interface with questionary

Photo by Lukas on Unsplash

While writing my article on commitizen, I was amazed by the beauty of the command line interface (CLI) and the ease of choosing menu options using the arrow keys. It’s something I’ve always wanted to do, having seen it in various CLIs, but alas, Click doesn’t let you do it.

I dug into the commitizen code to see how it worked and that’s where I discovered the questionary library. Today, we will explore what we can accomplish with this fantastic library by implementing a clone of the command poetry init. If you don’t know poetry, it is a Python package for dependency management and packaging. You can read my introduction on this topic if you want.

Just to be clear, we will not fully implement the command, things like package conflict resolution or verifying package version syntax are out of the scope of this article for simplicity purposes. You can try to implement them if you wish. 😜

--

--

Kevin Tewouda

Déserteur camerounais résidant désormais en France. Passionné de programmation, sport, de cinéma et mangas. J’écris en français et en anglais dû à mes origines.