Learn Python with Talk Python's 270 hours of courses

#3: Pyramid Web Framework Transcript

Recorded on Monday, Apr 6, 2015.

00:00 Talk Python to me. Episode number three. With guest, Chris McDonough. Recorded Monday, April 6th, 2015.

00:09 Hello and welcome to Talk Python to me, a weekly podcast.

00:39 On Python, the language, the libraries, the ecosystem, and the personalities.

00:43 This 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.

00:52 This episode, we'll be talking to Chris McDonough about the Pyramid Web Framework.

00:58 Before we get to Chris, I have a few things to share with you.

01:01 First, thanks again to Python Gear for sponsoring the last episode.

01:05 They gave away a t-shirt to one lucky friend of the show.

01:08 I randomly chose a listener from the group, and Alejandro Villamarin from Spain was our lucky winner.

01:14 So congrats to Alejandro.

01:15 We now have a Facebook page, so be sure to like us on Facebook if that's your thing.

01:20 We're at facebook.com slash talkpython.

01:23 And we are also on SoundCloud.

01:26 You can listen to us on SoundCloud at soundcloud.com slash talkpython.

01:31 Listener 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.

01:45 It's already over $2,000 pledged towards his $5,000 goal, so check that out if you're interested in supporting Mike.

01:52 You can find the link in the show notes on talkpythontome.com.

01:56 Finally, I've started a Patreon campaign for this show.

01:59 Patreon allows listeners to directly support us with very small contributions, for example, a dollar for a show.

02:06 More details on this later, but you can find the campaign at patreon.com slash mkennedy.

02:12 Patreon 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.

02:22 I 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.

02:32 So look for that in an upcoming episode.

02:35 Now, let's get on to the interview with Chris.

02:37 Let me introduce Chris.

02:39 Chris McDonough is the primary author of the Pyramid Web Framework and the supervisor, Process Manager.

02:45 He has been a member of the Python community since 1999, and he is a principal of Agenda-less Consulting.

02:52 Chris, welcome to the show.

02:55 Thanks, Michael.

02:56 How are you today?

02:56 I'm doing great.

02:57 Thanks so much for being on my podcast.

03:00 Yes, thank you for doing it.

03:02 It's great to have another podcast, Python podcast.

03:05 Excellent.

03:06 And, you know, the reason I reached out to you is I'm a huge fan of the Pyramid Web Framework.

03:11 Oh, go on.

03:12 No, I am.

03:13 I mean, our website is even written in Pyramid.

03:16 I do love it.

03:17 So I wanted to talk to you and just sort of learn more about the history and what people are doing with it.

03:23 Great.

03:25 Yeah, I'd be happy to answer.

03:26 Cool.

03:26 So what is Pyramid?

03:27 Well, Pyramid is a Python Web Framework.

03:31 And that term means many things to many different people.

03:35 But it is a sort of web framework that's kind of light, I guess you would call it.

03:41 I hesitate to call it a micro framework, although it kind of sort of fits in the same little box.

03:47 That'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.

03:56 But 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.

04:09 So I really like the granularity and the control I have when I'm working with Pyramid.

04:13 Yeah, I do too.

04:15 And, you know, I actually came into Python through Zope, you know, in like 1998 or 99, something like that.

04:24 Zope is the, you know, kind of the antithesis of Pyramid, although they, you know, I stole lots of ideas from Zope.

04:31 But 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.

04:40 You know, they actually have built into them, you know, database bindings and ways to administer the site.

04:50 And, you know, they have UI to them and all kinds of stuff.

04:55 Pyramid 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.

05:06 Maybe Bottle.

05:07 Bottle, yeah, exactly.

05:09 Yeah, Bottle is an example.

05:10 And when I think of Pyramid, I think of sort of its peer or rival, frenemy maybe, I don't know, is Flask, right?

05:18 These are kind of the lighter weight versions.

05:21 You came from this background of these sort of bigger, larger, what you call full stack frameworks where it's like they predefine.

05:32 Here is your data access layer.

05:33 Here is your template layer.

05:36 Here is how you wire this all together.

05:38 What inspired you to go in the opposite direction?

05:41 Well, like I said, you know, I came to Python through Zope.

05:45 And Zope, even the word Zope, you know, can mean different things to different people.

05:51 But, you know, when I came to it in 99, it meant the thing that's currently now referred to as the Zope2 web framework.

06:03 And it was actually really great at the time.

06:08 I used it to build, you know, I didn't, I ended up working for the people who made Zope for a number of years.

06:15 But I did not work there then.

06:16 I 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.

06:27 But I don't think that term existed then.

