Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Production vs Development Dependencies

Give Feedback

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 requirements_dev.txt with pyvim:

$ pyvim requirements_dev.txt

A 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 >= in requirements_locked.txt to ==.

Comments & Discussion

Become a Member to join the conversation.