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