Learn Python with Talk Python's 270 hours of courses

#279: Modern Python Developer's Toolkit Transcript

Recorded on Tuesday, Jul 21, 2020.

00:00 Python is quick and easy to learn. And yet, there is a massive gap between knowing the

00:05 common aspects of the language, loops, variables, functions, and so on, and knowing how to write

00:10 a well-factored application using modern tools and libraries. That's where learning Python

00:15 is a never-ending journey. Sebastian Witwoski is here to give us his take on a modern Python

00:21 developer's toolkit. There are a bunch of great tips in store for us. This is Talk Python to Me,

00:26 episode 279, recorded July 21st, 2020. Welcome to Talk Python to Me, a weekly podcast on Python,

00:47 the language, the libraries, the ecosystem, and the personalities. This is your host,

00:51 Michael Kennedy. Follow me on Twitter, where I'm @mkennedy. Keep up with the show and listen to past

00:56 episodes at talkpython.fm, and follow the show on Twitter via at Talk Python. This episode is brought

01:02 to you by Linode and us. Hey folks, before we jump into the interview, there's so much going on over

01:08 at Talk Python Training that I want to share not one, but four exciting announcements with you.

01:12 Number one, we released a new course that has been a passion project of mine,

01:16 understanding how memory management works in Python. We don't have enough clear info out in the world to

01:22 get a solid picture of how our code runs. So I dove in and created a five-hour course covering all the

01:28 internals of Python memory. Things such as reference counting, garbage collection, and the fascinating

01:33 allocation algorithms. We also touch on a bunch of simple techniques and patterns to employ, which allow

01:39 our code to run much faster and use only half as much memory. Check it out at talkpython.fm/mem.

01:46 Announcement number two, Chris Moffitt of Escaping Excel Hell, episode 200 fame, has written a course to

01:53 help folks escape Excel and start leveraging Python's data science stack with tools like Jupyter and Pandas

01:59 to solve the same type of problems and do the same type of computation. So if you're keen to use more

02:05 Python and less Excel, check out that course at talkpython.fm/Excel. Announcement number three,

02:12 Chris and I are putting on a free webcast pulling some of the tips and tricks out of that Excel course

02:17 to help folks move from, well, Excel to Python. If you want to join us for that live event, it's going

02:23 to be live on September 29th, 2020, and it'll of course be available as a recording afterwards. Just

02:30 visit talkpython.fm/Excel dash webcast to be part of the webcast. And number four, we've crafted a

02:39 unique learning experience for teams built on our courses over at Talk Python. We call this team

02:45 cohorts. We've already tested this for individuals and we'll be announcing something for them shortly.

02:50 But right now we're launching this experience for teams within companies. The idea is to put together

02:56 a digitally native experience that brings your team together and keeps everyone on track and gets them

03:02 ready for that big upcoming project. These experiences include a private community, weekly video calls,

03:09 a clear schedule going through one or more courses of your choosing, and a lot more. Check it out at

03:15 talkpython.fm/cohorts. Wow, that's a lot for just one week, isn't it? All of these links will be in

03:22 your podcast player's show notes. Please check them all out. This is truly the best way to support the show.

03:27 Now let's talk about some modern Python.

03:29 Sebastian, welcome to Talk Python to Me.

03:33 Hi, thanks. I'm excited to be here.

03:34 Oh, it's great to have you here. I'm looking forward to exploring this idea of a modern Python

03:41 developers toolkit. You put together a really nice tutorial, which you, quote, presented at PyCon,

03:47 like all the other folks who presented at PyCon this year. And we'll talk about that. And I think

03:51 it's going to be a lot of fun to see your take on it. You do have a lot of good advice in here.

03:56 Before we get to it, though, let's start with your story. How'd you get into programming and Python?

03:59 So you know all those cool stories about people starting to code when they were like 10,

04:04 and then they learned some ancient programming language to program a video game?

04:08 Well, that's not me. My father had a computer, but as a kid, all I did was playing video games.

04:15 And then I went to the university where I was studying automatic control and robotics.

04:20 And I had three semesters of programming. And I think first semester was C, then was two semesters

04:27 of C++. And boy, I hated C. I mean, it was so bad for me that I actually had to cheat on the exams to

04:35 even pass it. And then I switched to C++. And it was slightly better. But so I eventually forced

04:43 myself to learn C++ enough to pass all the exams.

04:46 Yeah, C++ is better. But yeah, still, it's not Python.

04:49 Exactly.

04:50 Other modern languages. Yeah.

04:51 And then at some point, I think I had to do a website. And that's when I really got interested

04:58 into programming, let's say, because, well, it was HTML and CSS. But just the idea that you could

05:05 immediately see the results in the browser was what really picked my interest. So I learned

05:10 just making, I learned some basic CSS, some basic HTML and jQuery. And that's how I got into programming.

05:16 Then I learned PHP and I started building websites.

05:19 Cool. Well, I think building websites is one of those things that while it's pretty complicated,

05:24 because there's HTML and CSS in the programming language, there's a lot of moving parts.

05:28 It's definitely one of those things that's more rewarding than a lot of lower level programming,

05:33 because you can see it right away. It's easy to share, right? You can put it up on

05:38 some site and say, hey, everyone, check out this thing that I built. Try it. It's pretty fun.

05:42 Yeah. Yeah, definitely.

05:45 Speaking of learning languages that you might not want to learn, when I was in college,

05:49 I started out in chemical engineering and then moved over to math. But while I was in chemical

05:56 engineering for just a little bit, they said, you have to take a programming course. I'm like,

06:00 excellent. I've always wanted to learn C++ or something like that. And they're like,

06:04 no, you have to take Fortran. Really? I have to take Fortran. Like, yes, you have to take Fortran.

06:09 If you want, you can take C++ as an elective, but Fortran is the most important programming

06:14 language you're going to learn in your entire life. Don't you know? And I'm like, no, it's definitely

06:19 still not true. I'm waiting for that to come true, but I don't think that was true.

06:23 Anyway.

06:24 Yeah. You got to start where they have you start, I guess.

06:27 Yeah. It's nice to see that now it's changing and Python is more and more.

06:31 Absolutely.

06:32 Becoming more and more popular.

06:34 Yeah. And I think it makes it way more approachable to people who are not there to be programmers.

06:38 Exactly.

06:38 Right. Like economists or whatever. So that's how you got into programming and found your way over to

06:45 Perl. And where did Python come into this whole story?

06:49 So once I know how to make some websites, I applied for an internship at CERN. CERN is this

06:54 European organization for nuclear research. And so they have this large hard-run collider where they

07:00 do a lot of cool stuff, but they hire not only physicists. So I applied for an internship as a web

07:07 developer. And actually the first day when I started, one of my senior colleagues went to pick me up from

07:12 the reception and he had this t-shirt saying, I enjoy learning Python. It was a nice afternoon.

07:18 So that was my first interaction with Python. It was hilarious.

07:23 That's awesome.

07:24 I had to learn Python on that job, but I really enjoyed it. So I stayed at CERN for the next six years,