06:29 Well, the web world is a very, very different place than it was in 1998.

06:33 I mean.

06:34 Oh, yes.

06:34 So what people expect out of web frameworks may have changed as well.

06:39 Yeah, exactly.

06:39 And, 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.

06:51 In HTML, instead of, you know, server-side templates and sort of, you know, web 1.0, reload the page things, you have these frameworks.

07:00 Sure, AngularJS or Ember or any of these things, right?

07:04 Yeah.

07:05 And those things really don't need, you know, there's not much retail UI.

07:12 And 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.

07:30 So 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.

07:38 Yeah, that makes a lot of sense.

07:40 And 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.

07:54 Yeah, I totally agree.

07:57 I mean, that's the way people are thinking about how that works.

08:01 That 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.

08:11 And I don't think that'll ever die.

08:13 It's not.

08:14 It's definitely not going to die, and not in the near-term anyway.

08:17 And I think if for no other reason than purely for SEO purposes, right?

08:23 So 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.

08:29 And 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.

08:38 And 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.

08:50 You 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.

08:59 Maybe 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.

09:09 Yeah, I think that's right.

09:11 And I'm sure Google's going to have to write a crawler that executes JavaScript pretty soon, you know?

09:18 I mean… Yeah, it's going to be unavoidable.

09:20 Yeah.

09:21 Michael here.

09:30 Thank you so much for listening to and spreading the word about Talk Python TV.

09:34 The response to the podcast continues to be wonderful and humbling.

09:38 I have a quick comment about supporting and sponsoring the show.

09:41 I'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.

09:49 We are running a Patreon campaign.

09:51 You 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:00 Visit patreon.com slash mkennedy.

10:02 That'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:12 This is your chance to ensure that the Python community continues to have a strong public voice.

10:17 Consider supporting us today at patreon.com slash mkennedy.

10:21 And thanks for listening.

10:29 And 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:38 And, you know, I wrote something about it.

10:39 There's a page in the Pyramid Docs called Design Defense.

10:44 And 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:59 That's where that's from, that term.

11:01 And the web is nothing like that, you know.

11:05 Until we get these JavaScript frameworks, which actually do work like that, and those can be called MVC, you know.

11:11 But I think Rails came along in, you know, 2005 or 2007 or whenever it was.

11:17 Yeah, that sounds about right.

11:18 And I think it introduced the idea that, okay, your views are your templates and your controllers are, you know, our Ruby code.

11:28 Your model is your database.

11:30 And I don't think that was ever true.

11:33 You know, it sort of just got jammed on there.

11:36 But now it actually is true, you know, with these JavaScript frameworks.

11:39 Like 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:47 And your JavaScript stitches it all together and builds your UI.

11:50 And the JavaScript is, you know, it's Turing complete.

11:55 So, you know, you can do whatever you want.

11:57 You can, you know, the UI can change as a result of a server through WebSockets or SSC or, you know, whatever.

12:03 And it's really interesting.

12:05 And that's another reason I think people are interested in it.

12:08 Yeah, that's really, really cool.

12:10 I think JavaScript is definitely eating a large portion of the world.

12:13 So there's plenty of interesting stuff that's happening there.

12:16 Well, we're all JavaScript programmers.

12:19 That's right.

12:20 We don't want to be.

12:21 So, 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:33 Walk us through what are the steps to getting started with PyPyramid.

12:37 Sure.

12:38 So 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:52 But people tend to bounce off of it, set up tools.

12:57 And so Pyramid itself is a distribution in PyPI terms, which means, you know, a file that can be downloaded.

13:06 This is a targz file that gets installed when you run either easy install or pip.

13:12 And it has a bunch of dependencies mentioned in it that also come down as a result of you downloading it.

13:19 And then those have dependencies, et cetera.

13:22 And 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:31 I think it's down to seven or something now.

13:32 The reason we had so many was because we used to ship both two templating languages with the framework.

13:40 And we stopped that because, you know, there was no purpose in it.

13:45 We could do the same thing just by letting people choose.

13:50 Sure.

13:50 So you used to do Chameleon and Mako.

13:53 Is that correct, by default?

13:54 That's right.

13:55 And now you're just down to Chameleon?

13:56 Now we don't have any.

13:58 Now no templating languages gets installed with the – no templating bindings get installed and no templating package gets installed when you install Pyramid.

14:07 Right.

14:08 So you have to make the choice and install it yourself.

14:10 Right.

14:11 So when I create a site, maybe through one of the scaffolding things, in there it would have Chameleon as a dependency.

14:17 But the core, if I say pip install Pyramid, I don't get a templating framework necessarily.

