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


Talk Python's Mastodon Michael Kennedy's Mastodon