Modern Python Projects Transcripts
Chapter: Let's build a CLI
Lecture: Technical considerations
0:00 We are not going to write everything from scratch.
0:03 Now We will use a few existing python libraries to make it faster.
0:08 The most important choice to make is to select what CLI Python library we will use
0:12 We could decide to not use any,
0:15 but those libraries are actually very helpful.
0:18 They let you easily turn a simple Python script into a CLI application by adding a
0:23 few decorators here and there. I have made a very conservative choice,
0:28 and I will use one of the oldest CLI libraries out there. By oldest,
0:33 I mean, it was one of the first python CLI libraries created.
0:36 Not that it's no longer updated.
0:40 Flake is doing perfectly fine, and I often use it when I need to create
0:43 a CLI tool. There are many other alternatives,
0:47 like argparse, fire or typer,
0:50 so if you want an additional challenge,
0:53 you can follow this chapter using a different library then click.
0:57 Next We'll use request library to send our head requests,
1:01 and we will also use Colorama,
1:03 which is the most popular python library to.
1:06 Add some colors in your terminal.
1:08 If you know the click library a bit,
1:10 then you might be surprised why we are adding colorama,
1:13 If Click already has support for colorized output,
1:17 that's because it's needed for people who are using windows.
1:20 If you go to the documentation,
1:23 you will see that if you are on windows and you don't have colorama installed,
1:27 you probably won't get colorized output.
1:30 So just to make sure that my code works on everyone's machine,
1:33 I will install colorama. And then,
1:36 of course, I will use Pytest for testing and sphinx for documentation.
1:41 I will also use poetry as our project management tool.
1:45 It might be an overkill for such a small project,
1:48 but I just want to show you how you can use it when building a python
1:51 project. In the next chapter. We won't use poetry,
1:55 so you will have a comparison.
1:56 How to work with and without the project management tool. Okay lets start coding.