07:30 building some really cool stuff there.

07:31 Oh man, that's got to be awesome. Did you work remotely or were you in Geneva or where were you?

07:38 I was working there. CERN doesn't, at least back then didn't support working remotely.

07:42 Yeah. That's got to be such a cool environment to be in.

07:45 It was. I mean, people from every country, it's crazy. You just go for a lunch with people from

07:51 around the world.

07:52 That guy has a Nobel prize, of course. So he can join us. Come on.

07:56 Yeah, quite cool. And how about today? What are you doing now?

08:00 So I finished working at CERN and then I moved to freelancing. So right now I'm a Python freelancer

08:06 based in Poland. I still do a lot of web development because I really like it. I think that's my favorite

08:12 part of programming, but I also help companies fix their workflows, set up their architecture for new

08:17 projects. And I even do some custom onsite trainings.

08:21 So that sounds like a lot of fun and it's a nice mix. So you get to try a bunch of different things

08:25 and keep your hands in them. Nice. All right. Well, let's talk about your tutorial that you

08:31 did at PyCon online, which was really, you know, people who I'm sure most people know now, but

08:37 basically the way that PyCon US handled the whole shutdown lockdown thing was they said, okay,

08:44 we're going to take tutorials and the talks and still give people a chance to present. But it was

08:50 record this as a screencast basically, and then we'll publish it to the YouTube channel and we'll

08:56 list it on the PyCon page as a list. That's what you did. And I think honestly, for yours,

09:01 that might be even better because you came up with such a nice set of digital resources that people can use

09:09 that I feel is going to be really valuable to everyone, not just the, you know, 50 people or

09:15 however many would have taken it in person there. Yeah, I agree. I looking in the hindsight, I think

09:19 that it was much better than a tutorial that I would be able to give in person because I was over two

09:26 hours. So I really had to time everything. Well, I did a lot of editing to remove some stuff and still

09:31 it's almost like two and a half hour of basically only meet. Yeah, but it's engaging. You did a good job

09:37 with it. So when you come up with this idea, like we all think about what kind of tools we use

09:43 and it's easy to get stuck in doing certain things. So, you know, I never really, I mean,

09:48 I never really wrote tests. So, you know, I'm not using pytest, for example, or I've always just

09:55 enjoyed using Vim. So I'm going to stick with Vim, even though there may be a more productive

10:00 editors, for example, out there and so on. So how'd you come up with this idea for your,

10:05 your workshop here? So I actually come up with this idea talking with people.

10:09 So I noticed that people who are learning Python, they might learn how the language works. They

10:15 might know the syntax, but then when they sit down to write a Python project, they just don't know how

10:21 to start. I mean, you can see a lot of people asking what's the deal with virtual environments,

10:25 like what they should use for testing. So I had this idea in the back of my head, like,

10:30 hey, let's, let's make a tutorial how to build a simple Python project from scratch,

10:35 explain what tools to use, and just show enough tools. So people can like, take this project and

10:42 build something bigger on top of it. So to not overwhelm people with like, too much of different

10:47 stuff. Don't toss poetry or like different styles of managing dependencies, just give them one solid

10:55 approach that they can use. Yeah. And that can be one of the challenges, right? The more guidance

10:59 that you give, the less generally applicable the result is, right? If you, that you have to use

11:07 talks in this way, and you have to make sure you have these tests, and then you have to make sure

11:11 your APIs always look like this, and so on and so on, like every layer, here's your continuous

11:15 integration, how that has to be, right? Like, it just means fewer people necessarily fit that same

11:22 workflow. And so I think you found a pretty good balance here. Thank you. I had to remove a lot of

11:27 stuff because initially, I wanted to add even more features. But then I decided to like really narrow it

11:32 down to only the essential things that you're going to need. Yeah. So you set the stage. And I think this

11:37 is hard for beginners to get a lot of times to understand, sort of internalize this feeling. But

11:44 you said that there's a huge gap between knowing Python, the language, like I know how to do a loop,

11:51 I know how to create strings, I know how to like write a function, that kind of fluency with Python,

11:56 there's a huge gap between that and knowing how to write applications or create proper projects with

12:03 Python, right? Yeah, I mean, maybe huge gap is a huge word, but there is a gap. Yeah, there's definitely

12:08 a gap. Yeah, let's say that. Yeah. So that's the gap that I wanted to fill with my, my workshop. Yeah. And I

12:14 think it's an important one. I don't want to put words in your mouth. I'll put the huge out there for

12:17 the students who are taking, say, like my beginning programming courses. I find that they all can see

12:25 the syntax, they can recreate the syntax. If you say, okay, here's a thing, I want you to loop over it.

12:30 Yeah, no problem really quickly. A lot of times they've been able to learn how to like do that and

12:35 make Python do that thing. But if you put them in front of a blank file, just open up, you know,

12:42 app.py and come up with a solution to some kind of problem, like I want to use the right data

12:49 structures, and I want to have the right libraries to talk to this, you know, to APIs and stuff. I feel

12:55 like there's, there's a pretty big gap where they feel like they just don't know where to start.

12:59 And so putting a lot of the structure in there, I think will help people get sent down in the right

13:04 direction. One thing that I thought was pretty neat about your presentation was you had a whole website,

13:11 right? A whole dedicated domain for this tutorial. Do you want to tell us about that?

13:16 Yeah. So the website is bycon.svitowski.com.

13:20 I'll link to that in the show notes so people can just click it.

13:22 I used Hugo, the static site generator with learn template. And actually I stole it from

13:29 Nina Zakarenko's tutorial that I saw some years ago. She also used this template and I really like it.

13:35 So then I found it, I think completely by accident. And I saw it. Oh, that's the website template that

13:41 she was using. So I gave it a try and it looks really good. It has a nice sidebar with all the

13:46 sections. Yeah. So you have a whole bunch, like, as you go through the tutorial,

13:51 you've got the website and you've got the video on the website, which is pretty straightforward.

13:56 But then, you know, you, for each major section, you've got like a write-up about that with links.

14:01 So people don't have to try to type down or search for the various things you're talking about.

14:05 They've, you've got the exercises that people can do walking through. So I think like, this is what,

14:11 this is what I was thinking of when I said, I feel like this is almost better because it was done

14:14 online because you have this, this whole resource for people here.

14:18 Yeah. I was trying to make this website independent of the video. So you can just,

14:22 even if you don't know the video, you should be able to go to the website and kind of follow

14:26 everything. So it's complimentary to the video, but it stands on its own.

14:30 Yeah. Cool. So there's a couple of exercises that you have the students do. Maybe we could talk about

14:36 the exercises and then we could start going through the steps and the guidance and whatnot.

14:40 Sure. So I basically have two sections of exercises. First one is done after I talk about managing Python

14:48 versions and Python dependencies. So first I explain how you can install different versions of Python,

14:54 how you can like install different versions of packages. And there is an exercise to make sure

14:59 that people understand what's the difference between virtual environment and Python version and how they

15:06 interact with each other. So I have like a set of steps, try to install, let's say this package globally,

