How to Write Perfect Python Command-line Interfaces — Learn by Example by Yannick Wolff

April 3, 2019

This article will show you how to make perfect Python command line interfaces, to improve your team productivity and comfort.

As Python developers, we always use and write command-line interfaces. On my Data Science projects, for example, I run several scripts from command-line to train my models and to compute the accuracy of my algorithms.

This is why a good way to improve your productivity is to make your scripts as handy and straightforward as possible, especially when you are several developers working on the same project.

In order to achieve that, I advise you to respect 4 guidelines:

  1. You should provide default arguments values when possible
  2. All error cases should be handled (ex: a missing argument, a wrong type, a file not found)
  3. All arguments and options have to be documented
  4. Read the rest of this story with a free account.

    Already have an account? Sign in

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
© HAKIN9 MEDIA SP. Z O.O. SP. K. 2023
What certifications or qualifications do you hold?
Max. file size: 150 MB.

What level of experience should the ideal candidate have?
What certifications or qualifications are preferred?

Download Free eBook

Step 1 of 4


We’re committed to your privacy. Hakin9 uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.