Learn Python with Talk Python's 270 hours of courses

#97: Flask, Django style with Flask-Diamond Transcript

Recorded on Monday, Jan 16, 2017.

00:00 There's a whole spectrum of Python web frameworks.

00:02 On one end, we have the micro frameworks like Bottle, Flask, and to a lesser degree, Pyramid.

00:08 On the other, things like Django or even CMSs like Wagtail, which are built on top of Django way in the far end of the spectrum.

00:16 While this is often positioned as an either-or choice between these frameworks,

00:21 this week you'll meet someone who's doing a lot to build some middle ground in the spectrum.

00:26 Ian Dennis Miller, the creator of Flask Diamond, an extension of Flask which brings the good things from Django to Flask's simple and small API.

00:35 This is Talk Python to Me, episode 97, recorded January 16, 2017.

00:55 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

01:12 This is your host, Michael Kennedy.

01:14 Follow me on Twitter where I'm @mkennedy.

01:16 Keep up with the show and listen to past episodes at talkpython.fm and follow the show on Twitter via at Talk Python.

01:23 This episode is brought to you by Rollbar and Hired.

01:27 Thank them both for supporting the show.

01:29 Check them out at Rollbar and at Hired underscore HQ on Twitter and tell them thank you.

01:37 Ian, welcome to the show.

01:39 Thanks for inviting me.

01:40 Yeah, I'm really excited.

01:41 I often feel like we have to make this tradeoff between micro frameworks when we're choosing

01:46 a web framework like Flask, to some degree, Pyramid, Bottle, things like that, or Django,

01:50 which has all these cool building blocks.

01:52 And I think you're kind of here to dispel the fact that that's the choice to some degree,

01:56 right?

01:57 I hope so.

01:58 I think there's room for something that exists somewhere in between, or maybe that can look

02:04 like one thing sometimes and look like the other thing other times.

02:08 Yeah, absolutely.

02:08 So we're going to talk about your project, Flask Diamond, which brings some Django-like features

02:14 to Flask.

02:15 But before we get into those, let's get your story.

02:18 Where'd you get into programming?

02:19 Yeah.

02:20 Many moons ago, in, let's see, I guess, sixth, seventh grade, something like that, I made

02:29 some kind of transition from using the computer basically as a gaming device.

02:36 And I started experimenting with this weird program I found lurking in the DOS prompt called

02:43 GWBASIC, which was a basic interpreter that just shipped with DOS.

02:48 And I actually started off by entering random words into BASIC because I didn't really have

02:57 a book for it.

02:58 And the internet didn't exist at the time, at least not the way that it exists now.

03:04 You didn't want to like gopher for BASIC?

03:06 Yeah, right.

03:07 Now, gopher.

03:08 So, I mean, you know, as a sixth grader, all that stuff was way beyond my reach.

03:12 But I guess kids just, our time is worth so little.

03:16 We sit there and we can just pound away at a keyboard.

03:19 And eventually, randomly, things started working.

03:22 And it took years, actually, of doing this.

03:26 But I learned how to program in BASIC.

03:28 And then as I grew up, I was able to take courses at school.

03:35 And so that actually accelerated the process dramatically.

03:38 Yeah, that's really cool.

03:39 It's amazing that you actually were persistent to do that.

03:42 That's really quite incredible.

03:44 Oh, yeah.

03:45 You must have thought like when you got to a program in a class, you're like, you mean they

03:48 give you all the stuff you could tell?

03:50 You just put it together?

03:51 This is like, nobody's, I could do this.

03:53 This is easy.

03:54 I could not believe it when I learned about a for loop.

03:58 Because I had discovered this.

04:00 So in BASIC, you can use a go-to expression.

04:03 And when I put a logic test inside a go-to loop that just kept looping across itself.

04:10 And when I got that test to break out of the iterator, you know, that was like discovering the wheel or something.

04:16 And so then when I learned that other programming languages had that built in and they called it a for loop, that just blew my mind.

04:26 I mean, everything that came with these high-powered languages like C.

04:30 That was so awesome.

04:31 Yeah, that's great.

04:32 Yeah, so you studied in university?

04:36 Or when you went to school, what level was that that you started taking program courses?

04:40 I'm talking here about later in high school, the AP or the advanced placement track at the time was in a language called Pascal, which by now has kind of, you know, fallen away into history.

04:56 But in the course of taking this AP test, I learned this dead language.

05:02 And the following year, they switched it over to C++.

05:06 So I retook the course again, still in high school, and learned C++ in the process.

05:11 And then, yeah, in university, I actually went a kind of different direction and studied cognitive science.

05:16 But it still has a foundation in a knowledge of certain computer science principles.

05:24 But that's a pretty different beast.

05:26 It is pretty different.

05:28 Although my experience with cognitive scientists is a lot of them have some reasonable programming skills to do their modeling and whatnot with.

05:36 Yeah, that's been my experience, too.

05:37 Yeah, cool.

05:38 So basic, Pascal, C++, how'd you get to Python?

05:43 I took a very long pit stop in the Pearl universe.

05:49 After university, I got pretty involved with building web applications and CGI.

05:57 This was, you know, the early 2000s.

06:00 CGI was the way to do it.

06:02 And Apache had a strong connection to the PHP community and to the Pearl community.

06:09 And I dug really deep with Pearl for years, but found that this was Pearl 5, 5.8, thereabouts.

06:19 And it really didn't have a good object model.

06:22 It didn't have inheritance.

06:24 And a lot of the things that I came to like from statically typed languages, such as, you know, C and Java.

06:32 And I found that I wasn't able to scale up Pearl web applications as large as I wanted to.

06:38 Eventually, the chaos just took over and the bit rot.

06:42 And I watched a number of software projects die in my hands.

06:48 You know, I loved them so much, but I just couldn't speak to them anymore because my own Pearl was just so backwards.

06:53 And anyway, I went looking for something that would be an interpreted language, but also provide strong concepts about object orientedness and inheritance.

07:05 And Python was perfect.

07:07 And it also had the momentum, the community of the Python, all the extensions and everything.

07:14 Then the decent documentation made it pretty easy to get started.

07:18 So I was really attracted because I just needed to make bigger applications.

07:22 And Python just perfectly filled that space.

07:26 Right.

07:26 Just better structure, better packaging, better ability to separate concerns, all sorts of stuff, right?

07:32 Exactly.

07:32 Yeah.

07:33 And I mean, you could do it in Pearl.

07:35 There was just an awful lot of ritual, literally ritual involved in that stuff.

07:41 And they just thought through it the right way in Python.

07:45 I love it.

07:46 Yeah, I think that's really important.

07:47 Because a lot of people, when they're comparing languages, they're like, well, I can do this in this language.

07:51 Or I could do that in that language or whatever.

07:53 And it's not always about whether it's possible to be done.

07:56 It's also how much is that part of the idioms of the language?

08:00 How hard?

08:01 How do you have to fight the thing?

08:03 Yeah.

08:03 Or do you?

08:04 Yeah.

08:04 There's a saying that I like, falling into the pit of success, right?

08:08 So if you design the language and the APIs, right?

08:10 If you just kind of follow the breadcrumbs, you end up in the right place versus the wrong place.

