Introduction to Requirements Files
00:00
You might have seen those requirements files before, they are usually called requirements.txt
or sometimes also requirements.pip
and what they are is basically a list of pip install arguments placed in a text file.
00:15
So this is what a very simple requirements.txt
file would look like. You can see here that the requirements file contains a list of package names.
00:25
So in this case, it includes the requests
module, with a specific version using the version specifier syntax you learned about earlier, and it also lists the schedule
module with a similar version specifier.
00:38 Now this is a very simple example but it’s also quite typical of what a real world requirements file would look like. One interesting thing you can do with these requirements files is that you can add comments to these files.
00:51
So you would just place the #
(“hash”) character and then you can place a comment. This is often helpful to explain what is going on in your requirements files or if you want to leave a comment for the next developer working on that file.
01:05 Requirements files capture all of the third-party dependencies a Python program needs to run, and usually, they do that by specifying the exact package versions.
01:16 Using requirements files a Python environment can be reproduced in exactly the same way on a different machine or for different developer, or even just in a different directory on your local machine.
01:29 They are a key piece for achieving repeatability in your Python build environments.
Become a Member to join the conversation.