Latest / Talk Python To Me / #3: Pyramid Web Framework
Transcript
- 0:00Talk Python To Me. Episode number three. With guest, Chris McDonough. Recorded Monday, April 6th, 2015.
- 0:09Hello and welcome to Talk Python To Me, a weekly podcast.
- 0:39On Python, the language, the libraries, the ecosystem, and the personalities.
- 0:43This is your host, Michael Kennedy. Follow me on Twitter where I'm @mkennedy, and keep up with the show and listen to past episodes at talkpythontome.com.
- 0:52This episode, we'll be talking to Chris McDonough about the Pyramid Web Framework.
- 0:58Before we get to Chris, I have a few things to share with you.
- 1:01First, thanks again to Python Gear for sponsoring the last episode.
- 1:05They gave away a t-shirt to one lucky friend of the show.
- 1:08I randomly chose a listener from the group, and Alejandro Villamarin from Spain was our lucky winner.
- 1:14So congrats to Alejandro.
- 1:15We now have a Facebook page, so be sure to like us on Facebook if that's your thing.
- 1:20We're at facebook.com slash talkpython.
- 1:23And we are also on SoundCloud.
- 1:26You can listen to us on SoundCloud at soundcloud.com slash talkpython.
- 1:31Listener Nathan Chowning, who's at nbchowning on Twitter, pointed out a cool Kickstarter called Python 101 by Mike Driscoll to turn his book, Python 101, into a video series.
- 1:45It's already over $2,000 pledged towards his $5,000 goal, so check that out if you're interested in supporting Mike.
- 1:52You can find the link in the show notes on talkpythontome.com.
- 1:56Finally, I've started a Patreon campaign for this show.
- 1:59Patreon allows listeners to directly support us with very small contributions, for example, a dollar for a show.
- 2:06More details on this later, but you can find the campaign at patreon.com slash mkennedy.
- 2:12Patreon is actually doing some very cool work with Python, and since I started the campaign, they reached out to me, and we had a small discussion about what they're doing with Python.
- 2:22I decided it would make an excellent show, so we're going to talk to Patreon about how they're moving from PHP to Python 3, and that's how that's making all of their developers happy.
- 2:32So look for that in an upcoming episode.
- 2:35Now, let's get on to the interview with Chris.
- 2:37Let me introduce Chris.
- 2:39Chris McDonough is the primary author of the Pyramid Web Framework and the supervisor, Process Manager.
- 2:45He has been a member of the Python community since 1999, and he is a principal of Agenda-less Consulting.
- 2:52Chris, welcome to the show.
- 2:55Thanks, Michael.
- 2:56How are you today?
- 2:56I'm doing great.
- 2:57Thanks so much for being on my podcast.
- 3:00Yes, thank you for doing it.
- 3:02It's great to have another podcast, Python podcast.
- 3:05Excellent.
- 3:06And, you know, the reason I reached out to you is I'm a huge fan of the Pyramid Web Framework.
- 3:11Oh, go on.
- 3:12No, I am.
- 3:13I mean, our website is even written in Pyramid.
- 3:16I do love it.
- 3:17So I wanted to talk to you and just sort of learn more about the history and what people are doing with it.
- 3:23Great.
- 3:25Yeah, I'd be happy to answer.
- 3:26Cool.
- 3:26So what is Pyramid?
- 3:27Well, Pyramid is a Python Web Framework.
- 3:31And that term means many things to many different people.
- 3:35But it is a sort of web framework that's kind of light, I guess you would call it.
- 3:41I hesitate to call it a micro framework, although it kind of sort of fits in the same little box.
- 3:47That's one of the things that drew me to Pyramid was I think Django may be the most popular one out there just from taking the pulse of talking to people.
- 3:56But I feel like Django is like you build with these great big giant blocks, whereas with web frameworks like Pyramid, I'm building more with like little Lego pieces and not huge shipping containers.
- 4:09So I really like the granularity and the control I have when I'm working with Pyramid.
- 4:13Yeah, I do too.
- 4:15And, you know, I actually came into Python through Zope, you know, in like 1998 or 99, something like that.
- 4:24Zope is the, you know, kind of the antithesis of Pyramid, although they, you know, I stole lots of ideas from Zope.
- 4:31But Zope and Django and, you know, there's another framework called Web2Py are kind of, I guess what you'd call full stack web frameworks.
- 4:40You know, they actually have built into them, you know, database bindings and ways to administer the site.
- 4:50And, you know, they have UI to them and all kinds of stuff.
- 4:55Pyramid is a little bit more like something like Sinatra or Flask or other micro frameworks are escaping me, but, you know, something that's a little bit smaller.
- 5:06Maybe Bottle.
- 5:07Bottle, yeah, exactly.
- 5:09Yeah, Bottle is an example.
- 5:10And when I think of Pyramid, I think of sort of its peer or rival, frenemy maybe, I don't know, is Flask, right?
- 5:18These are kind of the lighter weight versions.
- 5:21You came from this background of these sort of bigger, larger, what you call full stack frameworks where it's like they predefine.
- 5:32Here is your data access layer.
- 5:33Here is your template layer.
- 5:36Here is how you wire this all together.
- 5:38What inspired you to go in the opposite direction?
- 5:41Well, like I said, you know, I came to Python through Zope.
- 5:45And Zope, even the word Zope, you know, can mean different things to different people.
- 5:51But, you know, when I came to it in 99, it meant the thing that's currently now referred to as the Zope2 web framework.
- 6:03And it was actually really great at the time.
- 6:08I used it to build, you know, I didn't, I ended up working for the people who made Zope for a number of years.
- 6:15But I did not work there then.
- 6:16I used it to build a site for an electrical, an electric company in Philadelphia that was something that we would now call today a content management system.
- 6:27But I don't think that term existed then.
- 6:29Well, the web world is a very, very different place than it was in 1998.
- 6:33I mean.
- 6:34Oh, yes.
- 6:34So what people expect out of web frameworks may have changed as well.
- 6:39Yeah, exactly.
- 6:39And, yeah, so that sort of skips over to the heart of it, which is that these days it's becoming much more interesting to write your UI in JavaScript.
- 6:51In HTML, instead of, you know, server-side templates and sort of, you know, web 1.0, reload the page things, you have these frameworks.
- 7:00Sure, AngularJS or Ember or any of these things, right?
- 7:04Yeah.
- 7:05And those things really don't need, you know, there's not much retail UI.
- 7:12And when I say retail UI, I mean, you know, the UI that your customers see when you make an application or something that these days is, you know, more pleasant to write, you know, on a totally server-side application than it could be in just JavaScript.
- 7:30So the frameworks have become smaller as a result, and a lot of the stuff that the old frameworks did have moved into these JavaScript libraries.
- 7:38Yeah, that makes a lot of sense.
- 7:40And I think the lighter-weight web frameworks pair well with, hey, I mostly need you to deliver HTML and CSS and JavaScript and then provide a cool sort of service layer back end to keep the JavaScript active.
- 7:54Yeah, I totally agree.
- 7:57I mean, that's the way people are thinking about how that works.
- 8:01That said, you know, it's often pretty convenient to write just flat-out, you know, templated web pages that, you know, have links that go to other templated web pages.
- 8:11And I don't think that'll ever die.
- 8:13It's not.
- 8:14It's definitely not going to die, and not in the near-term anyway.
- 8:17And I think if for no other reason than purely for SEO purposes, right?
- 8:23So if I've got a cool AngularJS page and it's got all my handlebar stuff in there, it's more or less empty of content.
- 8:29And if Google or Bing come along and try to index it, it's just going to say, hey, angle bracket, angle bracket content, as opposed to the real content of the page.
- 8:38And so as long as you're writing public-facing sites, you want to show up in search engines, you know, unless the search engines start executing the AngularJS bits, which they may well be trying, but I don't know that they do today.
- 8:50You know, there's still going to be some place for these sort of back-end, server-oriented, templated pages, at least the public-facing ones.
- 8:59Maybe your admins area becomes an AngularJS sort of spa type of application, but the front-end for your public-facing stuff probably will be HTML for a while to come.
- 9:09Yeah, I think that's right.
- 9:11And I'm sure Google's going to have to write a crawler that executes JavaScript pretty soon, you know?
- 9:18I mean…
- 9:19Yeah, it's going to be unavoidable.
- 9:20Yeah.
- 9:21Michael here.
- 9:30Thank you so much for listening to and spreading the word about Talk Python TV.
- 9:34The response to the podcast continues to be wonderful and humbling.
- 9:38I have a quick comment about supporting and sponsoring the show.
- 9:41I'm still looking to line up stable corporate sponsorships, but I wanted to tell you about a community-based campaign I'm launching to allow listeners to directly support the show.
- 9:49We are running a Patreon campaign.
- 9:51You might not have heard about Patreon, but it's kind of like Kickstarter for things like podcasts, which release frequent small deliverables rather than one-off large engineering projects.
- 10:00Visit patreon.com slash mkennedy.
- 10:02That's p-a-t-r-e-o-n dot com slash mkennedy and watch the video to see how you can donate as little as $1 per episode to support Talk Python To Me.
- 10:12This is your chance to ensure that the Python community continues to have a strong public voice.
- 10:17Consider supporting us today at patreon.com slash mkennedy.
- 10:21And thanks for listening.
- 10:29And really, you know, one of the things, one of my minor, you know, kind of pet peeves are just like, the Pyramid Docs have this in there.
- 10:38And, you know, I wrote something about it.
- 10:39There's a page in the Pyramid Docs called Design Defense.
- 10:44And one of the design defenses is that I don't call it an MVC framework because, to me, you know, MVC means a UI that has events that, you know, like it's a small talk thing.
- 10:59That's where that's from, that term.
- 11:01And the web is nothing like that, you know.
- 11:05Until we get these JavaScript frameworks, which actually do work like that, and those can be called MVC, you know.
- 11:11But I think Rails came along in, you know, 2005 or 2007 or whenever it was.
- 11:17Yeah, that sounds about right.
- 11:18And I think it introduced the idea that, okay, your views are your templates and your controllers are, you know, our Ruby code.
- 11:28Your model is your database.
- 11:30And I don't think that was ever true.
- 11:33You know, it sort of just got jammed on there.
- 11:36But now it actually is true, you know, with these JavaScript frameworks.
- 11:39Like you were saying, you know, you have these really thin applications that just serve out XML or they serve out JSON, you know, whatever.
- 11:47And your JavaScript stitches it all together and builds your UI.
- 11:50And the JavaScript is, you know, it's Turing complete.
- 11:55So, you know, you can do whatever you want.
- 11:57You can, you know, the UI can change as a result of a server through WebSockets or SSC or, you know, whatever.
- 12:03And it's really interesting.
- 12:05And that's another reason I think people are interested in it.
- 12:08Yeah, that's really, really cool.
- 12:10I think JavaScript is definitely eating a large portion of the world.
- 12:13So there's plenty of interesting stuff that's happening there.
- 12:16Well, we're all JavaScript programmers.
- 12:19That's right.
- 12:20We don't want to be.
- 12:21So, first of all, let's maybe, maybe you could walk the listeners through what the process of setting up all through the PyPI down to a running web page.
- 12:33Walk us through what are the steps to getting started with PyPyramid.
- 12:37Sure.
- 12:38So for better or worse, you know, we started out in Pyramid and we embraced Python packaging, including something that was, had been around for a long time when we embraced it.
- 12:52But people tend to bounce off of it, set up tools.
- 12:57And so Pyramid itself is a distribution in PyPI terms, which means, you know, a file that can be downloaded.
- 13:06This is a targz file that gets installed when you run either easy install or pip.
- 13:12And it has a bunch of dependencies mentioned in it that also come down as a result of you downloading it.
- 13:19And then those have dependencies, et cetera.
- 13:22And I think at this point, at our sort of beefiest, we had maybe 13, you know, 13 distributions that came down when you installed Pyramid.
- 13:31I think it's down to seven or something now.
- 13:32The reason we had so many was because we used to ship both two templating languages with the framework.
- 13:40And we stopped that because, you know, there was no purpose in it.
- 13:45We could do the same thing just by letting people choose.
- 13:50Sure.
- 13:50So you used to do Chameleon and Mako.
- 13:53Is that correct, by default?
- 13:54That's right.
- 13:55And now you're just down to Chameleon?
- 13:56Now we don't have any.
- 13:58Now no templating languages gets installed with the – no templating bindings get installed and no templating package gets installed when you install Pyramid.
- 14:07Right.
- 14:08So you have to make the choice and install it yourself.
- 14:10Right.
- 14:11So when I create a site, maybe through one of the scaffolding things, in there it would have Chameleon as a dependency.
- 14:17But the core, if I say pip install Pyramid, I don't get a templating framework necessarily.
- 14:23That's right.
- 14:25That's right.
- 14:25And you brought up a good word, which is the scaffolding.
- 14:30So that's a term that I stole from Pylons, and maybe Pylons was another web framework.
- 14:36Oh, by the way, I should mention it confuses people that this web framework is called Pyramid.
- 14:42It is part of a project, of a larger project called the Pylons Project.
- 14:47The Pylons Project has in it the Pyramid web framework, the sort of legacy old Pylons web framework, and then a bunch of other – a mess of other software that has sort of the same authors, me included.
- 15:00The way that people should probably think about that is there's the Apache Software Foundation, and they have God knows how many pieces of software at this point.
- 15:10But there's also the Apache Web – or sorry, Web Server.
- 15:13And so they – so anyway, I wanted to explain that.
- 15:16Yeah, that confused me when I first got started looking at Pyramid.
- 15:21I'm like, okay, there's Pylons, which kind of seemed like to be this older framework, and then there's Pyramid, and they were kind of merged, but they're somewhat distinct.
- 15:30And so, yeah, thanks for the clarification there.
- 15:32Yeah, I think it confuses everybody, and really it was just kind of a negotiated thing because, you know, we started out and we just kind of mashed – we thought we were going to mash three things together at first.
- 15:45We thought we were going to mash Pylons and the framework that Pyramid was renamed from, which had the awesome name of Repose.BFG.
- 15:58It was a terrible name.
- 16:01And we also thought we were going to get TurboGears, you know, in our thing.
- 16:04We actually met in, like, me, Ben Bangert, who's the guy who rode Pylons, and Mark Graham, who at the time was the guy who was maintaining TurboGears, or one of the guys who maintained TurboGears.
- 16:17And we, you know, came up with that name and said, okay, good enough.
- 16:20You know, we'll run with that.
- 16:22And as it turned out, the TurboGears guys, you know, I think Mark got another job, and he wasn't quite as involved with TurboGears.
- 16:29And they, you know, maintained their own projects, and they didn't come along.
- 16:35But anyway.
- 16:37But there's a little shared heritage there indeed.
- 16:40Yeah, yeah, yeah.
- 16:41Okay, cool.
- 16:42So I've pip installed Pyramid.
- 16:45Right.
- 16:47And now what's my next step?
- 16:48Well, so you mentioned a word.
- 16:51That's what I was going to say.
- 16:52You mentioned a word called scaffolding.
- 16:54We have these commands that once you install Pyramid, they are in Python, well, in setup tools terms, called console scripts.
- 17:04And all that means is they end up in the bin directory, you know, B-I-N, bin directory of your Python installation when you install Pyramid.
- 17:14Right.
- 17:15So it almost adds, like, new commands.
- 17:17After I pip install Pyramid, I can, like, pcreate and pserve and things like that, right?
- 17:21Exactly, yeah.
- 17:23And those commands used to actually all be subcommands.
- 17:30You know, you know, over the course of the pyramid compatible with Python 3.
- 17:39And we were using a piece of software that Ian Bickman had originally written called Paste, and PasteScript and PasteDeploy and a number of other things.
- 17:50We still use one of those packages because it's a lot of things like that.
- 17:51We still use one of those packages because it's Python 3.
- 17:53And we still use one of those packages because it's Python 3.
- 17:53And we still use one of those packages because it's Python 3.
- 17:53And we still use one of those packages because it's Python 3.
- 17:54And we still use one of those packages because it's Python 3.
- 17:55The one that we do use is called PasteDeploy, and somebody else maintains that right now.
- 18:00But Paste and PasteScript were just – they just had too much stuff in them that we didn't use to port them over.
- 18:07So, you know, what I wound up doing was I copied all the code, basically, you know, and just kind of copied the stuff we needed into Pyramid and made these commands, these console scripts called, you know, the one that we were just talking about that creates projects from scaffolds, which are just kind of like templates of projects.
- 18:25It's called pcreate.
- 18:29And what you used to do when you installed Pyramid was you used to type something like paste or create, you know, project name, whatever.
- 18:37And then when you wanted to go to a project, you would type paste or serve and then the name of a .ini file, and it would serve up the application.
- 18:46All we did was we sort of pulled those things out.
- 18:49Now you type pcreate.
- 18:50That makes project from a scaffold.
- 18:52And you type pserve to serve the project.
- 18:56And it's all still Ian's code.
- 18:57It's just only what we needed.
- 18:59Right.
- 19:00Excellent.
- 19:00And so if I type pcreate, I have to give it a scaffold name or type.
- 19:04These are like pre-built little websites that I can start from.
- 19:07And there's three, right?
- 19:08Yeah.
- 19:10There's an Alchemy one.
- 19:11There's a ZDB one.
- 19:13And there is a starter one.
- 19:15And the starter one is the very simplest thing.
- 19:18It is not bound to any particular database at all.
- 19:22And it's just, you know, basically one view.
- 19:24And inside of a, you know, a views.py file, for better or worse, and an init.py file.
- 19:32And basically when you go there, it just shows you a hello world page.
- 19:36And that's the very simplest thing.
- 19:37The other ones have, you know, they're still very simple.
- 19:43And they're just toys.
- 19:44You know, they're not full applications or anything.
- 19:46They don't really do anything.
- 19:49But they set up bindings to a database, more or less.
- 19:54The Alchemy one, which uses SQLAlchemy.
- 19:57And the ZDB one, I'm probably the only one who's ever used that one.
- 20:02But I'm a big fan of ZDB, so I put it in there.
- 20:07Yeah, that's excellent.
- 20:08We're going to actually have Mike Bayer, who did SQLAlchemy on in one of the next shows.
- 20:13So that'll be great.
- 20:13That's great.
- 20:14Yeah, yeah.
- 20:15That piece of software is really, really good.
- 20:19And Mike spends so much time trying to make it better and answer everybody's questions and everything.
- 20:25And he should be applauded.
- 20:27Yeah, absolutely.
- 20:28I think it's a thing of beauty.
- 20:29That said, I usually start from the starter one if I'm working with Pyramid because I do a lot with them.
- 20:36Do you find that the scaffold is useful?
- 20:41I mean…
- 20:41I absolutely find it useful.
- 20:42I mean there's all these little pieces you've got to wire together.
- 20:45It creates your little static section.
- 20:47You know, it kind of gives you the right structure and just a little bit of guidance.
- 20:52You know, it sets up your setup.py and your under-under init and all that kind of stuff for you.
- 20:57So, yeah, I do find it useful.
- 20:59That's good.
- 21:00I think there's another thing I should probably either mention or defend or apologize for, whatever I have to do for it, which is that, you know, like for better or worse, I said, you know, we embrace setup tools to install Pyramid and its dependencies way early on.
- 21:23We also embrace setup tools to set up projects.
- 21:26So, when you create, when you use that pcreate command, you say pcreate starter, you know, and then you give it a name.
- 21:32And what it does is it creates a directory in the current working directory and that becomes your project.
- 21:40And literally, in terms of setup tools, it is called a project.
- 21:44You know, it's a directory on disk that has a setup.py in it, which is a setup tools thing, disk utils thing.
- 21:51Yeah, it's basically a package, right?
- 21:53That's right.
- 21:54There is, well, it's a little tricky because, you know, there's PyPI, P-Y-P-I, you know, the index server for packages.
- 22:04And, you know, it's called the Python package index.
- 22:09But the things that it serves are actually technically not packages.
- 22:12That's a word reserved for, you know, directories on disk that have an initpy in them, you know, Python.
- 22:19Python.
- 22:19What P-Y-P-I should be called is P-Y-D-I, Python Distribution Index.
- 22:26But no one, you know, that ship is long-sailed.
- 22:29We're way past that, aren't we?
- 22:31Right.
- 22:32So, yes, in common parlance, you know, it is a package, which means it has a, you know, it can be turned.
- 22:43Technically, it's a project until you run the setuppy sdist or however you package it up to put it somewhere so that it's installable through easy install or pip.
- 22:55Right.
- 22:56Okay.
- 22:57But inside of that thing, so it makes a directory.
- 22:59Inside of that directory is a setup.py that has a bunch of setup tool stuff in it.
- 23:04And for better or worse, I think that's the thing that people tend to trip over the most or that's, you know, and it's, you know, we try to make it as sort of, you know, we try to explain it as best we can in the docs and put comments in the code and, you know, the thing that gets run by the scaffolding.
- 23:24So that people understand what's going on.
- 23:26But, you know, the state of Python packaging is still just kind of funky.
- 23:32And I think it'll be kind of funky forever, you know.
- 23:34And I think the, you know, one thing that, you know, this is something you asked earlier about something that's different between, you know, something like Flask and Pyramid.
- 23:46Flask doesn't do any of this.
- 23:47You know, Flask says, hey, you know, open a file, start typing.
- 23:54You know what I mean?
- 23:55Right.
- 23:55Or, you know, I'm sure there's some example projects you can get and stuff.
- 23:59But, you know, and people, that is much easier.
- 24:05It is much easier to get started with.
- 24:08And you can actually do that with Pyramid as well.
- 24:10You can open a file, start typing.
- 24:12You don't need any of this package nonsense and everything.
- 24:15But the thing is that what I've found is that, you know, applications that grow beyond, you know, a few views and whatever tend to need some structure, you know.
- 24:26And I'm not sure that there's any purpose in not putting it inside of a, you know, a project folder with a set of tools.
- 24:33Right.
- 24:34It lets you do cool stuff like say, hey, this website depends on these other packages.
- 24:38That's right.
- 24:39And it just automatically sort of pulls everything it needs in to run.
- 24:43So it's not, you know, tricky and hidden deep down in some import statement.
- 24:47Yeah, and you can, you know, you can run the tests through the set of PyPy file if you have tests.
- 24:52And you can create a, you know, a package, you know, and upload it to PyPy.
- 24:59And it's just like any other package.
- 25:01You can be your own package author and put stuff up on PyPy.
- 25:04Yeah, excellent.
- 25:05Okay, so I've gone to done pip install pyramid.
- 25:09And then maybe I've done pcreate, what is it, dash s, like start.
- 25:13That's right.
- 25:14And that'll generate it.
- 25:15And it's almost ready to run.
- 25:17But then I need to kind of somehow get that package, like registered.
- 25:20That's right.
- 25:22Yeah.
- 25:22So this is, you know, the thing that you create by running the pcreate command, like I said, as a project.
- 25:30And the way that you install the project is by typing Python setuppy either.
- 25:35My recommendation is typing Python setuppy develop, which.
- 25:40Yeah, that's the one I've been using as well, because it leaves the files there on the disk.
- 25:45The ones that you're working on are the ones that it runs from, as opposed to install, which copies it to what is that your site packages folder or something like that.
- 25:52That's right.
- 25:53Yeah, that's right.
- 25:54And when you type Python setuppy install, it actually, you know, you can you can then, you know, if you're curious, you can change directories to your Python site packages folder, which is, you know, somewhere under your Python's lib directory.
- 26:09And after you type Python setuppy install, you will see either a tarball or directory that represents your project.
- 26:18And alongside of all the other software you might have installed from third parties, it's just like any other any other thing.
- 26:24But when you type Python setuppy develop, it doesn't put anything in your site packages.
- 26:29And and sort of if it needs to need any dependencies for better or worse, it puts them in the in the same directory as setuppy.
- 26:38I never quite understood that, but it does that.
- 26:40And it also puts into your easy install dot there's a there's a there's a there's a file in your I guess I guess it's also in site packages.
- 26:51Yeah, I think it's like a sort of link back says, hey, look over for this dot eggs folder here rather than like in the site packages.
- 26:58It's not a sub folder, but it's like external or something.
- 27:00It's called like easy install dot PTH.
- 27:02And, you know, all this all this stuff is just like, you know, ancient, you know, rhyme of the ancient mariner stuff from from setup tools.
- 27:11You know, it's just been passed down through the ages, you know.
- 27:14And, you know, the reason these things exist, these PTH files is because they are consulted at an appropriate time when Python starts.
- 27:23And they are meant to Python.
- 27:28Python will look for them inside of site packages or inside of, you know, the I think Python calls them the dist folders or whatever.
- 27:35But usually it's just called site packages.
- 27:37And it will read these files.
- 27:40And these files are meant to have just just like directory names in them more or less to say, OK, this is the when when Python starts,
- 27:48I'm going to add these to the sys path of this of this Python interpreter.
- 27:52And but it turned out that somebody made a mistake and you could actually put Python code in there.
- 27:58Oh, boy.
- 27:59So so if you if you look inside of easy install dot PTH thing, Philip Eby took serious advantage of that, you know, when he wrote setup tools.
- 28:08And it's got it's got some Python, inscrutable Python in there that does some fun stuff.
- 28:16I think it sets up package resources on there.
- 28:19Go ahead.
- 28:20Sorry.
- 28:20Yeah, no, that's interesting.
- 28:21That's pretty interesting.
- 28:22So I've I've got it.
- 28:25I think we're basically there.
- 28:27Right.
- 28:27You've you've said set up that PY --develop.
- 28:31And that'll sort of register my site with the Python implementation that I'm using.
- 28:37So Python two or Python three.
- 28:38And then I just want to run it.
- 28:40So that's P serve.
- 28:41And then you guys have any files, one for at least in the scaffolds, one for deployment or one for dev and one for production.
- 28:48Right.
- 28:48That's right.
- 28:49That's right.
- 28:50And the scaffold, the difference between the two.
- 28:53The main difference between the two is that when you run the development one, it will install this piece of software called the well, it will include this piece of software called the pyramid debug toolbar, which is pretty handy to use.
- 29:08That pyramid debug toolbar is super cool.
- 29:10I mean, you think of a debug toolbar, maybe it gives you a little log or something.
- 29:14But after I looked in there, I'm like, wow, this really reaches down into a lot of areas.
- 29:18Performance, SQLAlchemy queries, logging errors, request time and performance.
- 29:24What what view template was selected?
- 29:27There's a lot of stuff in there.
- 29:27There is.
- 29:29And I mean, I think I would like to take credit for most of that.
- 29:33But the original version of that was a blatant ripoff of something that was in Flask, actually.
- 29:41And in turn, that thing that was in Flask was a blatant ripoff of something that was in Django.
- 29:46They actually even had the same UI like they were the same thing, you know.
- 29:50Yeah.
- 29:51For a while.
- 29:51That's cool.
- 29:52Wow.
- 29:53Yeah, I kind of thought they had some Django heritage in there somewhere.
- 29:55Yeah, yeah.
- 29:57And and, you know, so those guys, you know, the original author of the Django thing.
- 30:03God, I don't remember who it was, but I remember the guy, the guy who did it for Flask.
- 30:08His name his name is Matt Mantellogen, I think.
- 30:12I'm sorry, Matt, if I'm brutalizing your name.
- 30:14It was it was nicely done, you know, and I understood it and, you know, just basically just stole it in a couple of days and had it going.
- 30:22Since then, though, since, you know, that that sort of iteration of that project, I no longer sort of did much on it and other people picked it up.
- 30:32And since then, it's gotten I think it's gotten way better and it's and it's sort of outgrown.
- 30:37It's it's derivative nature.
- 30:39It's you know, it's it's different than the other ones.
- 30:41Now, it actually keeps track of past requests and you can go back and look at, you know, headers of some number of requests and it uses SSE to it's it's it's it's really neat.
- 30:52It's really I was really blown away to see how much was behind that little toolbar.
- 30:56That's cool.
- 30:57So one of the things sorry, one of the things that drew me to Pyramid was it's sort of full support for Python 3, whereas, you know, at the time when I was getting started at these, I looked at Flask and it was kind of like, well, it may run on Pyramid 3.
- 31:11It's not really supported and some of the other web frameworks.
- 31:14And so I think your support for Python 3 is really a nice sort of contribution towards trying to move everything forward.
- 31:22Well, actually, the credit for that probably belongs mostly to the PSF, Python, Python Software Foundation, because, you know, we pyramid itself, you know, pyramid itself is pretty small.
- 31:36I mean, it's it's not very big.
- 31:37You know, it's it's it's at this point, maybe, I don't know, 15,000, 20,000 lines.
- 31:43I'm probably going to look at it and I'll make a liar of myself.
- 31:47But it's it's not that big anyway.
- 31:49But it has dependencies, you know, it has it has a dependency on a package on a package called WebOB, which was also written by the super productive Ian Bicking, who is we've lost to JavaScript at this point.
- 32:02But WebOB is this is this implementation of sort of HTTP request response library.
- 32:09And it just it was kind of sitting unmaintained because, you know, Ian went to work for Mozilla and, you know, he was doing JavaScript stuff and just not it wasn't in his, you know, interest anymore to keep it up.
- 32:22So we sort of ended up just well, that's not that's not true.
- 32:27Another I shouldn't have shouldn't have said that.
- 32:28Another guy, Sergei, took it over for a while and he did a did a great job sort of, you know, shepherding it along.
- 32:35And then he he moved on.
- 32:37You know, maybe he got another job where it wasn't so important anymore or whatever.
- 32:40And so it kind of wound up in the pylons project.
- 32:43So now now we're the owners of WebOB.
- 32:45And that was, you know, that was Python to only library, you know, in 2010, I guess, 2011.
- 32:56And so that was that was the first thing that we had to port in order to start to port pyramid.
- 33:03Right. Because if you're going to port it, you got to start at the bottom and everything it builds on also has to move on over.
- 33:08Right. So that's a little project.
- 33:10It's not just your 20,000 lines of code.
- 33:12It's 20,000 lines plus foundation.
- 33:14Yes. Yeah.
- 33:15And so that so I I was whining heavily about that because, you know, I mean, it's, you know, I think.
- 33:26You know, for better or worse, you know, you want you want to sort of move along with the with the with language, you know, where you want to be where the language is going to be.
- 33:37But, you know, economically, it's really difficult to think about doing that.
- 33:44You know, I mean, you have you have you have to spend, you know, sometimes weeks, you know, to to to especially especially especially if the thing doesn't have good test coverage, because, you know, when you go to port something to Python 3, it's not really porting it to Python 3.
- 33:57It's it's it's actually making it run on both Python 2 and Python 3.
- 34:01So you're kind of straddling.
- 34:02Right. That's an even more interesting problem because, you know.
- 34:06Yeah.
- 34:06And sort of polyfill all that stuff back in.
- 34:11Yeah. Yeah. That's that's a great word. Yeah.
- 34:12I mean, it's almost exactly the same the same thing.
- 34:15So I was whining about having to do that, you know, and I was going to do it anyway.
- 34:22But I think either Alex Keener or Nick Coghlan called call me out on it and said, look, you know, the PSF has grants for this stuff.
- 34:31This kind of stuff was like, really?
- 34:33Like and I think, you know, I I asked them, I applied for a grant and they gave it to me.
- 34:38And I was, you know, it was it really, really wouldn't matter how much it was.
- 34:42You know what I mean?
- 34:43It was just something, you know, just some amount of money I could say went towards that.
- 34:47And I could I could be paid.
- 34:49I think I think they gave us like three thousand dollars or something.
- 34:52That's cool.
- 34:53What the PSF is doing lately is really cool.
- 34:56They seem to be doing a lot to support the community.
- 34:58and kind of guide it and sort of with these little little gentle pushes.
- 35:03Yeah.
- 35:04And I, you know, I really appreciated it.
- 35:07And I I still from time to time whine about that stuff because still there, you know,
- 35:12I'm dragging along 10 years of Python history.
- 35:15You know what I mean?
- 35:16I mean, at this point, I've just had to sort of like drop some like drop some friends, you know.
- 35:22Sorry, I can't talk to you anymore.
- 35:24You know, I can't think about this.
- 35:25I can't I can't think about porting this to Python 3.
- 35:27So I'm, you know, whatever.
- 35:29But but I think it's getting a lot better.
- 35:32And I think, you know, with these frameworks, you know, the web stuff, at least at least
- 35:37the web portion of the world, I think, is pretty much OK on Python 3.
- 35:42You know, if you're going to start a new project, I don't think you're going to have a lot, you
- 35:46know, too many problems starting on Python 3.
- 35:48Yeah.
- 35:49A lot a lot of the cloud providers are starting to support it.
- 35:53Last year, I believe Azure had no option for Python 3, but now they do.
- 35:57Python Anywhere has some fantastic support and it's starting to get easier.
- 36:02And then, you know, with the advent of Docker, you have a lot more control over your actual runtime.
- 36:07You can kind of drop Python 3 in there and you don't have to ask permission.
- 36:11That's your little container.
- 36:12Do what you want, you know?
- 36:13Yeah.
- 36:14Yeah.
- 36:14Yeah.
- 36:14And so I think just from from both the standpoint of deployment, like you just said, and the
- 36:21standpoint of development where you need some library, you know, some library at this
- 36:26point, you you're going to you're going to run it.
- 36:29You're probably going to run into one thing that's that only runs on Python 2 and and you're
- 36:33going to gnash your teeth and and whatever.
- 36:34But maybe not, you know, maybe not if you're if it's really vanilla.
- 36:40You know, you don't need some Excel import libraries.
- 36:44I mean, but people need that stuff.
- 36:46You know, people it's it's a it's a long tail of of stuff that people often need when they
- 36:51build stuff and they often run into problems.
- 36:54So and all that stuff hasn't quite caught up yet, but it's it's getting better.
- 36:58So I don't think there's any reason at this point in the web world anyway to think about
- 37:02starting a new project with Python 2.
- 37:04So speaking of sort of Python 3 and looking towards the future and things moving ahead, you
- 37:09know, what's your sort of view of the future of web frameworks in Python?
- 37:14I think they're going to probably become a lot less interesting.
- 37:16You know, I think of the of the frameworks that have it probably, you know, most right at
- 37:24this point.
- 37:25It's it's probably, you know, bottle flask pyramid sort of frameworks that are that are pretty
- 37:29small and don't do a lot and and are just just, you know, places to hang code that gets
- 37:36called and returns from JSON more or less.
- 37:39I think that's probably going to be the major way we build applications and all the all the
- 37:44gnarly stuff will probably be on the on the client end.
- 37:47Of course, there's always going to be, you know, there's always going to be server side
- 37:51code that's running.
- 37:54But I think we'll see a lot less of templating templating languages in particular, more JSON,
- 37:58less HTML and lighter weight, smaller building blocks, something like that.
- 38:03The applications, the applications that people want to build are really for phones.
- 38:07You know, people want to build applications that run on many platforms.
- 38:11I mean, they still have to run on a desktop and everything.
- 38:13But if you'll notice, you know, some very, very big sites now are are very clearly sort
- 38:19of, you know, optimized, not optimized, but, you know, they they they are.
- 38:25What's the word response?
- 38:26They have responsive design for for both phones, tablets and the desktop.
- 38:33You know, like if you go to orbits, for example, orbits dot com.
- 38:36It looks terrible on a desktop.
- 38:38It's awful, you know, but it looks good on a phone.
- 38:40Yeah, it used to be it used to be much easier to use, you know, but really what people want
- 38:45is just a way to maintain this stuff so that they don't have to write, you know, the desktop
- 38:51app and the desktop web application and the phone web application and everything.
- 38:54And there are so many more phones these days than there are computers that that, you know,
- 39:01they already know how to do UI.
- 39:04You know, they have a they have a UI layer built into them and they they don't need
- 39:08HTML.
- 39:09It's nice to be able to use it if you if you have a web view on the phone or whatever.
- 39:12So I think I think anyway, I'll be cut that short, but I think that's the way it's going
- 39:18to go.
- 39:18OK, yeah, that's very interesting.
- 39:20And there's you know, you see the sort of hosting services popping up to be just the back
- 39:24end for phones.
- 39:25And that could be from a Cordova HTML based phone app or it could be like a Swift iOS app.
- 39:30Yeah, that's I'm thinking of like Azure Mobile Services or Parse.
- 39:33Parse, which was acquired by Facebook.
- 39:35And some of these guys are really doing interesting stuff.
- 39:39Can you speak about any like well-known deployments other than, of course, talk python to me dot com,
- 39:44which I'm ranking up there.
- 39:45But I've seen that on Alexa.
- 39:48I think that's like number three.
- 39:50It's probably three or two.
- 39:52I haven't checked today.
- 39:53I haven't checked today.
- 39:54I can actually.
- 39:56I didn't know.
- 39:57It was really funny.
- 39:58I was reading Reddit and I saw an article about Yelp infrastructure.
- 40:05And I was like, oh, I'll go check that out.
- 40:08Sounds interesting.
- 40:08It was they were talking about how they had deployed a service oriented architecture infrastructure.
- 40:14And so I read through it and halfway through it, I'm like, they said, our, you know, server, you know, Python backend server stuff is built on pyramid.
- 40:23I was like, well, I had no idea.
- 40:25That's pretty fantastic.
- 40:26Yeah, that was that was great.
- 40:29So when you go to Yelp, I think if that article is true, I haven't I haven't spoken to anybody.
- 40:35I have no idea how accurate it is.
- 40:38But I think all that stuff runs a pyramid.
- 40:39There are a number of other sort of, you know, well, far lesser known sites that I've developed.
- 40:48If you go to environmental health sciences dot org, that's a that's a pyramid site.
- 40:54If you go to Carl project dot org, that's a pyramid site.
- 40:58We've we've worked on these projects.
- 41:00And I think some other folks have, you know, a little bit.
- 41:06Oh, survey survey monkey.
- 41:07Oh, yeah.
- 41:08Survey monkey.
- 41:09That's cool.
- 41:10Survey monkey is a local company for me here in Portland.
- 41:13So I know those guys.
- 41:14Oh, that's right.
- 41:15Yeah.
- 41:16They have they have an office.
- 41:17Is I don't know if their headquarters is.
- 41:19I'm not sure where their headquarters is.
- 41:21I just know is walking around town like, oh, wait, they're they're here.
- 41:24They're for them.
- 41:24That's interesting.
- 41:25Yeah, I think I I've been to their San Francisco office, which is beautiful.
- 41:29Sorry, Palo Alto office, which is beautiful.
- 41:32And I know a lot of those guys there.
- 41:34Some of cars dot com is pyramid.
- 41:39I know a guy there who's a fantastic supporter of pyramid.
- 41:44Hello, Michael.
- 41:45Michael Ryabushkin, also known as Goodwill.
- 41:48He hangs out on IRC a lot and he he organizes a lot of stuff for us.
- 41:52And just most recently he is he got cars dot com to sponsor a the graphics and display
- 42:02artwork and stuff for a booth at PyCon for us.
- 42:06And he did.
- 42:06He's done it for like three years in a row.
- 42:08Oh, that's fantastic.
- 42:09And and he is a he is a great supporter of pyramid.
- 42:12He does a great job.
- 42:14The other, you know, over Christmas time, he sent me a monitor in the mail just showed
- 42:19up.
- 42:19Wow.
- 42:20That's really generous.
- 42:21Yeah.
- 42:22So so, you know, I'm I'm really I'm really lucky that that people like him around and other
- 42:27people have done the same.
- 42:28I've had people send me send me several hundred dollars, you know, just out of the blue.
- 42:32Just wow.
- 42:32That's great.
- 42:33It's like thanks for thanks for building this great framework.
- 42:35Yeah, that's right.
- 42:36Our company runs on it.
- 42:37So, you know, cheers.
- 42:39Yeah, it's really humbling.
- 42:40You know, I was I was saying about cars dot com.
- 42:43I think some of that runs on it and I'm sure there's other people.
- 42:45I'm sure I'm forgetting somebody.
- 42:46Yeah, I'm sure there's there's there's a whole bunch of sites that don't talk about what the
- 42:50infrastructure is that are probably.
- 42:52Yeah.
- 42:52Yeah.
- 42:54I think I think for sure there are still more Django sites, you know, high profile Django
- 42:59sites, I think.
- 42:59Yeah, I'm sure there are.
- 43:01So, you know, people who are out there listening, if you've got like a cool, well-known site, maybe
- 43:06you should email Chris and just say, hey, Chris, you know, such and such runs on
- 43:09pyramid as well.
- 43:10And I will forget about that like I forgot about all the other ones as well.
- 43:13No problem.
- 43:15I can forget for you all day long.
- 43:16Perfect.
- 43:17All right.
- 43:19Well, I think that that's a lot of interesting stuff about pyramid.
- 43:22Is there anything else you'd like to kind of add?
- 43:24Yes, I would.
- 43:26Actually, I am the originator of, you know, I started the first file in the project and all
- 43:32that stuff.
- 43:33But over the last year or so, I have had to go and work.
- 43:38You know, I've had work to do and I took some time off.
- 43:41And I've I've I sort of didn't do as much on pyramid or any of any of the other pylons
- 43:47projects projects.
- 43:49There are a group of guys.
- 43:51Michael miracle is he's on.
- 43:55I should say this.
- 43:56There is a there is a pyramid IRC channel that if you're interested in pyramid on free
- 44:00know that you should probably get into.
- 44:01He's I'm I'm M.C.D.O.N.C.
- 44:04And they're McDunk.
- 44:06And the guy, Michael miracle, who is also a core maintainer.
- 44:09His name is radio.
- 44:10R.A.Y.D.E.O.
- 44:12And there's a guy who now is kind of I think we tricked him into maintaining Webob.
- 44:20His name is Berger's year.
- 44:22I'm sure I'm murdering his name.
- 44:24But he's he's he's he's Norwegian.
- 44:27So I'm allowed to do that.
- 44:28God, I hope he's Norwegian now.
- 44:30He's Scandinavian in some sense.
- 44:32I don't know.
- 44:33That's great.
- 44:33So some people are coming along to pick up the effort.
- 44:36Yeah.
- 44:37And and and really, I am I am I have contributed far less than those people have.
- 44:43And there's other guys, you know, John Anderson.
- 44:45There's a bunch of guys in there that really picked up the slack when I when I sort of, you
- 44:50know, wandered, did a bit of a walkabout.
- 44:52I'm getting back into it now.
- 44:54But there's those guys are really the guys who've been carrying them, carrying the water
- 44:57for for at least a year now.
- 44:59OK, do you guys do you have any future releases coming up that you guys have like a roadmap for
- 45:05you can talk about or is that still?
- 45:06Yeah, no, I think I think I'm hoping, you know, as we record this, it is it is April 6th
- 45:12and and PyCon starts on April 9th, maybe even earlier than I think about it.
- 45:18Yeah, maybe April.
- 45:19I think it's Wednesday, actually, possibly.
- 45:21OK, maybe people arrive on Wednesday.
- 45:23I'm not sure.
- 45:23But it's definitely coming in fast.
- 45:25Yeah.
- 45:26And I'm sort of closing last issues now that I hope will let us have a release by PyCon of
- 45:33Pyramid 1.6, which has a bunch of new shiny features in it and and and stuff.
- 45:39So that should that should be good.
- 45:40That's great.
- 45:41Well, by the time this comes out, people will it maybe will be already out.
- 45:45So that'd be great.
- 45:46Yeah.
- 45:48So go go go go check out look for Pyramid 1.6.
- 45:52Yes.
- 45:52Yes, definitely.
- 45:53All right.
- 45:54Is there any final person or thing you want to give a shout out to somewhere you want to draw the listeners attention to?
- 46:00Well, if you're if you're if you're interested, you should go to pylons project dot org.
- 46:04That is the main site for all this stuff.
- 46:07And you'll see pyramid and you'll see Web of and a bunch of other things listed on there and documentation.
- 46:13And that's the that's the place to go and and visit the RC channel, the pound pyramid channel in free node RC.
- 46:20And those are the places you can come and talk to us and make us laugh.
- 46:26And and also I wanted to give you a shout out because I think I think you're I'm really happy that there's a new Python podcast.
- 46:32I I will listen to all the other episodes.
- 46:34I will not listen to this one because I'm terrified of hearing myself.
- 46:38Well, thank you so much.
- 46:39I really appreciate your kind words and the community support has been really amazing.
- 46:43Like the amount of messages I got on Twitter saying thanks for creating a new Python podcast have been really overwhelming.
- 46:49So, you know, that that's great.
- 46:51And I really appreciate it.
- 46:52Chris, thank you for being on the show.
- 46:54This is this is really interesting.
- 46:55I'm a big fan of pyramid and use it for a couple of projects.
- 46:59And I definitely definitely recommend people check it out on your docs.
- 47:03I thought you have some really nice sort of tutorial walkthroughs that were quite easy to get started with.
- 47:07So well done on the docs as well.
- 47:09And thanks for being on the show.
- 47:10Thank you.
- 47:11I appreciate it.
- 47:12Thanks very much for having me.
- 47:13Yeah.
- 47:14Talk to you later.
- 47:14Bye bye.
- 47:15This has been another episode of Talk Python To Me.
- 47:19Today's guest was Chris McDonough.
- 47:21Thanks for being on the show, Chris.
- 47:22Remember, you can find the links from the show at talkpythontome.com slash episodes slash show slash three.
- 47:32And if you're feeling generous, please check out our Patreon campaign at patreon.com slash mkennedy or work with your company to encourage them to sponsor an episode.
- 47:41This has been your host, Michael Kennedy.
- 47:43Thanks for listening.
- 47:45Smix.
- 47:46Take us out of here.
- 47:47Staying with my voice.
- 47:49There's no norm that I can feel within.
- 47:51Haven't been sleeping.
- 47:52I've been using lots of rest.
- 47:53I'll pass the mic back to who rocked it best.
- 47:56I'll pass the mic back to who rocked it best.
- 47:56I'll pass the mic back to who rocked it best.
- 48:09you
- 48:09Thank you.