Modern Python Projects Transcripts
Chapter: Course conclusion and review
Lecture: CI

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Building a Python project is not just coding. You will be constantly running tests,
0:06 rebuilding documentation from time to time and running black or flake 8 to make sure that your code doesn't have an easy to spot problems.
0:15 Instead of doing all that by hand, you can use tools to automate. a lot of those tasks. One of those tools is Tox.
0:24 Tox will automatically run a set of commands in different virtual environments.
0:29 The most common use case is to run tests under different Python versions.
0:34 This is especially useful for developers who build Python packages instead of manually testing that your
0:40 package works with Python 3.6,3.7,3.8 and so on. You just write a Tox configuration file where you specify what Python version you want to
0:50 test and what commands you want to run, and Tox will take care of everything for you. Another tool is pre commit. This one will generate a git hook.
1:01 So a script that will be run each time you create a new git commit, this hook can run some scripts like black or flake 8 on your code.
1:11 That way you can make sure that your code meets the quality standards set by your team, before you push it to the code repository.
1:19 Both Tox and pre commit are great, but they require you to configure something on your computer.
1:25 So, a much better alternative, especially for a large team, is to set up a continuous integration server.
1:32 Both GitHub and GitLab comes with a continues integration solution built in. But there are also plenty of other external services that you can use,
1:41 so a CI, tool, will monitor your code repository, And each time there is a new commit or a
1:47 new pull request, it will automatically run some checks on them. You can run tests, you can run black or flake 8,
1:55 and you can even run any kind of Linux command that you want. If your code can pass all those checks, it will get a green light and it can be merged.
2:05 The main advantage of using a CI. Is that you set it up once, and then it works for everyone on your team.
2:13 No one has to install anything on their computer,and the same checks runs on every ones code.

Talk Python's Mastodon Michael Kennedy's Mastodon