08:16 And I think there's a lot of that in the Python, the falling into the pit of success story.

08:21 So that's really nice.

08:22 Yeah.

08:22 Well, and you know, it's kind of like we, you have infinite power with Perl.

08:26 And it's the kind of thing where you need to stop and ask yourself if you should, you know, like in the first place, do you embrace that?

08:35 And the people who do become actual wizards and power maybe, well, I don't know.

08:43 Perl is really powerful.

08:45 Let's just say that.

08:46 Yeah, absolutely.

08:47 I've actually, yes, just following good Python practices like PEP 8, for example, or the Google style guides are great ways to accidentally write better code.

09:01 I mean, not accidentally, but just due to habit, create code that is so much more valuable.

09:07 Yeah, yeah, totally agree.

09:08 Totally agree.

09:08 So how'd you get interested in the combination of Django and Flask?

09:13 Like you were obviously doing CGI and Apache stuff with Perl before.

09:17 So you're already in the web space.

09:19 Definitely.

09:20 And I learned Django first because the documentation is so fantastic.

09:28 They have covered the novice, like the tutorials for the beginners.

09:32 They've covered all the depth that you would ever need in terms of API documentation.

09:37 It was just such a great example of how to build a really vibrant community that is able to get up to speed and then live with it for a long time.

09:49 So I learned Django.

09:51 I really like it.

09:52 I thought an awful lot about the model view controller pattern because that generalizes across a whole bunch of different frameworks.

09:59 But what I came to the friction point that I found was the typical object relational mapper.

10:09 The Django way of doing it is part of the core library.

10:13 And I was really attracted to SQLAlchemy just as a good single concern library that just solved the problems with SQL for all time.

10:26 And so I didn't want to sacrifice the clarity of using an ORM like SQLAlchemy just so that I could have a better web application experience.

10:41 I just didn't want my object relational mapper to be so tightly tied to my web stack.

10:47 And so Flask really provided a model that separated those concerns a lot more cleanly.

10:53 And when I say Flask, I'm also just kind of lumping in the Flask SQLAlchemy extension, which bridges it in a very natural way.

11:01 So for me, the ability to deal with the database and alone just in terms of SQLAlchemy and set aside the web concerns for a time meant that it would be a powerful enough way of expressing some really strong statements about the data.

11:22 I have a lot to say about the data.

11:25 But as I got deeper into scientific computing, that's where my concerns really lay.

11:30 And I couldn't imagine using Django to perform that kind of work.

11:34 I definitely don't want to give the impression you can't do these things with Django because I know that you very much can customize it and set it up just the way you want.

11:44 But I think it also goes a little bit back to that pit of success, right?

11:47 That's not the first thing that it encourages.

11:50 It doesn't say bring your own ORM and use it however you want.

11:54 Bring your own ACP client and do whatever you want with it, right?

11:58 It's more about these are the building blocks and you build with them.

12:02 Whereas with Flask or Pyramid, it's like you go through and you pick the type of thing you want to work with, the pieces you want to use across the whole 96,000 packages.

12:11 And then you put them together however you feel like.

12:13 And that doesn't work for everyone.

12:15 But it sounds like it works for you.

12:17 And that's also the way that I like to work.

12:19 So I think it's an interesting option.

12:21 Well, you know, it did and it didn't work for me.

12:23 I actually started running into trouble with taking Flask and then having the freedom, having the power.

12:30 Again, sort of thinking about Pearl and wizardry.

12:34 The ability to glue together absolutely anything that you can imagine can lead you into chaotic projects.

12:43 I think it's a lot of places where you do things in an idiosyncratic way and suddenly you can't really collaborate about your project anymore because you've done things because Flask let you.

12:55 I mean, I'm not blaming Flask, but it just requires such discipline to use it in a way that's predictable enough that any teammate could actually, you know, meet you halfway, read your source code, extend it.

13:09 I'm being a little bit hyperbolic here because I know that there are people out there that are being very successful using Flask in a team context.

13:17 But I found that I was getting burned by some of the power and I wanted to regularize some of the ways that I was using Flask and make some of those things repeatable, if only because I didn't want to have to start from scratch every single time.

13:33 As freeing as that is, I just didn't want to do that anymore.

13:36 Yeah, I do find a lot of times if you've been working in one company or one environment for a long time, you do feel like you're doing the same thing over and over and over again.

13:47 One company I worked at, I went so far as to build like a new app generator.

13:54 And it would spit out a new app with logging already set up.

13:57 We'd have like exception handling services, kind of things like Rollbar before they existed.

14:02 It would automatically, you know, all that stuff was integrated and you press the button and then you added, you know, where you went from there.

14:08 Exactly.

14:09 That is really handy as long as you can tweak and do whatever you want, I suppose.

14:13 Well, so yeah, that's a whole other can of worms there.

14:17 Because I kind of think that scaffolds, so there's a whole ecosystem now of Flask scaffolds because the idea of an app generator is actually really attractive.

14:27 A lot of people have gained efficiencies by automating some of that stuff.

14:32 And I went down that path.

14:35 I started using a Python library called Mr. Bob that just takes a template and a Jinja type template and spits out a file structure, like a directory hierarchy with auto-generated code.

14:49 And what I wanted there then was the ability to keep the app generator alive such that I could then fold back things that I learned in the process of the previous app into the scaffold so that the scaffold evolved along with my other projects.

15:07 And so actually that's a large part of Flask Diamond is that it is an app generator.

15:13 It will scaffold an application, maybe kind of like what you were just describing, you know.

15:18 It has logging already embedded.

15:21 Well, anyway.

15:22 Yeah, so tell us about your project.

15:23 I mean, I think we've sort of found our way to your project in this whole conversation.

15:27 So the thing that you created is called Flask Diamond.

15:31 What is that?

15:31 So Flask Diamond is, I see it as consisting of a couple of important components.

15:38 So at a high level, Flask Diamond is a batteries-included Python Flask framework.

15:46 So the batteries-included part means it will do something without you really doing anything at all.

15:52 So if you pip install Flask Diamond and then you scaffold an app, the app that comes out already works.

16:00 And everything's in it.

16:02 So it does have logging enabled and it does have all these features.

16:05 And, you know, some of these things I might describe a little bit more later.

16:10 But the batteries included means the Flask extensions are already there and they've already been hooked up in a way that basically makes sense.

16:19 For a typical case, this is the kind of thing that's impossible to anticipate everybody's individual project considerations.

16:27 So you want to get kind of a happy medium between providing something that actually does something kind of neat without any configuration.

16:36 And it doesn't ideally have too much bloat in terms of getting in the way of you configuring it for however your project is going to deviate from whatever the defaults are, whatever the opinions are.

16:50 Right.

16:50 The more opinionated you make it and the more features you add to it, kind of ironically almost, I suspect, means the fewer people who are interested and enjoy it.

16:59 Right.

16:59 Yes, I think so.

17:00 Because if you're like, oh, it needs logging.

17:02 Most people are like, yeah, logging is good.

17:04 Oh, it also needs like caching.

17:05 It also needs message queues.

17:07 It also needs like, whoa, I don't need all this stuff.

