Modern Python Projects Transcripts
Chapter: Course conclusion and review
Lecture: Pinning dependencies

Login or purchase this course to watch this video and the rest of the course contents.
0:00 One very important thing to keep in mind when building a python project is to pin
0:05 your dependencies. If you only specify the name of a package that you want to
0:09 use, pip will install the latest version,
0:12 and it's possible that this latest version will have some changes that will break your project
0:17 Or they can simply contain a bug.
0:20 So a much better idea is to always specify which version of a package you want
0:24 to use. So don't just say that you want to use Django or that you
0:29 want to use Django 2 always say that you want to use for example,
0:33 jungle 2.2.4 because this is the version that you test it and you know
0:38 that it will work with your project.
0:40 So always pin versions of all the packages that you use in your project.
0:45 And the best way to do this is to use a tool called pip tools with
0:49 pip tools. You just create a file with some dependencies pinned and you run.
0:54 pip compile. This will create a new file,
0:57 but this time, with all the versions of third party packages that you use in
1:01 your project pinned. Then you just pass this file to pip when you want to install dependencies to your project.