Managing Python Dependencies Transcripts
Chapter: Setting Up Reproducible Environments & Application Deploys
Lecture: Lesson Overview
0:00 Welcome to the setting up reproducible environments and application deploys module.
0:03 Here is where you are right now in the course,
0:07 so you've learned how to manage third party dependencies with pip,
0:10 you know how to isolate your dependencies with virtual environments
0:13 and you also just learned how to find and identify quality Python packages,
0:18 now let's talk about another very important topic
0:21 when it comes to dependency management in Python.
0:25 Let's say you're working on a Python program,
0:28 and the project has matured quite a bit,
0:30 and so now finally, you want to share it with other people.
0:33 If you're using third party packages, in your Python program,
0:36 then that might not be so easy.
0:39 How can you make sure that someone else trying out your program
0:42 can get the exact same set of dependencies?
0:45 Even the slightest version conflicts can make installing
0:48 someone else's Python program a very frustrating experience.
0:53 So the real question here is how do you reliably specify
0:56 all of the dependencies that a Python program needs.
1:00 And this is not only about sharing your programs with other people,
1:04 there are many environments your Python program can run in,
1:08 for example, there is likely going to be a local development environment and ideally,
1:12 that development environment should be the same
1:14 across all of the developers working on the project.
1:18 Then there might be automated tests that are being run
1:21 on a continuous integration infrastructure.
1:24 Again, all of these tests should run under the same set of dependencies,
1:27 depending on the complexity of your program,
1:30 there might be several deployment targets,
1:33 for example, if you're building a web application,
1:35 there might be a staging server and a production server.
1:38 How can you make sure that all of those environments
1:41 use the exact same set of dependencies,
1:43 because using the same set of dependencies across all of these environments,
1:48 with the exact same packages and the exact same version numbers,
1:52 is very important to achieve a reliable deployment process.
1:56 So really, the goal here is that all environments
1:59 are going to use the same set of dependencies.
2:02 So this is the goal that we're aiming for here.
2:05 Now, how do you make dependency installs repeatable in Python?
2:10 And the answer is requirements files.
2:14 In this module in the course you are going to learn
2:18 how to use requirements files to make your application deploys
2:21 and Python project installs fully repeatable.
2:24 First, you are going to go through a quick introduction to requirements files,
2:27 to learn what they are, what they look like and how to use them.
2:31 Right after that, you are going to learn how to capture
2:34 project dependencies automatically using pip.
2:36 In the third lesson in this module, you are going to learn
2:39 how to restore captured dependencies in order to deploy your application.
2:43 Next, you're going to learn some tricks on how to separate
2:45 your development and production dependencies;
2:48 to conclude the module, you are going to learn some best practices
2:51 around requirements files that will make working with them a lot easier.
2:54 Alright, time to make your Python application deploys
2:56 fully repeatable, let's jump right in.