15:12 try to install, try to create a new virtual environment, create a package there,

15:17 deactivate virtual environment, try to run this package and see what happened. Do you understand?

15:23 And then I have the second exercise. This is a bigger one. This is basically a mini project.

15:28 So at the end of the workshop, after I discuss everything, testing documentation and all this

15:34 stuff, I have a mini project to create a to-do application. So basically you take everything

15:39 that I showed you before and your objective is to create a to-do application. I wanted to make

15:45 something more interesting, but everyone knows what a to-do app is. So I decided to go for this.

15:50 That's the canonical example of a like, let's rebuild something that everyone is familiar with.

15:55 That's right. It used to be blogs, but now the JavaScript people made it the to-do app that

16:00 everyone builds. Yeah. I put a lot of thought into finding a more interesting project, but nothing.

16:04 Yeah. The problem is the more interesting it gets, the more you get lost in the details,

16:10 right? It's yeah. Anyway, it's fine. It's a cool example. All right. So there's a couple of

16:15 hands-on exercises that people get to do. That's good. Now, maybe the first big piece of advice,

16:22 but also advice that is challenging for people who've been doing a long time. And I guess to some

16:28 degree, this is probably more focused at people who are new. So that hesitancy matters less,

16:34 but is to recommend a code editor, right? People are very passionate or sticky to their code editors.

16:40 Yeah. I was really hesitating if I should include this point or not. But at the end,

16:45 I checked the Stack Overflow survey from last year and VS Code was used by basically every other programmer.

16:55 This portion of Talk Python to Me is brought to you by Linode. Whether you're working on a personal

17:00 project or managing your enterprise's infrastructure, Linode has the pricing, support, and scale that you

17:05 need to take your project to the next level. With 11 data centers worldwide, including their newest data

17:11 center in Sydney, Australia, enterprise-grade hardware, S3-compatible storage, and the next-generation

17:17 network, Linode delivers the performance that you expect at a price that you don't. Get started on

17:23 Linode today with a $20 credit, and you get access to native SSD storage, a 40 gigabit network,

17:28 industry-leading processors, their revamped cloud manager at cloud.linode.com, root access to your

17:34 server, along with their newest API and a Python CLI. Just visit talkpython.fm/Linode when creating

17:42 a new Linode account, and you'll automatically get $20 credit for your next project. Oh, and one last

17:47 thing. They're hiring. Go to linode.com slash careers to find out more. Let them know that we sent you.

17:52 You actually, at the start, you said, okay, we got to pick a code editor because you got to write

17:59 some code. Let's do VS Code. And yeah, you went through the stats from the Stack Overflow

18:04 Developer Survey, and you're like, it's like 12% in 2017. It was 30% in 2018. In 2019, it was like 50%

18:13 or something. You're like, all right, this is a pretty safe bet. A lot of people are doing this

18:16 and liking it. Yeah, exactly. Yeah. So I guess first bit of advice, would you get VS Code? You

18:22 don't have any Python tooling? Not really? Yeah. So when you install VS Code, it's pretty empty.

18:28 But the nice thing about VS Code is that when you install it, you have this welcome window,

18:33 and it says like, oh, if you're programming in Python, check out this package.

18:37 So basically, first package that you install is Python package. And it's actually the most popular

18:43 package on the VS Code marketplace. It's like way above...

18:49 By a long ways. Yeah. It's like two or three times above even the C Sharp and C++ one. And those are,

18:55 you know, very core to Microsoft, right?

18:56 Yeah, exactly. Yeah. Yeah. So when you start, you basically first install Python package. And then

19:02 once you have Python package, it's going to give you some pop-ups like, hey, do you want to install

19:07 a code formatter? Or like, hey, do you have some tests? Do you want to install a test tool and stuff

19:12 like that? So it really takes you by hand through all the steps that you need to have the basic Python

19:18 IDE. Yeah, for sure. Have you looked at PyLance, the new language extension for VS Code for Python?

19:26 So actually, no, I've heard about it from Python Bytes. Yes.

19:31 In the podcast. And then it fell off my radar. Yeah, Anthony Shaw brought that one. Yeah,

19:35 that was cool. Yeah. I thought it's going to be like built in into Python extension,

19:38 but then I saw it's a separate extension. So I kind of forgot about it. But have you been using it?

19:44 Not really. I just looked at it when Anthony and Brian and I were speaking about it. And it looks like

19:49 it looks deeper into the Python language and more across your project, more across

19:56 the libraries, looks at the documentation that might come with like the help strings and whatnot.

20:01 So you actually have to have the VS Code Python plugin. And then the PyLance plugin is like on top of that

20:08 one. So it uses the new language server thing that they've got that I don't really know much about. But

20:13 it looks I installed it. It looks like it'll be be nicer. We'll see. I haven't done a ton with it.

20:18 Yeah, I'll definitely check it out at some point. Yeah, not to start too much of a heated debate. But what

20:23 what are your thoughts on things like VS Code and PyCharm? The more GUI based helpful, trying to help

20:32 anyway, editors versus some something like Emacs or Vim? I know a lot of people still use Emacs and Vim and

20:38 the more terminal based editors. I think both are good. I mean, I'm still using Vim if I want to do some

20:43 quick edits, and I'm in the terminal. So I don't really mind it. It's just VS Code or PyCharm are more

20:49 beginner friendly. So if you're new to programming, that's you're probably gonna start with one of

20:54 those. And what I really like about VS Code is that you can use it for different programming languages,

20:59 you're not limited to Python. While if you start using PyCharm, then you can use it for Python. But if

21:06 you want to switch to JavaScript, it's not very useful. Yeah, it's weird how to make Yeah,

21:12 yeah, VS Code is more general, right? It sort of equally does Node.js as well as it does.

21:19 Python. Exactly. And you can customize it with extensions. Yeah, cool. So one of the pieces of

21:25 advice you gave around is choosing a linter and not choosing the default linter. So two questions,

21:31 what is a linter? And then why did you want to change what VS Code wanted you to do with one?

21:37 Basically, a linter is a tool that if you make some mistakes in their code, it's gonna in your code,

21:44 it's gonna shout at you and tell you that you did it wrong. And some linters are more strict,

21:48 some linters are less strict. For example, for me, Flake 8 is the best linter that I use all the time,

21:55 because it complains about, for example, if you try to use a variable that you forgot to define,

22:02 it's going to complain about it. If you define a variable that it's not used in the function,

22:06 it's going to complain about it. So it gives you hints, it doesn't try to change your code,

22:10 but it gives you hints as you're coding. Well, some people use PyLint. And it's also a good

22:17 linter. For me, it's just more strict. And sometimes it's complaining that you have

22:21 too many public methods in a class and stuff like that. So that's why I didn't like it.

22:26 I see. Okay, yeah, cool. So you basically go through and show how to, you know, when you set up the Python extension in VS Code, it says, oh, you don't have a linter.

22:34 Click here to install PyLint. And you're like, hold on, let's go over here and tell it that