14:23 That's right.

14:25 That's right.

14:25 And you brought up a good word, which is the scaffolding.

14:30 So that's a term that I stole from Pylons, and maybe Pylons was another web framework.

14:36 Oh, by the way, I should mention it confuses people that this web framework is called Pyramid.

14:42 It is part of a project, of a larger project called the Pylons Project.

14:47 The 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:00 The 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:10 But there's also the Apache Web – or sorry, Web Server.

15:13 And so they – so anyway, I wanted to explain that.

15:16 Yeah, that confused me when I first got started looking at Pyramid.

15:21 I'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:30 And so, yeah, thanks for the clarification there.

15:32 Yeah, 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:45 We thought we were going to mash Pylons and the framework that Pyramid was renamed from, which had the awesome name of Repose.BFG.

15:58 It was a terrible name.

16:01 And we also thought we were going to get TurboGears, you know, in our thing.

16:04 We 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:17 And we, you know, came up with that name and said, okay, good enough.

16:20 You know, we'll run with that.

16:22 And 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:29 And they, you know, maintained their own projects, and they didn't come along.

16:35 But anyway.

16:37 But there's a little shared heritage there indeed.

16:40 Yeah, yeah, yeah.

16:41 Okay, cool.

16:42 So I've pip installed Pyramid.

16:45 Right.

16:47 And now what's my next step?

16:48 Well, so you mentioned a word.

16:51 That's what I was going to say.

16:52 You mentioned a word called scaffolding.

16:54 We have these commands that once you install Pyramid, they are in Python, well, in setup tools terms, called console scripts.

17:04 And 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:14 Right.

17:15 So it almost adds, like, new commands.

17:17 After I pip install Pyramid, I can, like, pcreate and pserve and things like that, right?

17:21 Exactly, yeah.

17:23 And those commands used to actually all be subcommands.

17:30 You know, you know, over the course of the pyramid compatible with Python 3.

17:39 And 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:50 We still use one of those packages because it's a lot of things like that.

17:51 We still use one of those packages because it's Python 3.

17:53 And we still use one of those packages because it's Python 3.

17:53 And we still use one of those packages because it's Python 3.

17:53 And we still use one of those packages because it's Python 3.

17:54 And we still use one of those packages because it's Python 3.

17:55 The one that we do use is called PasteDeploy, and somebody else maintains that right now.

18:00 But Paste and PasteScript were just – they just had too much stuff in them that we didn't use to port them over.

18:07 So, 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:25 It's called pcreate.

18:29 And 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:37 And 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:46 All we did was we sort of pulled those things out.

18:49 Now you type pcreate.

18:50 That makes project from a scaffold.

18:52 And you type pserve to serve the project.

18:56 And it's all still Ian's code.

18:57 It's just only what we needed.

18:59 Right.

19:00 Excellent.

19:00 And so if I type pcreate, I have to give it a scaffold name or type.

19:04 These are like pre-built little websites that I can start from.

19:07 And there's three, right?

19:08 Yeah.

19:10 There's an Alchemy one.

19:11 There's a ZDB one.

19:13 And there is a starter one.

19:15 And the starter one is the very simplest thing.

19:18 It is not bound to any particular database at all.

19:22 And it's just, you know, basically one view.

19:24 And inside of a, you know, a views.py file, for better or worse, and an init.py file.

19:32 And basically when you go there, it just shows you a hello world page.

19:36 And that's the very simplest thing.

19:37 The other ones have, you know, they're still very simple.

19:43 And they're just toys.

19:44 You know, they're not full applications or anything.

19:46 They don't really do anything.

19:49 But they set up bindings to a database, more or less.

19:54 The Alchemy one, which uses SQLAlchemy.

19:57 And the ZDB one, I'm probably the only one who's ever used that one.

20:02 But I'm a big fan of ZDB, so I put it in there.

20:07 Yeah, that's excellent.

20:08 We're going to actually have Mike Bayer, who did SQLAlchemy on in one of the next shows.

20:13 So that'll be great.

20:13 That's great.

20:14 Yeah, yeah.

20:15 That piece of software is really, really good.

20:19 And Mike spends so much time trying to make it better and answer everybody's questions and everything.

20:25 And he should be applauded.

20:27 Yeah, absolutely.

20:28 I think it's a thing of beauty.

20:29 That said, I usually start from the starter one if I'm working with Pyramid because I do a lot with them.

20:36 Do you find that the scaffold is useful?

20:41 I mean… I absolutely find it useful.

20:42 I mean there's all these little pieces you've got to wire together.

20:45 It creates your little static section.

