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