22:38 we want it to use Flake 8. And then it'll say, actually, click here to install Flake 8, right?

22:42 Yeah, exactly. Because by default, VS Code tries to install everything kind of globally. And I wanted

22:48 to show people how to nicely isolate everything using virtual environment. So instead of just

22:55 letting VS Code to install Flake 8, I first show people how to use pipX to install Flake 8. And then

23:00 I point VS Code to use it. Yeah. Well, let's talk about pipX just for a second, because it's,

23:06 it is a pretty interesting way to install these kinds of tools. I'm a big fan of pipX. I think

23:12 it solves this really interesting problem. And to me, the way I think about it, this only really will

23:18 like maybe resonate with people on a Mac. But to me, it's like homebrew for Python utilities and library,

23:24 right? Maybe chocolatey on Windows is a similar type of thing, right? Some kind of central repository

23:31 where I can say install this tool. And it will just install it to my computer. That works well for

23:37 some things. But there's a bunch of things you would normally pip install, but then they have commands

23:41 like black or pytest or Flake 8 or whatever. And so pipX installs those. But usually those tools don't

23:47 necessarily belong in your project. You just want to run them against your project. And so this will create,

23:53 pipX will create a virtual environment and install that thing in isolation and sort of manage it like it's

24:00 like an application, if you will, like an app store or something.

24:02 Yeah. So there are basically two types of packages that you probably want to install on your computer.

24:07 One is packages for the project that you're currently working with. So for that, you would use a virtual

24:12 environment.

24:13 Right. Like requests or something. Yeah.

24:14 Yeah, exactly. Or like Django, you might be working on different versions of Django and you might be

24:19 switching between projects. But then there are also some packages like Flake 8, like black, maybe cookie

24:25 cutter. And for that, you probably want to have one version, preferably the most up to date version on

24:32 your computer. You don't need to have five different versions of Flake 8 for each of your project. You just

24:38 want to use the latest Flake 8 because you know it's going to catch up, catch most errors. So that's where you

24:45 would use PipX. So it lets you install package and it will act as a global package. But at the same time,

24:53 it's installed inside a virtual environment. So PipX handles all this virtual environment creation,

24:58 activation. And for you, you just see this package as normal, as if you would normally install it with

25:04 Pip.

25:04 Yeah. Yeah. It's super cool. I really like the way that that works and it manages and lets you upgrade

25:08 those things separately. So you might use that to install Flake 8 or various tools that you're going to

25:15 do, set that up in VS Code. And then another thing you talked about is by default, probably code is not

25:23 installed in the path. So you can run VS Code, but if you're on the terminal and you want to edit

25:29 something, you might want to be able to type like code space file name or code space directory name

25:35 and open those up. Right. So you've got to go and take an extra step to install that.

25:39 Yep. And I think right now VS Code will even give you a pop-up saying that, hey, you can actually do

25:45 this. And there is a command in the command palette to add VS Code to your shell. So it's getting even

25:52 more and more beginner friendly. Yeah. VS Code is interesting in that it does so many things and yet

26:00 it's not obvious what it's capable of. Right. It's, you know, if I go into PyCharm, there's a button,

26:06 you're like, oh, this button, what does it say? Oh, that means it's going to do like a profiling of my

26:11 code if I click that button. But there's no button for so many of these things in VS Code. Instead,

26:15 it uses this idea of the command palette. Right. Yeah. As you said, that's the thing, for example,

26:19 with testing, there is like no sidebar for tests. But once you set up testing tool, you have a

26:26 sidebar. Yeah. You talked about some of the commands that are useful there. And unfortunately, I only have

26:31 these for Mac. People have to translate probably command equals control. And that's pretty much it.

26:36 Open the command palette. So you hit command shift P, and then you can type all sorts of stuff. And this

26:41 is kind of how you get to all those features that we're talking about. Go to files, command P,

26:45 go to a symbol, command shift P, or command shift O, or you just command click a thing.

26:50 Go to symbol, control T, go to line, control G, command space, or sorry, control space to trigger

26:57 the IntelliSense. But you couldn't get that to work, right? If for some reason you had to like use them

27:00 alternate, like shift escape or something to make that come up. Yeah, I don't know what was the

27:05 problem. Yeah, yeah, yeah. So there's a bunch of cool commands. And I think anytime people switch into

27:10 an editor, that's not the one that they're used to using, it's really worthwhile to sit down and just

27:15 maybe even make a list of here are the top 20 most common hotkeys. Right? Because just because you're in

27:22 a GUI doesn't mean you should be using the mouse all day. Yeah. And it's interesting that you mentioned

27:26 it because before VS Code, I was a heavy sublime text user. And when I switched to VS Code, my muscle

27:33 memory was still with sublime. And actually for VS Code, you have those extensions that will bring the

27:39 keyboard bindings from other text editors. So there is an extension that will rebind some commands to

27:45 commands from sublime. There is an extension for atom and stuff like that. So for a long time, I was using

27:52 the sublime key binding. And even now, I recently reinstalled everything from scratch, I still had to

27:58 manually remap some commands because my muscle memory was just not fixable. Yeah, yeah. Sometimes it's like,

28:06 nope, this is I'm just going to always type this. So we're just going to make it do that. And that's

28:10 okay. Now, another thing that's not obvious, I think, in VS Code, especially to beginners, is how do you run

28:16 your project? Right? Like running a single file, maybe it's not too hard, right? You can there's a

28:22 little button for that. But if you open up a Flask app, and you want to use Flask run, rather than,

28:28 you know, just running the app.py or whatever, or you want to run some tests or so on, that can be

28:34 tricky. Do you want to talk people through that experience? Basically setting up a run configuration?

28:38 As you mentioned, if you want to run a single file, you can use it from the command palette, or you can

28:43 press this green arrow button, everything is fine. And you can actually even use it for a Flask server,

28:49 you just run the file that starts the Flask server, and it's going to be fine. But actual power,

28:56 better idea is to use the debug configuration, or how is it called? I don't have VS Code.

29:02 Something, yeah, launch, maybe launch configuration. I'm not sure. Something like that. Anyway, yeah.

29:07 Yeah, so it's under the sidebar for debugging. And if you don't have any launch configuration

29:12 configured, you're going to have like a button there saying configure launch file or something

29:18 like that. Once you click it, you can select one, you can select one of the popular frameworks that

29:24 are there. So you can select the Django or Flask or Pyramid configuration. And that's going to create

29:29 a launch file for you with some predefined commands. And for most cases, you should be good.

29:35 But if you want to modify, for example, some parameter that you specify at the run server command,

29:42 you can do this there. Once you have this launch file, you can actually launch a web server.

29:47 And now the cool thing is that if you put some breakpoints in your code, so you can click next to

29:53 the line number in the gutter, and it's going to put a breakpoint, this will trigger the breakpoint

29:58 in your server. So now if you go to your website, it's actually going to stop at that breakpoint,

30:05 and you can use VS Code to do debugging.

30:07 Yeah, yeah, that really unlocks the power if you set up the debug, whatever configuration to launch

