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

Apr 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

Subscribe
Notify of
guest

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

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
© HAKIN9 MEDIA SP. Z O.O. SP. K. 2023