Managing Python Dependencies Transcripts
Chapter: Setting Up Reproducible Environments & Application Deploys
Lecture: Introduction to Requirements Files
0:01 You might have seen those requirements files before,
0:03 they are usually called requirements.txt
0:06 or sometimes also requirements.pip
0:09 and what they are is basically a list of pip install arguments placed in a text file.
0:15 So this is what a very simple requirements.txt file would look like.
0:20 You can see here that the requirements file contains a list of package names.
0:25 So in this case, it includes the requests module,
0:29 with a specific version using the version specifier syntax you learned about earlier,
0:34 and it also lists the schedule module with a similar version specifier.
0:38 Now this is a very simple example but it's also quite typical
0:42 of what a real world requirements file would look like.
0:45 One interesting thing you can do with these requirements files
0:48 is that you can add comments to these files,
0:51 so you would just place the hash character and then you can place a comment.
0:55 This is often helpful to explain what is going on in your requirements files
1:00 or if you want to leave a comment for the next developer working on that file.
1:05 Requirements files capture all of the third party dependencies
1:09 a Python program needs to run, and usually,
1:12 they do that by specifying the exact package versions.
1:16 Using requirements files a Python environment can be reproduced
1:20 in exactly the same way on a different machine or for different developer,
1:26 or even just in a different directory on your local machine.
1:29 They are a key piece for achieving repeatability in your Python built environments.