Introduction to Dependency Management
00:00 You might have heard the term dependency management in combination with Python packaging. What is dependency management, and what do you need it for?
00:09 So most real world programs that you are going to write and that you are going to encounter are likely to use third party libraries and frameworks. These frameworks that the program uses and that the program requires to function are called dependencies, so here is an example.
00:26
Let’s say you are working on a project called my_program
and to do its job, my_program
actually relies on two other packages, and so my_program
would enlist these other dependencies and use those other packages and other libraries to get the job done.
00:44
So maybe you don’t want to reimplement some function like HTTP downloads and you program would just use that in a library and these packages super_library
and other_dependency
, they would be called dependencies of my program in this case.
00:59 Of course, not only can your programs have dependencies, but the dependencies of you programs can have dependencies again, and so on, and this is what we refer to as transitive dependencies, or you could also think of them as dependencies of dependencies or secondary dependencies.
01:20
So let’s take a look at our my_program
example. So in this case, we said my program has two direct dependencies and that will be super_library
and other_dependency
, now what you can see here is that super_library
and other_dependency
itself, actually have dependencies again, and some of the dependencies of those dependencies, have dependencies again.
01:43 So this is a whole tree of dependencies. On the one hand, having this flexibility is great because it allows us to abstract away all kinds of functionality and then make that available to other programs and other libraries, so that the community of Python developers can build increasingly powerful libraries and programs and frameworks.
02:03 But on the other hand, I am sure you’re starting to see why managing dependencies manually is so difficult, it’s super time consuming, copying and pasting source code makes updating really difficult, imagine you downloaded some file off the internet, some Python source code that you’re including in your project, what happens if you want to update that file… maybe a new version came out or the author released a new version, and you want to include that in your program to make use of some awesome new features.
02:33 Now, if you have to manually copy and paste that around it’s very easy to make mistakes and it’s kind of hard to understand what the real dependencies of a program are.
02:42 So if you are sending that over to a co-worker or you want to publish that program on the internet, it becomes very hard for everyone else to actually understand what dependencies they would need to install in order to get your program to run.
02:57 The solution to all of these problems is of course, more software; You know, I am joking here, but, there is software that can make your life a little bit easier when it comes to dependency management, and this software is typically referred to as package managers.
Become a Member to join the conversation.