Modern Python Projects Transcripts
Chapter: Managing Python project
Lecture: Simple projects
0:00 Let's start with a very small project that consists of only,
0:03 one Python file and maybe some additional files,
0:06 like Read me, requirements, license,
0:08 etcetera. If you're using cookie cutter that I showed you in the previous chapter,
0:12 then you might have some other files.
0:14 If the cookie cutter template is good,
0:16 then it will explain, what's the purpose of each of those files?
0:20 As you can see in this case,
0:22 managing this project is easy. You pack everything inside one folder,
0:25 and that's it. The only file that it's actually required is the simple.py
0:30 file that contains all our python code.
0:33 We might not even have the other files,
0:35 but they're useful, so let's see what each of them does.
0:38 A license, as the name suggests,
0:41 contains the LICENSE text of your code.
0:43 If you want to let others use your project or build something cool on top of
0:48 it, you need to choose a license that explains how they can use it.
0:53 You might be thinking, Well,
0:54 I don't really know anything about licensing,
0:56 and they all sound complicated, so I'll just not select any license,
1:00 and people can do whatever they want with this code,
1:03 but that's not how licensing works.
1:06 If you don't specify any license,
1:08 the default copyright applies, and the default copyright law says that you retain all rights
1:14 to the source code, and no one can reproduce,
1:17 distribute or create derivative work from this code.
1:21 So, basically without specifying the license,
1:24 no one can use your code.
1:26 If you're planning on open source in your code,
1:28 make sure to select the correct license.
1:31 Next we have Makefile. I know that Makefile sounds like some scary Linux
1:36 magic, but they're actually not that bad.
1:39 Makefiles are a great way to organize tasks for your project.
1:42 For example, if you're building Docker Images,
1:45 then instead of memorizing all the parameters and file paths to different configurations,
1:50 you can turn them into a build task and save it in a Makefile.
1:54 Or, if you are running pytest with a lot of parameters,
1:57 you can save all those parameters as the name of a specific task.
2:01 For example, a unit test.
2:03 I will show you an example of a Makefile later on.
2:06 The next file is Read Me file, that contains all the information about this project you
2:11 can use a plain text format,
2:12 or if you prefer a nicer styling,
2:15 you can use markdown. And if you're hosting your code on,
2:18 GitHub, it will format,
2:19 Your read me file accordingly. Read me
2:21 should contain the most important information to everyone, who is seeing your project for the
2:26 first time, together with links to additional resources, like the documentation.
2:31 Next, we have requirements file.
2:33 If your project depends on some additional packages,
2:36 you will need to specify them somewhere.
2:38 The most popular file format is a plain text file called requirements.txt.
2:43 simple.py is the file that contains the actual python code of your simple
2:48 project. And finally, if you add some test for your simple application,
2:52 it's common to put them in a file called tests.py