20:47 You know, it kind of gives you the right structure and just a little bit of guidance.

20:52 You know, it sets up your setup.py and your under-under init and all that kind of stuff for you.

20:57 So, yeah, I do find it useful.

20:59 That's good.

21:00 I 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:23 We also embrace setup tools to set up projects.

21:26 So, when you create, when you use that pcreate command, you say pcreate starter, you know, and then you give it a name.

21:32 And what it does is it creates a directory in the current working directory and that becomes your project.

21:40 And literally, in terms of setup tools, it is called a project.

21:44 You know, it's a directory on disk that has a setup.py in it, which is a setup tools thing, disk utils thing.

21:51 Yeah, it's basically a package, right?

21:53 That's right.

21:54 There 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:04 And, you know, it's called the Python package index.

22:09 But the things that it serves are actually technically not packages.

22:12 That's a word reserved for, you know, directories on disk that have an initpy in them, you know, Python.

22:19 Python.

22:19 What P-Y-P-I should be called is P-Y-D-I, Python Distribution Index.

22:26 But no one, you know, that ship is long-sailed.

22:29 We're way past that, aren't we?

22:31 Right.

22:32 So, yes, in common parlance, you know, it is a package, which means it has a, you know, it can be turned.

22:43 Technically, 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:55 Right.

22:56 Okay.

22:57 But inside of that thing, so it makes a directory.

22:59 Inside of that directory is a setup.py that has a bunch of setup tool stuff in it.

23:04 And 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:24 So that people understand what's going on.

23:26 But, you know, the state of Python packaging is still just kind of funky.

23:32 And I think it'll be kind of funky forever, you know.

23:34 And 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:46 Flask doesn't do any of this.

23:47 You know, Flask says, hey, you know, open a file, start typing.

23:54 You know what I mean?

23:55 Right.

23:55 Or, you know, I'm sure there's some example projects you can get and stuff.

23:59 But, you know, and people, that is much easier.

24:05 It is much easier to get started with.

24:08 And you can actually do that with Pyramid as well.

24:10 You can open a file, start typing.

24:12 You don't need any of this package nonsense and everything.

24:15 But 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:26 And 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:33 Right.

24:34 It lets you do cool stuff like say, hey, this website depends on these other packages.

24:38 That's right.

24:39 And it just automatically sort of pulls everything it needs in to run.

24:43 So it's not, you know, tricky and hidden deep down in some import statement.

24:47 Yeah, and you can, you know, you can run the tests through the set of PyPy file if you have tests.

24:52 And you can create a, you know, a package, you know, and upload it to PyPy.

24:59 And it's just like any other package.

25:01 You can be your own package author and put stuff up on PyPy.

25:04 Yeah, excellent.

25:05 Okay, so I've gone to done pip install pyramid.

25:09 And then maybe I've done pcreate, what is it, dash s, like start.

25:13 That's right.

25:14 And that'll generate it.

25:15 And it's almost ready to run.

25:17 But then I need to kind of somehow get that package, like registered.

25:20 That's right.

25:22 Yeah.

25:22 So this is, you know, the thing that you create by running the pcreate command, like I said, as a project.

25:30 And the way that you install the project is by typing Python setuppy either.

25:35 My recommendation is typing Python setuppy develop, which.

25:40 Yeah, that's the one I've been using as well, because it leaves the files there on the disk.

25:45 The 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:52 That's right.

25:53 Yeah, that's right.

25:54 And 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:09 And after you type Python setuppy install, you will see either a tarball or directory that represents your project.

26:18 And alongside of all the other software you might have installed from third parties, it's just like any other any other thing.

26:24 But when you type Python setuppy develop, it doesn't put anything in your site packages.

26:29 And 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:38 I never quite understood that, but it does that.

26:40 And 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:51 Yeah, 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:58 It's not a sub folder, but it's like external or something.

27:00 It's called like easy install dot PTH.

27:02 And, 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:11 You know, it's just been passed down through the ages, you know.

27:14 And, you know, the reason these things exist, these PTH files is because they are consulted at an appropriate time when Python starts.

27:23 And they are meant to Python.

27:28 Python 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:35 But usually it's just called site packages.

27:37 And it will read these files.

27:40 And 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:48 I'm going to add these to the sys path of this of this Python interpreter.

27:52 And but it turned out that somebody made a mistake and you could actually put Python code in there.

27:58 Oh, boy.

27:59 So 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:08 And it's got it's got some some some Python, inscrutable Python in there that does some fun stuff.

28:16 I think it sets up package resources on there.

28:19 Go ahead.

28:20 Sorry.

28:20 Yeah, no, that's interesting.

