Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Introducing the Pyramid framework
Lecture: Pyramid principles

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's spend a moment on the Pyramid philosophy and some of the principles that they use to drive their project. I love their tagline:
0:09 The start small, finish big, and stay finished framework. You'll see that the principles really drive that mission statement there.
0:17 First of all, they focus on simplicity, and the pay-only-for-what-you-eat approach. And what that means is they've designed the framework
0:26 so that you can get results even if you have only a partial understanding of Pyramid. You don't need to understand all the stuff
0:33 in order to make use of it. You just need to know how to, say, create a view and a template and pass data to it. That's really all you need to know
0:40 if you just want to show simple data, things like that. So they've built this start small and add your understanding
0:48 to do more and more advanced stuff over time but if you don't care about it, you don't need to know about it, and that's really nice.
0:54 Being a microframework, they focus on minimalism; the core things that web applications do: mapping URLs to code, templating,
1:03 security, and static assets. And that's pretty much it. Every web application has to do stuff like this, so that's what they've focused on,
1:10 doing this really fast and really well. Because Pyramid's relatively small, they can focus on having documentation for everything.
1:20 So their goal is to make sure nothing goes undocumented. And I could tell you, I've submitted a couple of PRs back to various aspects of Pyramid
1:27 and a lot of the conversation actually has been, well, what are the effects of this change on the documentation, on the tutorials,
1:34 and making sure that that's always up to date. Maybe even more so than, is this the right change for the framework?
1:41 So I can tell you they take documentation super seriously. We talked about focusing on the core things the web framework does,
1:49 routing URLs, serving static assets, and so on, and I can tell you that Pyramid is one of the fastest Python web frameworks out there.
1:58 It's super fast, really runs well, and it runs well on Python 3. Some of the frameworks out there, you'll see they run pretty fast on Python 2
2:05 but not on Python 3, and nobody wants to be in that place these days, right? Python 2 is on its way out, so having this run fast
2:12 on Python 3 is really, really awesome. I can give you a little bit of background just running Pyramid for my web applications, both the podcast website
2:21 and the training website run on Pyramid. I've had various things of those sites each featured on Hacker News, and be on the front page,
2:31 in the top five or top 10 on Hacker News for a day or two, and that sends a ton of traffic over. You go over to the web server, pull it up,
2:39 it's like a $5/10 web server, virtual machine, and it's doing like 5/10% CP usage even though it's just getting hammered
2:48 with all this traffic. So this framework is super fast and easy on the hardware, and really, really scales in some impressive ways.
2:56 We obviously want our web frameworks to be reliable, and it's really encouraging that every release of Pyramid
3:02 has 100% statement coverage for their unit tests. That's awesome. Pyramid is open source and released under a permissive license.
3:11 You can see your github.com/pylon/pyramid, and you can go check it out, download it, clone it, do whatever you want so you'll always
3:19 have access to your web framework. One of the first things that drew me to Pyramid was actually it's super strong support for Python 3.
3:30 So they made a statement early on saying, Python 3 is the future, Python 3 is going to be our default implementation.
3:37 Yes, it may still run on Python 2, but we are going to build all of our demos, build all of our examples, and primarily test and develop on Python 3,
3:48 and make sure things run fast on Python 3. Which they've done really well, and that's awesome. You definitely need to be on Python 3 these days,
3:56 Python 2 is on its way out really, really soon. At the 2020 deadline, it's basically going unsupported and you do not want to be built on a framework
4:05 or a runtime that's unsupported. So the fact that Python 3 is the default implementation for Pyramid is just excellent.


Talk Python's Mastodon Michael Kennedy's Mastodon