Python for Entrepreneurs Transcripts
Chapter: Build web apps with Pyramid: Part 1
Lecture: Managing outside dependencies

Login or purchase this course to watch this video and the rest of the course contents.
0:03 Python comes with pip and pip is all about installing packages and making sure we have the latest up-to-date version
0:10 of all the various Python libraries we are using. But web apps are not just about Python. In fact, you don't typically even see the Python as a user,
0:19 but what you do see are CSS frameworks, JavaScript libraries and various front-end interactive pieces
0:25 and PyCharm and pip have no real great way to deal with those dependencies. But there are a couple of systems out there that do. One of them is Bower,
0:35 another one that comes to mind is npm, which comes with Node. So you can find Bower at bower.io. Here you can see their little slogan
0:44 "Web sites are made of lots of things - frameworks, libraries, assets and utilities. Bower manages all of these things for you."
0:50 Yeah, that's exactly right. So let's look at our website in PyCharm and see where these dependencies might be
0:56 and how we can switch to using Bower to manage them. Here is the app we created in PyCharm using the scaffolding.
1:03 Notice here we have some static pieces, the Pyramid logo, the CSS theme and so on, and so where are dependencies?
1:11 We are actually using JavaScript and we are using CSS, front-end frameworks, we are using for example Bootstrap,
1:17 well, the way it works, if we go over here to this template, we are going to pull this out, so there is one common template
1:23 that is shared across all the views, but let's just focus on this one template for now.
1:27 Notice right here, the open source MaxCDN, we are using Twitter Bootstrap 3.0.3 and we are importing that. We are also using HTML5 Shiv and Respond.js,
1:38 we are pulling these off the dedicated versions on the CDN. Well, this is pretty good and there probably are some benefits to this
1:45 for our users and that if they have gone to another site that also uses this exact version off of this exact CDN,
1:52 they won't have to load it, it makes development harder and you have dependencies on the CDN and personally, I don't really like it,
1:58 so for example what if you are on an airplane or you are in a coffee shop with poor Wi-Fi or something like that,
2:04 and you'd like to work on your web app, you better hope you've already cached these things.
2:07 So let's switch to local versions that we can control more carefully and we'll do that with Bower.
2:13 One more set of dependencies we probably have down at the bottom, here you can see that we depend on jQuery and we also depend on the JavaScript
2:21 that comes out of Twitter Bootstrap, which of course itself depends on jQuery.


Talk Python's Mastodon Michael Kennedy's Mastodon