30:13 those things. And yeah, because then you can do the breakpoints, watch the variables, the inspections,

30:18 all that kind of stuff. And again, the reason I think it's valuable to talk about these kind of

30:21 things is it's not obvious that this is what you should be doing to get the debugging support to work,

30:26 right? There's a lot of like implicit stuff. But once you know, it's fine. Another thing that's pretty

30:30 cool is code snippets.

30:32 Yeah, so VS Code comes with some code snippets by default. But if you install some extensions, for example,

30:37 if you install Python extensions, you're going to get even more extension, you're going to get even more

30:42 snippets, like a snippet to create a class to create a main function, let's call it like that. And then for example,

30:48 if you install a Django extension, you're going to get even more snippets like Django template tags and stuff like

30:54 that. And on top of that, you can define your own snippets. So just you just select a command, create a

31:00 snippet. And you're going to get a nice scaffolding with some information, what do you have to put in

31:05 each place, basically, that's a JSON file. So you define what's the abbreviation to trigger the snippet,

31:10 you define the description, and then you just define the code that you want to put there. And what's also

31:15 interesting is that you will have some placeholders that if you press tab, your mouse will move there.

31:22 So if you want to pre fill some values in a function, you can press tab and you will be moving between those

31:28 places. And there are some special variables that will insert, for example, the current date or the

31:34 current folder. So VS Code has this nicely documented in the documentation.

31:39 Yeah, you can build it's almost like a little scripting language. So that's super cool. And if you find

31:43 yourself just doing the same thing over and over again, maybe it should be a snippet. And then your last

31:49 thing on the VS Code topic before we move on, is you talked about a bunch of interesting extensions for VS Code.

31:57 And some of these I hadn't heard about are plugins. Let's maybe just talk about a couple of your

32:02 favorite, because I mean, obviously, the Python and the PyLance ones are there. But there's other

32:07 ones that people maybe haven't tried out, like there's a Django one, and there's a Telecode,

32:12 you want to hit the highlights there?

32:13 Sure. So apart from the obvious Python, then if you're working Django or in Flask, then there are some

32:19 plugins that will add additional snippets. And for example, for Django, it will also add some syntax,

32:25 highlighting support for Django HTML files. But apart from the obvious things, there is, for example,

32:31 a plugin called IntelliCode that will try to predict, it will try to make the auto-suggestion a bit more

32:38 smarter. So it will try to predict what's the item from the autocomplete list that you are most likely

32:46 to choose. And it will move this item to the top of this list and add this nice star. And it actually

32:52 works pretty well from what I noticed. So I can actually highly recommend it.

32:56 Yeah, cool. Yeah, uses machine learning across a bunch of open source libraries to say, well,

33:01 if you're using SQLAlchemy, these are the most common functions to be called in these situations.

33:06 And it tries to understand the context rather than just, here's the whole list, whatever.

33:11 Yeah. From other interesting stuff, there is, for example, autodoc string.

33:15 So if you define your function, you can just press enter, add triple quote, then press enter again,

33:22 and it will put some scaffolding for the documentation. It will also take the arguments

33:27 from the function signature and put it in the documentation. So it will make your life much

33:31 easier. If you're using type hints, it will also detect that it will also detect the type hints and put

33:36 them in the correct place. Oh, yeah, that's cool. That's also nice.

33:39 From non Python specific extensions, I really like bookmarks, because it makes my it makes moving

33:45 around the code much easier. So we just put a bookmark in different files, and you can easily

33:49 switch between them. And yeah, get lens is nice. Oh, yeah, get lens is a massive extension. I mean,

33:56 the amount of features it has, it's incredible. And just using very small subset, but really gives you a

34:03 really good overview of what's going on in your project, you can open repositories, comments,

34:09 branches, merge requests, whatever you want in the GitLab, GitHub, it has everything.

34:15 Yeah, I remember looking at some CPython source code with get lens installed in VS Code. And it had

34:23 something like this file change from really long ago by Gito Van Rossum or something like that. I'm like,

34:30 oh, okay, this is still like some of the original code right here. This is cool.

34:33 Talk Python to me is partially supported by our training courses. How does your team keep their

34:40 Python skills sharp? How do you make sure new hires get started fast and learn the Pythonic way?

34:45 If the answer is a series of boring videos that don't inspire, or a subscription service you pay way

34:52 too much for and use way too little, listen up. At Talk Python Training, we have enterprise tiers for

34:57 all of our courses. Get just the one course you need for your team with full reporting and monitoring.

35:03 Or ditch that unused subscription for our course bundles, which include all the courses and you pay about the

35:08 same price as a subscription once. For details, visit training. talkpython.fm/business or just

35:15 email sales at talkpython.fm.

35:21 Yeah, you also have error lens. Yeah, so error lens, you can use it to customize how you want to see the errors. So by default, you're going to have like a separate tab in VS Code that lists all the errors. But I like to see the squiggly brackets, the squiggly underscore, whenever an error happens. It will also let you customize if you don't want to see the info or hints, you can put the font size to zero and it will completely make them disappear.

35:48 So it's a nice way to customize your errors.

35:51 Yeah, yeah, very cool. Maybe the last one to just give a shout out to is Jumpy.

35:55 Oh, yeah, this is a really cool one. Basically, how Jumpy works is that you define a keyboard shortcut, you press it, and then it will show like a two letter, small two letter snippets, basically at every word in your current screen. And then if you press those two letters, your cursor will jump to that place.

36:15 So it's like incredibly convenient way to move around your code, as long as you remember to use it, because I always forget it.

36:23 Yes. And we were talking before, like, I always forget this as well. I have Ace Jump installed on PyCharm. And I can hit Ctrl semicolon and then type a few characters.

36:33 And it's kind of like find, it'll highlight all the stuff that would match that substring. But as you said, it puts one or two characters next to those things. And if you want to go to the third, like if you're doing a request.get, you could do the quick search for G.

36:47 And you want to go to the third get, it would highlight that there might be like, you might press, like why or something to get there. And it'll just immediately take you there with no mouse. It's beautiful.

36:56 And I never use it. I hardly ever use it, let's say. That's my new thing. I'm going to try to start using this more because it's awesome.

37:02 All right. Well, that's probably enough for the editor. But this is a whole lot of stuff, a whole lot of customization and specialization to really get the editor and the tools and the stuff more than just, hey, you should use VS Code, but really just set it up the way that you like.

37:17 So that's good advice. Then another problem, especially beginners are going to hit straight away.

37:22 And this one is tricky because it varies on the platform is, do you have Python? What version of Python is it? Is it the right version? Can you install packages into it? Should you install packages into it? And so on and so on, right?

37:37 Yeah. So that's the next topic I talk about after the VS Code, basically how to manage different Python versions and packages.

37:44 And why the first point is why you should not use the system version of Python, because once you mess it up, you're going to mess a lot of things on your computer.

37:52 So one of the first things that you want to do is to install some custom Python manager and switch Python version to this custom version.

38:01 I think back in the days when I was still using Linux and I was still a beginner programmer, I tried to update the global Python version, my operating system, and that broke a lot of stuff.

