Modern Python Projects Transcripts
Chapter: Course conclusion and review
Lecture: Pinning dependencies
0:00 One very important thing to keep in mind when building a Python project is to pin
0:06 your dependencies. If you only specify the name of a package that you want to use, pip will install the latest version,
0:13 and it's possible that this latest version will have some changes that will break your project Or they can simply contain a bug.
0:21 So a much better idea is to always specify which version of a package you want to use. So don't just say that you want to use Django or that you
0:30 want to use Django 2 always say that you want to use for example, jungle 2.2.4 because this is the version that you test it and you know
0:39 that it will work with your project. So always pin versions of all the packages that you use in your project.
0:46 And the best way to do this is to use a tool called pip tools with pip tools. You just create a file with some dependencies pinned and you run.
0:55 pip compile. This will create a new file, but this time, with all the versions of third party packages that you use in
1:02 your project pinned. Then you just pass this file to pip when you want to install dependencies to your project.