17:09 I'll just, you know, you start to push people out, right, as you like overdo it.

17:12 So, you know, how did you find that balance?

17:14 I don't know that I have just yet.

17:16 So I'll issue that disclaimer.

17:18 But I will say that for my own uses, I do think that it meets a certain balance by being, I'm calling it radically decomposable.

17:30 So what I mean by that is it is actually safe to strip away pretty much everything that comes sort of bundled by default with Flask Diamond and actually create a command line app that doesn't even use Flask to spin up a web server and a database model.

17:51 I've actually used the whole Flask Diamond setup to create, yeah, really simple little scripts.

17:57 But I've also used that basic pattern of a command line driver with a full-fledged SQLAlchemy database lurking behind it.

18:07 And again, I'll use Flask Diamond to do that because it merely simplifies the interfaces and the process and the extensions and importing the database models and setting up the namespaces in a predictable way.

18:21 You know, it does all of that for free such that I actually don't care if Flask happens to be a WSGI environment, you know, an HTTP server.

18:32 I'm actually using it as just this really general purpose application framework.

18:37 And I even consider the web part to be decomposable and extractable from the whole rest of the application platform.

18:47 So what I'm saying is I don't even always write web apps with Flask anymore.

18:52 There's a way of using the Flask application context to script an app that does not actually need to be running in conjunction with a WSGI server.

19:03 It's an incredibly powerful pattern.

19:05 And it's another thing that I would never do with a thing like Django.

19:10 That is, it's very heavy.

19:12 And when you start up a Django process, it's not that easy to slice out different pieces of the core.

19:20 But with Flask, pretty much nothing is included in the core to begin with.

19:25 Yeah, even Flask itself is made up of like a number of building blocks that are put together, like It's Dangerous and Vexig and those sorts of things, right?

19:33 That's right.

19:34 You know, you mentioned It's Dangerous.

19:36 And one of the things that is kind of nice about folding in something like It's Dangerous using something like Flask Diamond is that by default, it's just folded in in a way that is going to work.

19:51 So the pathway there is through Flask security and Flask security will sanitize all your inputs with It's Dangerous and perform all of the cross-site scripting protections.

20:04 And so, you know, it's there.

20:06 You know it's there and that your input will be sanitized.

20:10 And frankly, if you don't want it, you don't have to have it.

20:14 You can also get rid of all that.

20:20 This portion of Talk Python to me has been brought to you by Rollbar.

20:33 One of the frustrating things about being a developer is dealing with errors.

20:37 Relying on users to report errors, digging through log files, trying to debug issues, or a million alerts just flooding your inbox and ruining your day.

20:45 With Rollbar's full stack error monitoring, you'll get the context, insights, and control of the data.

20:50 All that you need to find and fix bugs faster.

20:52 It's easy to install.

20:54 You can start tracking production errors and deployments in eight minutes or even less.

20:58 Rollbar works with all the major languages and frameworks, including the Python ones such as Django, Flask, Pyramid, as well as Ruby, JavaScript, Node, iOS, and Android.

21:08 You can integrate Rollbar into your existing workflow.

21:10 Send error alerts to Slack or HipChat.

21:12 Or even automatically create issues in Jira, Pivotal Tracker, and a whole bunch more.

21:17 Rollbar has put together a special offer for Talk Python to me listeners.

21:20 Visit rollbar.com slash Talk Python to me.

21:23 Sign up and get the bootstrap plan free for 90 days.

21:26 That's 300,000 errors tracked all for free.

21:29 But hey, just between you and me, I really hope you don't encounter that many errors.

21:32 Loved by developers at awesome companies like Heroku, Twilio, Kayak, Instacart, Zendesk, Twitch, and more.

21:38 Give Rollbar a try today.

21:40 Go to rollbar.com slash Talk Python to me.

21:51 Before we get to the nitty-gritty details of it, tell me why and when did you create this?

21:56 How old is this project?

21:57 And what got you to say, all right, I'm making this thing?

22:00 Totally.

22:00 So this has been going on for years by this point.

22:04 And it's the kind of thing that didn't happen intentionally.

22:08 No one ever sits down and says, I'm going to write a framework today.

22:12 But I needed it.

22:13 I found that I just needed something to fill a missing spot in my research pipeline.

22:20 Pipeline, basically.

22:22 So I was doing a lot of work with online memes and their propagation through social networks.

22:31 And so I was building a couple of web apps.

22:33 And I guess this is 2011, 2012.

22:38 I was using a framework called WebPy, which Reddit was using.

22:42 And at the time, the principal author was a guy named Aaron Swartz, who died in early 2013.

22:50 And the WebPy project died with him, as far as I can tell.

22:55 So I needed something.

22:56 Yeah.

22:57 That whole story is super tragic.

22:58 Yeah.

22:59 It's unfortunate.

23:00 Yeah.

23:00 It's very sad.

23:01 Yeah.

23:01 It's interesting to consider some of just the rippling costs, the things that a huge tragedy,

23:09 actually.

23:09 And so when you're trying to do some kind of academic work that's going to be reproducible,

23:16 be repeatable, the code needs to be shareable.

23:20 It needs to be portable.

23:21 You need to be able to give it to other people and they need to be able to run it.

23:26 And it also needs to be able to run ideally 5, 10, 20 years in the future.

23:31 And so a web framework that's not going to be evolving beyond 2012 or so is no good.

23:37 So I experimented with Bottle and I liked it.

23:41 And just I discovered Flask.

23:44 It's kind of, I think, because of the plan words between Bottle and Flask.

23:49 And in summer of 2013, I started really making some of these ideas into a repeatable template.

23:57 So I was building, at this time, an application to model Twitter.

24:03 I was scraping a ton of Twitter data.

24:05 And so I had all these different types of objects.

24:09 There were accounts and there were tweets and there were links between them and all the

24:13 data model that you need to do to scrape Twitter.

24:17 What I really needed was a way for other peers, collaborators to be able to look at this data

24:25 without needing to understand SQL themselves, without needing to understand Python, ideally

24:31 without even me needing to be there.

24:33 And it was through Flask that I discovered this whole ecosystem then of things like Flask

24:39 Flask admin and Flask security and the whole rest of it that I started assembling into this kind

24:46 of research data support infrastructure.

24:51 So all my data then I could put on a server somewhere in the cloud and just give a login to

24:58 an advisor and they would be able to look at it.

25:01 So the need was really, I just had so much data and I wanted to talk about it.

25:07 I wanted to collaborate with it.

25:09 And like I said earlier, I didn't want to have, I didn't want to be tied to the Django ORM.

25:15 I just wanted to use SQLAlchemy.

25:17 Cool.

25:17 I think that's a really forward looking way of doing it.

25:20 Here, I'm doing this research.

25:21 I'm going to put it on the web.

25:22 You can just execute it, slice it, dice it, whatever you want.

25:26 This predates Docker, but it seems to me like Docker is being used by a lot of scientists

25:31 for that purpose as well.

25:33 Like I'm going to package up the execution of my analysis into a Docker image and then you

25:38 can go do what you want.

25:40 So it's like the next level or something.

25:42 Yes, absolutely.

25:43 A kind of anecdotal story is that back in the day, I was aware of a guy in this one department

25:50 who needed, for timing purposes, he needed these 286s because that was the only thing that would

25:57 execute his code at the right timing for a certain kind of reaction time task that he was recording.

26:03 So he actually stockpiled these 286s.

26:07 And I mean, by the way, this was happening in like 2008.

26:10 So someone with a big pile of 286s, all for the purpose of getting the software to run exactly

26:16 right decades after it was originally written.

26:19 It's a serious problem.

26:20 It really is.

26:21 You take the 286, 16 megahertz and don't press the turbo button or it won't work right.

26:26 Exactly.

26:27 That'll screw up all your data.

26:29 Yeah.

26:30 But no, I mean, it's a real problem.

26:31 And reproducibility is a big it's a hot topic in science right now, especially in the field

26:37 of social psychology, which is kind of my home base right now.

26:41 These issues of sharing data between labs and getting the same results, even when different

26:47 researchers do it.

26:48 It's actually getting a lot of cool papers written right now.

26:51 So anyway, yeah, it's really important for data to be kind of social.

26:55 Sure.

26:56 I don't think that we as an industry or users or programmers across the board, we're not

27:03 used to thinking of execution as a thing that has to be kept for long terms of period.

27:08 We think about how are you going to archive data?

27:11 How are you going to make that interoperable so you can read it in the future?

27:15 But not like, how am I going to be able to run this algorithm that nobody's going to rewrite

27:20 or something like this?

27:21 This is an interesting problem.

27:23 It's not something that affected my day to day life until relatively recently.

27:29 But it gives me new respect for mainframe type stuff, like the whole IBM system 360 stack

27:38 that goes back 50 years and what they have done to virtualize hardware and enable code, ancient

27:44 code to still execute today.

27:46 I mean, I think about just the horrors that the banks must be facing on a regular basis.

27:52 So yeah, you know, let's be sensitive to those forward looking issues.

27:57 And I don't know, maybe mitigate that a little bit.

28:00 Fully the solution.

28:02 But anyway.

28:02 Yeah, it's a small deposit.

28:05 But I think you're probably right that like emulation and virtualization and, you know,

28:10 throw containers in there.

28:11 Those will like alleviate that to some degree.

28:13 But still, it's going to be tough.

28:14 So there's a bunch of cool features to flash diamond.

28:17 Let's let's dig into those for a bit.

28:18 Yeah.

28:19 So what I found was, you know, when we're talking about not wanting to repeat the same

28:25 steps every single time you start a new application, I found there were a couple of features that

28:30 pretty much every application I needed to build, it required those features.

28:36 And I've already talked about some of these things that I just needed in the process of

28:40 just normal, like I say, social data, like collaborative access to my data.

28:47 And so this account management is a pretty obvious feature.

28:51 It is provided by Flask admin in association with a number of other really helpful extensions.

28:58 So I've already mentioned Flask security.

29:00 And one of the things that I actually liked a lot about Django is the way that you get this

29:08 GUI management interface kind of for free.

29:12 Whatever your object model is, Django makes it so easy to get in there, see it in your web browser,

29:20 create test data.

29:22 And so that's something that Flask admin provides pretty easily.

29:26 And so I really wanted to bake that in.

29:28 So administrative access just works.

29:31 And then databases are especially important for me.

29:35 I've used a whole bunch of different SQL backends, but I've also used MongoDB very successfully

29:41 with Flask.

29:42 This is another instance where just because Flask diamond has a little opinion about databases

29:50 and the basic entity relationship pattern for describing object models, despite that, it's

29:57 really not very hard to switch that out for Mongo.

30:00 And when I say not very hard, I mean five lines of code.

30:03 There's no extremely deep epistemological commitment to using a SQL database just because the default

30:11 is a SQL database.

30:12 That's cool.

30:12 And so you have a SQLAlchemy part of that story?

30:15 In a couple of different ways, actually.

30:17 So SQLAlchemy is not the only object relational mapper, but it has documentation that is spiritual.

30:27 I think alchemy is a great term for what SQLAlchemy does.

30:32 They go to crazy places in terms of what they are doing to layer the SQLAlchemy core on top of these

30:41 relatively stupid databases.

30:44 I'm just so impressed with what SQLAlchemy has done.

30:47 Yeah, I really like it too.

30:48 I use it a lot.

30:50 Yeah.

30:50 But, you know, there's other ones like PeeWee that are really popular and a lot of people like it.

30:56 In terms of being opinionated, you know, in terms of offering these little opinions for optimizations,

31:02 the reason that I'm going with SQLAlchemy is because sometimes there's just a really crazy thing that you just want to do.

31:12 And they've already thought about it.

31:15 I haven't found something that I can't do yet with SQLAlchemy.

31:18 And if there is something that maybe you can't express with SQLAlchemy, you can always just drop to a database shell and do it directly in Postgres or whatever.

31:29 So that's another thing that I never wanted to get too far away from was the ability to just physically interact with the database and not lose some connection back to the original web application.

31:42 And like I say again, the alchemy is magic.

31:46 Nice.

31:47 What they have done makes it possible.

31:48 Yeah, it is really great.

31:50 I think it never ceases to amaze me that you really can keep on doing that.

31:54 I can also model that and see what I mean, right?

31:56 Yeah, basically, I think it's good enough for real research.

31:59 Yeah, I totally agree.

32:00 I guess that's the story.

32:01 Yeah.

32:02 Yeah, and there's a lot of interesting places using it in production.

32:05 I forget some, I don't want to say the wrong one off the top of my head, but some really major apps that are very cool, major companies using it.

32:12 You also talked about pointing Flask Diamond at existing databases and having presumably the SQLAlchemy classes, the models generated from existing databases.

32:25 Tell us about that because that sounds like saving a ton of work.

32:28 This is actually just some kind of experimentation that I've done on the side with some of my buddies.

32:32 And we have done it successfully.

32:35 SQLAlchemy ships with, it's a Python script that'll scrape your SQL schema and auto generate model code for you.

32:44 So I don't want to give you the wrong idea that this is already baked into Flask Diamond.

32:49 Simply that we have done it in a Flask Diamond app.

32:53 It worked pretty much.

32:55 And it did save us time in this one instance.

32:59 So I mean, again, this is kind of like sort of spooky, pseudo-magical stuff here.

33:04 And I'm saying like, yes, yes, this is possible, but I will only speak of it.

33:07 I won't actually show you.

33:10 But you'll just have to take my word for it.

33:13 But it's possible.

33:13 Yeah, I've done that before as well.

33:15 I think there was a third-party package that didn't come directly from SQLAlchemy.

33:19 That sounds right.

33:20 Maybe the contrib.

33:22 Yeah, it might have been contrib or something that was like, hey, this works with SQLAlchemy and it'll like read your schema and it'll actually generate your classes.

33:31 And maybe the classes have stupid names and you need to go edit them a little bit.

33:34 But still, like when you're looking at a big daunting database and you're like, oh, I got to get started with this.

33:40 Like the ability to auto-generate or pre-generate like a starting place is really cool.

33:44 Yeah.

33:45 And it worked.

33:45 Yeah, like I say, it worked most of the way.

33:47 Which saves you most of the work.

33:49 That's right.

33:50 Yeah.

33:51 That's awesome.

33:51 You said it also has one of the features is model CRUD.

33:55 Create, read, update, delete.

33:56 Yeah, that's right.

33:57 Create, read, update, delete is a really useful pattern that I've encountered all over the place.

34:02 And all the more so with RESTful HTTP interfaces where the basic HTTP verbs more or less map on to create, read, update, and delete.

34:11 And so I just found that I was doing this constantly.

34:15 And so I wanted to do this.

34:16 And so I wanted to do this.

34:16 And so I wanted to do this.

34:16 And so I wanted to do this.

34:16 And so I wanted to do this.

34:16 And so I wanted to do this.

34:16 And so I wanted to do this.

34:17 And so I wanted to do this.

34:18 And so I wanted to persist that through just the general object model.

34:26 And so this is actually implemented as a mix in that you can include with any SQLAlchemy object that you create.

34:35 And it simply extends your model with create, read, update, and delete for free.

34:40 And it extends it a little bit more with the ability to rapidly load and dump objects from JSON.

34:48 Or you can extend it further for something like CSV.

34:51 So the idea is to take some of the nice stuff from the GUI CRUD and enable that Pythonically.

34:59 It's just a convenience thing, but I use it constantly.

35:04 It's really the only way that I'm interacting with objects anymore is through this CRUD interface.

35:10 Huge time saver for me, at least.

35:11 Yeah, that sounds cool.

35:12 Another thing a lot of apps need is email.

35:15 Definitely.

35:16 It's a necessary evil.

35:18 Email is kind of an out-of-channel or an out-of-band way of communicating things like account changes.

35:28 And actually, Flask security provides a number of features for email account confirmation if you're going to incorporate some kind of second factor authentication into your platform.

35:43 So email is a necessary thing.

35:46 It's provided by Flask mail.

35:48 Again, needs to be integrated.

35:49 And once again, Flask Diamond gives you an integrated email solution for free, batteries included.

35:56 However, in this case, this is the kind of thing that not everybody needs.

36:01 And so I've gone the extra step and I've actually commented out the one line that would enable email by default.

36:08 And so if you find that you actually want it in your app, you are going to have to uncomment that line.

36:14 But then, you know, emails is just there and it's free.

36:17 And it works.

36:19 Yeah, that's really great.

36:20 And testing.

36:22 One of the things I feel like is more possible, things like Flask, the micro frameworks, is because they're just less, they're easier to test.

36:30 Yeah, it's possible to get in there and test some really low level things like the generation of signals or like I mentioned the application context earlier.

36:41 The ability to create an application completely separate from any kind of web server or any kind of WSGI serving infrastructure is so powerful for testing.

36:52 And so Flask testing makes some of these things really easy, like creating a debugging server and creating a phony HTTP test client for local testing of HTTP interfaces.

37:04 So, of course, that's stitched in.

37:06 But also, a simple testing framework is included with the scaffold to provide some examples of how you might use nose test, which is one of the Python testing suites.

37:21 Other examples are pytest or Tox.

37:24 And, you know, once again, you can actually use another testing platform, apart from nose, relatively easily.

37:31 So I actually use Tox on a couple of projects.

37:34 But the scaffold includes some, a pattern for building a test harness using nose tests and integrating it with the command line, making it pretty easy to run single tests, to run all of the tests, to automatically run tests when a file changes.

37:56 Certain things that become really more like the DevOps side of things.

38:03 Once again, a basic workable solution comes for free out of the box with Flask Diamond.

38:11 And once again, it's the kind of thing that if you don't like it, you can just delete it and it's gone because it's really not baked in very deeply.

38:17 It's just hooked in enough that it'll work, that the make file has a make test command and it'll do the right thing unless you don't want it to.

38:26 Right.

38:27 There's probably like a test stop py or something like that.

38:29 Exactly.

38:30 Hang around somewhere.

38:30 Yeah.

38:31 It was a test directory, but anyway.

38:33 Right.

38:33 Okay, sure.

38:34 You could delete the test directory and you're done with the test if you don't want it or whatever.

38:37 Yeah.

38:37 This portion of Talk Python is brought to you by Hired.

38:52 Hired is the platform for top Python developer jobs.

38:55 Create your profile and instantly get access to 3,500 companies who will work to compete with you.

39:00 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:08 I've worked with recruiters in the past, but they've always been pretty hit and miss.

39:11 I tried LinkedIn, but I found Hired to be the best.

39:14 I really like knowing the salary up front.

39:16 Privacy was also a huge seller for me.

39:18 Sounds awesome, doesn't it?

39:20 Well, wait until you hear about the sign-in bonus.

39:22 Everyone who accepts a job from Hired gets $1,000 sign-in bonus.

39:26 And as Talk Python listeners, it gets way sweeter.

39:29 Use the link Hired.com slash Talk Python to me and Hired will double the signing bonus to $2,000.

39:33 Opportunity's knocking.

39:35 Visit Hired.com slash Talk Python to me and answer the door.

39:46 You also talked about deployment.

39:47 How's the deployment different or enhanced with Plast Diamond?

39:51 I came to really like a Python package called Fabric that abstracted away some of the weirdness of SSH and RSync and simplified some of the management of remote tasks that occur on your testing server or on your production server.

40:10 And so I started baking this into the scaffold again.

40:14 So what comes for free is a little fab file that actually I want to take a step back.

40:21 For deployment, you can do it in a couple of different patterns.

40:24 There's a way in which you could push your code to a central Git server or something like that and have all of your testing machines automatically pull from that server or have your production machines pull from that server.

40:37 And so that's kind of a passive deployment.

40:40 And then there's also an active deployment where you physically push the code to the machine that you're actually going to be running it on.

40:47 You know, you don't relay it through some other intermediary server.

40:51 And so I wanted to support both styles, actually, of deployment.

40:55 And so that's supported with Fabric and with a command line interface, because this is the kind of thing that every command is a one off.

41:05 And you just want to rapidly be able to SSH to a deployment server or push the code directly to a deployment server.

41:13 And these things happen constantly.

41:15 I just wanted, again, a simple solution that came for free out of the box.

41:20 Yeah, that's cool.

41:20 So nice that that's built in there.

41:23 So another thing when I was cruising around your website that I saw, you were talking about facets.

41:28 What are facets in this project?

41:30 In a roundabout way, I've kind of been describing what these facets are.

41:35 A facet is kind of a feature.

41:38 So, you know, a facet is kind of like a face of a surface or as a play on words, a diamond is faceted with many faces.

41:47 And so each of these features is actually a facet.

41:51 So there's an account facet.

41:52 There's an administration facet.

41:54 There's a databases facet.

41:56 There's an email facet and so on.

41:58 And the basic idea is that together, these facets are the default types of considerations, the typical considerations that many of these web applications just require.

42:11 You know, insofar as many of them need accounts and administration.

42:14 Well, those are facets.

42:16 At the Python level, each facet is really like a proxy for the extensions that are loaded to actually provide that facet.

42:27 So I mentioned that Flask admin and Flask security have an interplay where admin uses security for login purposes.

42:39 And the facets just ensure that those get that all the objects are created in the correct order and that Flask security knows about Flask admin.

42:49 And what this means, again, Pythonically, is that you can either inherit and override or completely comment out any of these facets and really control whether or not your application has that facet at all.

43:05 Right. Or replace it with something different.

43:07 Exactly.

43:07 Yeah. OK.

43:08 And so it creates like a predictable hook where if you're going to use a different database, then that's where you do it.

43:16 You know, you don't just randomly decide when you're sitting down to create the application that, you know, I'm going to do my database, whatever.

43:23 This is predictable place where all the database stuff happens.

43:26 You just go to the database facet.

43:29 And if you're going to use Mongo, then you do it there.

43:32 You just override, you inherit and override what I wrote.

43:36 And boom, that's the right place or the opinionated place.

43:41 Certainly not the right place, but that's the agreed upon place.

43:45 Sure.

43:45 I see.

43:47 So it's kind of a convention.

43:48 The facets sort of bundled, like your convention on top of like Flask security or some part of the API.

43:55 Exactly.

43:55 Convention is a good word for it.

43:57 It's creating some conventions.

43:58 OK.

43:59 Conventions are good.

44:00 That's cool.

44:01 So let's assume that people out there are basically familiar with how you write Flask apps and how you write Django apps.

44:08 Can you talk just a little bit about like, what does it look like?

44:11 What's the API look like?

44:13 Does it look a lot like Flask?

44:14 Does it look like Django?

44:15 Like what do I, what are the feelings I get when I write code in this, on top of this?

44:19 Totally.

44:20 I would expect it to be really familiar for Flask users.

44:25 Because what comes out is actually a Flask application.

44:29 The process starts off a lot like Django.

44:32 You know, I was saying that Django has done such a great job of creating tutorials and making it easy for new users to get started.

44:41 So just like Django, Flask Diamond begins with a scaffold and it creates a directory structure that would be really familiar to somebody who uses Django.

44:55 So there's a manage.py and it does basically what you would expect.

44:58 You can do manage.py server and then it'll, you know, just run your server or manage.py DB.

45:04 And it gives you access to all of your database stuff.

45:08 So in that sense, it's reminiscent of Django.

45:11 And incidentally, all of that manage.py stuff is implemented with Flask script, another really great extension.

45:18 But after you scaffold your application, it really comes to resemble Flask.

45:23 The basic pattern uses the Flask create app idiom where somewhere in your project code, instead of just directly instantiating all of the Flask objects, you wrap that in a function called create app.

45:40 And that really simplifies testing and it does all these things.

45:43 And that's kind of the Flask way to do it.

45:45 And all the extensions have an init app style of object creation.

45:51 So Flask admin, it has a slightly opinionated way of setting it up.

45:57 So once you have your application scaffold, it follows all the Flask conventions.

46:04 You'll find a create app is inside your init file.

46:07 And you'll find that each extension is created using the typical Flask init app idiom.

46:13 I would expect that everything else should just look pretty much like another Flask scaffold.

46:19 Okay.

46:20 You might find online.

46:21 Yeah, cool.

46:22 So maybe not like a new Flask app, but like more, a more mature one you've dropped into or something.

46:26 Yeah.

46:27 Okay.

46:28 You talked about the Django tutorials and documentation and they are really important.

46:33 They make a big difference.

46:34 Actually, when the Django tutorial switched from just by default recommending Python 3 over Python 2,

46:41 that made a significantly measurable difference in Python 3 usage on PyPI.

46:47 Yeah.

46:48 So, you know, that I think speaks pretty strongly how powerful the Django documentation is.

46:53 But yours is really nice as well.

46:55 And you have a tutorial called Planet Tutorial, which I thought was cool.

46:59 And it has a video as well as like a screencast video as well as just the steps, which I really like that.

47:06 Yeah, thanks.

47:07 Like I say, I'm really inspired by Django and what they have done.

47:11 And one of the things that I've put a lot of time into over the years, because this is several years in the making,

47:20 is creating some kind of a compelling story or a tutorial that kind of made sense at some level.

47:27 And so I used to use an example about chess.

47:31 And, you know, there's a board and there's pieces and there's players.

47:34 And for some reason it didn't, I don't know, I guess I didn't care at a certain point.

47:40 Like it wasn't interesting implementing chess.

47:42 And I had a breakthrough a couple of months ago when I realized that whatever tutorial I write about,

47:50 it really needs to ship with working code.

47:54 The two need to play off of each other.

47:57 So over the course of a couple of weeks, these ideas kind of came together.

48:00 And the planets tutorial actually ships as another code scaffold.

48:04 There's only two that ship with Flask Diamond.

48:07 The one will create an application for you.

48:10 And the other will set up this planets tutorial.

48:12 And so it's working code that comes in the package and it maps on to the documentation.

48:18 So the idea is it should be a consistent story.

48:21 Part of why that's important is to make it possible.

48:26 So let's assume that you're doing some team collaboration, some development that involves a couple of people.

48:32 And let's assume that they know Python and maybe even they know Flask already.

48:37 The idea is you should be able to point them at something and make it pretty easy for people to become initiated or get up to speed such that they can collaborate.

48:47 So the planets tutorial is really just there's planets and there's moons or there's satellites.

48:53 And it walks through creating Earth and Mars and Venus and just adding a couple of moons around those planets.

49:01 And at that level, it's actually pretty pedestrian.

49:04 There's some simple models.

49:06 But I just kind of liked the story a little bit more than, I don't know.

49:10 It sounds intriguing.

49:12 Like I want to go through a planets tutorial.

49:14 Yeah.

49:15 Well, hey, it's an 11 minute video.

49:17 So nice.

49:20 How about how are you using this?

49:22 You said you're using this in a few interesting ways in production today, right?

49:25 Yeah.

49:25 So I am actually using it in production.

49:27 And I gave a few examples of some research projects where I wanted advisors or peers to have access to this stuff.

49:38 But I've done a couple of other projects more recently that are actually live and out there and even potentially getting some decent traffic.

49:47 So peopleapi.com.

49:50 So that's P-P-L-A-P-I dot com is something I've been working on for a couple of years.

49:55 It's part of my dissertation work.

49:58 It's a virtual database of the human population.

50:01 So for everyone who is alive, approximately in 2014, that was about 7.2 billion people.

50:07 There's an entry in this database for everybody.

50:11 Now, to be clear, it's synthetic data that's not actually scraped from Facebook or something like that.

50:18 I have a bunch of algorithms based on demographics that make guesses about where everybody is and how old they are and all that stuff.

50:27 And, you know, and the guesses are pretty good.

50:30 But the idea is that they're not real people just yet.

50:33 But it's billions.

50:34 I mean, it's a really big database.

50:36 That is a big database.

50:37 Yeah, something like seven terabytes.

50:40 And I was really happy that this got featured on Hacker News and Product Hunt last week.

50:46 And the website did not fall over.

50:50 I was sustaining 150 simultaneous connections.

50:54 And it held up on a virtual machine in the Digital Ocean cloud.

51:01 So that was actually a pretty cool validation of the ability of one of these applications to sustain moderate traffic.

