Mastering PyCharm Transcripts
Chapter: PyCharm Projects
Lecture: Requirements.txt and friends

Login or purchase this course to watch this video and the rest of the course contents.
0:01 If we open a project and it has a requirement.txt file
0:06 PyCharm understands this,
0:08 so these requirements are often here
0:10 for complex applications that require many dependencies
0:13 or maybe it's some kind of package itself that has dependencies
0:17 like let's say Requests, you're working on the Requests package directly
0:22 or you've even created Pyramid web application
0:25 which each web app is itself a package that has a bunch of dependencies.
0:29 When you open one of these in PyCharm,
0:31 it inspects the target selected interpreter
0:34 and it says are the required libraries installed?
0:38 In this case you can see that they're not
0:41 whatever interpreter we have set up to run
0:44 you can't really tell from this window,
0:47 PyCharm can say Requests, BeautifulSoup and Colorama are not satisfied
0:52 so how does it know what these requirements are?
0:54 Well, if you open up the requirements.txt
0:57 you can see those are the three that are listed right there
1:00 and it's the fact that these are listed in the requirements file
1:02 but not actually installed in the interpreter
1:05 so PyCharm is saying hey, these are required, you have to install them.
1:08 Installing stated requirements is really awesome,
1:12 but another problem that you can run into is
1:14 you can create a rich, complex application
1:17 and forget to put some of the requirements into this requirement.txt file,
1:21 this is what tells everyone what you need to run
1:24 and if you forget let's say, we're using 6
1:28 or we're using some other thing
1:30 that won't get pulled in by any of the requirements here
1:32 let's say SQLAlchemy for example,
1:35 if we forget to list it here, our app will not run.
1:38 So, what we can do is actually PyCharm knows this
1:43 and will fix it in both directions, so the previous example
1:47 was you have stated there are requirements that are not here
1:51 and we're going to install them for you;
1:54 it will do the reverse, like let's look at this—
1:56 Uplink is a really cool api package
2:00 for basically mapping classes to apis on the client side
2:03 if you don't know about it, check it out, it's super cool,
2:06 but it's an external package that we need to state that we depend upon
2:10 so here we are using it, we've imported it
2:12 but we haven't actually gone back to the requirements file
2:15 and PyCharm gives us a little squiggly
2:17 and if you expand out, there's like a light bulb,
2:20 if you expand out what it says it wants to do for you
2:22 it says, it looks like this Uplink is something you're using,
2:25 we know that's a package, but it's not actually listed as a requirement
2:30 so if you click here, we'll go ahead and put Uplink in requirements.txt
2:34 so that people who get your application, know exactly what they need
2:38 and when they run pip install- requirements.txt
2:41 it's going to actually be ready to run.