Modern Python Projects Transcripts
Chapter: Managing Python project
Lecture: Medium projects
0:00 As you add more features to your project,
0:02 the single python file starts growing,
0:05 so, at some point you will have to split it into separate files.
0:09 You might still use one main file,
0:11 but you move all the helper functions into separate files, and store them inside the folder
0:16 like here. Or maybe you move all the python files inside one folder like here
0:21 on the right, although as the number of test grows,
0:24 you will probably split your tests into separate files, and move them inside the folder called
0:29 tests. So, now you're Project looks more like one of those two options.
0:33 They're both quite similar, so let's discuss the project structure on the left.
0:38 Now we have two new folders,
0:40 medium and tests, medium contains all additional python files.
0:45 You will usually name this folder in the same way as the name of your application
0:48 So, if my application is called medium, because this is a medium sized project,
0:54 then this folder is also called Medium.
0:56 We still have a main.py file that we used to start our application
1:00 but this main.py imports additional functions from files inside the medium directory
1:07 I have also moved all the tests inside the directory called tests.
1:11 And here I have split all the tests into separate files,
1:15 depending on what they are testing.
1:17 As you can see, we have a nice separation.
1:20 We have the main folder that contains our main python file and all the additional
1:25 files for our project. We have the medium folder that contains all python files related
1:31 to our application and finally, tests that contain all the tests. Everything has its own place.