38:12 Yeah, I can imagine it does.

38:14 Yeah, these days when I'm on virtual machines, I will set up a virtual environment. Usually the virtual machine is meant to run one app anyway. So I'll set up a virtual environment for that app. And then in my RC file, when I log in, I'll have it activate that virtual environment. So if I accidentally type pip install something or mess with it, it's just going to mess with that virtual environment. It's very rare. I want to log in and change the system Python. It's very common. I want to log in and change the virtual environment for that particular app that server is dedicated to.

38:41 Actually, there is a setting for pip that will prevent pip running outside of the virtual environment.

38:45 There is an option.

38:46 Oh, really?

38:47 I said, yeah.

38:47 Oh, that's cool.

38:49 I don't remember it by heart, but I actually have it on my blog. I discovered it some time ago and I was super happy about it.

38:55 Nice. Yeah, that's really cool. A couple of suggestions that you have here. Obviously, we have VE and V, like Python 3-M VE and V type of thing, the built-in, which is nice that it's built-in. But you didn't start there. You started with PyE and V.

39:10 Tell us about why you chose that and what you're doing with it.

39:13 Yeah. So I wanted to show first how you can manage different Python versions and then how you can manage different Python dependencies. So basically, PyE and V is a tool that lets you install different Python versions on your computer.

39:26 So let's say you're on a Mac, so your system Python is 2.7. For whatever reason, it's still there.

39:33 That's crazy. And they're going to take it away in the next version. But they're not replacing it with 3. They're just going to take Python away or something to that effect. I remember them announcing.

39:41 Oh, cool.

39:42 So I don't know if that's better or worse. But anyway, it's not going to have Python 2 at some point.

39:46 It's probably going to break a lot of stuff.

39:48 Yeah, I think it probably will. That's Apple. All right. Sorry. Anyway, didn't mean to derail you. So you've got the wrong version of Python if you're on Mac. If you're on Windows, these days they have the Windows Store little pop-up thing, which is cool, but also confusing to people.

40:02 And on Linux, who knows? It depends on your version, right?

40:05 Yeah. For example, if you want to install a different version of Python, you can install it using, well, just some standard Python installation. But PyE is much better because it lets you easily switch between versions.

40:16 So if you're using just the latest Python all the time, it might not be a big of a deal for you. But for example, I'm working on a different project. One project is using Python 3.6. One is using Python 3.8. And I want to find a way to easily switch between those two versions.

40:30 That's what I would use PyEnf for. So you install PyEnf, and then you say PyEnf install 3.8.3. And that's going to install this version of Python. And then I say PyEnf install 2.7. And it's going to install 2.7 as well. It's going to be different than the system one. It's going to be managed by PyEnf.

40:52 And now let's say I'm working on a project with Python 2.7. All I have to do is to say PyEnf global 2.7. And just like that, my global Python version is 2.7.

41:04 Yeah, I wasn't aware of this feature of PyEnf, where you can basically shadow what Python means on your machine and cycle it. So with PyEnf, you install the different Pythons. You could have, you know, 3.7, 3.8, 3.9, maybe, if you get, if it'll pull the beta version 2.7.

41:22 But then you can say PyEnf global Python 3.6, PyEnf global Python 3.8. And then if you just type the word Python, that means that version you set it to, which is pretty awesome, actually.

41:36 Yeah, it is. And it's actually done in a pretty clever way. So it's using the system of shims, or how is it pronounced, that basically it prepends to your path variable, this PyEnf Python version.

41:49 So whenever you type Python, your computer is going to look for Python binary, and it's going to find on your path this shimmed version, this shadowed version, and it's going to use this one.

41:59 It's a pretty non-intrusive version.

42:03 So that lets you get some version that, the version that you want onto your system. And then you went on, I think you were using virtual, just VNV, not the built-in virtual environment capabilities of PyEnf, right?

42:16 I showed how to use the VNV module from Python, because, well, it's built in Python, so that's the easiest way. But I'm not using this in my daily work. And so I wanted to show, I think I'm using virtual fish right now, which is a wrapper over virtual environment.

42:32 Right, but it works in the fish shell, yeah.

42:34 Yeah, it's the same as virtual env and virtual env wrapper for non-fish shells. And what I really like about this is that it has a set of commands to list all your virtual environments, to create them, to remove them.

42:47 And so it's much easier to manage those virtual environments. And I prefer it to have like one separate folder for all of those.

42:54 Yeah.

42:55 And I also wanted to show people that there are different tools than the built-in Python module, because I see a lot of people who are teaching Python, they show the built-in Python tools, but there are a lot of other cool tools that you can use, and maybe you'll like them more.

43:10 Yeah, for sure. And then the last thing you talked about here was PipX, which we already covered, so I don't want to spend too much time on it, really. Although I do want to throw out one tip for people, because something that has been driving me crazy about PipX is I install Python through Homebrew, which I don't know if it's the best way. Maybe I should be using PyInf, but for whatever reason, that's what I've been doing. So it's that way.

43:31 And when Homebrew upgrades Python, PipX virtual environments become invalid for some reason. I don't know why. But with PipX, you can just do a PipX reinstall-all, no, reinstall-all, and it'll basically tear them all down and recreate them.

43:48 So that'll kind of fix when these shims get out of sync with PipX and whatnot. So maybe that'll help some folks out there. But yeah, that's a cool tool.

43:57 Next up, we've got our runtime, there's Python's pick, we've got our editor all set up. Now it's time to start creating projects. And you already mentioned cookie cutter, but yeah, cookie cutter was what came to mind here, right?

44:11 Yeah. So I was thinking, because people are wondering, people are often asking what's the best way to structure Python project. And pretty much there is no best way. But if you really don't know where to start, there is this tool called cookie cutter.

44:26 And basically what it does is, you're provided with some template that someone created before you. And it's going to generate a scaffolding of the project for you. But it's going to actually ask you some questions on the way. So if someone was giving you the option of different databases, cookie cutter is going to ask you, do you want to use MySQL? Do you want to use Postgres? Do you want to use SQLite?

44:48 And depending on what your answer is, cookie cutter will define a different config file. So all those things have to be first defined by the person who created the template. So cookie cutter doesn't do any magic.

45:01 But if you're new, you can go to cookie cutter website, and you will find some very popular templates, let's say for a Django project, or for a Python package, or for a Flask project, you can take the most popular one, provide it to the cookie cutter, and it will generate base for your project that many, many people before you have used that is usually very well documented.

45:25 It has some hints like, well, how to set up CI or how to deploy some stuff.

45:30 Yeah, those are really, really nice. And I guess it depends on what you're building. But often, you know, say you're building a package, you want to have a setup pie, and the various other things that go along with that, right? And it'll automatically pre populate that when you just run cookie cutter, you know, create me a packet, a Python package thing that's called this.

45:50 Yeah, it's really nice. I like it quite a bit. Again, those are super, they can be super opinionated. So depending on how, how much you align with what they're trying to do, it may work well or not. But there's many, many different templates. So you can even just search GitHub for them, and just point cookie cutter at a GitHub repo, long as that repo is public and has, basically is a template.

