Modern Python Projects Transcripts
Chapter: Welcome to the course
Lecture: What you will learn
0:00 What exactly we're going to talk about in the course?
0:03 I will start by showing you, how to set up visuals to their code and
0:07 how to use it when working with Python.
0:09 I know that a lot of Python Programmers are using PyCharm,
0:12 but also, a lot of people use VSCode.
0:15 So, if you're one of them,
0:16 I hope you will enjoy this chapter.
0:18 Then we'll talk about installing different Python versions and Python packages on your computer.
0:24 By default, you can't have two different versions of the same package installed at the same time
0:29 because of the way how pip works.
0:31 So, I will explain you what virtual environments are and
0:35 How to use them, When you work on different Python projects,
0:38 I will show you three tools pyenv, venv and pipx.
0:42 When you learn how to use them,
0:44 you will be able to easily Install new Python versions on your computer,
0:48 instantly switch between them and even install packages globally without messing up their dependencies.
0:55 Then we'll talk about how to start a Python project.
0:58 Starting a new project can be hard.
1:00 You stare at the blank folder,
1:02 wondering, what should be the first file that you will,
1:04 write. Okay, maybe it's not that difficult when you only have one Python file.
1:08 But as your project grows,
1:11 there will be more files. So, we have to figure out a good project structure.
1:15 To Avoid problems in the future.
1:17 I will show you how to use a tool called cookie cutter to generate the initial
1:22 structure of your project. Cookie cutter is great because a bunch of smart people created
1:26 templates for some typical projects. For example,
1:29 there is a template for a PyPI package or for a Django website,
1:33 and you can take those templates and use them to start your Python project,
1:37 which is often much easier than writing everything from scratch.
1:41 Next, we'll talk about how to manage your project as it grows.
1:44 Where to put some Python files,
1:46 Where to put some typical tasks,
1:47 like running tests or building the PyPI package.
1:51 We'll use a tool called Peep tools to pin versions off our dependencies,
1:56 and then I will show you how to use poetry when building a Python project.
2:00 After that, we will talk about the writing Python code.
2:04 I want to tell you how to write a good Python code,
2:06 but I will show you some tools that will complain when you write a bad code
2:10 I will explain what PEP 8 is and how we can use a tool called
2:14 black to automatically format our code according to the rules from PEP 8.
2:19 And we'll also talk about other static code analyzer. so tools that can monitor our code
2:25 and pick up some errors. We will use Pylint and Flake 8 on some ugly
2:29 Python code to see what errors it can find.
2:32 I will show you some popular Flake 8 plugins that you can install to make
2:35 it works even better. But Flake 8 and Pylint are not the only great Linters
2:40 out there. So, I will also quickly show you tools like bandit,
2:43 Prospector and Sorcery and explain what's the difference between all of them.
2:48 Once you are done with writing code,
2:50 you probably need to add some tests and documentation, so I will show you how to
2:54 use pytest and Sphinx to do that.
2:56 Both of them are very easy to start with,
2:58 but they offer a lot of amazing features,
3:02 so, I will show you some cool tricks,
3:03 like testing the code examples in your documentation or automatically extracting the documentation from the Docstrings
3:09 in the source code. We will take an existing test written in the unit tests
3:14 and converted to Pytest to see how much easier it gets when you use Pytest
3:18 will use some fixtures parameters some tests and add some marks,
3:22 so you will not only learn the basics of Pytest,
3:25 but also some more advanced features.
3:27 And since running your tests or building your documentation manually each time you change,
3:32 something in your code is boring.
3:34 We'll also talk about some ways to automate this.
3:37 I will show you how to use tox,
3:39 which is the best friend of every Python developer who builds packages because with a simple
3:44 configuration file, you can run test under different Python versions.
3:48 Then we'll take a look at Git hooks and use the pre commit tool to.
3:52 Add some automatic pre committed checks.
3:54 That way, you can quickly check that your call is correctly formatted and doesn't have
3:59 any easy to spot errors each time you create a new Git commit.
4:04 But configuring tox or pre commit on everyone's computer can be error prone when you work
4:09 with different people. Someone might use the old pre commit configuration.
4:13 Another person might forget to use tox and send a failing test to the git repository
4:17 So, to solve this problem,
4:20 we will talk about continuous integration services like GitHub actions or GitLab CI.
4:24 They can automatically run a set of checks each time someone creates a new
4:29 pull request or sends a new commit.
4:32 They are a great way to check everyone's code without making every person on your team
4:37 set up something or run those checks manually under computer.
4:42 And that should cover everything that you need to know to Build a great Python project
4:46 But this course wouldn't be complete with a bit of practice,
4:50 so we'll have three more chapters where we will build something in the first one.
4:55 We will build a command line application,
4:57 and we'll use poetry to manage this project.
5:00 Then we will build a Python package,
5:02 but this time we will start with a cookie cutter template,
5:05 and we want to use poetry so you'll have a comparison of how it is to
5:10 work with and without the poetry.
5:13 And we'll also publish this packet on PyPI and finally we will build a simple
5:18 GUI application with the window where we can put some text and the button that you
5:22 can click. I will show you how you can package it as an executable Python
5:26 application. That way, you will be able to send it to someone on the windows
5:30 or Mac computer, and they will be able to run it even if they don't
5:34 have Python install. And in the final chapter,
5:37 For those of you who are thinking about building a website,
5:40 I will show you how you can deploy that website.
5:43 We'll compare using a virtual private server,
5:46 a platform as a service like Heroku and a containerized solution like Docker.
5:51 We will look at pros and cons of each of them.
5:54 And then we'll deploy a very simple application to Heroku and then to Digital Ocean as
6:00 a Docker image. Yeah, that was a lot of things I know,
6:05 but that's basically everything you need to know to build a great Python project from scratch
6:09 And I hope that when you finish this course you will have a great development
6:14 environment setup. You will have your code editor configured,
6:18 and you will at least know where to start.
6:20 No matter what kind of Python project you want to build.