28:21 That's pretty interesting.

28:22 So I've I've got it.

28:25 I think we're basically there.

28:27 Right.

28:27 You've you've said set up that PY --develop.

28:31 And that'll sort of register my site with the Python implementation that I'm using.

28:37 So Python two or Python three.

28:38 And then I just want to run it.

28:40 So that's P serve.

28:41 And 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:48 Right.

28:48 That's right.

28:49 That's right.

28:50 And the scaffold, the difference between the two.

28:53 The 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:08 That pyramid debug toolbar is super cool.

29:10 I mean, you think of a debug toolbar, maybe it gives you a little log or something.

29:14 But after I looked in there, I'm like, wow, this really reaches down into a lot of areas.

29:18 Performance, SQLAlchemy queries, logging errors, request time and performance.

29:24 What what view template was selected?

29:27 There's a lot of stuff in there.

29:27 There is.

29:29 And I mean, I think I would like to take credit for most of that.

29:33 But the the original version of that was a blatant ripoff of something that was in Flask, actually.

29:41 And in turn, that thing that was in Flask was a blatant ripoff of something that was in Django.

29:46 They actually even had the same UI like they were the same thing, you know.

29:50 Yeah.

29:51 For a while.

29:51 That's cool.

29:52 Wow.

29:53 Yeah, I kind of thought they had some Django heritage in there somewhere.

29:55 Yeah, yeah.

29:57 And and, you know, so those guys, you know, the original author of the Django thing.

30:03 God, I don't remember who it was, but I remember the guy, the guy who did it for Flask.

30:08 His name his name is Matt Mantellogen, I think.

30:12 I'm sorry, Matt, if I'm brutalizing your name.

30:14 It 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:22 Since 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:32 And since then, it's gotten I think it's gotten way better and it's and it's sort of outgrown.

30:37 It's it's derivative nature.

30:39 It's you know, it's it's different than the other ones.

30:41 Now, 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:52 It's really I was really blown away to see how much was behind that little toolbar.

30:56 That's cool.

30:57 So 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:11 It's not really supported and some of the other web frameworks.

31:14 And so I think your support for Python 3 is really a nice sort of contribution towards trying to move everything forward.

31:22 Well, 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:36 I mean, it's it's not very big.

31:37 You know, it's it's it's at this point, maybe, I don't know, 15,000, 20,000 lines.

31:43 I'm probably going to look at it and I'll make a liar of myself.

31:47 But it's it's not that big anyway.

31:49 But 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:02 But WebOB is this is this implementation of sort of HTTP request response library.

32:09 And 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:22 So we sort of ended up just well, that's not that's not true.

32:27 Another I shouldn't have shouldn't have said that.

32:28 Another guy, Sergei, took it over for a while and he did a did a great job sort of, you know, shepherding it along.

32:35 And then he he moved on.

32:37 You know, maybe he got another job where it wasn't so important anymore or whatever.

32:40 And so it kind of wound up in the pylons project.

32:43 So now now we're the owners of WebOB.

32:45 And that was, you know, that was Python to only library, you know, in 2010, I guess, 2011.

32:56 And so that was that was the first thing that we had to port in order to start to port pyramid.

33:03 Right. 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:08 Right. So that's a little project.

33:10 It's not just your 20,000 lines of code.

33:12 It's 20,000 lines plus foundation.

33:14 Yes. Yeah.

33:15 And so that so I I was whining heavily about that because, you know, I mean, it's, you know, I think.

33:26 You 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:37 But, you know, economically, it's really difficult to think about doing that.

33:44 You 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:57 It's it's it's actually making it run on both Python 2 and Python 3.

34:01 So you're kind of straddling.

34:02 Right. That's an even more interesting problem because, you know.

34:06 Yeah.

34:06 And sort of polyfill all that stuff back in.

34:11 Yeah. Yeah. That's that's a great word. Yeah.

34:12 I mean, it's almost exactly the same the same thing.

34:15 So I was whining about having to do that, you know, and I was going to do it anyway.

34:22 But 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:31 This kind of stuff was like, really?

34:33 Like and I think, you know, I I asked them, I applied for a grant and they gave it to me.

34:38 And I was, you know, it was it really, really wouldn't matter how much it was.

34:42 You know what I mean?

34:43 It was just something, you know, just some some amount of money I could say went towards that.

34:47 And I could I could be paid.

34:49 I think I think they gave us like three thousand dollars or something.

34:52 That's cool.

34:53 What the PSF is doing lately is really cool.

34:56 They seem to be doing a lot to support the community.

34:58 and kind of guide it and sort of with these little little gentle pushes.