46:10 Yeah, exactly. And as you said, they are very opinionated. But in my opinion, it's opinionated. It's much easier to find a cookie cutter template and actually remove stuff than to start from scratch. And when you're staring at your blank editor, trying to come up with some ideas how to set up things.

46:29 Yeah, absolutely. I totally agree. Find a good cookie cutter template and roll with that as well. Maybe it even sets up things like black and pre commit hooks and so on for you.

46:38 Yeah, exactly. Many templates already follow some good practices for installing some linting and formatting tools for you.

46:45 Yeah. Another thing that you spoke about is the REPL, the redeveloped print loop, you know, what you get when you just type Python. And just typing Python is okay. But honestly, it's, it leaves a lot to be desired. Like even just up arrowing through your history, it repeats the line.

47:02 Like if you wrote a block of three, three lines, like you've got to like re arrow through them to get to if you want to go back to that group, right? That's kind of annoying. So there's other options that you can use for your rebels that you suggest or talk about at least I noticed that a lot of people who do some tutorials or show some presentations about Python, they use the default Python REPL.

47:23 And if imagine you're a new person who doesn't know there are different Python REPLs, you're gonna get stuck with Python REPL. And as you mentioned, it's not the most user friendly REPL. I mean, it's there, it's fine to use it. And it's not Python core developers job to improve it. But there's different tools that you can that are basically a drop in replacement.

47:44 And for example, one of them, and my favorite one is IPython. Basically, that's the Python REPL on steroids. So you just install it. And instead of typing Python, you just type IPython. So there is like almost no change for you.

47:59 And out of the box, you got like syntax highlighting, you got top auto completion, you it's much smarter about when you press enter, because when you start typing a function definition, and you press enter, it's gonna actually indent the next line and it's gonna detect that you're still typing this function, not that you just finished typing.

48:19 And for example, you can append a question mark. So you will see the signature of a function or you can append two question marks, you will see the whole whole code source code of a given function. So I'm actually using IPython to read the documentation. Also the time is really cool.

48:36 Yeah, I didn't know about this feature. This is really cool. So if I had a variable like x equals a string, something just quote something, right? Then I hit enter, then I can say x question mark, and I'll say this is a string.

48:46 It's string form is whatever the string is, its length is what it is, and it'll list out the doc string. And yeah, that's super nice that you can just ask it questions about what it can do. Yeah, very nice.

48:56 Yeah, and there's a lot of cool things that you can do. For example, you can edit a file. And for example, you can tell it to edit command or a function, and IPython will try to figure out where this function is defined. And if it's from like some package install with peep, it will actually open the file in this virtual environment that contains this given function, and it lets you edit it.

49:20 Oh, wow. That's pretty awesome. Cool. So IPython is definitely there. And it's got this kind of Jupyter feel, right? It's like, basically a little bit like Jupyter in the terminal or command prompt. But you also talked about two other ones, ptpython and bpython.

49:38 Yeah, so there is ptpython. I think the name stands for prompt toolkit Python, and bpython. They are both much lightweight approached in IPython. So they are between IPython and Python, they have syntax highlighting, they have some tab completion. But they don't have as many features as IPython. But for example, they have different features.

50:01 I think it's bpython that lets you rewind code. So if you type something and you realize you made a mistake, and you want to actually undo the last command, because I don't know, you close the file, or you just deleted something from the array, you can actually undo this, there is a keyboard shortcut to undo the last command, and then you can continue working on the file, or whatever. So both of them are much better than the build in Python REPL.

50:27 Yeah, I totally agree. And if you pull up ptpython, you can have an emacs mode, you can have it in VI mode, you can go and pull up all sorts of things like enable fuzzy completion and all sorts of cool stuff, syntax highlighting. Really, really nice. I haven't done as much with bpython, but they both seem, you know, much nicer to me, in that you get autocomplete, and you get better editing and whatnot.

50:54 Yeah, so certainly good recommendations there. I guess, probably not quite as much to discuss with tests in some regard, right? Like you said, okay, well, people are using pytest, you should probably use pytest. That seems to be pretty good consensus these days.

51:09 Yeah, it's a pretty solid choice. I also explained why it's better to use pytest than the build in unit test library. I mean, the unit test library is pretty good, but it also suffers from the same problem as the Python REPL. So it's kind of basic. And at the same time, I find it a bit over complicated, because you have all those different assert types.

51:30 While with pytest, you just have one assert. And basically, that's all you need for most of the time.

51:35 Yeah. One thing that maybe is not as obvious is how to get the test to run in VS Code.

51:41 Ah, yeah. So that's a pretty cool feature of VS Code.

51:43 I think when you install Python extension, it's going to ask you what test framework you want to use.

51:51 So you select pytest, and then you will have the sidebar with tests.

51:54 And then you can just click Discover Tests, and it will go through your project and try to find all the tests, all the files and all the functions that are matching the pytest convention.

52:07 And then in the sidebar, you will see all those tests, you can run them.

52:11 And you will see if it's passing or if it's failing, you can debug them.

52:16 So if the test was failing, it will actually stop in the place where the assertion is failing or when there is some problem.

52:24 And then actually, if you open this file in the VS Code, you will see like a small text above each test function that will tell you you can run it or you can debug it.

52:36 So you don't even have to go to the sidebar.

52:38 You can just click in your text in your code editor, and you can run the test directly from the test file.

52:45 Yeah, that's super cool. And it just runs that one test, right?

52:47 Yeah, exactly.

52:48 All right. Another thing that you suggested people do is that they write documentation.

52:53 And I guess this probably varies depending on what the goal of the project is.

52:57 If the goal is just like a small little app for just you, maybe it doesn't need documentation.

53:02 But a lot of times it will.

53:04 What was your advice there?

53:06 You already sort of mentioned Autodoc.

53:08 I know that was a plugin for the extensions, but there's also Autodoc for APIs, right?

53:15 Yeah. So for documentation, I recommend Pretty Standard Sphinx.

53:18 It's a very good tool used by many projects.

53:21 And even with the read the doc project, if your project is open source, then you can host your documentation for free.

53:28 So this is really nice.

53:29 So yeah, for documentation, I would use Sphinx.

53:32 And then as you mentioned, there is this Autodoc plugin that you can add to Sphinx.

53:37 And it will automatically generate the documentation for your API, which is really cool because it saves you a lot of repetitive code.

53:45 Yeah, right. If you're already going to write it for the help string in your library, you might as well just get it to write, you know, copy it over there.

53:52 Exactly. And there are also some other cool plugins.

53:56 So if you have an example of code in your doc string, quite often it can get out of date because, I mean, documentation is often, well, outdated.

54:11 So you can actually install a plugin that will try to detect code snippets inside the documentation and it will actually run those code snippets, comparing it to the next line in the documentation.

54:21 And if it's not matching, it's going to report you an error.

