#99: Morepath: Super Powered Python Web Framework Transcript
00:00 One of the areas where Python truly shines is on the web.
00:02 Many well-known websites like YouTube, Pinterest, and Spotify are powered by Python.
00:07 In the mid-2000s, a number of powerful and popular web frameworks were created,
00:12 such as Django, Flask, and Pyramid.
00:13 It may feel like the choices of web frameworks and innovation in that space is basically baked and done.
00:19 But we're actually seeing an explosion of new frameworks because of some new web paradigms.
00:24 In this episode, you'll meet Martin Fassen, who created MorPath, a relatively new web framework built to be a first-class citizen of this JavaScript,
00:33 client-side, heavy web paradigm that's popular in many apps today.
00:37 This is Talk Python to Me, episode 99, recorded January 19th, 2017.
00:57 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem,
01:14 and the personalities.
01:15 This is your host, Michael Kennedy.
01:17 Follow me on Twitter, where I'm @mkennedy.
01:19 Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.
01:25 Martin, welcome to Talk Python.
01:28 Hello.
01:28 I'm excited to have you here.
01:30 I really love web development in Python.
01:33 And I think web development in Python is actually one of the really early places that Python
01:39 became super relevant.
01:40 And we've seen it spread to other places really well, like data science is the most recent of
01:46 these.
01:46 But, you know, at the heart, I think a lot of Python developers are web developers.
01:50 When people ask me, hey, what do you do?
01:53 And I don't want a long conversation.
01:54 I just want a quick answer.
01:55 Like, oh, I write web apps.
01:57 I'm a developer.
01:57 Something like this.
01:58 So I love web apps.
01:59 And I think it's really cool, even though there are many Python web apps around, that you've
02:04 created a new one relatively recently, within the last couple of years.
02:07 So I'm excited to talk to everyone about MorePath.
02:10 Before we do, though, let's hear your story.
02:12 How did you get into Python and programming?
02:14 Well, programming I've been doing since I was a child, trying to create games in BASIC on
02:22 various computers, first at my father's office, because we had no computer at home, and then
02:28 later on, on home computers.
02:30 What was that first computer?
02:31 The very first computer that I remember using, I think that's actually the very first computer
02:37 I used, was called a Triumph Adler, which is, I don't know what kind of brand that is.
02:44 It was a CPM machine, and then after that, moved to early PCs, Olivetti M24s are the ones
02:53 I recall also being very early.
02:55 And my home computer was an MSX2, which was C80-based and more popular in Japan and Europe
03:02 than the United States.
03:04 Okay.
03:04 And so you started out originally just poking around at these things, and did you try to
03:08 write some games?
03:09 Yes, yes.
03:10 Like, I imagine many programmers tried to write some games, very simple things.
03:14 I think it's interesting.
03:15 Like, people really want to get into it and write games, and games are some of the hardest
03:19 types of software to write.
03:20 Yeah, it used to be easier, I think, back then, because even mobile phone games are more complicated
03:26 than the games that were commercial back then.
03:28 But even, there are a lot of sort of details, like real-time requirements and things like that,
03:33 that you don't really have so much in other contexts.
03:36 Yeah, absolutely.
03:37 So where'd you go from there?
03:38 Are you planning on it at home?
03:39 Did you study computer science in university, or where?
03:42 Yeah, I did something more artificial intelligence-oriented, but that's a very long time ago.
03:47 But I had some courses, various languages, LISP, Prologue, taught myself C.
03:52 I had a Pascal course.
03:54 I did some work with Delphi for a while, back in the 90s.
03:58 And then I was programming in C++, was writing this artificial life simulation.
04:04 And then I heard about scripting languages, read an article in some magazine at some point
04:11 that listed Perl and Tickle and Python, maybe one or two others.
04:17 And I basically just wanted to write some tools that could help me manage my C++ code base.
04:23 And I looked at Perl, because that was sort of the obvious candidate at the time, and it was on my computer.
04:30 And messed around with it for a while, and I could see how that would be a useful language.
04:36 Like, it had made things like data types really easy.
04:39 But it never quite clicked in my brain.
04:43 Then I remember printing out the Python tutorial from python.org.
04:48 And I read it one evening before sleeping, and the next day I was a Python programmer.
04:53 That's awesome.
04:54 I'm sure it's one day, right?
04:56 I've done this as well, but it's been very, very long that I printed.
05:01 Like, I remember printing like 100 pages of source code in C++, trying to understand some application.
05:07 And printed it and took it with me, because I was going away somewhere for the summer,
05:10 and I didn't have a computer with me the whole summer.
05:13 Like, the world has changed so much, right?
05:15 Yes, yes.
05:15 This was just without a computer for during the evening, but I just had printed out the tutorial.
05:21 And yeah, then a few weeks later, I actually managed to get a job writing Python code in 1998,
05:27 which was kind of...
05:28 That's awesome.
05:28 ...kind of surprised myself.
05:31 But I was at a...
05:33 Well, it was actually the veterinary department of Dutch University in Utrecht,
05:37 and they were looking for somebody who would clean up some script that had fallen apart
05:42 that was written in some combination of DOS batch files and D-based code.
05:48 And they wanted me to rewrite it.
05:52 And I said, can I use Python?
05:53 And they said, what's that?
05:55 And I said, well, it's a programming language.
05:57 And is it readable?
05:59 I said, yeah, yes.
06:00 It's very readable.
06:02 Which is really what they were looking for.
06:05 And then I found myself having a job writing Python code, which then quickly sort of moved into the web as well.
06:11 I started...
06:13 That was 98 as Zope was released as an open source product back in 98 as well.
06:20 So I started playing around with that and then moved into web development from there.
06:24 That's cool.
06:24 Yeah.
06:25 That first week or two of the job was just like, what am I doing here?
06:29 I can't believe they just hired me.
06:30 I just barely know this.
06:32 Well, I mean, I guess I had just been playing with Python for like a few weeks, I guess.
06:37 But it just clicked in my brain so much that I thought, okay, this is the right tool for the job.
06:42 And it was sort of more or less a scripting job anyway.
06:45 So that fit.
06:46 And I remember I was reading like complex Python, the Python news group.
06:50 And people were saying, oh, I wish I had a Python job and I'm stuck here programming in this other language.
06:55 That it looks really unrealistic to get a real Python job.
07:00 You know, back then those were very rare.
07:02 And I was like, hey, I actually have a Python job.
07:04 And I, you know, I didn't even particularly look for one.
07:08 I just had one.
07:09 So I was lucky.
07:10 Yeah.
07:11 Yeah, that's really lucky.
07:12 I still hear that from people today that, you know, they're working in some other technology.
07:16 But they play with Python at home and they're looking to get there.
07:19 So that's really cool.
07:21 Yeah, it's everywhere though now.
07:22 I mean, Python, it's really a different world.
07:25 I remember Python.
07:26 I had to explain to everybody what Python was.
07:29 I mean, even other software developers.
07:30 And these days, I don't have to do that anymore.
07:33 It's really everywhere.
07:35 Yeah.
07:35 There's some stats.
07:36 Somebody that did a study recently analyzing active, non-trivial, GitHub repositories, which was something like they have 10K lines of code.
07:46 No, 10K is worth of file content.
07:48 And they've been updated within the last year.
07:50 And if you take that in there, Python is the number two most popular language on GitHub
07:55 behind JavaScript, which I think is overcounted.
07:57 So it's definitely a different world.
07:58 Uh-huh.
07:59 Yes, yes.
08:00 And there's just lots of commercial projects that use Python in one another way that don't
08:05 even show up on GitHub as well.
08:07 Yeah, absolutely.
08:08 So you talked about Zope and some of the, I think, you know, the successors a little
08:12 bit like Pyramid and whatnot.
08:15 It seems to me like those were kind of inspirations in your new web project because you reference
08:21 them somewhat positively in your documentation and things like that.
08:24 Sure.
08:25 Yeah.
08:25 No, I started with Zope in 98 and I was very involved with it until I think even, yeah,
08:31 about up to about 2010.
08:33 I was even chairman of the Zope Foundation for a few years.
08:38 And Zope was really, it was really a killer app for Python in a way because there are a lot
08:45 of the, as you mentioned, web development was an early thing for Python though.
08:50 I think data science was there very early as well.
08:52 But the conferences like the early EuroPythons and the International Python Conference that I
08:59 went to even before then, a lot of the people there were there because of Zope.
09:05 That's how they were attracted to the conference and to Python.
09:08 So it drew in a lot of people similarly to, I imagine, Django does now.
09:13 Zope was a web framework before we even had a word for that because web framework only arose
09:20 as a concept later.
09:23 So it was called a web application server, I believe.
09:25 These frameworks were extracted out of like, let's build this web app.
09:28 Oh, and actually there's some kind of framework we could almost use here, right?
09:31 In that sense.
09:32 Zope was actually, yeah, it was a very strange beast.
09:36 And in part it's because there were no, there was no normal beast out there at the time because
09:41 everybody was exploring.
09:42 And in part it's because it was enormously creative.
09:46 What it had was a web-based user interface, which doesn't sound very amazing now because
09:53 lots of things do.
09:53 back then that's kind of unusual for web application development framework.
09:59 And through that you would add templates.
10:02 And later on you could add little pieces of Python code.
10:04 And then it sort of slowly morphed into doing more and more sort of larger scale Python projects
10:11 using Zope's plugin architecture.
10:13 And fairly quickly we were dissatisfied with Zope's plugin architecture.
10:19 And then this whole Zope 3 project emerged, which was sort of intending to rewrite Zope and make it all better and create the future paradise.
10:29 And while we created a lot of interesting technology and we learned a lot and actually built some real applications
10:35 with Zope 3, it never really took off because we sort of overshot in the other direction as you tend to get.
10:43 Yeah, you rarely make one rash decision.
10:45 It's usually swing back the other way, right?
10:47 Like it's just, I see that all the time in technology that people have some kind of monolithic thing
10:52 and they're like, oh, we're going to fix this.
10:53 We're going to make it extensible.
10:54 You can enable, disable, et cetera.
10:56 Yes.
10:56 And then it just becomes like, well, wait, this is no longer easy to use.
10:59 I liked it because it was easy.
11:00 And now it's like there's a hundred choices and it's hard to fix when it's broken and all that kind of stuff.
11:05 Yeah, the early Zope was never really easy if you were going to build a larger Python-based project with it.
11:10 But if you just wanted to write something quick, sort of using the web user interface, then yeah, it was very easy.
11:16 And yeah, I actually spent time in making the Zope 3 technology available in Zope 2.
11:23 So I created this little glue framework that I called 5, which is what inspired the Python name for 6.
11:32 The name 5 was already taken.
11:34 So they multiplied 2 and 3.
11:36 Yeah, oh, that's cool.
11:37 I didn't know you were behind that.
11:39 Yeah.
11:39 So I'm not behind 6, but 2 plus 3 was already taken.
11:43 So they had to go to 6 instead of 5.
11:45 Nice.
11:46 Yeah, you already had the package name.
11:47 So that's all that debate.
11:48 That technology is still in use inside of the blown CMS to this very day.
11:52 And then what I did in 2006 is actually started together with a bunch of other people.
11:57 But sort of I kicked off that project.
12:00 The Grok web framework, which was based on the Zope 3 technology, tried to put a friend of your face on it.
12:06 Also inspired by sort of the new wave of web frameworks that had been coming then.
12:12 Right.
12:12 Right.
12:12 That's like Flask and Django time.
12:14 Yeah, Ruby.
12:15 Flask was not around yet.
12:16 But yeah, Ruby on Rails and Django were new at the time.
12:20 So we tried to do something like that.
12:23 So with Grok, we had some sort of moderate success because it sort of benefited also from the larger Zope community.
12:31 People did start using it.
12:33 And it was a lot easier to start a new web framework project back in 2006 than it is in 2013.
12:38 Yeah, the expectations were way lower of what a web framework had to be, right?
12:42 It didn't have to be as polished.
12:44 And the web itself was simpler, right?
12:46 I think the web itself was simpler.
12:49 But I think the main thing that I think has changed a lot is documentation.
12:54 Back then you could start a new web framework and have, you know, some documentation, but not really exhaustive documentation.
13:01 Or very good documentation and still get some traction.
13:05 And these days that's a lot harder, I think.
13:07 The web was simpler, but the basics of Ajax, I remember I implemented those early on in Grok as well.
13:15 So that hasn't changed all that much in some ways.
13:18 But of course, client-side development was still very different.
13:22 There wasn't as much of it going around back then.
13:25 Yeah, it was much, much smaller scale.
13:27 I mean, maybe jQuery was around then.
13:29 I don't even remember the time.
13:30 Maybe not.
13:31 I think it was right.
13:32 Yeah, I remember.
13:32 I think I used MochiKit for a while.
13:34 But yeah, I don't know where the jQuery is around then.
13:36 But definitely not AngularJS and a lot of those types of things, right?
13:41 No, I did a framework there as well.
13:43 I just keep creating stuff.
13:46 You do create a lot of frameworks, I know.
13:47 Yeah, because I can't help myself.
13:49 So back in, I think, around 2010, it was just before all those client-side frameworks started emerging.
13:58 I thought, oh, I have a great idea.
13:59 I'll take my experience from server-side frameworks like templates and models and views and things like that.
14:07 And I'll take some of those ideas and then see what happens when I use them on the client.
14:13 So I created this JavaScript framework called OVL, which was based around jQuery, but allowed you to create views, view components for little bits of JSON that could identify themselves with a type.
14:27 And then it would look up the appropriate view for it.
14:29 And then you could just basically render a tree of client-side components driven by the server.
14:34 And just around that time, Backbone emerged and then Angular and then all the others.
14:41 And then I thought, okay, yeah, it was a good idea.
14:44 But I just, because other people are having the same idea.
14:48 And yeah, it was definitely an idea ripe for its time to take some of these server framework concepts and move them to the client.
14:54 So OVL didn't get any traction.
14:56 But I did learn a lot from creating it, which helped me.
15:01 That's cool.
15:01 It was absolutely the time.
15:03 Yeah, it was definitely the time when there was many, a lot of evolution and creation around that kind of stuff.
15:09 There still is, but a lot of, it was like every, every month you'd hear about something that's going to change the world.
15:16 Yes.
15:16 As you know, right.
15:17 It's still changing quite rapidly.
15:19 I, myself, I mean, people complain about JavaScript fatigue, but I kind of like it because I like the creativity around it.
15:25 Yeah, and I can say I'm a client-side web framework hipster because I was doing that before it was cool.
15:31 Definitely doing it before it was cool.
15:33 Yes.
15:33 Very interesting.
15:35 So let's talk about your project, MorePath.
15:38 One of the things, I watched a nice talk from you at EuroPython in 2014.
15:44 I'll be sure to link to the video.
15:46 And one of the things you started out talking about was why would one go and create a new web framework when Flask, Django, Pyramid, and lots more exist already?
15:55 Yes.
15:55 Yes.
15:56 And that's basically because I can't help myself.
15:59 It's just a creative urge.
16:03 I mean, of course, there are reasons why I created one.
16:05 I had a customer at the time who wanted something that could do REST APIs really well and was small enough to plug into a larger application.
16:15 So I could have used an existing framework for it.
16:18 But I said, you know, what if I just take some ideas I already have and I had some pieces of code lying about and I just put them together and I'll create a little framework.
16:26 And that's where MorePath came from.
16:30 And it's still a relatively small framework.
16:32 It hasn't grown that much.
16:33 Yeah, you describe it as a micro framework and it seems certainly like it fits well in there.
16:38 It seems like somewhere between Bottle and Flask, maybe.
16:42 I cheat a little bit because MorePath, the core itself, is just a couple of thousand lines of code.
16:48 It's built on top of this predicate dispatch library called reg, which I also created, which is just 500 lines of code, I think.
16:57 But then I spun off another library from MorePath called Dectate, which is a configuration Python sort of decorator configuration library that MorePath then uses to implement its directives.
17:08 And that's also some, I don't know, hundreds of lines of code as well.
17:13 So, you know, you can still be micro if you depend on a few libraries that you're also maintaining.
17:19 But nonetheless, it's still pretty small.
17:21 I think it's about the size of Flask.
17:23 So it depends a little bit on what you count.
17:26 If you count the template language implementation or you count the request response implementation, which is WebOp in case of MorePath.
17:33 How do you add up these things?
17:36 How many lines of code is a micro framework?
17:38 But yes, it's small.
17:39 Yes.
17:40 Yeah, in my mind, micro framework is more about the exposed feature set and how much I have to learn to work with it.
17:47 More than whether it's a thousand or two thousand lines or whatever.
17:51 That's true.
17:51 Yeah, that's true.
17:52 And in that sense, I feel like your framework is something you can pick up pretty quickly and you can kind of understand a good portion of it.
17:59 Yes.
17:59 Yes.
17:59 Pretty quickly.
18:00 So let's talk about the goals first.
18:02 Like what were the goals of this project?
18:04 So one of the things that I had been doing with Grok is I started using...
18:11 So I have to go back to ZOPE again.
18:13 ZOPE and also Grok use this database called the ZDB, the ZOPE object database, which is a pretty nice object store for Python.
18:23 You can just put in any almost arbitrary Python object, hook it up to another Python object just as an attribute.
18:31 And as long as there's some path to a root object, then everything gets persisted automatically for you.
18:37 That makes it really flexible because you can just basically store any kind of Python object to represent any model that you'd like.
18:45 It sounds like a kind of early concept of what document databases became.
18:50 Yeah.
18:50 I mean, it's very tied to Python, which is both its strength and its weakness.
18:54 Because, you know, if you change your class, then suddenly the instances need to be updated.
18:59 But it used to be very hard to explain because when you said database, the late 90s, early 2000s, people just assumed you were talking about a relational database with SQL on it.
19:08 And there was nothing really else that people were familiar with.
19:12 And then no SQL happened, and then it became a lot easier to explain.
19:16 It's like a hipster NoSQL database because there was NoSQL before there was NoSQL also.
19:21 Yes.
19:22 Yes.
19:23 I mean, that makes some things very easy, but I needed to integrate a relational database with Grok.
19:29 And one of the nice features about the ZOPE database is that you can vary.
19:35 Well, okay, we have to go back to the ZOPE publisher.
19:38 ZOPE has this sort of publisher that's based on traversal.
19:42 So you just traverse a Python object.
19:44 So if you have a path A slash B slash C to resolve that to an object and then call a method on that object to represent it as HTML or JSON or whatever,
19:54 it would basically just do a lot of get that there and get item into the object tree.
20:00 So you would just get attribute A from the root, and then you would get item B from the item that you just got.
20:09 And then you ask for get item from that object, and then you get another object, and then you call it represent me as HTML method on it.
20:19 So that's how ZOPE worked.
20:20 So that's how ZOPE worked.
20:21 And the nice feature of that is that it also allows you to construct URLs really well because you can retrace the path that you took.
20:28 So if you have an object like a document and you want its URL, you just can construct it automatically.
20:35 So I like that feature of object database and traversal.
20:39 So then with Grok, I wanted to integrate a relational database, and I was using SQLAlchemy, but I wanted to retain that feature.
20:46 And then first I sort of tried to coax SQLAlchemy to become a traversable tree.
20:55 And while SQLAlchemy, it being very flexible, made that possible.
21:00 It was not really very – it didn't really fit the models very well.
21:03 And to have to adjust the models just so you can actually traverse to it with URL paths, this didn't really work very well.
21:09 So then I had this idea, okay, I'll do it another way.
21:12 I'll create a routing framework, but one with the property that you route not to a view but to the model, just like I was used to from the ZDB.
21:20 And also I have the property that you can take instance of a class that is in the routing system and ask for a link to it.
21:30 And then it will just construct it automatically from the routing information that it has.
21:34 Right.
21:35 So you could do something like if you had, say, like a customer, let's say.
21:39 Uh-huh.
21:39 Your routing URL might look like something like slash customers slash seven.
21:45 Sure.
21:45 It might know that, okay, well, that seven actually corresponds to the customer ID.
21:49 And then you have attributes – you have decorators that will indicate, like, well, here's the function that you call to actually do that query and represent it however it's going to be represented.
22:00 Yes.
22:00 Yes.
22:01 That's how it works in mobile path.
22:02 In Crockett still had a slightly different sort of – there were no decorators.
22:06 But otherwise, yeah, that's more or less the principle.
22:09 So to resolve something, you first look up the model instance.
22:13 You first do your query or you construct some kind of Python instance.
22:17 You return this from a function that's connected to the route.
22:20 And then after that, you look up a view function for it, and it can do this based on the class of what you just found and information in the request and things like that.
22:29 So you can find this view function, and the view function gets the request and also the instance that you just returned from the path function.
22:37 And then you do your rendering in there.
22:39 And that has the nice property that you can link to any class that you exposed to that routing system.
22:45 Do you, like, register documents or type entities?
22:49 Can you say these are the entities that you might be able to go to?
22:52 I register whatever models my views need.
22:56 So in some cases, those are backed by a relational database like a customer.
22:59 And in some cases, I need to create a model that represents, for instance, a collection, which is not really backed directly by a relational database.
23:07 But you can implement it in terms of queries as well.
23:11 And then you just attach views to that collection class.
23:15 So, yeah, with Grok, I figured this out.
23:18 And then with Moapath, I sort of took that idea and cleaned it up and made that sort of one of the central principles of the web framework.
23:27 And I think sort of besides the easy linking, which was sort of the primary motivation, I think it also really helps structuring code.
23:36 With other web frameworks, you often you see some kind of get this object from the database or if you can get it, do a 404 error kind of convenience function.
23:46 And if you don't use that convenient function, you have to watch for, you know, a failure to find the object.
23:53 And if you do so, you have to remember to raise a 404 error yourself.
23:57 And with Moapath, because it has more knowledge about being able to find the model or not.
24:01 It's not hidden inside of a view function like you would have in Flask or Django.
24:06 Right.
24:06 And if you screw that up in, let's say, Flask, you probably get like a none type does not have like whatever property you're looking for error, right?
24:14 Yeah.
24:14 You'll get a 500.
24:15 Yeah.
24:15 You're getting a 500 error.
24:17 That surfaces as, you know, cannot process requests, 500, which always gives people confidence in your application.
24:23 Yes.
24:23 Yes.
24:23 Yeah.
24:24 It turns out that if you have to write that boilerplate code anyway in your application, it almost doesn't cost anything anymore to just write a separate function to separate it into two stages.
24:35 And you get other features from that as well.
24:37 You can do permission checks also because you have an idea of the instance that is being represented.
24:43 So you can say, okay, well, customers are only accessible.
24:46 Views for customers are only accessible if you have a certain permission.
24:51 And you can actually make sort of the concept of customer play a part in your authorization system as well.
24:58 That sort of all these, because you constrain yourself to really route to a model instance first and then to a view you get from that constraint to framework and benefit and build on top of it.
25:10 Let me take just a moment and tell you about Metis.
25:13 Metis, a sponsor of this episode.
25:15 A data scientist's responsibilities can range far and wide.
25:19 How can you be sure you have the necessary skills and training to enter the field or keep up with emerging technologies?
25:24 Metis, a data science training company based in New York City, San Francisco, Chicago, and Seattle, provides full-time immersive boot camps, evening part-time professional development courses, online resources, and corporate programs.
25:38 All with a goal of training you to become a data scientist and help you stay on top of new and necessary skills.
25:44 Metis has a long list of professional development courses starting soon in any of these four cities taught by industry leaders.
25:52 Interested in honing your skills?
25:53 Then these courses are for you.
25:56 How do they work?
25:56 Courses on topics like data visualization, deep learning with TensorFlow, machine learning, and statistical foundations run two nights a week for six weeks during the evening hours that fit into your busy schedule.
26:07 These courses are laser-focused on relevant topics and skills that are sure to enhance your career.
26:12 They have a special offer for you at thisismetis.com slash talkpython.
26:17 Be sure to check out what they're offering.
26:18 It helps support the show.
26:20 Sounds to me like you focused very heavily on RESTful type of ideas, right?
26:28 Like the routing framework assumes that there's some kind of resource or model at the end,
26:35 and you can use like get to do default queries on it and things like that.
26:39 Yeah.
26:40 One of the sort of the basic ideas behind Moapath when I started developing it is to be good at doing REST.
26:46 It turned out that actually, you know, a framework that's good at doing REST actually is also pretty good at doing traditional server-side web applications as well that do generate HTML.
26:57 Those things are not in conflict with each other at all.
27:01 But, yeah, the initial goal was to do REST well.
27:05 And actually template language implementation took, I think, a year and a half or so until I finally got around to doing that.
27:12 Okay.
27:12 So some of the origins was almost to make this something that you can serve up almost static HTML with rich JavaScript that reaches back to the server for all sorts of data and whatnot.
27:22 Yeah, because I had been developing, you know, even with OVL, I had been developing that way.
27:27 So I had some ideas of what I wanted my framework to be able to do also from the client-side perspective.
27:33 And one of the things that I sort of always have been is I tried to actually do real REST.
27:39 These days, REST, the term has become so eroded that it basically just means, yeah, it means endpoints that the client just needs to know about.
27:49 And it returns some kind of data format, but it doesn't involve linking or anything like that.
27:54 So I always actually try to do and work with real REST where your JSON data structures also include links to other structures to sort of the other endpoints and that you can sort of enter your application with one root endpoint and then find sort of all the links and follow them.
28:14 And perhaps also embed objects if you want to get to me.
28:18 To me, REST has become a synonym for HTTP-based services.
28:22 Yes.
28:22 Usually that return JSON.
28:23 But I think the two things that are often neglected that you are hinting at is one is content-type negotiation.
28:29 Uh-huh.
28:30 And the other is the dynamic linking and discovery, right?
28:33 You request an original resource and it tells you like how you can continue to explore the service.
28:38 MorePath has good support for content-type negotiation, right?
28:42 Well, actually, that's a thing I have cared less about.
28:46 So it's actually, we do have a really powerful system which allows you to build that should you want to.
28:54 But I haven't seen a lot of people actually try.
28:57 So the idea that if you request HTML, you'll get HTML from the same URL as where you, if you request JSON, then you'll get JSON.
29:05 Or perhaps you have multiple, even multiple versions of your API that are sort of negotiated that way.
29:11 In practice, I haven't seen a lot myself yet.
29:14 That doesn't mean very much.
29:16 Sure.
29:17 But you can go to like a view and say, you know, at app.json, at app.html and things like that, right?
29:24 Like theoretically.
29:25 Yes.
29:26 What you can do is you can name multiple views and then you can do, well, it's not negotiation,
29:31 but you can just say, okay, I want my different version of this or a different view entirely, actually.
29:37 Because views are looked up by the class of the model, but also by the request method
29:43 and also by the name of the view, which is the last part of the path.
29:47 If it's there, you can use an add sign.
29:49 And you can also look up views if they have a body.
29:53 You can actually look, interpret somehow the post body if it's JSON and then switch to a different view if you post something else.
30:02 Just have it dispatched to a different function.
30:04 And that whole system is extensible.
30:06 So you could just write a new directive and add more criteria for your views in your own application.
30:13 And it's actually possible to have, in the same runtime, to have one application that uses more criteria than another one.
30:19 And they will just live next to each other because of more path configuration system.
30:24 So you can add stuff that looks at the accept header.
30:27 That's pretty easy to implement sort of in a basic case.
30:30 But if you want to do full accept header support, it tends to get a little bit hairy because there's a lot of different possibilities there.
30:36 I find, yeah, right, that's a very rarely used feature of services.
30:42 Usually people say, go to this URL, do a get, and you're going to get JSON or something like that.
30:47 Yeah, because the information is encoded in the URL, right?
30:51 You can just see it.
30:51 And if you suddenly have to worry about, I mean, yeah, content types that you do the request with,
30:57 it becomes a lot harder to sort of get an idea in your head of what's going on.
31:01 Yeah, yeah, for sure.
31:02 So one of the things that you talk about that I thought was cool, and you even had some nice hand-drawn pictures.
31:09 Nice, yes.
31:11 In your presentation, yeah.
31:12 And one was like a web framework and embodied as a person pulling their dress shirt open,
31:20 and there's like a more path superman type suit underneath.
31:24 You talk about the superpowers of more path.
31:27 Do you want to touch on those a little?
31:28 Right.
31:28 So some of them I've touched on already, but one of the superpowers, I would say, is the dispatch system.
31:36 So the view dispatch system, but it's also used in other areas like this authorization system uses it, for instance,
31:43 allows you to write Python functions that dispatch on not just one argument like you have normally in Python with a method that dispatches on self.
31:53 At least you can look at it that way.
31:55 So the class of the self-argument of a method with the same name determines which actual method gets called.
32:02 You can also dispatch on other arguments as well, and not just its class, but also other attributes of those arguments.
32:11 And that allows the view system to dispatch on the class of the model.
32:14 The request methods get boot post of the request, the view name, which is also stored on the request, the last part of the path.
32:22 But also if the accept header or, you know, the type of the JSON body that you submit or whatever else you come up with.
32:30 Yeah, I can tell linking is super important in this whole routing and linking is really a key part of what you're trying to focus on.
32:37 Right.
32:38 But yeah, this is the dispatch system.
32:40 Okay.
32:40 That's not the linking or the routing system.
32:42 It allows you to write views that can be really general, work for, you know, any subclass of a particular base class, or be really specific for a specific class as well.
32:55 And you can dispatch a lot of different factors.
32:58 So that's the reg bit.
32:59 Yeah.
32:59 There's almost like an inheritance thing that you can do with that stuff, right?
33:03 Yes.
33:03 You can kind of override a view in a specialized class.
33:06 Okay.
33:07 Gotcha.
33:07 Yes.
33:07 Yes.
33:08 So it's like, basically, if you just look at the model bit of how you register views, it's very much like you define methods, but you don't define them inside of the class.
33:17 You define them just as functions outside of the class.
33:20 And your decorator says where they belong.
33:23 But basically, that's just one factor of what it does to look up with.
33:28 And authorization also works that way.
33:30 It's like, do I have this particular permission for this particular model instance?
33:35 And then it also knows about inheritance.
33:37 So you can be very specific about, well, this subclass needs to have a different permission rule than everything else.
33:42 And that's reg.
33:43 Then there is the, well, the automatic link generation already talked about, which I think is really neat.
33:48 Most frameworks don't really do it.
33:52 I mean, they do it sort of halfway, where you say, okay, well, you need to give all your routes a name.
33:58 You need to come up with a name and remember that and maintain that.
34:00 And then when you want to generate a link from your Python code or your template or whatever, you need to use a special API or do this special thing.
34:08 And then you need to give it all the variables that are needed to construct the link again.
34:14 So you need to know still what those things are, whether that's the ID or whatever the link construction is based on.
34:22 Yeah.
34:22 And it usually appears in multiple places.
34:24 There's usually some configuration thing where you define the route for the URL dispatch.
34:28 And then there's the actual template where you put the thing.
34:31 And you have to know, okay, I have to replace, you know, these two parts of the URL with this part of data.
34:37 And then in your actual view, you've got to pull that data out of the route data that was passed.
34:44 And it's at least in three places.
34:45 So you have to do that.
34:47 And if you have multiple places where you link to the same thing, you have to do it sort of in multiple places.
34:53 And that also makes the code less generic because suddenly it's dependent on sort of the particular structure of what you're linking to.
35:00 And if you were to change that, then you would have to change all the templates to link to it.
35:03 Yeah.
35:04 Everything breaks.
35:05 And so what I do on my web apps is on my model, I will use like some kind of rich class and then convert it to a dictionary at sort of render time.
35:15 But I'll put like a method like here's the function or the property that gets me the URL with all the pieces filled in.
35:22 So I'll go in like template and say, you know, dot like purchase URL or whatever.
35:26 Yeah, exactly.
35:27 You kind of bake this concept directly into more path in a sense, right?
35:31 Yes, yes.
35:32 So it's that concept.
35:33 But then you don't have to burden your classes, your model classes with information about the web, which is basically, I mean, it's a reasonable compromise.
35:41 I see Django.
35:42 You can also do it with Django.
35:43 There's a convention there as well.
35:45 It's still, I mean, why would my model class know about URLs?
35:49 That's the whole point about routing framework is to not have to worry about that kind of stuff in the model classes.
35:55 Exactly.
35:56 You look at the standard MVC design pattern.
36:00 There's, you know, an arrow from down to the model, but there's no arrows back from the model, right?
36:06 Which is like these basically what I'm proposing, right?
36:08 That it knows how to get back to these things.
36:10 Yeah.
36:10 And more path knows how to do that.
36:12 But the information is stored outside of the model classes themselves.
36:18 Nice.
36:19 In the configuration system.
36:20 But that allows generic code as well.
36:22 If you, you know, make, have a list of objects and you just want to create a list of links to it.
36:27 And those objects might be completely different places in your website.
36:30 I mean, if you were to solve that with, well, you can solve it if you, again, burden your model with this get URL method, then you can do it.
36:38 And without that, you would have to use a lot of special cases in your template or whatever to create the right link.
36:44 So more path does that for you.
36:46 It gets the information that it needs from the models.
36:49 By default, just there's a convention that the name that you use in the route is the name of the attribute, but you can override that to reconstruct it.
36:57 So that's really powerful.
36:59 And then there's the configuration system.
37:01 So more path has an actual sort of thought through configuration system as an entity by itself, which should not be that unusual for web frameworks, but it actually is.
37:15 And what I mean with the configuration system is the system that lets you express things like, okay, well, this route exists and this view exists and I have this permission to access that view.
37:29 Or I want to install a middleware that sits between the request and the handler and the response and sort of can interfere in there.
37:37 Or I have a template rendering engine that I want to plug in.
37:41 All those things I consider to be configuration.
37:44 And that's really my SOAP history speaking, because in SOAP 3, that was one of the big innovations.
37:50 We created this XML-based confirmation language called ZCML, where you would express all of this in XML files, which sounded really cool at the time.
37:59 But one of the things that I did...
38:01 You just put this namespace here on this XML element that it'll...
38:05 Oh, yeah.
38:06 Just kidding.
38:07 Oh, yeah.
38:08 Well, you know, you would just have an XML, a little XML language.
38:12 That was namespaced, of course, where you would say, okay, well, this...
38:14 Well, you did have routes, but you would say, this view has this permission.
38:18 And if you...
38:20 There were all kinds of things that could be configured.
38:23 You would have adapters and things like that.
38:25 But that's all pretty low-level stuff.
38:28 But also services like, you know, the service that can send email is here.
38:33 So if the application asks for it, just look at the configuration, basically, for the service that can send email.
38:38 That kind of pattern you tend to see a lot in larger applications that need to be customized in different contexts, like a CMS, for instance.
38:51 This portion of Talk Python is brought to you by Hired.
39:01 Hired is the platform for top Python developer jobs.
39:04 Create your profile and instantly get access to 3,500 companies who will work to compete with you.
39:09 Take it from one of Hired's users who recently got a job and said, I had my first offer on Thursday, after going live on Monday, and I ended up getting eight offers in total.
39:17 I've worked with recruiters in the past, but they've always been pretty hit and miss.
39:20 I tried LinkedIn, but I found Hired to be the best.
39:23 I really liked knowing the salary up front.
39:25 Privacy was also a huge seller for me.
39:28 Sounds awesome, doesn't it?
39:29 Well, wait until you hear about the sign-in bonus.
39:31 Everyone who accepts a job from Hired gets $1,000 sign-in bonus.
39:35 And as Talk Python listeners, it gets way sweeter.
39:37 Use the link Hired.com slash Talk Python to me, and Hired will double the sign-in bonus to $2,000.
39:43 Opportunity's knocking.
39:45 Visit Hired.com slash Talk Python to me and answer the door.
39:48 What I did with Grok is already tried to merge that back into Python, so you could express it.
40:00 Well, we didn't really have class decorators at the time, and function decorators were very new,
40:05 so we did it in another way.
40:07 But you can express it inside a Python code.
40:09 And then with Morpath, I express it with decorators.
40:12 And all those decorators are attached to classes, application classes, subclasses of the Morpath application,
40:18 that allows you to be classes you could inherit.
40:23 So you can say if you want to inherit all the configuration of a particular base class,
40:26 and then override specific bits of configuration, like one view or added piece of middleware or whatever,
40:33 you could just do that with subclassing.
40:35 And then you add your configuration to the subclass, and then your base class still has the original configuration.
40:40 So if you were to run that by the WSGI server, it would still behave as it did originally.
40:45 But your subclass has the new, if you instantiate that, you again get a Whiskey app,
40:50 and that will have the new behavior.
40:52 And that's really powerful.
40:54 And that was also powerful is that you can actually compose those little applications together into a larger one.
41:01 So Morpath allows you to mount applications onto other applications, which all could have their complete different configuration.
41:08 It could even override some very basic behavior of Morpath and run in the same runtime.
41:13 Sure.
41:14 So give me some examples of what two or more applications might look like,
41:18 how do they work together, what's a practical story there?
41:21 Well, so for instance, if you wanted to develop something like a GitHub,
41:25 where you have projects, projects could have issue trackers.
41:30 And you also have a wiki, perhaps, in a project.
41:33 Now those issue trackers and wikis could be implemented as separate applications
41:38 that don't know anything about projects or each other.
41:41 So you could configure them with their own routes and views and things like that.
41:45 And then you can mount them together onto the project application, should you want to use the wiki and the issue tracker there.
41:53 But if you wanted to mount them somewhere else in a completely different project,
41:56 you wanted to use the wiki, you could mount it there.
42:00 And in the mounting, the active mounting, you define sort of how to translate from the
42:05 sort of the outer applications set of concepts to the, for instance, find the idea of the wiki app or whatever to find the wiki in the database.
42:13 So they're really isolated from each other.
42:16 But you could combine them with composition.
42:18 And then, you know, if you have a customer that likes the wiki and it's all perfect,
42:23 but just wants to tweak this one little thing, you know, in their deployment,
42:27 then you could subclass the wiki and change it in that one little way.
42:31 Hopefully, your wiki will let you do that.
42:33 That's still up to the design of the application.
42:36 But yeah, that kind of sort of feature is something that I was used to from Zope 3.
42:41 And Pyramid is the other Python web framework that has this kind of capability,
42:46 though it does not have the mounting system.
42:48 I don't believe Pyramid allows you to run multiple configurations in the same application.
42:52 But I might be wrong.
42:53 Sure.
42:54 You might have to just merge it.
42:55 But at least it has this notion of configuration, override, extension, that kind of thing.
42:59 And Moopart tries to let you do that while also being really simple to use.
43:06 So you just, you know, you have application classes and you can subclass them.
43:10 Sure.
43:10 That's really cool.
43:11 So instead of having one big monolithic app, you could write a bunch of small apps and then sort of glue them together.
43:17 Yes.
43:17 Yes.
43:18 Okay.
43:18 That's really, yeah, that's really cool.
43:20 You have a couple of ways to get started.
43:23 Like if I want to get started with Moopart, like what are the few steps?
43:26 You know, obviously pip install, Moopart, then what?
43:29 Well, there is a...
43:29 Do you scaffolding?
43:30 Yeah.
43:30 We have a cookie cutter template out there now.
43:33 It's in the documentation.
43:34 So you could use that and then you get set up with a slightly bigger Moopart application.
43:41 I've been resistant sort of to doing something like this for quite a while
43:46 because I find that if you do a lot of scaffolding, it sort of becomes tempting to put a lot of,
43:53 sort of generate a lot of code basically when your project starts.
43:56 And then I always think, okay, why is that not a library?
43:59 Why cannot, is that not configuration?
44:01 Why is there so much sort of stuff that gets generated just to get an application going?
44:06 Yeah.
44:06 I think that, you know, Django sort of has that, right?
44:08 Yes.
44:09 It's a sense that people think Django is huge, but you can actually create like a one file simple Django app.
44:16 It's just nobody does it.
44:17 So it feels larger.
44:18 I think it's so...
44:19 Yeah.
44:19 I think also Django is larger in other senses, but I believe...
44:23 No, yeah.
44:23 It is larger, but it has its ORM and a template language and a lot of other things.
44:27 You know, and I think Pyramid suffers from this as well in that it feels really big
44:32 because when you create it, there's so many pieces.
44:34 I don't necessarily mind that, but I think that's the message that it does send, right?
44:38 It's a different philosophy, I think, and both of them have their benefits.
44:42 So Pyramid, I think, really tries to keep a lot of options open and to be sort of a little toolkit
44:48 that you can use in very different ways with a ZDB, with a relational database, with routing,
44:55 with traversal.
44:56 Sort of it has all those different options and it tries to be pretty neutral about sort of
45:01 what the way that you pick is.
45:04 And that's...
45:08 I mean, that's useful, but with Moopata, I try to be a little bit more opinionated.
45:12 I mean, it's still a micro framework.
45:13 You can still do a lot of different things, but I do say, okay, there's routing and you
45:17 route the models.
45:18 There's no traversal.
45:19 There's no routing to views.
45:21 You could plug it, the OPEC database is completely database agnostic, but it tries to be a bit
45:26 more opinionated about some bits in the hopes that that also makes it more approachable
45:30 so that basic application is not so much heavy lifting.
45:35 Sure.
45:35 Well, I think opinionated has been the success of Ruby on Rails.
45:39 It's been the success of Django to some degree.
45:42 So it's not necessarily bad.
45:44 No, no.
45:45 Opinionated is not bad, but it's sort of a tricky balance between being a micro framework
45:49 and being flexible, but still being opinionated.
45:52 But, you know, if you're going to be a framework, you have to have some opinions because otherwise
45:56 there's no point at all, right?
45:59 You're a framework.
46:00 You're supposed to guide people in one direction or another.
46:03 And Pyramid does have opinions.
46:05 It has opinions about the configuration system, about these.
46:10 It uses the SOAP component architecture to put things together, and those things are pretty
46:15 fundamental to its use.
46:17 Yeah, absolutely.
46:18 So there's a place in MorePath where I can plug in some kind of middleware?
46:22 Like, what are the options for that?
46:24 Are there many things I can choose from and wire together?
46:27 There's a tween system, and I just took that term and the concept from Pyramid.
46:31 I stole a lot of ideas from Pyramid and Chris McDonough because he went there first, right?
46:36 He was coming from SOAP, and then he thought, okay, I'm going to do it better.
46:39 And then he was very successful doing that.
46:43 And then I thought, okay, well, let's try as well, see where I end up.
46:46 So tell people about what tweens are in case they don't know.
46:49 It's a slightly higher level abstraction of what a whiskey middleware is.
46:53 A whiskey middleware is a little bit too low level because whiskey is very low level.
46:57 But a tween is a function that takes a request object and calls some kind of handler, which
47:04 is your application or another tween that's sitting below, that returns a response object.
47:11 And because you have this function that you plug in, you can do stuff to the request just
47:14 before it goes into the handler, or you can do stuff to the response just before it comes
47:19 out of the handler.
47:19 And that allows you to do all kinds of neat stuff like commit transactions or do stuff
47:26 to the HTML that comes out of the system or whatever.
47:28 Right.
47:28 Like I think rollbar is a tween in Pyramid, and you can install it.
47:35 And anytime there's a 500 error, it'll capture all the details and send that off.
47:40 And all you've got to do is like pyramid.include rollbar middleware name.
47:44 It's like pyramid.trib.rollbar or some variation of that name.
47:48 Yeah.
47:48 Django also has its own middleware system, which is very similar.
47:52 With Moabot, it plays sort of into the configuration system.
47:55 Though, of course, only the outer application, mounted applications, they all share the same
47:59 middleware of the other application.
48:01 But with inheritance, yeah, it allows you to basically make available a Moabot application
48:07 that has some middleware installed.
48:09 And then if you subclass that, then that middleware is there as well for you.
48:13 So you don't have to know very much to use middleware.
48:16 And you can also configure a middleware to go on top of that or just under it.
48:23 And then Moabot takes care of doing the sorting so that everything happens in the way you specified,
48:29 if it's possible at all, of course.
48:30 Sure.
48:31 Of course.
48:31 Okay.
48:32 Yeah, very nice.
48:33 What kind of templates are supported?
48:35 Like, do you have Chameleon?
48:36 Do you have Jinja 2?
48:38 Yes, so Chameleon, Jinja 2, and Mako, I believe.
48:40 Okay.
48:41 Yeah, those seem to be...
48:43 Much plugins.
48:43 They're not out of the box.
48:44 You just need to install the template dependency, more.chameleon or more.Jinja2, etc.
48:50 And then you just subclass from a base class that those packages expose.
48:54 And then you have that template language available.
48:57 So then when you use that extension, those particular extensions, like .pt for Chameleon
49:03 and .Jinja2, I believe, for Jinja 2, then it will just render using that template
49:07 language.
49:08 You could even use both in the same app if you wanted to.
49:10 Yeah, and one of the other types that you have is just straight-up JSON, right?
49:14 You can just put it in decorator save.
49:16 This thing renders as JSON.
49:18 It just converts directly.
49:19 Yeah, then you just return a Python structure that can be serialized to JSON.
49:23 Okay, excellent.
49:24 What's the deployment story?
49:28 Like, this is just a straight-up WSGI application, so I can put it on micro WSGI backed by Nginx
49:34 or G Unicorn or whatever I want, right?
49:36 Yes, yes.
49:37 If you take the application class and you instantiate it, then you get a WSGI application
49:42 and you could just hook it into whatever you like.
49:44 Okay, excellent.
49:45 Excellent.
49:46 How about Python 3 versus Python 2?
49:50 What's the status of the various versions?
49:53 Well, we support both.
49:55 We have for some years now.
49:56 For more path, that's fairly simple.
50:00 For reg, there's a few very dark corners of Python that we have to be aware of.
50:05 But yeah, both are supported.
50:06 Okay.
50:07 Yeah, excellent.
50:08 It's good to see lots of projects supporting Python 3 these days.
50:11 Nice to hear that one does.
50:12 Yeah, it's easier for libraries than for applications.
50:15 So if you have a test suite, that's pretty comprehensive.
50:18 It's pretty doable.
50:20 Okay.
50:21 Excellent.
50:21 So you're also involved in some other projects, and we're getting kind of the end of the show.
50:25 So maybe we just really quickly say what they are and then one or two sentences about it.
50:32 I don't want to go deep on it, but just to let people know the other projects that you've worked on.
50:36 So we talked about Zope and Grok already and Ovil, more path.
50:43 But you've also done some stuff with LXML, right?
50:45 Yeah, I created LXML years ago.
50:48 I've been messing around with XML and Python.
50:50 XML was way cool back in 2000.
50:52 I remember.
50:53 So I messed around with Python and XML, and I tried to write my own DOM implementation a few times
50:59 and created sort of a start of an XPath implementation at one point.
51:04 And it was all very interesting, and I learned a lot, but none of them sort of became anything very useful.
51:10 And then at one point, I had already worked with the LXML2 library, which is this really fast,
51:17 very featureful XML library and LXML2 on top of that, written in C.
51:22 And they had Python minings, but they really sucked because it was like programming C in Python.
51:28 So if you were to initialize something wrong, then you get a sec fault in Python.
51:34 And if you forget to freeze something, you would just get a memory leak in Python.
51:40 And those things are not something you want from a Python library.
51:44 So I decided, okay, let's be minimally ambitious and build on top of this LXML2 library because it's really fast.
51:53 And I tried to create a Pythonic API and also not invent a Pythonic API for XML because Fred DeKlant already had done that.
52:00 He created element tree.
52:03 And there wasn't any C element tree at the time, just element tree.
52:06 So what I did is, okay, let's create an element tree API with extensions for XSLT and XBot and all those things on top of a libxml2.
52:16 So that's what I did.
52:17 That actually is quite tricky because of trying to do garbage collect C objects that can be in tree shape to each other.
52:27 Things that, I mean, can be separate from each other, but maybe, you know, there's all kinds of sort of interesting details there.
52:33 And I used a technology called Pyrex at the time, but it's now been renamed to Cython.
52:38 So I was a very early adopter of Pyrex because I didn't want to write all that secret myself.
52:43 And then one of the best things in my open source career sort of happened.
52:47 So I worked on Alex Melt for maybe a year or so, and I got sort of it working, and I was doing garbage collection, and there was an element tree API, and it was all working pretty nicely.
52:57 And then this German guy, Stefan Benel, he started sending me lots and lots of patches and all kinds of enhancements and features and things like that.
53:09 And I basically, I was busy.
53:10 I couldn't really keep track of all the patches, and then I made the conscious decision at one point.
53:15 I remember it being the end of the year at one point, and I mailed him, and I said, you know, now you're co-maintainer of the project.
53:22 You can do whatever you like.
53:23 So I gave him that power and responsibility.
53:27 And that was a very good move because he's been maintaining Alex Melt since then, which is like, I don't know, more than 10 years now.
53:35 And added lots of features and improvements and things to it.
53:38 And he also descended down the stack because he ran into Pyrex because I was using that, and he wanted to improve that as well.
53:45 And in the end, he and some sort of people from the data sciences angle, they forked Pyrex, and they basically created Cython because, you know, he was descending through that as well.
53:57 And I sort of always wondered, like, if he keeps descending, you know, eventually he'd be doing microcode architecture for CPUs or whatever.
54:05 But he stopped there.
54:07 As far as I know, he's only doing Cython, but he's been a very capable maintainer.
54:12 So I always say that I put AlexML in the open source bank, and I'm getting interest on it because people have added features to it since then.
54:22 And I still use – I was using AlexML just this week in a project.
54:26 It's still – I still run into it, and I just use it as a library now, but I did create it originally.
54:32 It's probably a good feeling, though, to run across other people's projects and go, oh, there it is.
54:36 Yeah.
54:36 It's a very good feeling.
54:37 It's also very useful to say to Potential, because I'm a freelancer, so it's very useful to tell Python people that you created AlexML because then, oh, yeah, we used that.
54:46 Most people know.
54:47 Yeah, yeah.
54:48 Oh, prove to me that you actually know what you're doing.
54:50 Yeah, that library you're using?
54:51 Yeah.
54:51 I read that already.
54:52 Yeah.
54:52 Oh, all right, then.
54:54 So that's pretty neat.
54:56 Plus, yeah, I've been drawing interest on the – I mean, usually when you have an open source project, you don't really draw interest on it.
55:01 This is an exception.
55:02 Yeah, there have been features added to AlexML, like HTML parsing and all that stuff that I've used in the past that they were just pure interest payments on my initial investment.
55:13 Oh, absolutely.
55:13 Cool.
55:14 You also did something called Fantastic and Bower Static.
55:17 What are those two?
55:18 Yeah, FanStatic, actually.
55:20 Yeah, it's very hard to pronounce.
55:21 Oh, FanStatic.
55:21 Yeah, I got to read more carefully.
55:22 Yeah, it's a joke.
55:23 I mean, it's the plain words.
55:24 But it's about – those projects came out of something I actually started with, hurry.resource, which was a SOP project.
55:35 So what I needed was sort of JavaScript files in my application, and those JavaScript files had dependencies, and there was no dependency system for JavaScript.
55:46 So I created one in Python, and a resource eventually got sort of renamed FanStatic and refactored into it.
55:54 And the idea was to piggyback on Python's packaging infrastructure and Python's dependency infrastructure by just having modules where you declare that you have a JavaScript file or maybe a CSS file, other statistics resources, and how they depend on other ones.
56:09 And then it can automatically generate include statements or generate rollups for you in a web page.
56:15 Okay.
56:15 Oh, very nice.
56:16 And that's FanStatic, and it was sort of piggybacking, so you could release, like, jQuery as a Python package, and then you could just install it like that and start using it.
56:26 And it would be – you could use it as a whiskey middleware, so you would just insert FanStatic on top of your web framework.
56:35 And then inside of your view code, you would say, okay, I need this jQuery or whatever, or jQuery UI, and then it would figure out it would need jQuery as well, and then it would just include the right script text for you automatically.
56:46 By the middleware, we just automatically do that.
56:49 So that became an open source project a bunch of us worked on.
56:53 But, of course, JavaScript now does have a dependency system.
56:56 It took a long time, but – and a packaging system.
56:59 So that became – And Power is one of those, right?
57:02 Yeah, Power is one of those.
57:03 And, you know, when I started BowerStatic, it was basically, okay, I'll just whip up something that's based around Power because there's a packaging system already there.
57:11 In some ways, BowerStatic is less powerful than FastStatic, but at least you can install a Power package.
57:16 You don't have to wrap all your JavaScript code inside of a Python package and then upload it to PyPy anymore.
57:22 You can just use the Power package database.
57:25 These days, you know, I use BowerLess and less as well.
57:28 I tend to just go for CommonJS packages on NPM and then use the tools that exist for that to package up my JavaScript code.
57:37 There are still use cases like BowerStatic can solve.
57:40 They're a little bit harder to solve with those tooling because you have a – if you have the use case that you have that's typical for enterprise software, where you have one core application that needs to be deployed in multiple places with particular extensions.
57:57 And if those extensions are also JavaScript code, bundling everything up for one deployment is not good enough.
58:04 You would need to do something to bundle up things in pieces.
58:08 And then if you want to ship them separately, it all becomes pretty hairy because the bundling tool needs to be run sort of at the very end.
58:16 So for use cases like that, something like FastStatic or PowerStatic can still work better if at least your native enterprise installation system is something like Python packages.
58:31 So that's a very specific use case.
58:33 Those are both really nice touches.
58:34 All right.
58:35 So I think I'll have to leave it there for more, Pat.
58:37 We've definitely got into a lot of detail, but I know there's a lot more we could touch on.
58:42 All right, Martin, before I let you out of here, how about your favorite editor?
58:46 When you write some Python code, what do you open up?
58:48 I use Emacs.
58:49 I sometimes try out other editors and then I go back to Emacs.
58:52 I realize now what it is because I'm not really an Emacs power user.
58:56 At least that's what I say, but I've been using Emacs so long that I...
58:59 Probably are.
59:00 ...I, you know, learn more and more features over the years.
59:03 But nonetheless, I wouldn't call myself an Emacs power user.
59:05 But, you know, if you use it for 10 years and you learn a few features every year, you do know a bunch of features in the end.
59:12 But the thing I really like about Emacs is that it just knows how my Python code is supposed to be indented.
59:18 And if I press tab, it tends to do the right thing.
59:21 Also in other languages, it indents stuff.
59:24 And I'm so used to that that I tried Atom a while ago and it just didn't do indentation right for my tastes.
59:31 I could press tab, I could install an extension and edit.
59:33 It would let me press tab, but then it would just indent stuff wrong.
59:37 And then I went back to Emacs again.
59:40 So, yeah, we'll see.
59:43 Yeah.
59:43 All right.
59:43 Cool.
59:44 Yeah.
59:44 There's a lot of...
59:45 There's increasingly more options around the editors that are good, I think.
59:48 Yes.
59:48 That's cool.
59:49 Yes.
59:49 Yes.
59:49 And favorite PyPI package?
59:51 We've got 96,000, almost 97,000.
59:53 I have trouble deciding.
59:55 I mean, I like AlexML, of course, because I mentioned already I'm drawing interest on that one.
01:00:00 So maybe I'll just stick to that.
01:00:02 All right.
01:00:02 I use so many and there are so many very nice ones, but I just can't really think of anyone in particular that stands out.
01:00:09 Sure.
01:00:10 It's like, which one of your children do you love the most, huh?
01:00:13 Well, yeah, it's not even my own children.
01:00:15 It's not even my own children.
01:00:15 It's other people's children do I love the most.
01:00:18 That's true.
01:00:18 That's true.
01:00:19 No, there are a lot of nice packages there.
01:00:21 Let's see, whatever.
01:00:22 I mean, I used Click recently.
01:00:24 I like that.
01:00:24 Yeah, that is nice.
01:00:25 That's a nice little library.
01:00:26 What else have I used recently?
01:00:29 Well, I like, I've been messed around with numeric and pandas recently, but I was playing around with developing a data-driven game engine because, you know, why use numeric and panda for what they're really for?
01:00:45 So I was trying to blast data into OpenGL with Piglet.
01:00:49 Piglet is also a very nice library.
01:00:50 See there?
01:00:51 I remember packages now.
01:00:54 So I blast OpenGL data into Piglet coming out of, oh, sorry, NumPy.
01:00:59 I mean, of course, not numeric.
01:01:00 So out of NumPy arrays, blast them into OpenGL to try to reduce overhead.
01:01:06 Okay.
01:01:07 That's a pretty interesting use case.
01:01:08 Yeah.
01:01:08 Yeah.
01:01:09 All right.
01:01:09 Awesome.
01:01:10 Well, very interesting answers.
01:01:12 Okay.
01:01:13 So you got a final call for action.
01:01:15 Like, how do people get started with MorePath?
01:01:17 Like, what can they do?
01:01:18 What do you need?
01:01:19 Do you need contributors?
01:01:20 What's on your radar that you'd love to have?
01:01:22 Well, contributors are always great.
01:01:25 We have a few core contributors now, which I'm very happy about.
01:01:28 And I noticed that if I do, like, one major outreach thing, like, when I spoke at EuroPython in 2014 for, like, hundreds of people, one guy started using MorePath and he became a core contributor.
01:01:43 So that's just a few core contributors already, such a wealth in an open source project.
01:01:48 So those things I like very much.
01:01:50 We have a documentation website, morepath.read.docs.io.
01:01:55 There's also a link to a Discord chat.
01:01:57 So it just opens in your web browser and you can talk to MorePath developers and other people use MorePath.
01:02:04 Create an issue on the issue tracker.
01:02:06 That's also a way to reach us.
01:02:08 And, yeah, I started thinking a little bit about, I was looking at Django a little bit recently.
01:02:13 So I started a little bit about trying to create something like the Django admin UI, but then for MorePath using client-side technology somehow and perhaps using, I've never used it before, but I looked at the Pony ORM.
01:02:28 And that looks like a nice ORM, so maybe I'll try that one day.
01:02:32 Yeah, Pony ORM is really nice.
01:02:34 I had those guys on the show about 10 weeks ago, and it's really cool.
01:02:39 Yes, yeah.
01:02:39 That's excellent.
01:02:40 Everyone get out there and check out MorePath.
01:02:42 And, Martin, thank you for being on the show.
01:02:44 It was great to talk with you.
01:02:45 Thank you very much.
01:02:46 Thank you for letting me talk.
01:02:48 Absolutely.
01:02:50 This has been another episode of Talk Python to Me.
01:02:53 Today's guest has been Martin Fasson, and this episode has been sponsored by Metis and Hired.
01:02:59 Thank you both for supporting the show.
01:03:01 Want to learn data science?
01:03:03 Well, don't forget to visit thisismetis.com slash talkpython to learn more about their upcoming courses.
01:03:09 Get the skills that you need to succeed in the fast-paced world of data science.
01:03:15 Hired wants to help you find your next big thing.
01:03:17 Visit hired.com slash talkpython to me to get five or more offers with salary and equity presented right up front,
01:03:23 and a special listener signing bonus of $2,000.
01:03:26 Are you or a colleague trying to learn Python?
01:03:28 Have you tried books and videos that just left you bored by covering topics point by point?
01:03:33 Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm/course
01:03:39 to experience a more engaging way to learn Python.
01:03:42 And if you're looking for something a little more advanced, try my Write Pythonic Code course at talkpython.fm/pythonic.
01:03:49 Be sure to subscribe to the show.
01:03:52 Open your favorite podcatcher and search for Python.
01:03:54 We should be right at the top.
01:03:55 You can also find the iTunes feed at /itunes, Google Play feed at /play,
01:04:00 and direct RSS feed at /rss on talkpython.fm.
01:04:04 Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
01:04:09 Corey just recently started selling his tracks on iTunes, so I recommend you check it out at talkpython.fm/music.
01:04:16 You can browse his tracks he has for sale on iTunes and listen to the full-length version of the theme song.
01:04:21 This is your host, Michael Kennedy.
01:04:24 Thanks so much for listening.
01:04:25 I really appreciate it.
01:04:26 Smix, let's get out of here.
01:04:28 Stay tuned.
01:04:30 Stay tuned.
01:04:30 Stay tuned.
01:04:30 Stay tuned.
01:04:30 Stay tuned.
01:04:32 Stay tuned.
01:04:33 I'm sleeping, I've been using lots of rest. I'll pass the mic back to who rocked his best.
01:04:38 I'm first developers.
01:04:40 I'm first developers.
01:04:47 Developers, developers, developers, developers.
01:04:50 you you