35:03 Yeah.

35:04 And I, you know, I really appreciated it.

35:07 And I I still from time to time whine about that stuff because still there, you know,

35:12 I'm dragging along 10 years of Python history.

35:15 You know what I mean?

35:16 I mean, at this point, I've just had to sort of like drop some like drop some friends, you know.

35:22 Sorry, I can't talk to you anymore.

35:24 You know, I can't think about this.

35:25 I can't I can't think about porting this to Python 3.

35:27 So I'm, you know, whatever.

35:29 But but I think it's getting a lot better.

35:32 And I think, you know, with these frameworks, you know, the the web stuff, at least at least

35:37 the web portion of the world, I think, is pretty much OK on Python 3.

35:42 You know, if you're going to start a new project, I don't think you're going to have a lot, you

35:46 know, too many problems starting on Python 3.

35:48 Yeah.

35:49 A lot a lot of the cloud providers are starting to support it.

35:53 Last year, I believe Azure had no option for Python 3, but now they do.

35:57 Python Anywhere has some fantastic support and it's starting to get easier.

36:02 And then, you know, with the advent of Docker, you have a lot more control over your actual runtime.

36:07 You can kind of drop Python 3 in there and you don't have to ask permission.

36:11 That's your little container.

36:12 Do what you want, you know?

36:13 Yeah.

36:14 Yeah.

36:14 Yeah.

36:14 And so I think just from from both the standpoint of deployment, like you just said, and the

36:21 standpoint of development where you need some library, you know, some some library at this

36:26 point, you you're going to you're going to run it.

36:29 You're probably going to run into one thing that's that only runs on Python 2 and and you're

36:33 going to gnash your teeth and and whatever.

36:34 But maybe not, you know, maybe not if you're if it's really vanilla.

36:40 You know, you don't need some some Excel import libraries.

36:44 I mean, but people need that stuff.

36:46 You know, people it's it's a it's a long tail of of stuff that people often need when they

36:51 build stuff and they often run into problems.

36:54 So and all that stuff hasn't quite caught up yet, but it's it's getting better.

36:58 So I don't think there's any reason at this point in the web world anyway to think about

37:02 starting a new project with Python 2.

37:04 So speaking of sort of Python 3 and looking towards the future and things moving ahead, you

37:09 know, what's your sort of view of the future of web frameworks in Python?

37:14 I think they're going to probably become a lot less interesting.

37:16 You know, I think of the of the frameworks that have it probably, you know, most right at

37:24 this point.

37:25 It's it's probably, you know, bottle flask pyramid sort of frameworks that are that are pretty

37:29 small and don't do a lot and and are just just, you know, places to hang code that gets

37:36 called and returns from JSON more or less.

37:39 I think that's probably going to be the major way we build applications and all the all the

37:44 gnarly stuff will probably be on the on the client end.

37:47 Of course, there's always going to be, you know, there's always going to be server side

37:51 code that's running.

37:54 But I think we'll see a lot less of templating templating languages in particular, more JSON,

37:58 less HTML and lighter weight, smaller building blocks, something like that.

38:03 The applications, the applications that people want to build are really for phones.

38:07 You know, people want to build applications that run on many platforms.

38:11 I mean, they still have to run on a desktop and everything.

38:13 But if you'll notice, you know, some very, very big sites now are are very clearly sort

38:19 of, you know, optimized, not optimized, but, you know, they they they are.

38:25 What's the word response?

38:26 They have responsive design for for both phones, tablets and the desktop.

38:33 You know, like if you go to orbits, for example, orbits dot com.

38:36 It looks terrible on a desktop.

38:38 It's awful, you know, but it looks good on a phone.

38:40 Yeah, it used to be it used to be much easier to use, you know, but really what people want

38:45 is just a way to maintain this stuff so that they don't have to write, you know, the desktop

38:51 app and the desktop web application and the phone web application and everything.

38:54 And there are so many more phones these days than there are computers that that, you know,

39:01 they already know how to do UI.

39:04 You know, they have a they have a UI layer built into them and they they don't need

39:08 HTML.

39:09 It's nice to be able to use it if you if you have a web view on the phone or whatever.

39:12 So I think I think anyway, I'll be cut that short, but I think that's the way it's going

39:18 to go.

39:18 OK, yeah, that's very interesting.

39:20 And there's you know, you see the sort of hosting services popping up to be just the back

39:24 end for phones.

39:25 And that could be from a Cordova HTML based phone app or it could be like a Swift iOS app.

39:30 Yeah, that's I'm thinking of like Azure Mobile Services or Parse.

39:33 Parse, which was acquired by Facebook.