54:24 Yeah, that's cool. So if you've got an example in your doc string, like here's how it's supposed to work.

54:28 And if it doesn't do that, that's a problem. Nice.

54:31 So one other thing that you did talk about in this section that I thought was worth mentioning is what should you put into your documentation?

54:39 And you talked about someone, Daniela, I don't remember what the last name was, who talked about four different categories you might have,

54:48 like tutorials, how-to guides, explanations and references to help give you some structure to think about what you might write.

54:56 Yeah. So I saw this really good talk from Daniela Procida and he splits the documentation into four parts.

55:02 First is tutorials.

55:04 So people who are like complete beginner can come to your project and see, OK, how I can start using it.

55:10 Then you have how-to guides.

55:11 So recipes for solving a specific problem.

55:15 So if you have a very specific problem, you can find it probably there.

55:18 Then you have explanations.

55:20 So this part actually explains how your project works, how each parts interact with each other.

55:27 And then finally you have reference, which is like a Wikipedia page for your project.

55:32 So all the terms, all the classes, whatever they are defined there.

55:37 Maybe the why, like why did we put this here or the history of it or something.

55:42 Yeah.

55:42 Yeah.

55:42 OK, that's really helpful.

55:44 And then last thing on the documentation side, you mentioned that you can get a, you know, normally you would write this in restructured text.

55:50 But Markdown is the current thing that people like to use the most, I think.

55:57 There's a Markdown extension you can get as well.

55:59 Yeah, there is a Markdown extension for Sphinx that you can install and it will let you write documentation in Markdown.

56:06 Yeah.

56:06 We even have pypi.org supports Markdown these days.

56:09 Yeah.

56:09 Yeah.

56:09 Sweet.

56:10 And then I also mentioned that if you're writing some rest APIs, there are tools like Swagger or Redog that you can use and they will also generate like really nice documentation for your APIs.

56:21 Yeah.

56:21 If you use frameworks like FastAPI, it's like basically built in and stuff like that, which is really, really cool as well.

56:27 It depends on what you've got underneath the covers there.

56:30 Cool.

56:31 So last thing, got everything set up.

56:34 You've got your package structure.

56:35 You got your documentation, presumably written subcode.

56:38 The last thing, you've got to deploy your app.

56:40 Yeah.

56:40 So I was hesitating if I should include this section, but since it was pre-recorded, I still had some time.

56:47 So I decided to give people like a very simple Docker file that they can use to take this project that we are building and to deploy it as a Docker container.

56:56 So I explained like very briefly what Docker is.

57:00 I started by showing how to make a Docker file, which is intentionally kind of bad Docker file.

57:07 Then I explained what are problems with this Docker file.

57:09 And then finally, I showed them like a much better Docker file that they can use, but it's still a very basic one.

57:16 Yeah.

57:17 Cool.

57:17 Then you could put it in presumably in like a Kubernetes cluster or something like that if you want.

57:22 Yeah.

57:22 There's even this website played with Docker.

57:24 So at the end of the workshop, I'm showing how to use this website to actually deploy our application.

57:29 It's deployed in this like terrible URL that it's going to, and the container, it's only there for four hours, but it's there.

57:38 It's online.

57:38 You can share it with someone.

57:39 It gets you the idea.

57:39 Yeah, exactly.

57:40 That's awesome.

57:41 Well, that's quite a whirlwind tour.

57:44 All the tools that you might use, but I think it's a lot of good advice.

57:49 It exposes people who are maybe a little bit new to putting together these projects and closes that gap from, I know the language to now I know how to actually create and ship applications.

57:58 In a more professional way.

58:00 Yeah.

58:00 Yeah.

58:01 Yeah.

58:01 Pretty neat.

58:02 So thanks for putting that tutorial together.

58:04 And because it's on PyCon online, people can go take the workshop, right?

58:09 It's two and a half hours and it's easy to follow along and yeah, nicely produced.

58:14 All right.

58:15 Well, before we call it wraps, even though we are getting long on time here, two final questions.

58:20 First, maybe this is a hint.

58:22 I'm not sure how much time we spend on VS Code, but if you're going to write some Python code, what editor do you use?

58:28 That's a good question.

58:29 Now, so it's VS Code and for like some short edits, it's Vim.

58:34 Right, right on.

58:35 And then notable PyPI package, you know, something that maybe you've run across recently that's really cool that people don't know about.

58:43 So I'm pretty sure you already know what I'm going to say.

58:45 It's IPython.

58:47 So I'm not a contributor or anything, but I really love it.

58:51 And actually, I was writing a blog post a few weeks ago and I put an introduction, something along the lines, along those lines that I really like IPython.

59:00 And if I ever got invited to your podcast, not that I have anything to talk about, I will mention IPython.

59:07 So I'm here and I'm mentioning IPython.

59:09 But no, seriously, this is a really great package and I use it all the time.

59:13 Yeah, it's super cool.

59:14 And I really have not used it enough as a REPL.

59:16 So I should definitely be thinking more about that as well.

59:19 Awesome.

59:19 All right.

59:20 Well, final call to action.

59:21 People are excited about this, all the ideas we talked about in the tutorial.

59:25 How do they, what should they do now?

59:27 Well, start building.

59:28 So you can just, you can follow this tutorial and this will give you a pretty solid base for any projects that you want to build on, build from it.

59:37 And if you know someone who's learning Python and who's not sure how to start building stuff or who wants to build something in Python, just please tell them about this video.

59:48 I mean, it's quite long, but it's free.

59:51 And at the end, you'll have a very solid scaffolding of a Python project that you can use.

59:55 Yeah.

59:55 Good advice.

59:56 Thanks for being on the show and sharing it with everyone.

59:58 Thank you very much.

59:59 Thank you for inviting me here.

01:00:00 Of course.

01:00:01 Bye-bye.

01:00:01 This has been another episode of Talk Python to Me.

01:00:05 Our guest on this episode was Sebastian Witwoski, and it's been brought to you by Linode and us over at Talk Python Training.

01:00:12 Start your next Python project on Linode's state-of-the-art cloud service.

01:00:16 Just visit talkpython.fm/Linode, L-I-N-O-D-E.

01:00:21 You'll automatically get a $20 credit when you create a new account.

01:00:24 Want to level up your Python?

01:00:26 If you're just getting started, try my Python Jumpstart by Building 10 Apps course.

01:00:31 Or if you're looking for something more advanced, check out our new Async course that digs into all the different types of Async programming you can do in Python.

01:00:39 And of course, if you're interested in more than one of these, be sure to check out our Everything Bundle.

01:00:44 It's like a subscription that never expires.

01:00:46 Be sure to subscribe to the show.

01:00:48 Open your favorite podcatcher and search for Python.

01:00:50 We should be right at the top.

01:00:51 You can also find the iTunes feed at /itunes, the Google Play feed at slash Play, and the direct RSS feed at /rss on talkpython.fm.

01:01:01 This is your host, Michael Kennedy.

01:01:02 Thanks so much for listening.

01:01:04 I really appreciate it.

01:01:05 Now get out there and write some Python code.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon