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