Understanding Python: Click-based CLI

preview_player
Показать описание
In this video, I go over how to create a command-line interface using the third-party library for Python called Click.
Included in the lesson is how to use Click's decorators to add arguments and options for users of your script and how those arguments and options are handled in the function itself.
As always, if you have any questions or suggestions for future videos, please leave a comment down below.

Timelapse music: 失望した by Eva
Outro music: Elix by Synthness
Рекомендации по теме
Комментарии
Автор

The way you explained is truly amazing. Subscribed right

turugasairam
Автор

I swear, at this rate we'll have a 3 line pizza builder app in a couple more videos.
Thanks man.

ingydegmar
Автор

Subscribed immediately when u explained their decorators rather than just going over the functions. Looking at your subscribers count u are underrated. Maybe make some fancy thumbnails going forward to make people click.

vickylance
Автор

Excellent! Well done, should be >100, 00 views...
thanks.

rob_mccormack
Автор

No doubt I have gained a lot, provides a lot of details,unlike the anothers,not only talk about how to code but also talk why code.especially use ipython to find the diffrent between a to b,i do not know the way that before this!very great!

hoox
Автор

Another great tutorial! Awesome work Jake.
I just thought it's a bit uncomfortable to write -t in front of every topping we want to pass, and hence searched the documentation. Unfortunately, click by default has no help for passing multiple args while writing the option name only once. But I think a custom class/function and some clever str manipulation can do the trick. Other than that, I feel click is a great tool for every python programmer to have.

Do you have some custom class to handle such scenarios? I think it'll relatively easy to build one. I am guessing we could even use a namedtuple object for this.

Cheers and Kudos!

cheesecake_mafia
Автор

Great video, thank you so much…, just for info, if you can do a video about python fire, its much better and easy than click

arturocdb
Автор

I added this to cause help to show if no arguments
#cause help to run help
which I think would be the preferred behavior.

rob_mccormack
Автор

Maybe I'm missing something but your help says the syntax is
pizza_builder.py [OPTIONS] [s|m|l] etc... but you are throwing your options AFTER... so your help string is wrong... right?

I would expect your syntax to be
pizza_builder.py -t onions s thin

I'm probably missing something but I think there's too much magic going on with Click. I prefer argparse.

Matt-dkwl