Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 5: Real-time weather client
Lecture: Concept: Python Package Index (PyPI)
0:00 Let's talk about the Python package index.
0:03 You can think of the Python package index
0:05 as the place where you can go to find all these amazing packages
0:10 that can add super powers to your application
0:13 so quite literally in a few lines of code you can install
0:16 amazing HTTP clients as we are going to with Request,
0:19 screen scraping libraries, scientific visualization libraries,
0:24 code coverage, testing libraries,
0:26 you name it, chances are you can find it on PyPi.
0:30 Sometimes you will hear PyPi referred to as PyPy,
0:33 that is kind of considered not really correct,
0:36 there is also an alternate implementation of Python that is called PyPy
0:39 so it's also a little confusing with that,
0:41 so PyPi if you go back aways, people have also referred to this as the chi shop,
0:46 building on the whole Monty Python history of Python itself.
0:50 Now, look at how many packages are in here,
0:52 there are 75,633 packages or libraries that you can just go out and grab,
1:00 and bring into your application.
1:02 Let's go to the website PyPi.python.org/pypi
1:06 because who wouldn't want a little reputation in their url, anyway right.
1:09 Over here, we have the Python package index
1:12 and you can see when I took that screenshot just yesterday,
1:16 there was 75,630 ish today, there are 75,690,
1:22 so that is around 60 new packages added just in the last day.
1:26 That's not updating packages, that of course happens all the time,
1:29 but new packages that were not there before.
1:32 That is really awesome.
1:33 Let me show you one other thing,
1:35 it's kind of a part of the trick but it's really awesome and pretty cool
1:38 and it makes you feel good about working with Python,
1:40 so I told you that Python is often referred to
1:43 as a programming language with batteries included,
1:45 meaning it has a really rich standard library with lots of functionality built in,
1:49 you wrap on the Python package index
1:52 and you get 75,000 more amazing things
1:55 and so the xkcd comic took that and did a really interesting little twist
2:00 and so let's go over here and actually not go to the web where xkcd is
2:04 but let's go to Python and actually launch Python 3.
2:07 Remember the way you use any of these packages from the package index
2:11 or the standard libraries, you say import
2:13 so you would say import OS to work with path and so on
2:16 but the cartoon goes something like this,
2:19 import antigravity, because in Python you can import anything it basically exists,
2:25 so what is going to happen if I hit enter,
2:28 literally inside Python when I say import antigravity well, something pretty funny,
2:32 it actually takes us over to the webpage where the cartoon is
2:35 so let's check this out, so the guy asks, "How are you flying?"
2:38 "Python, I just learned it last night, everything is so simple,
2:42 hello world is just print hello world!"
2:44 "I don't know, don't you have like typing white space" little weird,
2:48 "Come join us, programming is fun again,
2:50 it's a whole new world up here".
2:51 "But how are you flying?"
2:53 "I just imported antigravity." "That's it?"
2:55 "Well, I also sampled everything in the medicine cabinet for comparison,
2:58 but I think this is the Python".
3:01 So this little cartoon really captures the fact that there is so many things
3:05 you can just install and import and do amazing with.
3:09 That is one of the reasons Python is so fun to work with.