Latest / Talk Python To Me / #279: Modern Python Developer's Toolkit
Transcript
- 0:00Python is quick and easy to learn. And yet, there is a massive gap between knowing the
- 0:05common aspects of the language, loops, variables, functions, and so on, and knowing how to write
- 0:10a well-factored application using modern tools and libraries. That's where learning Python
- 0:15is a never-ending journey. Sebastian Witwoski is here to give us his take on a modern Python
- 0:21developer's toolkit. There are a bunch of great tips in store for us. This is Talk Python To Me,
- 0:26episode 279, recorded July 21st, 2020. Welcome to Talk Python To Me, a weekly podcast on Python,
- 0:47the language, the libraries, the ecosystem, and the personalities. This is your host,
- 0:51Michael Kennedy. Follow me on Twitter, where I'm @mkennedy. Keep up with the show and listen to past
- 0:56episodes at talkpython.fm, and follow the show on Twitter via at Talk Python. This episode is brought
- 1:02to you by Linode and us. Hey folks, before we jump into the interview, there's so much going on over
- 1:08at Talk Python Training that I want to share not one, but four exciting announcements with you.
- 1:12Number one, we released a new course that has been a passion project of mine,
- 1:16understanding how memory management works in Python. We don't have enough clear info out in the world to
- 1:22get a solid picture of how our code runs. So I dove in and created a five-hour course covering all the
- 1:28internals of Python memory. Things such as reference counting, garbage collection, and the fascinating
- 1:33allocation algorithms. We also touch on a bunch of simple techniques and patterns to employ, which allow
- 1:39our code to run much faster and use only half as much memory. Check it out at talkpython.fm/mem.
- 1:46Announcement number two, Chris Moffitt of Escaping Excel Hell, episode 200 fame, has written a course to
- 1:53help folks escape Excel and start leveraging Python's data science stack with tools like Jupyter and Pandas
- 1:59to solve the same type of problems and do the same type of computation. So if you're keen to use more
- 2:05Python and less Excel, check out that course at talkpython.fm/Excel. Announcement number three,
- 2:12Chris and I are putting on a free webcast pulling some of the tips and tricks out of that Excel course
- 2:17to help folks move from, well, Excel to Python. If you want to join us for that live event, it's going
- 2:23to be live on September 29th, 2020, and it'll of course be available as a recording afterwards. Just
- 2:30visit talkpython.fm/Excel dash webcast to be part of the webcast. And number four, we've crafted a
- 2:39unique learning experience for teams built on our courses over at Talk Python. We call this team
- 2:45cohorts. We've already tested this for individuals and we'll be announcing something for them shortly.
- 2:50But right now we're launching this experience for teams within companies. The idea is to put together
- 2:56a digitally native experience that brings your team together and keeps everyone on track and gets them
- 3:02ready for that big upcoming project. These experiences include a private community, weekly video calls,
- 3:09a clear schedule going through one or more courses of your choosing, and a lot more. Check it out at
- 3:15talkpython.fm/cohorts. Wow, that's a lot for just one week, isn't it? All of these links will be in
- 3:22your podcast player's show notes. Please check them all out. This is truly the best way to support the show.
- 3:27Now let's talk about some modern Python.
- 3:29Sebastian, welcome to Talk Python To Me.
- 3:33Hi, thanks. I'm excited to be here.
- 3:34Oh, it's great to have you here. I'm looking forward to exploring this idea of a modern Python
- 3:41developers toolkit. You put together a really nice tutorial, which you, quote, presented at PyCon,
- 3:47like all the other folks who presented at PyCon this year. And we'll talk about that. And I think
- 3:51it's going to be a lot of fun to see your take on it. You do have a lot of good advice in here.
- 3:56Before we get to it, though, let's start with your story. How'd you get into programming and Python?
- 3:59So you know all those cool stories about people starting to code when they were like 10,
- 4:04and then they learned some ancient programming language to program a video game?
- 4:08Well, that's not me. My father had a computer, but as a kid, all I did was playing video games.
- 4:15And then I went to the university where I was studying automatic control and robotics.
- 4:20And I had three semesters of programming. And I think first semester was C, then was two semesters
- 4:27of C++. And boy, I hated C. I mean, it was so bad for me that I actually had to cheat on the exams to
- 4:35even pass it. And then I switched to C++. And it was slightly better. But so I eventually forced
- 4:43myself to learn C++ enough to pass all the exams.
- 4:46Yeah, C++ is better. But yeah, still, it's not Python.
- 4:49Exactly.
- 4:50Other modern languages. Yeah.
- 4:51And then at some point, I think I had to do a website. And that's when I really got interested
- 4:58into programming, let's say, because, well, it was HTML and CSS. But just the idea that you could
- 5:05immediately see the results in the browser was what really picked my interest. So I learned
- 5:10just making, I learned some basic CSS, some basic HTML and jQuery. And that's how I got into programming.
- 5:16Then I learned PHP and I started building websites.
- 5:19Cool. Well, I think building websites is one of those things that while it's pretty complicated,
- 5:24because there's HTML and CSS in the programming language, there's a lot of moving parts.
- 5:28It's definitely one of those things that's more rewarding than a lot of lower level programming,
- 5:33because you can see it right away. It's easy to share, right? You can put it up on
- 5:38some site and say, hey, everyone, check out this thing that I built. Try it. It's pretty fun.
- 5:42Yeah. Yeah, definitely.
- 5:45Speaking of learning languages that you might not want to learn, when I was in college,
- 5:49I started out in chemical engineering and then moved over to math. But while I was in chemical
- 5:56engineering for just a little bit, they said, you have to take a programming course. I'm like,
- 6:00excellent. I've always wanted to learn C++ or something like that. And they're like,
- 6:04no, you have to take Fortran. Really? I have to take Fortran. Like, yes, you have to take Fortran.
- 6:09If you want, you can take C++ as an elective, but Fortran is the most important programming
- 6:14language you're going to learn in your entire life. Don't you know? And I'm like, no, it's definitely
- 6:19still not true. I'm waiting for that to come true, but I don't think that was true.
- 6:23Anyway.
- 6:24Yeah. You got to start where they have you start, I guess.
- 6:27Yeah. It's nice to see that now it's changing and Python is more and more.
- 6:31Absolutely.
- 6:32Becoming more and more popular.
- 6:34Yeah. And I think it makes it way more approachable to people who are not there to be programmers.
- 6:38Exactly.
- 6:38Right. Like economists or whatever. So that's how you got into programming and found your way over to
- 6:45Perl. And where did Python come into this whole story?
- 6:49So once I know how to make some websites, I applied for an internship at CERN. CERN is this
- 6:54European organization for nuclear research. And so they have this large hard-run collider where they
- 7:00do a lot of cool stuff, but they hire not only physicists. So I applied for an internship as a web
- 7:07developer. And actually the first day when I started, one of my senior colleagues went to pick me up from
- 7:12the reception and he had this t-shirt saying, I enjoy learning Python. It was a nice afternoon.
- 7:18So that was my first interaction with Python. It was hilarious.
- 7:23That's awesome.
- 7:24I had to learn Python on that job, but I really enjoyed it. So I stayed at CERN for the next six years,
- 7:30building some really cool stuff there.
- 7:31Oh man, that's got to be awesome. Did you work remotely or were you in Geneva or where were you?
- 7:38I was working there. CERN doesn't, at least back then didn't support working remotely.
- 7:42Yeah. That's got to be such a cool environment to be in.
- 7:45It was. I mean, people from every country, it's crazy. You just go for a lunch with people from
- 7:51around the world.
- 7:52That guy has a Nobel prize, of course. So he can join us. Come on.
- 7:56Yeah, quite cool. And how about today? What are you doing now?
- 8:00So I finished working at CERN and then I moved to freelancing. So right now I'm a Python freelancer
- 8:06based in Poland. I still do a lot of web development because I really like it. I think that's my favorite
- 8:12part of programming, but I also help companies fix their workflows, set up their architecture for new
- 8:17projects. And I even do some custom onsite trainings.
- 8:21So that sounds like a lot of fun and it's a nice mix. So you get to try a bunch of different things
- 8:25and keep your hands in them. Nice. All right. Well, let's talk about your tutorial that you
- 8:31did at PyCon online, which was really, you know, people who I'm sure most people know now, but
- 8:37basically the way that PyCon US handled the whole shutdown lockdown thing was they said, okay,
- 8:44we're going to take tutorials and the talks and still give people a chance to present. But it was
- 8:50record this as a screencast basically, and then we'll publish it to the YouTube channel and we'll
- 8:56list it on the PyCon page as a list. That's what you did. And I think honestly, for yours,
- 9:01that might be even better because you came up with such a nice set of digital resources that people can use
- 9:09that I feel is going to be really valuable to everyone, not just the, you know, 50 people or
- 9:15however many would have taken it in person there. Yeah, I agree. I looking in the hindsight, I think
- 9:19that it was much better than a tutorial that I would be able to give in person because I was over two
- 9:26hours. So I really had to time everything. Well, I did a lot of editing to remove some stuff and still
- 9:31it's almost like two and a half hour of basically only meet. Yeah, but it's engaging. You did a good job
- 9:37with it. So when you come up with this idea, like we all think about what kind of tools we use
- 9:43and it's easy to get stuck in doing certain things. So, you know, I never really, I mean,
- 9:48I never really wrote tests. So, you know, I'm not using pytest, for example, or I've always just
- 9:55enjoyed using Vim. So I'm going to stick with Vim, even though there may be a more productive
- 10:00editors, for example, out there and so on. So how'd you come up with this idea for your,
- 10:05your workshop here? So I actually come up with this idea talking with people.
- 10:09So I noticed that people who are learning Python, they might learn how the language works. They
- 10:15might know the syntax, but then when they sit down to write a Python project, they just don't know how
- 10:21to start. I mean, you can see a lot of people asking what's the deal with virtual environments,
- 10:25like what they should use for testing. So I had this idea in the back of my head, like,
- 10:30hey, let's, let's make a tutorial how to build a simple Python project from scratch,
- 10:35explain what tools to use, and just show enough tools. So people can like, take this project and
- 10:42build something bigger on top of it. So to not overwhelm people with like, too much of different
- 10:47stuff. Don't toss poetry or like different styles of managing dependencies, just give them one solid
- 10:55approach that they can use. Yeah. And that can be one of the challenges, right? The more guidance
- 10:59that you give, the less generally applicable the result is, right? If you, that you have to use
- 11:07talks in this way, and you have to make sure you have these tests, and then you have to make sure
- 11:11your APIs always look like this, and so on and so on, like every layer, here's your continuous
- 11:15integration, how that has to be, right? Like, it just means fewer people necessarily fit that same
- 11:22workflow. And so I think you found a pretty good balance here. Thank you. I had to remove a lot of
- 11:27stuff because initially, I wanted to add even more features. But then I decided to like really narrow it
- 11:32down to only the essential things that you're going to need. Yeah. So you set the stage. And I think this
- 11:37is hard for beginners to get a lot of times to understand, sort of internalize this feeling. But
- 11:44you said that there's a huge gap between knowing Python, the language, like I know how to do a loop,
- 11:51I know how to create strings, I know how to like write a function, that kind of fluency with Python,
- 11:56there's a huge gap between that and knowing how to write applications or create proper projects with
- 12:03Python, right? Yeah, I mean, maybe huge gap is a huge word, but there is a gap. Yeah, there's definitely
- 12:08a 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:14think it's an important one. I don't want to put words in your mouth. I'll put the huge out there for
- 12:17the students who are taking, say, like my beginning programming courses. I find that they all can see
- 12:25the syntax, they can recreate the syntax. If you say, okay, here's a thing, I want you to loop over it.
- 12:30Yeah, no problem really quickly. A lot of times they've been able to learn how to like do that and
- 12:35make Python do that thing. But if you put them in front of a blank file, just open up, you know,
- 12:42app.py and come up with a solution to some kind of problem, like I want to use the right data
- 12:49structures, and I want to have the right libraries to talk to this, you know, to APIs and stuff. I feel
- 12:55like there's, there's a pretty big gap where they feel like they just don't know where to start.
- 12:59And so putting a lot of the structure in there, I think will help people get sent down in the right
- 13:04direction. One thing that I thought was pretty neat about your presentation was you had a whole website,
- 13:11right? A whole dedicated domain for this tutorial. Do you want to tell us about that?
- 13:16Yeah. So the website is bycon.svitowski.com.
- 13:20I'll link to that in the show notes so people can just click it.
- 13:22I used Hugo, the static site generator with learn template. And actually I stole it from
- 13:29Nina Zakarenko's tutorial that I saw some years ago. She also used this template and I really like it.
- 13:35So then I found it, I think completely by accident. And I saw it. Oh, that's the website template that
- 13:41she was using. So I gave it a try and it looks really good. It has a nice sidebar with all the
- 13:46sections. Yeah. So you have a whole bunch, like, as you go through the tutorial,
- 13:51you've got the website and you've got the video on the website, which is pretty straightforward.
- 13:56But then, you know, you, for each major section, you've got like a write-up about that with links.
- 14:01So people don't have to try to type down or search for the various things you're talking about.
- 14:05They've, you've got the exercises that people can do walking through. So I think like, this is what,
- 14:11this is what I was thinking of when I said, I feel like this is almost better because it was done
- 14:14online because you have this, this whole resource for people here.
- 14:18Yeah. I was trying to make this website independent of the video. So you can just,
- 14:22even if you don't know the video, you should be able to go to the website and kind of follow
- 14:26everything. So it's complimentary to the video, but it stands on its own.
- 14:30Yeah. Cool. So there's a couple of exercises that you have the students do. Maybe we could talk about
- 14:36the exercises and then we could start going through the steps and the guidance and whatnot.
- 14:40Sure. So I basically have two sections of exercises. First one is done after I talk about managing Python
- 14:48versions and Python dependencies. So first I explain how you can install different versions of Python,
- 14:54how you can like install different versions of packages. And there is an exercise to make sure
- 14:59that people understand what's the difference between virtual environment and Python version and how they
- 15:06interact with each other. So I have like a set of steps, try to install, let's say this package globally,
- 15:12try to install, try to create a new virtual environment, create a package there,
- 15:17deactivate virtual environment, try to run this package and see what happened. Do you understand?
- 15:23And then I have the second exercise. This is a bigger one. This is basically a mini project.
- 15:28So at the end of the workshop, after I discuss everything, testing documentation and all this
- 15:34stuff, I have a mini project to create a to-do application. So basically you take everything
- 15:39that I showed you before and your objective is to create a to-do application. I wanted to make
- 15:45something more interesting, but everyone knows what a to-do app is. So I decided to go for this.
- 15:50That's the canonical example of a like, let's rebuild something that everyone is familiar with.
- 15:55That's right. It used to be blogs, but now the JavaScript people made it the to-do app that
- 16:00everyone builds. Yeah. I put a lot of thought into finding a more interesting project, but nothing.
- 16:04Yeah. The problem is the more interesting it gets, the more you get lost in the details,
- 16:10right? It's yeah. Anyway, it's fine. It's a cool example. All right. So there's a couple of
- 16:15hands-on exercises that people get to do. That's good. Now, maybe the first big piece of advice,
- 16:22but also advice that is challenging for people who've been doing a long time. And I guess to some
- 16:28degree, this is probably more focused at people who are new. So that hesitancy matters less,
- 16:34but is to recommend a code editor, right? People are very passionate or sticky to their code editors.
- 16:40Yeah. I was really hesitating if I should include this point or not. But at the end,
- 16:45I checked the Stack Overflow survey from last year and VS Code was used by basically every other programmer.
- 16:55This portion of Talk Python To Me is brought to you by Linode. Whether you're working on a personal
- 17:00project or managing your enterprise's infrastructure, Linode has the pricing, support, and scale that you
- 17:05need to take your project to the next level. With 11 data centers worldwide, including their newest data
- 17:11center in Sydney, Australia, enterprise-grade hardware, S3-compatible storage, and the next-generation
- 17:17network, Linode delivers the performance that you expect at a price that you don't. Get started on
- 17:23Linode today with a $20 credit, and you get access to native SSD storage, a 40 gigabit network,
- 17:28industry-leading processors, their revamped cloud manager at cloud.linode.com, root access to your
- 17:34server, along with their newest API and a Python CLI. Just visit talkpython.fm/Linode when creating
- 17:42a new Linode account, and you'll automatically get $20 credit for your next project. Oh, and one last
- 17:47thing. They're hiring. Go to linode.com slash careers to find out more. Let them know that we sent you.
- 17:52You actually, at the start, you said, okay, we got to pick a code editor because you got to write
- 17:59some code. Let's do VS Code. And yeah, you went through the stats from the Stack Overflow
- 18:04Developer Survey, and you're like, it's like 12% in 2017. It was 30% in 2018. In 2019, it was like 50%
- 18:13or something. You're like, all right, this is a pretty safe bet. A lot of people are doing this
- 18:16and liking it. Yeah, exactly. Yeah. So I guess first bit of advice, would you get VS Code? You
- 18:22don't have any Python tooling? Not really? Yeah. So when you install VS Code, it's pretty empty.
- 18:28But the nice thing about VS Code is that when you install it, you have this welcome window,
- 18:33and it says like, oh, if you're programming in Python, check out this package.
- 18:37So basically, first package that you install is Python package. And it's actually the most popular
- 18:43package on the VS Code marketplace. It's like way above...
- 18:49By a long ways. Yeah. It's like two or three times above even the C# and C++ one. And those are,
- 18:55you know, very core to Microsoft, right?
- 18:56Yeah, exactly. Yeah. Yeah. So when you start, you basically first install Python package. And then
- 19:02once you have Python package, it's going to give you some pop-ups like, hey, do you want to install
- 19:07a code formatter? Or like, hey, do you have some tests? Do you want to install a test tool and stuff
- 19:12like that? So it really takes you by hand through all the steps that you need to have the basic Python
- 19:18IDE. Yeah, for sure. Have you looked at PyLance, the new language extension for VS Code for Python?
- 19:26So actually, no, I've heard about it from Python Bytes. Yes.
- 19:31In the podcast. And then it fell off my radar. Yeah, Anthony Shaw brought that one. Yeah,
- 19:35that was cool. Yeah. I thought it's going to be like built in into Python extension,
- 19:38but then I saw it's a separate extension. So I kind of forgot about it. But have you been using it?
- 19:44Not really. I just looked at it when Anthony and Brian and I were speaking about it. And it looks like
- 19:49it looks deeper into the Python language and more across your project, more across
- 19:56the libraries, looks at the documentation that might come with like the help strings and whatnot.
- 20:01So you actually have to have the VS Code Python plugin. And then the PyLance plugin is like on top of that
- 20:08one. So it uses the new language server thing that they've got that I don't really know much about. But
- 20:13it looks I installed it. It looks like it'll be be nicer. We'll see. I haven't done a ton with it.
- 20:18Yeah, I'll definitely check it out at some point. Yeah, not to start too much of a heated debate. But what
- 20:23what are your thoughts on things like VS Code and PyCharm? The more GUI based helpful, trying to help
- 20:32anyway, editors versus some something like Emacs or Vim? I know a lot of people still use Emacs and Vim and
- 20:38the more terminal based editors. I think both are good. I mean, I'm still using Vim if I want to do some
- 20:43quick edits, and I'm in the terminal. So I don't really mind it. It's just VS Code or PyCharm are more
- 20:49beginner friendly. So if you're new to programming, that's you're probably gonna start with one of
- 20:54those. And what I really like about VS Code is that you can use it for different programming languages,
- 20:59you're not limited to Python. While if you start using PyCharm, then you can use it for Python. But if
- 21:06you want to switch to JavaScript, it's not very useful. Yeah, it's weird how to make Yeah,
- 21:12yeah, VS Code is more general, right? It sort of equally does Node.js as well as it does.
- 21:19Python. Exactly. And you can customize it with extensions. Yeah, cool. So one of the pieces of
- 21:25advice you gave around is choosing a linter and not choosing the default linter. So two questions,
- 21:31what is a linter? And then why did you want to change what VS Code wanted you to do with one?
- 21:37Basically, a linter is a tool that if you make some mistakes in their code, it's gonna in your code,
- 21:44it's gonna shout at you and tell you that you did it wrong. And some linters are more strict,
- 21:48some linters are less strict. For example, for me, Flake 8 is the best linter that I use all the time,
- 21:55because it complains about, for example, if you try to use a variable that you forgot to define,
- 22:02it's going to complain about it. If you define a variable that it's not used in the function,
- 22:06it's going to complain about it. So it gives you hints, it doesn't try to change your code,
- 22:10but it gives you hints as you're coding. Well, some people use PyLint. And it's also a good
- 22:17linter. For me, it's just more strict. And sometimes it's complaining that you have
- 22:21too many public methods in a class and stuff like that. So that's why I didn't like it.
- 22:26I see. Okay, yeah, cool. So you basically go through and show how to,
- 22:30you know, when you set up the Python extension in VS Code, it says, oh, you don't have a linter.
- 22:34Click here to install PyLint. And you're like, hold on, let's go over here and tell it that
- 22:38we want it to use Flake 8. And then it'll say, actually, click here to install Flake 8, right?
- 22:42Yeah, exactly. Because by default, VS Code tries to install everything kind of globally. And I wanted
- 22:48to show people how to nicely isolate everything using virtual environment. So instead of just
- 22:55letting VS Code to install Flake 8, I first show people how to use pipX to install Flake 8. And then
- 23:00I point VS Code to use it. Yeah. Well, let's talk about pipX just for a second, because it's,
- 23:06it is a pretty interesting way to install these kinds of tools. I'm a big fan of pipX. I think
- 23:12it solves this really interesting problem. And to me, the way I think about it, this only really will
- 23:18like maybe resonate with people on a Mac. But to me, it's like homebrew for Python utilities and library,
- 23:24right? Maybe chocolatey on Windows is a similar type of thing, right? Some kind of central repository
- 23:31where I can say install this tool. And it will just install it to my computer. That works well for
- 23:37some things. But there's a bunch of things you would normally pip install, but then they have commands
- 23:41like black or pytest or Flake 8 or whatever. And so pipX installs those. But usually those tools don't
- 23:47necessarily belong in your project. You just want to run them against your project. And so this will create,
- 23:53pipX will create a virtual environment and install that thing in isolation and sort of manage it like it's
- 24:00like an application, if you will, like an app store or something.
- 24:02Yeah. So there are basically two types of packages that you probably want to install on your computer.
- 24:07One is packages for the project that you're currently working with. So for that, you would use a virtual
- 24:12environment.
- 24:13Right. Like requests or something. Yeah.
- 24:14Yeah, exactly. Or like Django, you might be working on different versions of Django and you might be
- 24:19switching between projects. But then there are also some packages like Flake 8, like black, maybe cookie
- 24:25cutter. And for that, you probably want to have one version, preferably the most up to date version on
- 24:32your computer. You don't need to have five different versions of Flake 8 for each of your project. You just
- 24:38want to use the latest Flake 8 because you know it's going to catch up, catch most errors. So that's where you
- 24:45would use PipX. So it lets you install package and it will act as a global package. But at the same time,
- 24:53it's installed inside a virtual environment. So PipX handles all this virtual environment creation,
- 24:58activation. And for you, you just see this package as normal, as if you would normally install it with
- 25:04Pip.
- 25:04Yeah. Yeah. It's super cool. I really like the way that that works and it manages and lets you upgrade
- 25:08those things separately. So you might use that to install Flake 8 or various tools that you're going to
- 25:15do, set that up in VS Code. And then another thing you talked about is by default, probably code is not
- 25:23installed in the path. So you can run VS Code, but if you're on the terminal and you want to edit
- 25:29something, you might want to be able to type like code space file name or code space directory name
- 25:35and open those up. Right. So you've got to go and take an extra step to install that.
- 25:39Yep. And I think right now VS Code will even give you a pop-up saying that, hey, you can actually do
- 25:45this. And there is a command in the command palette to add VS Code to your shell. So it's getting even
- 25:52more and more beginner friendly. Yeah. VS Code is interesting in that it does so many things and yet
- 26:00it's not obvious what it's capable of. Right. It's, you know, if I go into PyCharm, there's a button,
- 26:06you're like, oh, this button, what does it say? Oh, that means it's going to do like a profiling of my
- 26:11code if I click that button. But there's no button for so many of these things in VS Code. Instead,
- 26:15it uses this idea of the command palette. Right. Yeah. As you said, that's the thing, for example,
- 26:19with testing, there is like no sidebar for tests. But once you set up testing tool, you have a
- 26:26sidebar. Yeah. You talked about some of the commands that are useful there. And unfortunately, I only have
- 26:31these for Mac. People have to translate probably command equals control. And that's pretty much it.
- 26:36Open the command palette. So you hit command shift P, and then you can type all sorts of stuff. And this
- 26:41is kind of how you get to all those features that we're talking about. Go to files, command P,
- 26:45go to a symbol, command shift P, or command shift O, or you just command click a thing.
- 26:50Go to symbol, control T, go to line, control G, command space, or sorry, control space to trigger
- 26:57the IntelliSense. But you couldn't get that to work, right? If for some reason you had to like use them
- 27:00alternate, like shift escape or something to make that come up. Yeah, I don't know what was the
- 27:05problem. Yeah, yeah, yeah. So there's a bunch of cool commands. And I think anytime people switch into
- 27:10an editor, that's not the one that they're used to using, it's really worthwhile to sit down and just
- 27:15maybe even make a list of here are the top 20 most common hotkeys. Right? Because just because you're in
- 27:22a GUI doesn't mean you should be using the mouse all day. Yeah. And it's interesting that you mentioned
- 27:26it because before VS Code, I was a heavy sublime text user. And when I switched to VS Code, my muscle
- 27:33memory was still with sublime. And actually for VS Code, you have those extensions that will bring the
- 27:39keyboard bindings from other text editors. So there is an extension that will rebind some commands to
- 27:45commands from sublime. There is an extension for atom and stuff like that. So for a long time, I was using
- 27:52the sublime key binding. And even now, I recently reinstalled everything from scratch, I still had to
- 27:58manually remap some commands because my muscle memory was just not fixable. Yeah, yeah. Sometimes it's like,
- 28:06nope, this is I'm just going to always type this. So we're just going to make it do that. And that's
- 28:10okay. Now, another thing that's not obvious, I think, in VS Code, especially to beginners, is how do you run
- 28:16your project? Right? Like running a single file, maybe it's not too hard, right? You can there's a
- 28:22little button for that. But if you open up a Flask app, and you want to use Flask run, rather than,
- 28:28you know, just running the app.py or whatever, or you want to run some tests or so on, that can be
- 28:34tricky. Do you want to talk people through that experience? Basically setting up a run configuration?
- 28:38As you mentioned, if you want to run a single file, you can use it from the command palette, or you can
- 28:43press this green arrow button, everything is fine. And you can actually even use it for a Flask server,
- 28:49you just run the file that starts the Flask server, and it's going to be fine. But actual power,
- 28:56better idea is to use the debug configuration, or how is it called? I don't have VS Code.
- 29:02Something, yeah, launch, maybe launch configuration. I'm not sure. Something like that. Anyway, yeah.
- 29:07Yeah, so it's under the sidebar for debugging. And if you don't have any launch configuration
- 29:12configured, you're going to have like a button there saying configure launch file or something
- 29:18like that. Once you click it, you can select one, you can select one of the popular frameworks that
- 29:24are there. So you can select the Django or Flask or Pyramid configuration. And that's going to create
- 29:29a launch file for you with some predefined commands. And for most cases, you should be good.
- 29:35But if you want to modify, for example, some parameter that you specify at the run server command,
- 29:42you can do this there. Once you have this launch file, you can actually launch a web server.
- 29:47And now the cool thing is that if you put some breakpoints in your code, so you can click next to
- 29:53the line number in the gutter, and it's going to put a breakpoint, this will trigger the breakpoint
- 29:58in your server. So now if you go to your website, it's actually going to stop at that breakpoint,
- 30:05and you can use VS Code to do debugging.
- 30:07Yeah, yeah, that really unlocks the power if you set up the debug, whatever configuration to launch
- 30:13those things. And yeah, because then you can do the breakpoints, watch the variables, the inspections,
- 30:18all that kind of stuff. And again, the reason I think it's valuable to talk about these kind of
- 30:21things is it's not obvious that this is what you should be doing to get the debugging support to work,
- 30:26right? There's a lot of like implicit stuff. But once you know, it's fine. Another thing that's pretty
- 30:30cool is code snippets.
- 30:32Yeah, so VS Code comes with some code snippets by default. But if you install some extensions, for example,
- 30:37if you install Python extensions, you're going to get even more extension, you're going to get even more
- 30:42snippets, like a snippet to create a class to create a main function, let's call it like that. And then for example,
- 30:48if you install a Django extension, you're going to get even more snippets like Django template tags and stuff like
- 30:54that. And on top of that, you can define your own snippets. So just you just select a command, create a
- 31:00snippet. And you're going to get a nice scaffolding with some information, what do you have to put in
- 31:05each place, basically, that's a JSON file. So you define what's the abbreviation to trigger the snippet,
- 31:10you define the description, and then you just define the code that you want to put there. And what's also
- 31:15interesting is that you will have some placeholders that if you press tab, your mouse will move there.
- 31:22So if you want to pre fill some values in a function, you can press tab and you will be moving between those
- 31:28places. And there are some special variables that will insert, for example, the current date or the
- 31:34current folder. So VS Code has this nicely documented in the documentation.
- 31:39Yeah, you can build it's almost like a little scripting language. So that's super cool. And if you find
- 31:43yourself just doing the same thing over and over again, maybe it should be a snippet. And then your last
- 31:49thing on the VS Code topic before we move on, is you talked about a bunch of interesting extensions for VS Code.
- 31:57And some of these I hadn't heard about are plugins. Let's maybe just talk about a couple of your
- 32:02favorite, because I mean, obviously, the Python and the PyLance ones are there. But there's other
- 32:07ones that people maybe haven't tried out, like there's a Django one, and there's a Telecode,
- 32:12you want to hit the highlights there?
- 32:13Sure. So apart from the obvious Python, then if you're working Django or in Flask, then there are some
- 32:19plugins that will add additional snippets. And for example, for Django, it will also add some syntax,
- 32:25highlighting support for Django HTML files. But apart from the obvious things, there is, for example,
- 32:31a plugin called IntelliCode that will try to predict, it will try to make the auto-suggestion a bit more
- 32:38smarter. So it will try to predict what's the item from the autocomplete list that you are most likely
- 32:46to choose. And it will move this item to the top of this list and add this nice star. And it actually
- 32:52works pretty well from what I noticed. So I can actually highly recommend it.
- 32:56Yeah, cool. Yeah, uses machine learning across a bunch of open source libraries to say, well,
- 33:01if you're using SQLAlchemy, these are the most common functions to be called in these situations.
- 33:06And it tries to understand the context rather than just, here's the whole list, whatever.
- 33:11Yeah. From other interesting stuff, there is, for example, autodoc string.
- 33:15So if you define your function, you can just press enter, add triple quote, then press enter again,
- 33:22and it will put some scaffolding for the documentation. It will also take the arguments
- 33:27from the function signature and put it in the documentation. So it will make your life much
- 33:31easier. If you're using type hints, it will also detect that it will also detect the type hints and put
- 33:36them in the correct place. Oh, yeah, that's cool. That's also nice.
- 33:39From non Python specific extensions, I really like bookmarks, because it makes my it makes moving
- 33:45around the code much easier. So we just put a bookmark in different files, and you can easily
- 33:49switch between them. And yeah, get lens is nice. Oh, yeah, get lens is a massive extension. I mean,
- 33:56the amount of features it has, it's incredible. And just using very small subset, but really gives you a
- 34:03really good overview of what's going on in your project, you can open repositories, comments,
- 34:09branches, merge requests, whatever you want in the GitLab, GitHub, it has everything.
- 34:15Yeah, I remember looking at some CPython source code with get lens installed in VS Code. And it had
- 34:23something like this file change from really long ago by Gito Van Rossum or something like that. I'm like,
- 34:30oh, okay, this is still like some of the original code right here. This is cool.
- 34:33Talk Python To Me is partially supported by our training courses. How does your team keep their
- 34:40Python skills sharp? How do you make sure new hires get started fast and learn the Pythonic way?
- 34:45If the answer is a series of boring videos that don't inspire, or a subscription service you pay way
- 34:52too much for and use way too little, listen up. At Talk Python Training, we have enterprise tiers for
- 34:57all of our courses. Get just the one course you need for your team with full reporting and monitoring.
- 35:03Or ditch that unused subscription for our course bundles, which include all the courses and you pay about the
- 35:08same price as a subscription once. For details, visit training. talkpython.fm/business or just
- 35:15email sales at talkpython.fm.
- 35:21Yeah, 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:48So it's a nice way to customize your errors.
- 35:51Yeah, yeah, very cool. Maybe the last one to just give a shout out to is Jumpy.
- 35:55Oh, 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:15So 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:23Yes. 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:33And 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:47And 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:56And 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:02All 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:17So that's good advice. Then another problem, especially beginners are going to hit straight away.
- 37:22And 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:37Yeah. So that's the next topic I talk about after the VS Code, basically how to manage different Python versions and packages.
- 37:44And 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:52So 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:01I 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:12Yeah, I can imagine it does.
- 38:14Yeah, 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:41Actually, there is a setting for pip that will prevent pip running outside of the virtual environment.
- 38:45There is an option.
- 38:46Oh, really?
- 38:47I said, yeah.
- 38:47Oh, that's cool.
- 38:49I 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:55Nice. 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:10Tell us about why you chose that and what you're doing with it.
- 39:13Yeah. 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:26So let's say you're on a Mac, so your system Python is 2.7. For whatever reason, it's still there.
- 39:33That'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:41Oh, cool.
- 39:42So I don't know if that's better or worse. But anyway, it's not going to have Python 2 at some point.
- 39:46It's probably going to break a lot of stuff.
- 39:48Yeah, 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:02And on Linux, who knows? It depends on your version, right?
- 40:05Yeah. 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:16So 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:30That'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:52And 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:04Yeah, 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:22But 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:36Yeah, 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:49So 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:59It's a pretty non-intrusive version.
- 42:03So 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:16I 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:32Right, but it works in the fish shell, yeah.
- 42:34Yeah, 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:47And 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:54Yeah.
- 42:55And 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:10Yeah, 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:31And 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:48So 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:57Next 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:11Yeah. 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:26And 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:48And 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:01But 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:25It has some hints like, well, how to set up CI or how to deploy some stuff.
- 45:30Yeah, 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:50Yeah, 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:10Yeah, 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:29Yeah, 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:38Yeah, exactly. Many templates already follow some good practices for installing some linting and formatting tools for you.
- 46:45Yeah. 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:02Like 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:23And 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:44And 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:59And 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:19And 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:36Yeah, 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:46It'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:56Yeah, 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:20Oh, 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:38Yeah, 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:01I 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:27Yeah, 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:54Yeah, 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:09Yeah, 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:30While with pytest, you just have one assert. And basically, that's all you need for most of the time.
- 51:35Yeah. One thing that maybe is not as obvious is how to get the test to run in VS Code.
- 51:41Ah, yeah. So that's a pretty cool feature of VS Code.
- 51:43I think when you install Python extension, it's going to ask you what test framework you want to use.
- 51:51So you select pytest, and then you will have the sidebar with tests.
- 51:54And 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:07And then in the sidebar, you will see all those tests, you can run them.
- 52:11And you will see if it's passing or if it's failing, you can debug them.
- 52:16So if the test was failing, it will actually stop in the place where the assertion is failing or when there is some problem.
- 52:24And 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:36So you don't even have to go to the sidebar.
- 52:38You can just click in your text in your code editor, and you can run the test directly from the test file.
- 52:45Yeah, that's super cool. And it just runs that one test, right?
- 52:47Yeah, exactly.
- 52:48All right. Another thing that you suggested people do is that they write documentation.
- 52:53And I guess this probably varies depending on what the goal of the project is.
- 52:57If the goal is just like a small little app for just you, maybe it doesn't need documentation.
- 53:02But a lot of times it will.
- 53:04What was your advice there?
- 53:06You already sort of mentioned Autodoc.
- 53:08I know that was a plugin for the extensions, but there's also Autodoc for APIs, right?
- 53:15Yeah. So for documentation, I recommend Pretty Standard Sphinx.
- 53:18It's a very good tool used by many projects.
- 53:21And even with the read the doc project, if your project is open source, then you can host your documentation for free.
- 53:28So this is really nice.
- 53:29So yeah, for documentation, I would use Sphinx.
- 53:32And then as you mentioned, there is this Autodoc plugin that you can add to Sphinx.
- 53:37And it will automatically generate the documentation for your API, which is really cool because it saves you a lot of repetitive code.
- 53:45Yeah, 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:52Exactly. And there are also some other cool plugins.
- 53:56So 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:11So 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:21And if it's not matching, it's going to report you an error.
- 54:24Yeah, that's cool. So if you've got an example in your doc string, like here's how it's supposed to work.
- 54:28And if it doesn't do that, that's a problem. Nice.
- 54:31So 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:39And you talked about someone, Daniela, I don't remember what the last name was, who talked about four different categories you might have,
- 54:48like tutorials, how-to guides, explanations and references to help give you some structure to think about what you might write.
- 54:56Yeah. So I saw this really good talk from Daniela Procida and he splits the documentation into four parts.
- 55:02First is tutorials.
- 55:04So people who are like complete beginner can come to your project and see, OK, how I can start using it.
- 55:10Then you have how-to guides.
- 55:11So recipes for solving a specific problem.
- 55:15So if you have a very specific problem, you can find it probably there.
- 55:18Then you have explanations.
- 55:20So this part actually explains how your project works, how each parts interact with each other.
- 55:27And then finally you have reference, which is like a Wikipedia page for your project.
- 55:32So all the terms, all the classes, whatever they are defined there.
- 55:37Maybe the why, like why did we put this here or the history of it or something.
- 55:42Yeah.
- 55:42Yeah.
- 55:42OK, that's really helpful.
- 55:44And 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:50But Markdown is the current thing that people like to use the most, I think.
- 55:57There's a Markdown extension you can get as well.
- 55:59Yeah, there is a Markdown extension for Sphinx that you can install and it will let you write documentation in Markdown.
- 56:06Yeah.
- 56:06We even have pypi.org supports Markdown these days.
- 56:09Yeah.
- 56:09Yeah.
- 56:09Sweet.
- 56:10And 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:21Yeah.
- 56:21If you use frameworks like FastAPI, it's like basically built in and stuff like that, which is really, really cool as well.
- 56:27It depends on what you've got underneath the covers there.
- 56:30Cool.
- 56:31So last thing, got everything set up.
- 56:34You've got your package structure.
- 56:35You got your documentation, presumably written subcode.
- 56:38The last thing, you've got to deploy your app.
- 56:40Yeah.
- 56:40So I was hesitating if I should include this section, but since it was pre-recorded, I still had some time.
- 56:47So 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:56So I explained like very briefly what Docker is.
- 57:00I started by showing how to make a Docker file, which is intentionally kind of bad Docker file.
- 57:07Then I explained what are problems with this Docker file.
- 57:09And then finally, I showed them like a much better Docker file that they can use, but it's still a very basic one.
- 57:16Yeah.
- 57:17Cool.
- 57:17Then you could put it in presumably in like a Kubernetes cluster or something like that if you want.
- 57:22Yeah.
- 57:22There's even this website played with Docker.
- 57:24So at the end of the workshop, I'm showing how to use this website to actually deploy our application.
- 57:29It'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:38It's online.
- 57:38You can share it with someone.
- 57:39It gets you the idea.
- 57:39Yeah, exactly.
- 57:40That's awesome.
- 57:41Well, that's quite a whirlwind tour.
- 57:44All the tools that you might use, but I think it's a lot of good advice.
- 57:49It 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:58In a more professional way.
- 58:00Yeah.
- 58:00Yeah.
- 58:01Yeah.
- 58:01Pretty neat.
- 58:02So thanks for putting that tutorial together.
- 58:04And because it's on PyCon online, people can go take the workshop, right?
- 58:09It's two and a half hours and it's easy to follow along and yeah, nicely produced.
- 58:14All right.
- 58:15Well, before we call it wraps, even though we are getting long on time here, two final questions.
- 58:20First, maybe this is a hint.
- 58:22I'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:28That's a good question.
- 58:29Now, so it's VS Code and for like some short edits, it's Vim.
- 58:34Right, right on.
- 58:35And 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:43So I'm pretty sure you already know what I'm going to say.
- 58:45It's IPython.
- 58:47So I'm not a contributor or anything, but I really love it.
- 58:51And 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:00And if I ever got invited to your podcast, not that I have anything to talk about, I will mention IPython.
- 59:07So I'm here and I'm mentioning IPython.
- 59:09But no, seriously, this is a really great package and I use it all the time.
- 59:13Yeah, it's super cool.
- 59:14And I really have not used it enough as a REPL.
- 59:16So I should definitely be thinking more about that as well.
- 59:19Awesome.
- 59:19All right.
- 59:20Well, final call to action.
- 59:21People are excited about this, all the ideas we talked about in the tutorial.
- 59:25How do they, what should they do now?
- 59:27Well, start building.
- 59:28So 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:37And 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:48I mean, it's quite long, but it's free.
- 59:51And at the end, you'll have a very solid scaffolding of a Python project that you can use.
- 59:55Yeah.
- 59:55Good advice.
- 59:56Thanks for being on the show and sharing it with everyone.
- 59:58Thank you very much.
- 59:59Thank you for inviting me here.
- 1:00:00Of course.
- 1:00:01Bye-bye.
- 1:00:01This has been another episode of Talk Python To Me.
- 1:00:05Our guest on this episode was Sebastian Witwoski, and it's been brought to you by Linode and us over at Talk Python Training.
- 1:00:12Start your next Python project on Linode's state-of-the-art cloud service.
- 1:00:16Just visit talkpython.fm/Linode, L-I-N-O-D-E.
- 1:00:21You'll automatically get a $20 credit when you create a new account.
- 1:00:24Want to level up your Python?
- 1:00:26If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 1:00:31Or 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.
- 1:00:39And of course, if you're interested in more than one of these, be sure to check out our Everything Bundle.
- 1:00:44It's like a subscription that never expires.
- 1:00:46Be sure to subscribe to the show.
- 1:00:48Open your favorite podcatcher and search for Python.
- 1:00:50We should be right at the top.
- 1:00:51You 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.
- 1:01:01This is your host, Michael Kennedy.
- 1:01:02Thanks so much for listening.
- 1:01:04I really appreciate it.
- 1:01:05Now get out there and write some Python code.