39:35 And some of these guys are really doing interesting stuff.

39:39 Can you speak about any like well-known deployments other than, of course, talk python to me dot com,

39:44 which I'm ranking up there.

39:45 But I've seen that on Alexa.

39:48 I think that's like number three.

39:50 It's probably three or two.

39:52 I haven't checked today.

39:53 I haven't checked today.

39:54 I can actually.

39:56 I didn't know.

39:57 It was really funny.

39:58 I was reading Reddit and I saw an article about Yelp infrastructure.

40:05 And I was like, oh, I'll go check that out.

40:08 Sounds interesting.

40:08 It was they were talking about how they had deployed a service oriented architecture infrastructure.

40:14 And 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:23 I was like, well, I had no idea.

40:25 That's pretty fantastic.

40:26 Yeah, that was that was great.

40:29 So when you go to Yelp, I think if that article is true, I haven't I haven't spoken to anybody.

40:35 I have no idea how accurate it is.

40:38 But I think all that stuff runs a pyramid.

40:39 There are a number of other sort of, you know, well, far lesser known sites that I've developed.

40:48 If you go to environmental health sciences dot org, that's a that's a pyramid site.

40:54 If you go to Carl project dot org, that's a pyramid site.

40:58 We've we've worked on these projects.

41:00 And I think some other folks have, you know, a little bit.

41:06 Oh, survey survey monkey.

41:07 Oh, yeah.

41:08 Survey monkey.

41:09 That's cool.

41:10 Survey monkey is a local company for me here in Portland.

41:13 So I know those guys.

41:14 Oh, that's right.

41:15 Yeah.

41:16 They have they have an office.

41:17 Is I don't know if their headquarters is.

41:19 I'm not sure where their headquarters is.

41:21 I just know is walking around town like, oh, wait, they're they're here.

41:24 They're for them.

41:24 That's interesting.

41:25 Yeah, I think I I've been to their San Francisco office, which is beautiful.

41:29 Sorry, Palo Alto office, which is beautiful.

41:32 And I know a lot of those guys there.

41:34 Some of cars dot com is pyramid.

41:39 I know a guy there who's a fantastic supporter of pyramid.

41:44 Hello, Michael.

41:45 Michael Ryabushkin, also known as Goodwill.

41:48 He hangs out on IRC a lot and he he organizes a lot of stuff for us.

41:52 And just most recently he is he got cars dot com to sponsor a the graphics and display

42:02 artwork and stuff for a booth at PyCon for us.

42:06 And he did.

42:06 He's done it for like three years in a row.

42:08 Oh, that's fantastic.

42:09 And and he is a he is a great supporter of pyramid.

42:12 He does a great job.

42:14 The other, you know, over Christmas time, he sent me a monitor in the mail just showed

42:19 up.

42:19 Wow.

42:20 That's really generous.

42:21 Yeah.

42:22 So so, you know, I'm I'm really I'm really lucky that that people like him around and other

42:27 people have done the same.

42:28 I've had people send me send me several hundred dollars, you know, just out of the blue.

42:32 Just wow.

42:32 That's great.

42:33 It's like thanks for thanks for building this great framework.

42:35 Yeah, that's right.

42:36 Our company runs on it.

42:37 So, you know, cheers.

42:39 Yeah, it's really humbling.

42:40 You know, I was I was saying about cars dot com.

42:43 I think some of that runs on it and I'm sure there's other people.

42:45 I'm sure I'm forgetting somebody.

42:46 Yeah, I'm sure there's there's there's a whole bunch of sites that don't talk about what the

42:50 infrastructure is that are probably.

42:52 Yeah.

42:52 Yeah.

42:54 I think I think for sure there are still more Django sites, you know, high profile Django

42:59 sites, I think.

42:59 Yeah, I'm sure there are.

43:01 So, you know, people who are out there listening, if you've got like a cool, well-known site, maybe

43:06 you should email Chris and just say, hey, Chris, you know, such and such runs on

43:09 pyramid as well.

43:10 And I will forget about that like I forgot about all the other ones as well.

43:13 No problem.

43:15 I can forget for you all day long.

43:16 Perfect.

43:17 All right.

43:19 Well, I think that that's a lot of interesting stuff about pyramid.

43:22 Is there anything else you'd like to kind of add?

43:24 Yes, I would.

43:26 Actually, I am the originator of, you know, I started the first file in the project and all

43:32 that stuff.

43:33 But over the last year or so, I have had to go and work.

43:38 You know, I've had work to do and I took some time off.

43:41 And I've I've I sort of didn't do as much on on pyramid or any of any of the other pylons

