Modern Python Projects Transcripts
Chapter: Let's build a package
Lecture: Remove unnecessary files
0:00 This cookie cutter template has created a lot of files here,
0:03 so let's quickly go through them, and remove those that we don't necessarily need.
0:08 So let's open VSCode and let's go through them one by one.
0:14 So, first we have the editor config.
0:17 This is actually useful because it will set up a configuration file, no matter what Editor
0:22 you're using. So if you have VIM or emacs or VSCode,
0:26 they will all respect this configuration file.
0:29 Then we have gitignore with a lot of python specific files,
0:34 which is good. Then we have Travis yml.
0:37 I'm not planning to use Travis, so I can remove this file.
0:46 We have a file where we can list all the AUTHORS.
0:48 I'm going to leave it for now.
0:52 Then we have a contributing guide that explains how different people can contribute to this project
0:57 So if they want to report a bug report,
1:01 they can goto GitHub Repository.
1:03 That doesn't actually even exist. But we can always create it later.
1:10 And here are all the steps that people should do when they want to submit a
1:13 pull request. This is actually very useful file.
1:17 Let's leave it. History is a file where you specify all the changes that happened
1:22 in each release. So again,
1:24 another useful file, license since we created the MIT license.
1:29 This is the whole text of it. Here,
1:31 We have to MakeFile. That looks a bit complicated,
1:35 but actually it contains the typical stuff.
1:39 So when we run maketest,
1:41 we're gonna run pytest. When we run,
1:44 make test-all. We gonna run tox that will test our package under different versions
1:49 of Python, flake 8 set as our linter,
1:53 we can remove some test files,
1:57 Some compiled python files and stuff like that.
2:00 So, it's actually pretty useful file.
2:02 If you're following this video, I suggest you take a look and see what useful
2:06 commands you can find here. Then we have the manifest file that will be useful when
2:12 we'll be building the python package.
2:15 Typical. README with some badges from Travis from pypi and stuff like that
2:22 requirements_dev, So, here we have the requirements that I will use as a developer
2:28 Not necessary the final requirements of the end user of the package.
2:32 So, for example, I have pytest here,
2:34 but If people want to use my uptimer,
2:37 I don't expect them to install pytest.
2:39 Then we have a setup.cfg with some configuration and setup.py
2:44 which is the main file of the python package.
2:48 Although now there are more and more projects that they're using.
2:51 pyproject.toml also setup.py might be replaced in the future
2:55 but for now, this is the file that will be using. So, those are
3:06 the requirements for the end user of our package.
3:09 So, whenever people want to install uptimer from pypi,
3:13 they will also have to install everything that you specify in this list.
3:17 And finally we have the tox.ini file where we specify all the tox settings
3:22 So here we say that our project should support python 3.5,6,7 and 8.
3:29 Apart from that, we have some folders here,
3:30 so let's go from the uptimer.
3:33 So, here we have the init file that tells python that,
3:36 This is a package, the CLI file where we can specify the CLI commands and the actual
3:43 uptimer that should contain the main code of our project.
3:48 Next we have test folder. So again,
3:50 the init file and some examples of fixteures and tests and actually here we have the
4:02 example of how to test cli cli application.
4:06 So that's actually pretty useful boilerplate code.
4:10 Next, we have the docs folder, so we don't have to generate this sphinx documentation
4:14 from scratch. As you can see,
4:17 there is a lot of things going on here,
4:18 so we would have to go and modify all those files.
4:23 But I will leave that for the end.
4:25 We have a folder with the VSCode settings that was just created.
4:30 And finally, we have the .github folder that contains the issue template.
4:35 So this is a template file written in markdown that will be used when someone wants
4:40 to create a new issue in your github repository for this project.
4:44 So, again, this is a very useful file when you want to give people
4:47 a skeleton of, how they should document the issue with your code.
4:52 Otherwise, people will just write whatever comes to their mind like it doesn't work,
4:57 fix it or whatever. Here,
4:59 atleast we tell them to specify which version of the package they are using.
5:02 What's there Python version was the operating system and stuff like that.
5:07 So, again, very useful stuff.
5:09 So apart from removing this travis yml file,
5:11 the rest of the files can stay.