Building Command Line Interface with Click and Argparse

In a Deep Dive course Part I by Fred Baptiste I learned about how to use sys.argv and module argparse. However, I wanted to get a deeper understanding of the subject. Therefore, I took additional two tutorials on this subject. o The first intermediate-level tutorial I completed is the “How to Build Command Line Interfaces in Python With argparse” offered by Real Python. The instructor of the tutorial is Davide Mastromatteo. In this tutorial, I learned how to: • Setting the Name of the Program • Displaying a Custom Program Usage Help • Displaying Text Before and After the Arguments Help • Customizing the Allowed Prefix Chars • Setting Prefix Chars for Files That Contain Arguments to Be Included • Allowing or Disallowing Abbreviations • Using Auto Help • Setting the Name or Flags of the Arguments • Setting the Action to Be Taken for an Argument • Setting the Number of Values That Should Be Consumed by the Option • Setting a Default Value Produced if the Argument Is Missing • Setting the Type of the Argument • Setting a Domain of Allowed Values for a Specific Argument • Setting Whether the Argument Is Required • Showing a Brief Description of What an Argument Does • Defining Mutually Exclusive Groups • Setting the Argument Name in Usage Messages • Setting the Name of the Attribute to Be Added to the Object Once Parsed o The second intermediate-level tutorial I completed is the “Building Command Line Applications with Click” offered by Armin Ronacher on Youtube. He is a software programmer and the creator of the Flask web framework for Python. What makes Click special is that you can use decorators. In this tutorial I learned how to: • Create a proper piping package • Set up the entry points • Set the default • Add help strings, write this into a string • Set the default to dash • Attache a soft mount • Pass the verbose flag • Build very complex application displays You can find these tutorials at · https://realpython.com/command-line-interfaces-python-argparse/ · https://www.youtube.com/watch?v=kNke39OZ2k0&ab_channel=ArminRonacher

Our Sidebar

You can put any information here you'd like.

  • Latest Posts
  • Announcements
  • Calendars
  • etc