Production vs Development Dependencies
It’s often the case that you’ll want specific packages installed in your development environment that you don’t want installed in your production environment.
Unit testing frameworks like
pytest would be a good example of this. They need to be installed for development of the application, but they aren’t needed for the application to function in the production environment.
pyvim, the text editor used in this course, is another example of a development-specific dependency.
Create a new text file called
$ pyvim requirements_dev.txt
requirements_dev file like this would include all the dependencies from the
requirements.txt file, plus
pytest for testing:
-r requirements.txt pytest>=4.2.0
It’s also helpful to have a requirements file with locked down, known-good versions of dependencies for use in a production environment. This way, no
pip command can ever upgrade them and risk breaking the application.
You can create a copy of
requirements.txt with this Shell command:
$ cp requirements.txt requirements_locked.txt
To lock down dependencies, change all occurrences of
Comments & Discussion
Become a Member to join the conversation.