Skip to content

Commit 912c835

Browse files
committed
Video transcripts for responder mini course.
1 parent 70b70db commit 912c835

25 files changed

+1279
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
00:00 Hello and welcome
2+
00:01 to this short mini course on
3+
00:03 the Responder web framework.
4+
00:05 Maybe you've heard of Responder
5+
00:07 it's written by this guy, he's done a few
6+
00:09 open source projects in Python
7+
00:10 his name's Kenneth Reitz.
8+
00:12 So, likely you've heard of Kenneth
9+
00:13 because of his Requests library
10+
00:16 and Kenneth is pretty well known
11+
00:17 for creating clean and well liked APIs.
12+
00:22 So, when he said hey, I know there's a bunch
13+
00:24 of web frameworks out there, but I'm going to
14+
00:26 create another one to put my stamp on
15+
00:28 what that API might look like
16+
00:30 well that got my attention.
17+
00:31 And probably it got your attention as well.
18+
00:34 So, if you want to see what this web framework
19+
00:37 that Kenneth Reitz came up with looks like
20+
00:39 and take it for a tour
21+
00:41 well you've come to the right place.
22+
00:43 Let's talk quickly about what we're going to cover.
23+
00:46 First, I'm going to talk about some of the key features.
24+
00:48 After all, with this mini course
25+
00:49 we're not going to be able to dive deep
26+
00:51 into some of the really intriguing things
27+
00:53 that this framework takes on, for example
28+
00:55 it has async run as background work
29+
00:58 that you can run in process.
30+
01:00 It has web socket support
31+
01:02 it has really good async methods
32+
01:05 that you can work with.
33+
01:06 And we're not going to dig deep into that
34+
01:08 but we will talk a little bit about it.
35+
01:10 We're going to go and build an async capable API
36+
01:14 and notice I didn't say async API
37+
01:15 because we're not actually going into async here
38+
01:18 that's well beyond the scope of this
39+
01:20 I have a very long course on that
40+
01:22 and you're welcome to take it and it's super, super powerful
41+
01:24 and it's one of the things that drew me
42+
01:25 to this framework, however we're not
43+
01:27 going to go into those details.
44+
01:29 If you know async in a way, all the view methods
45+
01:32 and API endpoints we create here with Responder
46+
01:35 you can put async def on the method
47+
01:37 and you can do await within it
48+
01:39 it's really, really great for scalability
49+
01:41 but again, we're not going into it.
50+
01:43 We're going to create two kinds of views
51+
01:45 or processing with this web framework.
52+
01:47 One is going to return templated Jinja2 based views.
53+
01:51 I'm going to go to the database to go to a data source
54+
01:53 and then I'm going to convert that into
55+
01:57 a dictionary, I'm going to pass that dictionary
56+
01:58 to a Jinja2 template, Jinja2 template's going to be
57+
02:01 rendered into rich HTML, that's great.
58+
02:04 The other kind are more HTTP API endpoints.
59+
02:08 Here we're going to do a get request
60+
02:10 or a post request over to an endpoint
61+
02:12 and return some kind of JSON.
62+
02:14 These JSON endpoints, they're fun
63+
02:16 and they're cool, but you know
64+
02:17 they just exchange little bits of data.
65+
02:19 Wouldn't it be fun if we had
66+
02:20 a really awesome app built around it?
67+
02:23 Why, yes it would.
68+
02:24 So, we're going to take an app that I built
69+
02:26 using Vue JS to explore this API
70+
02:29 and it's really fun, it's really interactive.
71+
02:31 Again, same reasons as async
72+
02:33 we're not going to go into Vue
73+
02:35 I'm going to show you how the app works
74+
02:36 I'll give you like the one minute flyer
75+
02:37 of Vue JS, but I will give you this
76+
02:40 rich application that works with this API
77+
02:42 that we will build during the class.
78+
02:45 Now, I said it a few times but I just
79+
02:46 wanted to remind you, this is a fast course
80+
02:48 we're just going to go really quickly
81+
02:50 into some of the key elements of Responder
82+
02:52 we're going to build some JSON APIs
83+
02:54 we're going to build some cool apps to consume it.
84+
02:57 Think we're going to have a lot of fun.
85+
02:58 So, with that in mind, let's just keep moving.
86+
03:00 Now, what do we expect you to know
87+
03:01 in order to take this class
88+
03:03 and get the most out of it?
89+
03:04 Well, Python obviously.
90+
03:06 We're not going to cover any of the foundations
91+
03:08 you don't know what a foreign loop is
92+
03:10 or things like that, there's other places
93+
03:12 you probably should start and then come back here.
94+
03:14 This assumes that you know like the majority
95+
03:16 of the core Python language.
96+
03:18 We're not doing meta classes and deep things
97+
03:20 but the basic Python syntax, you should
98+
03:22 definitely have that down.
99+
03:23 And it is a web framework, we're not going
100+
03:25 really deep into the foundations
101+
03:27 of what REST APIs are or why you care about them.
102+
03:30 Or what HTTP verbs are, we're going to assume
103+
03:33 you kind of are familiar with that
104+
03:34 and we want to build something in Python with Responder.
105+
03:37 These are the expectations for the course.
106+
03:39 And finally, let me introduce myself, who am I?
107+
03:41 Who's this guy talking to you?
108+
03:42 My name's Michael Kennedy
109+
03:43 that's a picture of me, you can find me
110+
03:45 on Twitter @MKennedy.
111+
03:47 You might know me from the Talk Python to Me podcast
112+
03:49 you may also know me from the Python Bytes podcast
113+
03:52 but most relevant for this conversation
114+
03:55 I'm the founder and one of the main authors
115+
03:57 at Talk Python Training.
116+
03:59 Welcome, welcome to the course.
117+
04:00 It's going to be a lot of fun
118+
04:02 and it's not going to take a lot of time
119+
04:03 so I think that's a beautiful mix
120+
04:05 and I hope you enjoy it.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
00:00 Now we're almost ready to start writing some code
2+
00:02 and talking about this framework.
3+
00:03 But before we do, let's just make sure everyone's on a
4+
00:05 level playing field.
5+
00:06 There's a couple things I want to share with you.
6+
00:08 A couple things I want to give you.
7+
00:09 And, also want to make sure you have what you need
8+
00:12 to take this course.
9+
00:13 So the first thing I'm want to start with is
10+
00:15 what version of Python do you need.
11+
00:17 Well of course we're on modern Python.
12+
00:20 That in my mind I guess, is probably like
13+
00:22 Python 3.5 and above.
14+
00:24 But you're actually going to need Python 3.6 'cause
15+
00:26 I believe we use some f-strings.
16+
00:28 f-strings are a new way to format strings in Python
17+
00:30 which are great.
18+
00:31 Also it has async and await which came in 3.5
19+
00:34 but I believe some of the features that were added
20+
00:37 also required a little bit later.
21+
00:39 So let's just say, 3.6 or later, maybe even 3.7.
22+
00:42 Newer is better. You have to have Python installed
23+
00:45 and it has to be Python 3.5 at an absolute minimum.
24+
00:49 Ah, could be higher still. You may even wonder all
25+
00:52 "That's great Michael I, really want to have Python installed
26+
00:55 but do I on this particular machine".
27+
00:57 I don't know. Well you can always ask.
28+
00:59 You can go to your terminal in macOS or Linux
29+
01:02 and type python3 -V and it will tell you, one of two things.
30+
01:06 Either the version number or Python 3 not found.
31+
01:09 If Python 3 not found, that means it's either not installed
32+
01:12 or just not in your path.
33+
01:13 But, you can see I got Python 3.7.2
34+
01:15 that's almost the latest.
35+
01:17 Just the day I started pressing record here, 3.7.3 came out.
36+
01:22 Pretty much the same. On Windows, ah, python3 -V
37+
01:26 sometimes works and you can get 3.7.2.
38+
01:30 Depending on how you've installed Python.
39+
01:32 You might have to type just python, without the 3, -V
40+
01:35 and see what you get.
41+
01:37 And especially on Windows '�ause until recently
42+
01:39 could not target the version by the executable name.
43+
01:43 You have to make sure your path is just right
44+
01:45 so you can type "where python" on Windows I think
45+
01:49 and "which python" on Mac and Linux.
46+
01:51 If that's wrong, you can switch it.
47+
01:52 It's either which or where
48+
01:53 to show you where it's come from and if there is more
49+
01:55 it'll show you which, which is in the path and where
50+
01:57 you know which one comes first in the path and so on.
51+
02:00 So if you have a new enough version of Python
52+
02:03 super, let's rock and roll.
53+
02:04 If you don't, refer you over to
54+
02:06 realpython.com/installing-python
55+
02:10 These guys have a really nice set of steps on giving this OS
56+
02:14 here's how you get Python there
57+
02:15 here's the trade off's and so on.
58+
02:17 And, they're keeping it nice and up to date, so ah
59+
02:21 instead of showing you how install and maybe
60+
02:23 you know, six months there's some other way like
61+
02:25 Windows 10 now just offered Python 3.7 in the store
62+
02:29 which is a better way that getting it off
63+
02:31 python.org for example.
64+
02:32 So you can check out what they've got here.
65+
02:34 This is pretty helpful and of course, you know
66+
02:37 get modern Python all set up if you don't have it
67+
02:38 and let's roll.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
00:00 Now, we could use whatever editor we want
2+
00:02 but I am a big fan of PyCharm.
3+
00:04 I think PyCharm strikes a really nice balance
4+
00:07 of not being too heavyweight
5+
00:09 it's somewhat heavyweight, but it's really not that bad
6+
00:11 with absolutely supporting proper web applications.
7+
00:16 So, not only does it understand CSS and JavaScript and HTML
8+
00:20 it knows Python really well
9+
00:21 and it understands the relationships
10+
00:22 between your CSS files, your static files
11+
00:25 your Python files that you're working with.
12+
00:28 It has nice refactoring.
13+
00:29 All sorts of stuff.
14+
00:31 So, we're going to be using PyCharm.
15+
00:32 You can get the Community Edition
16+
00:33 which will do most of what you need here.
17+
00:36 It'll basically do everything except for give you
18+
00:39 any form of support for the Jinja2 stuff
19+
00:41 or the CSS editing, all right?
20+
00:44 You could still create those files and edit them
21+
00:46 I'm pretty sure
22+
00:47 but with the free community edition
23+
00:48 it won't do auto-complete within them.
24+
00:50 They don't have native support for Responder
25+
00:52 built in anyway, so that's not a huge shortcoming
26+
00:55 but it is something to be aware of.
27+
00:57 So we're going to use PyCharm Professional.
28+
00:58 You can follow along with that.
29+
01:00 Or use something else if you prefer
30+
01:01 but here's how you can get the same editor
31+
01:03 that we're using.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
00:00 Now of course, everything you see me type and much more
2+
00:02 will be available to you
3+
00:04 in a free and open GitHub repository, and this one, so go to
4+
00:08 github.com/talkpython/responder-webframework-minicourse.
5+
00:13 Here, you'll see all the demo code that you'll see created
6+
00:17 even a little bit more
7+
00:18 because I had to tweak a couple of things.
8+
00:19 We added the Vue JS, there's stuff in there
9+
00:21 that we're going to talk about at the end
10+
00:24 and everything that you need to get going
11+
00:26 you can get it right here.
12+
00:27 So be sure to go to this repository, star, and fork it
13+
00:31 and that way you'll be sure
14+
00:32 to have all the materials to follow along.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
00:00 Now some of the content
2+
00:01 in fact the main demo where we build out this Responder API
3+
00:05 comes from this other course that we're working on
4+
00:08 and we have been working on for a long time
5+
00:10 called 100 days of Web in Python.
6+
00:13 Haven't heard of it?
7+
00:14 That's because this is the first time
8+
00:16 were publicly talking about it at all
9+
00:18 so workin' on this with Bob Belderbos
10+
00:20 and Julian Sequeira who helped
11+
00:22 with the 100 days of Python course
12+
00:24 100 days of Code in Python course
13+
00:25 that we already did, and this is another
14+
00:27 massive course covering all sorts of things
15+
00:29 in the web framework world.
16+
00:30 Vue JS, React, Flask, Django, Responder
17+
00:34 APIStar, you name it.
18+
00:36 If you want to dig into a bunch of different web frameworks
19+
00:39 and kind of get a survey of the entire landscape
20+
00:40 this is the course where we're doing that.
21+
00:43 It's going to be like 25 hours of content
22+
00:45 and it's going to be amazing.
23+
00:46 So in the next chapter when we build out this API
24+
00:49 some of that presentation is coming from
25+
00:51 a little excerpt from his 100 Days of Web course.
26+
00:55 Now, I didn't know anything about it
27+
00:57 or have any experience with this 100 Days of Web course
28+
01:00 but you'll see it in the demo links
29+
01:02 like in the fold or path.
30+
01:04 Things like that if you see that and
31+
01:06 you're like, wait, what is this 100 Days of Web about?
32+
01:08 Well, here's what it's about.
33+
01:09 So we took this little bit of Responder
34+
01:11 from the 100 Days of Web course
35+
01:12 and we turned it into its own proper course
36+
01:15 this little mini course that you can take right here.
37+
01:18 That's what it's about, check this out.
38+
01:19 It's not out yet at the time of the recording
39+
01:22 but maybe the time of watching.
40+
01:24 Anyway, if you subscribe to get notified
41+
01:26 somehow at training.talkpython.fm
42+
01:29 like you have an account and you haven't opted out
43+
01:31 for example, you'll definitely hear about this
44+
01:33 when it comes out.
45+
01:34 Heads up, this a little excerpt from a really big course
46+
01:37 that's been blown up to be its own proper course.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
00:00 Think back to when you were younger, much younger.
2+
00:02 And you were playing with Legos or something like this.
3+
00:05 These look like so much fun, right?
4+
00:07 And see, there's a little dragon head there in the middle
5+
00:09 and there's a bunch of blocks
6+
00:10 and maybe somethin' from a spaceship, who knows?
7+
00:13 Well, this looks like fun.
8+
00:15 But it's a lot more fun to actually follow along
9+
00:18 and build something.
10+
00:20 So this course is built for you to follow along in two ways.
11+
00:23 So I want to highlight those right at the beginning.
12+
00:25 In case you want to follow along, you can.
13+
00:27 You don't have to, all right?
14+
00:29 If you just want to watch and let it wash over you
15+
00:32 that's great, you can totally do that.
16+
00:33 But if you want to follow along
17+
00:34 there's two things you can do.
18+
00:36 First, when we work our way
19+
00:38 through all the demos and stuff
20+
00:39 you could pause the videos and just go and recreate that.
21+
00:43 You might need to grab the data that we're using
22+
00:45 off of the GitHub repository.
23+
00:47 But after that, you should be able to follow along
24+
00:48 and create it yourself.
25+
00:49 So one, step one, round one, version one
26+
00:52 of this would be to follow along.
27+
00:55 The second is this thing I'm calling "Your Turn."
28+
00:58 So if you GitHub repo, actually to this folder here
29+
01:01 linked at the bottom, you'll see
30+
01:03 we put together a separate independent project
31+
01:06 that was not presented in this video
32+
01:08 for you to also follow along.
33+
01:11 So here we are in this responder webframe
34+
01:15 marked "Minicourse", Github repository.
35+
01:17 And here's your turn I was talking about.
36+
01:19 So if we go in here you can see, there's a couple of steps.
37+
01:22 It's not like, do X, type Y, and so on.
38+
01:25 It's more like, here's some ideas of how you can explore
39+
01:28 to build something with Responder.
40+
01:31 We're going to use this Mockaroo service
41+
01:33 go over here you can see if I log in.
42+
01:36 Mockaroo will let us generate things like
43+
01:38 ID, first name, email.
44+
01:39 And I can even preview it and it'll show me
45+
01:42 some pretty cool data there, actually.
46+
01:43 But you can go further and click here and say
47+
01:45 "I would like a animal scientific name,"
48+
01:48 or, "Bitcoin address."
49+
01:50 You see, there's all sorts of stuff here.
50+
01:53 So the idea is, you go to this Mockaroo service.
51+
01:56 You look through that data source
52+
01:58 of sets of data sources you can generate, and go
53+
02:00 "Oh, I have an idea for a veterinary clinic,"
54+
02:02 "or a Bitcoin company," or whatever, right?
55+
02:06 Look through and find something interesting
56+
02:07 and generate a bunch of data.
57+
02:09 You can save it as JSON, here's a way to load it back up
58+
02:11 as JSON into Python dictionaries that you can use.
59+
02:14 And then here's a simple example of
60+
02:16 building out some sort of API endpoint.
61+
02:19 And you'll have seen this, you'll see how this goes.
62+
02:23 So here, just a reminder on how that works.
63+
02:25 And you always look back at the demo code.
64+
02:27 And I encourage you, after you've seen the short course
65+
02:29 after you've followed along, to go explore Mockaroo.
66+
02:32 Build an interesting fake data set and then
67+
02:34 build an interesting fake service to work with that.
68+
02:38 All right, well hopefully this adds a fun twist
69+
02:40 at the end of the course for you.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
00:00 Hello and welcome to Day 50.
2+
00:02 We're going to spend this one day chapter on Responder
3+
00:07 a new async web framework created by Kenneth Reitz.
4+
00:11 Maybe you've heard of Responder, but very likely not.
5+
00:13 It's quite, quite new.
6+
00:15 It's a great async-capable web framework.
7+
00:19 Why are we only spending one day on this
8+
00:21 and not diving deep into it?
9+
00:23 Well, it's really quite new and I'm not sure
10+
00:26 if it's going to survive
11+
00:27 or if it's going to gain all the traction
12+
00:28 so right now we're just throwin' it out there
13+
00:30 as another topic that you can cover.
14+
00:33 Something that you can use. I really like the API even just building small apps with it
15+
00:37 it's made me smile.
16+
00:38 It seems like there's some
17+
00:39 really great stuff happenin' here.
18+
00:41 So we're going to build a quick, simple API and website
19+
00:46 within Responder and I think that'll make you smile as well.

0 commit comments

Comments
 (0)