51:11 And it's also a demonstration of the ability to manage a pretty sizable database using SQLAlchemy and exposing that over the web and coping with some kind of scale, coping with, like I say, a little, like a moderate amount of traffic.

51:26 So I'm pretty happy about that.

51:28 PPL API dot com.

51:29 But another thing that I'm doing that kind of relates to me as an open source developer is that I've been looking at GitHub.

51:38 And they have a ton of data available through their API.

51:42 And there are actually a bunch of academics out there who are scraping GitHub.

51:47 There's a lot of interesting research you can do with that data.

51:51 So I have created an analysis called GH Impact.

51:55 This relates to the number of projects that have a certain number of stars or more.

52:01 So if you have 10 projects with at least 10 stars, then you have a GH Impact score of 10.

52:07 And if you have 100 projects, each with 100 stars or more, then you have a score of 100.

52:13 And only companies like Google and Microsoft and Mozilla are able to get these scores that are really high, to have 100 projects.

52:23 And every single one of those projects is well liked on GitHub.

52:26 And typically, even prolific developers have fewer projects and they get fewer stars.

52:33 Or if they have one popular project, then they probably don't have a second popular project.

52:39 So this is kind of a social analysis of the impact that people are able to achieve through a platform like GitHub.

52:48 Once again, this is live on the Internet.

52:51 And once again, I did all the data modeling with Flask Diamond.

52:55 And in this case, one of the ways that that was really useful was the ability to extract small amounts of data from this, you know, this like 150 gigabyte database through a REST API.

53:09 And so that enabled me to use a statistical package called R to not have to load the whole 150 gigabyte database.

53:18 I was able to use a little tiny bit of data through the REST interface that I built.

53:24 In that manner, I was able to fit my analysis in RAM.

53:28 Because R is just not powerful enough to deal with an enormous database of many gigabytes.

53:34 And so for certain analyses, a tool like Flask Diamond fills a really crucial data translation role of adapting huge data down to relatively underpowered statistical workstations.

53:50 Yeah, that's cool.

53:51 So is it kind of like, did you kind of like sample or poll the GitHub population and then compare name you put in there against that?

53:59 No, I got all of it with like certain caveats.

54:01 I scraped as much as these other researchers over in the Netherlands have scraped.

54:07 Their project is called GH Torrent.

54:09 The torrent thing is, I think, irrelevant.

54:12 Now I'm pretty sure it's just a distributed scraping project.

54:15 As much as they were able to scrape, which is, I think, you know, certainly more than 90% of GitHub.

54:20 Yeah, that should be statistically relevant.

54:22 Yeah.

54:23 Yeah, yeah.

54:24 I got all of it.

54:24 So, no, I didn't sample any of it.

54:26 I just extracted specific columns and subsetted the data so that I was able to fit only what I cared about into RAM and ignore the rest.

54:36 Nice.

54:37 So I had to type my name into it because it's the only one I knew off the top of my head.

54:40 I have a GitHub impact score of eight and a 99 percentile.

54:43 Yeah, yeah.

54:44 That's cool.

54:45 It ceilings out pretty rapidly.

54:47 And, you know, so, you know, your score might be a little bit higher than that because, like I say, maybe they haven't scraped the whole thing just yet.

54:55 But, yeah, what that means is you have at least eight projects with each eight stars or more.

55:00 In all likelihood, some of those projects have way more than eight stars.

55:04 But the way that it draws the line is I guess they're not nine projects each with at least nine stars.

55:10 Yeah, that sounds right to me, actually.

55:12 It's pretty cool.

55:12 It's a cool measurement.

55:13 Yeah, thanks.

55:15 Yeah.

55:15 They like it in academia.

55:16 So, anyway.

55:17 Yeah, very nice.

55:18 So, the last one that you want to talk about in production is GThink.

55:22 This one's a weird one.

55:23 Without the I.

55:24 G-T-H-N-K dot com.

55:27 Yeah.

55:27 So, I do pronounce it GThink.

55:29 So, you got that right.

55:30 It's not actually hosted remotely.

55:33 This is one that you download and then you run it locally.

55:37 And on OS X, GThink installs as a launch service.

55:42 So, it's just kind of always running in the background.

55:45 And it's a note-taking application of sorts.

55:50 It's not in the cloud.

55:51 You know, it's not hosted remotely, which is, I believe, a security feature.

55:56 Like, I really don't trust a hosted cloud service to store my personal notes.

56:03 I would much rather just have a program running on my own computer.

56:07 That's what GThink is.

56:08 It's like a self-hosted Evernote or something along those lines.

56:12 Okay, cool.

56:13 It demonstrates that Flash Diamond can be packaged in a couple of different ways.

56:17 Not only hosted online.

56:18 That is really cool to have it as a desktop app.

56:20 Okay, nice.

56:21 That's quite an interesting twist.

56:23 So, tell me the story of Python 2 versus Python 3 with your project.

56:28 Yeah.

56:28 This was a bit of a struggle, actually.

56:31 Because the ecosystem was a real barrier.

56:36 Insofar as all the packages that Flash Diamond relies upon, they all need to have made the switch to Python 3.

56:44 And by now they have.

56:45 But also, you know, there was a little bit of stuff inside Flash Diamond itself that needed to be updated.

56:51 I eventually made the leap within the last year.

56:54 But I think I found that Travis, actually, in automated testing, is a real asset with Python 2 and Python 3 compatibility.

57:04 So, the ability to automatically run the test suite with different Python interpreters has saved me a lot of headaches.

57:11 Because I'm catching a lot of bugs that, well, less now the transition has been made.

57:16 But it caught an awful lot of bugs moving from 2 to 3.

57:19 But I find now that I make all my new projects using Python 3.

57:25 And personally, I'm really enjoying what's happened with Python 3.

57:30 And I do kind of, I check in on the arguments whenever it comes up.

57:36 You know, why isn't Python 3 whatever?

57:38 I like to sort of torture myself reading that stuff online.

57:42 Because I was held back for quite a while on Python 2.7.

57:46 Now that I have made the switch, there's no going back.

57:49 Yeah.

57:50 I really do like that.

57:51 Yeah, I'm with you.

57:51 There's a whole bunch of cool stuff.

57:53 Especially around concurrency and async stuff.

57:55 And just a lot of polish on the language.

57:57 Yeah.

57:58 Strings and bytes and Unicode.

58:00 It's so much better.

58:01 I feel like we, as a community, have sort of turned the corner.

58:05 A year ago, a few years, it wasn't entirely clear that Python 3 was like,

58:11 of course you should be doing it.

58:12 People were still like, no, I don't know about this.

58:14 I feel like most people, even though maybe they have a project that's not quite converted

58:19 or they don't foresee themselves able to move whatever project to Python 3,

58:24 like the recognition that it is the way to go, I think is definitely growing.

58:29 So I think it's a pretty positive move.

58:30 Yeah.

58:31 I think finally the critical mass is there.

58:33 Yeah.

58:33 And it's the way forward, clearly.

58:36 Absolutely.

58:37 Absolutely.

58:37 All right.

58:38 Well, your project looks really cool.

58:39 I feel like, you know, we've got Flask at one end with the micro frameworks.