43:47 projects projects.

43:49 There are a group of guys.

43:51 Michael miracle is he's on.

43:55 I should say this.

43:56 There is a there is a pyramid IRC channel that if you're interested in pyramid on on free

44:00 know that you should probably get into.

44:01 He's I'm I'm M.C.D.O.N.C.

44:04 And they're McDunk.

44:06 And the guy, Michael miracle, who is also a core maintainer.

44:09 His name is radio.

44:10 R.A.Y.D.E.O.

44:12 And there's a guy who now is kind of I think we tricked him into maintaining Webob.

44:20 His name is Berger's year.

44:22 I'm sure I'm murdering his name.

44:24 But he's he's he's he's Norwegian.

44:27 So I'm allowed to do that.

44:28 God, I hope he's Norwegian now.

44:30 He's Scandinavian in some sense.

44:32 I don't know.

44:33 That's great.

44:33 So some people are coming along to pick up the the effort.

44:36 Yeah.

44:37 And and and really, I am I am I have contributed far less than those people have.

44:43 And there's other guys, you know, John Anderson.

44:45 There's a bunch of guys in there that really picked up the slack when I when I sort of, you

44:50 know, wandered, did a bit of a walkabout.

44:52 I'm getting back into it now.

44:54 But there's those guys are really the guys who've been carrying them, carrying the water

44:57 for for at least a year now.

44:59 OK, do you guys do you have any future releases coming up that you guys have like a roadmap for

45:05 you can talk about or is that still?

45:06 Yeah, no, I think I think I'm hoping, you know, as we record this, it is it is April 6th

45:12 and and PyCon starts on April 9th, maybe even earlier than I think about it.

45:18 Yeah, maybe April.

45:19 I think it's Wednesday, actually, possibly.

45:21 OK, maybe people arrive on Wednesday.

45:23 I'm not sure.

45:23 But it's definitely coming in fast.

45:25 Yeah.

45:26 And I'm sort of closing last issues now that I hope will let us have a release by PyCon of

45:33 Pyramid 1.6, which has a bunch of new shiny features in it and and and stuff.

45:39 So that should that should be good.

45:40 That's great.

45:41 Well, by the time this comes out, people will it maybe will be already out.

45:45 So that'd be great.

45:46 Yeah.

45:48 So go go go go check out look for Pyramid 1.6.

45:52 Yes.

45:52 Yes, definitely.

45:53 All right.

45:54 Is there any final person or thing you want to give a shout out to somewhere you want to draw the listeners attention to?

46:00 Well, if you're if you're if you're interested, you should go to pylons project dot org.

46:04 That is the main site for all this stuff.

46:07 And you'll see pyramid and you'll see Web of and a bunch of other things listed on there and documentation.

46:13 And that's the that's the place to go and and visit the RC channel, the pound pyramid channel in free node RC.

46:20 And those are the places you can come and talk to us and make us laugh.

46:26 And 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:32 I I will listen to all the other episodes.

46:34 I will not listen to this one because I'm terrified of hearing myself.

46:38 Well, thank you so much.

46:39 I really appreciate your kind words and the community support has been really amazing.

46:43 Like the amount of messages I got on Twitter saying thanks for creating a new Python podcast have been really overwhelming.

46:49 So, you know, that that's great.

46:51 And I really appreciate it.

46:52 Chris, thank you for being on the show.

46:54 This is this is really interesting.

46:55 I'm a big fan of pyramid and use it for a couple of projects.

46:59 And I definitely definitely recommend people check it out on your docs.

47:03 I thought you have some really nice sort of tutorial walkthroughs that were quite easy to get started with.

47:07 So well done on the docs as well.

47:09 And thanks for being on the show.

47:10 Thank you.

47:11 I appreciate it.

47:12 Thanks very much for having me.

47:13 Yeah.

47:14 Talk to you later.

47:14 Bye bye.

47:15 This has been another episode of Talk Python to Me.

47:19 Today's guest was Chris McDonough.

47:21 Thanks for being on the show, Chris.

47:22 Remember, you can find the links from the show at talkpythontome.com slash episodes slash show slash three.

47:32 And 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:41 This has been your host, Michael Kennedy.

47:43 Thanks for listening.

47:45 Smix.

47:46 Take us out of here.

47:47 Staying with my voice.

47:49 There's no norm that I can feel within.

47:51 Haven't been sleeping.

47:52 I've been using lots of rest.

47:53 I'll pass the mic back to who rocked it best.

47:56 I'll pass the mic back to who rocked it best.

47:56 I'll pass the mic back to who rocked it best.

48:09 you Thank you.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon