Modern Python Projects Transcripts
Chapter: Managing Python project
Lecture: Simple projects

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


Talk Python's Mastodon Michael Kennedy's Mastodon