Welcome back.
I just found this python package, pi jokes.
And mind you, I have never installed this, so I'm going to try and do this from scratch so you can
see what the steps would be like.
So this is a completely useless package.
It looks like it gives us one line jokes for programmers, so I think this will be appropriate.
I also like the fact that it has GitHub stars.
So here sometimes some of these packages have are hosted on GitHub and GitHub is essentially a social
network for programmers.
You're able to put up your code up here and people can ve your code and download it.
And a good measure of how popular a package is is usually something like stars or forks, because stars
are given by people that really like the package or fork is people who copy the package and use it in
their own coding, maybe on their own GitHub profiles.
So this looks like a very simple library.
So let's, let's install it.
So there's several ways that we can actually install this package.
You can see here that the command is pip install py jokes, but I want to show you first how it works
with py charm and then show you how to do it with the command line.
So I have pie chart over here.
We have some relics of our old project.
Now in here in chart again, it's an ID, so it comes with a lot of built in things.
I can do charm preferences and then simply go to project modules.
I can go to Project Interpreter and then here I see that this interpreter has some modules already.
Pre-installed I see that I have Pip, but all I need to do is click on the plus sign here if I click
plus.
I can actually here search for packages.
So these are all the available packages that we have.
So what was our thing called again?
Pi jokes.
All right.
Let's search for Pi jokes.
Pi jokes.
There it is.
I think it was this one with 0.5 with the author joke society.
Just making sure that it's the same one.
Yep.
Author Pi Joke Society.
So all we need to do here is to simply install package.
There you go.
Pi jokes installed successfully.
So now that I have pie jokes here, let's have a look at how we can use it.
By the way, I can actually test to see that I have this installed.
If I go to lib python 3.7 site packages, there's my pie jokes distribution.
Awesome.
So let's see how we can use it again.
I've actually never used this before, so let's have a look.
You can also access jokes in your own project by importing PI jokes.
All right, let me just copy that.
And using the function, get joke and get jokes.
All right, sounds simple enough.
Let's give that a go.
I'm going to import PI jokes like that.
And then what was the function?
The function was get joke.
So let's do PI jokes.
And then say, get.
Get.
Joke and I can see that I can give it a language and category.
So let's say get joke here.
So string is English.
So let's do we want the joke in English and category?
Let's see.
It says we can do neutral.
What are the options here?
Neutral is neutral geek jokes.
No adult jokes for us.
We can do Chuck Norris jokes.
All right.
Neutral is fine.
That's the default.
So we actually don't even need to pass anything here.
But just to be safe, let's do neutral.
All right, let's.
I don't know what it's going to do, so let's just run this program and see what happens.
All right, let's print out the joke.
Let's say joke equals.
And then say print.
If I click Run.
Real programmers can write assembly code in any language.
Ha ha ha.
All right, there's our completely useless package.
Let's do another one.
Let's see if there's any funny ones.
How to explain the movie Inception to a programmer.
When you run a VM inside another VM, inside another VM, everything runs real slow.
All right.
Some of these jokes, I'm sure, are pretty funny.
Some of them might be a little bit advanced, but, hey, that's actually not bad.
You know what?
I might use this package in the future, I think.
I think this is fun, but I won't bore you with me.
Keep pressing play.
I might.
I might not record for a few hours and just waste time reading these these jokes.
But I just wanted to show the process of how I would go about doing something like this.
Now, most programmers that don't use Pi charm instead of doing what I did, will most likely use,
let's say, their terminal to actually do this.
So I have my sublime text here and my terminal or command prompt if you're on windows right here and
if I do present working directory again, this is a Linux and Mac command, so I see I'm on the desktop,
which is where my one pi file is now if I wanted to use.
The pie jokes in here.
And I click run.
So let's say Python 3.1.2 pi.
Module not found, no module named Pi jokes.
That's not good.
But that's because we installed it for our pi char environment, but not not for us to use outside of
pie chart.
So how can we do that?
Well, we can do pip to install from the Pi Pi library or the repository.
So again, if I go all the way up, you see that I have pip install pi jokes so I can even copy this
and just install it.
For myself here.
Now, here's the thing.
Depending on how you have your machine set up.
If I do pip dash.
V with capital v.
It's going to give me the version of Pip.
But you see here that it says from Python 2.7, we want to make sure we're using Python three.
So in your case, if you do pip three, dash v.
You'll get the right version of Pip.
So make sure you check that and make sure that you're using with the python three or higher.
In my case, I'll have to call Pip three.
You can always set this up so that PIP refers to the Python three.
But for now, let's say pip three.
And then we're going to install.
And here all we say is the package name we want to install.
In our case, it's the pie jokes package.
All right.
It's collecting pi jokes succesfully installed PI jokes 0.5.
I also get a little warning here.
You're using PIP version 19 .0.3.
However, version 19.1 is available and you might get this and I always recommend just upgrading.
So I'm just going to copy the command that they give us and I'm going to say pip install, upgrade,
pip.
Now I'm going to do PIP three.
All right, so I've successfully updated Pip.
So again, pip three v.
Now.
House version 19 .1.1.
If I now let's say clear here and do pip list.
I see that it shows me all the lists of the packages that I have and if I scroll up here, I see that
I have.
Where is it?
Well, I use the pip command instead of pip three.
So let's do Pip.
Three.
List.
So this is something that you just have to be careful of.
You can see Pip three list is looking a lot nicer.
Let's see.
I see that PI jokes is installed.
Awesome.
So now that I have this, let's run it so I can run Python three.
And then say, I want pie.
Oh, what an appropriate joke.
I swear I did not time this.
This is just the programming universe telling us something.
Says Friends don't let friends use Python 2.7 because hey, we should get this joke.
Python three is the current and latest.
Oh, that's funny.
That's actually I'm pretty pleased.
I feel like we should end the video here because this is this is just perfect.
All right, well, this is how you install packages with pi.
Pi.
We are able to really use the power of the developers all around the world using just the simple command,
pip or pip three install and whatever package we want across the world, across the Internet we have
access to in our projects.
I'll see you in the next one.
Bye bye.