58:44 We've got Django at the other end.

58:45 It's more sort of full-featured building blocks.

58:48 I talked with Julia Ellman and Mark Levin on episode 88 about a lightweight Django and bringing,

58:56 you know, sort of unrolling some of the stuff out of Django to make more lightweight,

59:00 to bend it however you want.

59:02 And this is kind of taking some of the niceties of Django, put it in a flask, and you're kind

59:06 of like filling out the spectrum.

59:07 I hope so.

59:08 Yeah.

59:09 So it sounds, I think it's a cool contribution.

59:11 Yeah.

59:11 Thanks.

59:12 Yeah.

59:12 So let's see, before we go, let me ask you the two final questions.

59:15 If you're going to write some Python code, what editor do you use?

59:18 It's Sublime Text 3 these days.

59:20 It's Python all the way down.

59:22 I love Emacs.

59:25 I love the Emacs philosophy.

59:26 And I love Lisp.

59:28 But the idea of redoing Emacs with Python as its heart and its brain is too cool.

59:37 So it's Sublime Text.

59:39 Yeah.

59:39 That's pretty cool.

59:40 Have you seen the Anaconda plugin for it?

59:45 I have not.

59:46 It's not the same as the Anaconda distribution.

59:48 I think these things are unrelated.

59:49 But it's like an extension for Sublime that brings all sorts of Python features, apparently.

59:54 I just ran across it recently.

59:56 But I haven't really explored it.

59:57 Yeah.

59:58 I would have just discounted it as just packaging of the other Anaconda.

01:00:02 Well, that's awesome, actually.

01:00:03 I'm going to check it out.

01:00:04 Yeah.

01:00:05 I'm quite sure that it's a different sort of thing.

01:00:09 Cool.

01:00:09 Yeah.

01:00:09 Cool.

01:00:09 So I'll put a link.

01:00:11 Yeah.

01:00:11 So here it says, I open it up and it says, Anaconda, the Sublime Text 3 Python IDE.

01:00:18 And it gives you all sorts of functionality.

01:00:20 Yeah.

01:00:20 So it's not the same thing as the Anaconda.

01:00:23 It's a different thing.

01:00:24 Check it out.

01:00:25 I'm giving that a look.

01:00:26 Yeah.

01:00:26 Awesome.

01:00:27 Okay.

01:00:27 And then there's over 96,000 PyPI packages.

01:00:31 I can't wait till it gets to 100,000.

01:00:32 There's got to be some kind of celebration.

01:00:34 But why don't you tell people about some that you think are cool they should know about.

01:00:40 Check out.

01:00:40 All right.

01:00:41 So I've already said so many good things about Flask and Sequel Alchemy.

01:00:46 Together, they have changed my life, I think, probably for the better.

01:00:51 So everybody needs to go look at those two.

01:00:54 But I also just want to, there's a special place in my heart for Beautiful Soup.

01:00:59 It's a throwback to an earlier time.

01:01:02 But when Beautiful Soup came along and made it easy for me to parse even really broken and terrible HTML,

01:01:11 and actually I was able to start doing useful stuff with web scraping, and I began sort of collecting some data that I was unable to access before.

01:01:22 I think there's a way that Beautiful Soup might have improved my life more than anything else in PyPI.

01:01:29 That's really cool.

01:01:31 It's a special place in my heart for that one.

01:01:33 Yeah.

01:01:34 You talked about the alchemy.

01:01:35 The alchemy nature of Sequel Alchemy.

01:01:37 Beautiful Soup is kind of magical as well.

01:01:39 Yeah.

01:01:40 Everything becomes an API even if it's not supposed to be.

01:01:44 Right.

01:01:45 Awesome.

01:01:47 And it's surprisingly easy to use.

01:01:48 So if you guys need to do web scraping, check it out.

01:01:50 It's definitely cool.

01:01:51 I can recommend it as well.

01:01:52 All right.

01:01:53 How about a final call to action?

01:01:55 You looking for contributors to this project, people to try it out?

01:01:58 Yeah.

01:01:59 Definitely check out the website flask-diamond.org.

01:02:04 That'll link you through to GitHub.

01:02:06 I'm looking for people to battle test this on Windows because that's harder for me to do.

01:02:12 And ideally give me feedback.

01:02:15 Or even better would actually be some edits to the documentation because I want to break down the barriers to get some new users initiated into this flask ecosystem.

01:02:26 Yeah.

01:02:26 That sounds great.

01:02:27 You know, people are always asking me like how they can contribute to open source.

01:02:30 Like something that just came to mind is maybe they could come write a tutorial and you could have like a whole bunch of tutorials.

01:02:35 Right.

01:02:36 That'd be a fun way to like a fun and easy way to get started.

01:02:38 Right.

01:02:38 I would love that.

01:02:39 And, you know, make a screencast video.

01:02:41 And man, you're you're you'll be my friend for life.

01:02:46 That's awesome.

01:02:46 All right.

01:02:47 Well, this is a really cool project.

01:02:48 And I think it's, you know, fills an interesting space in the spectrum of the web and Python.

01:02:53 So thanks for building it.

01:02:54 And thanks for taking the time to share the story.

01:02:56 Thanks.

01:02:56 It was really my pleasure.

01:02:57 You bet.

01:02:58 Bye.

01:02:59 This episode's guest has been Ian Dennis Miller.

01:03:02 And the episode has been sponsored by Rollbar and Hired.

01:03:06 Thank you both for supporting the show.

01:03:08 Rollbar takes the pain out of errors.

01:03:11 They give you the context and insight you need to quickly locate and fix errors that might have gone unnoticed until your users complain, of course.

01:03:19 As Talk Python to Me listeners, track a ridiculous number of errors for free at rollbar.com slash Talk Python to Me.

01:03:26 Hired wants to help you find your next big thing.

01:03:29 Visit Hired.com slash Talk Python to Me to get five or more offers with salary and equity presented right up front and a special listener signing bonus of $2,000.

01:03:37 Are you or a colleague trying to learn Python?

01:03:40 Have you tried books and videos that just left you bored by covering topics point by point?

01:03:45 Well, check out my online course, Python Jumpstart by Building 10 Apps at talkpython.fm/course to experience a more engaging way to learn Python.

01:03:54 And if you're looking for something a little more advanced, try my WritePythonic code course at talkpython.fm/Pythonic.

01:04:01 Be sure to subscribe to the show.

01:04:03 Open your favorite podcatcher and search for Python.

01:04:05 We should be right at the top.

01:04:07 You can also find the iTunes feed at /itunes, Google Play feed at /play, and direct RSS feed at /rss on talkpython.fm.

01:04:16 Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.

01:04:21 Corey just recently started selling his tracks on iTunes, so I recommend you check it out at talkpython.fm/music.

01:04:28 You can browse his tracks he has for sale on iTunes and listen to the full-length version of the theme song.

01:04:34 This is your host, Michael Kennedy.

01:04:35 Thanks so much for listening.

01:04:36 I really appreciate it.

01:04:38 Smix, let's get out of here.

01:04:40 Smix, let's get out of here.

01:04:40 Outro Music.

01:05:01 Bye.

01:05:02 .

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