Modern Python Projects Transcripts
Chapter: Managing Python project
Lecture: Separate requirements files
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Another common practice with requirements files is to have a separate set of.
0:05
dependencies required to run your application, and a separate set of dependencies used only
0:11
by developers. For example, your production server doesn't need to run pytest, so there is no need to install pytest at all. But you, as a developer,
0:20
need to have pytest to run tests. So you make two requirements files, one that is called requirements.txt
0:27
It contains the dependencies that you want to install everywhere, so on a production server, but also on your computer.
0:35
And then you create another one called Requirements-dev that installs all the dependencies from
0:41
the requirements.txt file and some additional ones like pytests and it's plugins.
0:48
You use this file on your computer when you develop your application, with the separation of
0:53
requirements, you only install the necessary packages on your production server. There is no need for you to have pytest installed on your production,
1:01
and the less packages you installed. The lower is the risk that some of them will have a security vulnerability that hackers
1:09
can use, and it will also be slightly faster to installed packages on your production server.