Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #169: Jupyter Notebooks natively on your iPad

Return to episode page view on github
Recorded on Wednesday, Feb 12, 2020.

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to

00:04 your earbuds. This is episode 169, recorded February 12th, 2020. I'm Michael Kennedy.

00:11 And I am Brian Okken.

00:13 And this episode is brought to you by Datadog. Check them out over at pythonbytes.fm slash

00:17 Datadog. Get a cool t-shirt for just giving a little trial, installing them and checking it out.

00:22 Brian, I love a good story. You got a tale to tell us?

00:26 Well, yeah, I've got a detail. So this was a suggestion on Twitter by, oh gosh, David Douglas

00:33 something? Maybe David Douglas Smith? How do you think you pronounce that?

00:38 David Douglas Smith. That's what I'm going with. If you can trust the Twitter name to be the real name.

00:42 Yeah, right. This is a little tool, which is pretty darn cool. Detail. This is a quote from their site.

00:49 A combination of a Flask backend and a React frontend to bring you an easy way to view and

00:55 analyze pandas data structures. It integrates seamlessly with IPython notebooks and Python

01:01 IPython terminals. Currently, this tool supports such pandas objects as data frames, series, multi-index,

01:07 date time index, and range index. Okay. So there's a live demo on the, in the linked from the readme.

01:14 And you can go to that and there's a little arrow on the top left. So you end up with something that

01:19 looks like a spreadsheet, whole thing. But in the demo, you, if you click on the little play button,

01:24 there's a whole bunch of different tools that pop up. One of them, like even just the describe button,

01:30 if you'd click that, you can select different columns and it gives you statistics and a little

01:36 graph of what the, what data is in there and top 100 values that are in there. That's even cool enough,

01:43 but that's just a start. This tool also gives you, you can filter your data, do correlations,

01:48 charts, heat maps, just all looking at a data frame through this user interface. It's pretty cool.

01:54 Yeah. That's super cool. When I first saw this, I wasn't sure what to make of it. And playing with

01:58 live demo really is the way to check it out, isn't it? Yeah. I mean, after playing at the

02:03 demo a little bit and then going back to the, the readme with all of the information, there's just so

02:08 much that you can do with this thing and it's all open source. So you can run it on your own servers

02:13 or whatever, but it's cool. I like the idea of having a live demo linkable.

02:17 Yeah. I do too. It's, it's makes it real and it's, it's a really cool, smooth, interactive framework for visualizing data. I like it a lot. I really, I think it's like,

02:26 if I did more with Panda data frames, I'd be all over this. Yeah. Cool. Cool. Speaking of the data

02:30 science side of things, there's a pretty cool project that just came out called carnets. Have you

02:37 heard this?

02:38 Not until you listed it, but I'm pretty excited.

02:40 Oh man, it's pretty awesome. I actually learned about this at PyCascades. We were hanging out

02:45 there with some folks and somebody sent this in to me over emails that, Hey, check this out or over

02:50 Twitter or something like that. And yeah, everyone was uniformly impressed and thought this was quite

02:55 cool. So you probably heard of Pythonista and Pythonista is a, not a description of a person who

03:00 likes Python, but Pythonista being the app in the app store that is kind, lets you do like automation

03:07 and stuff with Python on your iOS device. Okay. Okay. So what was cool about that is like,

03:12 you can write and run Python on your iPhone or on your iPad natively, which is pretty awesome.

03:17 This is kind of like that, but in that it runs Python natively, but this is Jupyter notebooks

03:24 on your phone or maybe more importantly on your tablet, like on your iPad.

03:30 Yeah. This is pretty slick. I can't wait to try this out.

03:34 Yeah. And it's, it's super, super smooth. So what's obviously these days there's options

03:40 for running and writing Python through your iPad. If like that's like that differentiation

03:46 makes sense. We can use Visual Studio Code online, which will just basically put the front end

03:53 into a web browser and then it runs somewhere on Linux and Azure, or there's some other ones

03:58 like coder.com and whatnot. But this is no internet required running Jupyter notebooks locally. And it has

04:07 built in IPI packages, NumPy, MapPlotlib, SciPy, and Pandas, and it's Pandas already installed. So you

04:15 don't have to install them or anything. So it's not just, Oh, here's a thing you can run Python. Like

04:19 there's even some of these C based packages that you might need already installed, which is great.

04:24 Yeah. It really looks really clean too. Yeah, for sure. And it also has file sharing ability. So

04:31 you could like share your stuff through iCloud, right? So you save your notebooks there, edit them

04:37 somewhere else, pick them back up again over there. You can import IPYNB files or whatever the Jupyter

04:43 extension is. Yeah. So it's really quite neat. And it looks like a proper Jupyter app running over

04:50 there. I think it's great. I'm impressed. It also extends the keyboard on iPad to give you a couple

04:55 of actions, some hotkeys or like, sort of, I guess, like the Mac touch bar, sort of. That's pretty cool.

05:02 One different thing from Pythonista is Pythonista, I believe you have to pay for on the App Store.

05:08 This one is open source and free. So just go click install and you have it.

05:13 And you can pip install stuff. I don't even know how that works.

05:16 Yeah. It's amazing. It's awesome. There's a restriction on the pip install stuff. So with

05:20 Jupyter, you can say percent pip install a thing or whatever, issue that to the shell. But this one,

05:26 you can do that as long as the thing you're pip installing is pure Python. It doesn't have like a

05:31 C compiler or something like that in your phone. Well, that makes sense.

05:35 Yeah. Yeah. Isn't this cool though? Yeah. It's very neat. I got to try this out.

05:38 Yeah. I definitely want to put it on my iPad and check it out. And it has a separate dedicated iPad

05:42 app that's slightly different, which is nice. Honestly, like a lot of times you can kind of

05:47 get away with the both the same app or it's not really that big of a difference, but this is the

05:51 kind of thing where it's most relevant on iPad or like a larger device. And then it just happens to

05:57 also work on the phone is the way I would see it. I wouldn't really want to develop on my phone.

06:01 I don't know. Doesn't seem great. Right. Harder to hook an external keyboard to your phone and

06:05 whatnot as opposed to an iPad. But yeah, this is really cool. People should check this out and it's

06:09 open source. People can go download it and play with it and whatnot. Speaking of really cool,

06:13 Datadog is pretty cool. They're doing really good stuff, supporting the show as they have been for a

06:18 long time. So they're a cloud scale monitoring platform that unifies metrics, logs, and traces.

06:23 If you've ever wondered what's going on in your app, you know, you can watch one log or another or look

06:29 at the performance of one part or another, but it's hard to put that all together in an overall

06:33 request. Well, Datadog is what you want to put all those pieces together.

06:36 So you can trace requests across service boundaries and that sort of stuff. And they're

06:41 tracing client auto instruments, popular frameworks like Django, AsyncIO, and Flask. So you can quickly

06:46 see the health and performance of your Python app. Get started today with a 14-day free trial

06:51 and a complimentary free t-shirt with a cute little dog on it over at pythonbytes.fm/Datadog.

06:56 Wonderful. Thanks, Datadog. Yeah. Thank you, Datadog. Brian, you spent some time on a podium not long

07:01 ago, didn't you? Yeah, just this last Sunday. Or I mean like, you know, a Sunday ago,

07:05 depending on time travel. So yes, and this actually came from PyCascades. I got this suggestion from

07:12 Katie McLaughlin. I did my talk using, there's a lot of people that use HTML5-based presentation

07:18 frameworks. And that's what I was using. I was using remark.js. I chose it because I like Markdown.

07:26 And so I can write my slides in Markdown and then present it. But there was difficulty. So I,

07:31 in order to get this all to work, maybe some people know some other secrets to it, but I had to go in a

07:38 little early and then like go into the extended display mode so that I can drag the version of the

07:47 presentation that's going to be on the display. Drag that web browser window into the other window

07:53 that's on the display and then maximize it. But I'm not in front of it. So I got to like use the mouse to

07:59 try to go to the maximize button. And then on the other, my laptop display, I have my presenter notes

08:04 and timer and stuff. And it actually worked really good, but that setup was a little bit of a pain.

08:09 And so Katie McLaughlin told me about Podium, which is a Beware application. And I got to tell you,

08:16 I love the Beware stuff, but one, and they know it also is that the documentation, they need more help

08:22 with documentation because there's not much there. But this is cool. It's a native application. It

08:28 currently supports, there's builds for Linux and for macOS, which bummer for Windows people, but

08:36 it works for me for macOS. And it's a, since it's not a browser thing, it's a native app,

08:41 it can have control over going to different screens and stuff. So when you hit like command P,

08:48 it just goes into presentation mode. You've got your notes on your computer and the presentation on the

08:54 extended one, it's automatic. You don't have to fight it. They've also simplified the syntax of the

08:59 markdown. So remark.js has a bunch of boilerplate HTML stuff on the top and bottom,

09:05 but the Podium, Beware Podium has removed that. So your markdown file with all your slide content

09:13 is just content. It's not a bunch of other stuff. So I'm really happy about this.

09:18 Yeah, this looks nice. It's cool to not see it all just a bunch of JavaScript, right? And it's cool to

09:22 have a little bit more of a native app that can do more than just something in your browser.

09:26 Yeah. So this isn't specifically a Python related topic, but in watching other people's slides, I know a lot of

09:32 people are using remark because I recognize it when people do it. So I'm hoping this might help other

09:39 people too. Yeah, absolutely. If anyone wants to help out with the documentation, a little Giphy or

09:44 video or something of what this looks like and what it does would go a long way. Just like, you know,

09:49 the D type detail that you had before would be quite cool. So, or the car nets, right? Just the Beware

09:56 stuff is cool, but it's always, you know, it's just text usually talking about something visual. So

10:01 that would be great. Now, this one, I feel like this topic is cheating on you, Brian. I'm going to cover a

10:08 pytest thing. I love it.

10:10 So this is pytest mock resources. So this comes from Daniel Cardin and his company recently open

10:18 sourced some of their internal pytest tools to help them do more pytest goodness. And I think it's cool

10:24 that the team at the company put the effort into open source this project. So basically this is

10:30 something to help out with testing external resources. Now, testing external resources is one of the tricky,

10:37 challenging bits of testing code, right? I'm going to call the credit card API, but I don't really want

10:44 to charge it. I just want to simulate calling it and telling it and get the response back, or I'm going

10:49 to query the database. And I don't really want to hit the database. I just want to simulate getting this

10:53 data back. And that's already solved with mocks and patching and that kind of stuff, right?

10:57 Yeah.

10:57 But this is a way that you can test if you do need to actually get some data back from the database

11:04 or from some other service and just go like, I really need it to give me this data back to see

11:10 that the part that actually processes the query that is working correctly. So basically its job is to

11:18 set up Docker containers and manage the lifecycle of those around your tests. So it'll fire up a little

11:24 Postgres server or it'll fire up a MongoDB server inside of a Docker instance, get it set up for your tests,

11:30 let your test query against it, and then throw it away. Sometimes it makes sense to have tests that

11:35 are abstracting away or hiding or patching or mocking the dependencies. Like we described, that

11:41 probably makes sense most of the time, but there's a little slice where it really needs to interact

11:46 with those resources and you might want to test that, right? Like did my SQLAlchemy class get out

11:52 of shape with the way the database thinks it is? Well, I can mock that out all day, but the only way I'm

11:58 going to find out that doesn't work is try to do a query and have, you know, the relational database

12:02 throw an exception and say, this column that you're querying for doesn't exist. And then I'll find out,

12:07 right? So I think it's cool for testing that level. Oh, that's neat. What's your take on this?

12:11 It's not a domain that I'm in having to utilize, but the, I love that people that solve a problem

12:20 are willing, even in a company setting, are willing to open source it to other,

12:24 to let other people benefit as well. Yeah. Pretty cool. I can definitely see that using

12:27 this around the websites and stuff like that. There's certain parts where, you know, it really

12:32 would be easier if it just would generate the sitemap.xml correctly. So then I can use that

12:39 to poke back at some of the elements and whatnot. It, it seems pretty interesting. I haven't used it for

12:44 anything yet, but it looks, looks cool. Yeah. Nice. Let's keep rolling and testing, huh? Yeah. I guess

12:48 we got two testing things in a row. This is an article. I wrote the title as how James Bennett

12:53 is testing in 2020. The actual article title is how I'm testing in 2020, but it isn't how I'm testing.

13:00 So it's James Bennett because it's his article. So anyway, he wrote an article called, I forget

13:06 what it's called, but it's an article about testing Django applications in 2018. And so he's following it up

13:13 again to see, you know, kind of what changed. It sounds like he's testing more things than just

13:18 Django, but it still is. I'm going to go through a few of these, using, still using unit test over

13:25 py test. And I, I respect that there's a lot of people that just think in the X unit style and for

13:32 some reason have trouble thinking in py test and that's fine. We can both coexist. He's using,

13:39 talks to be able to test over multiple Django and Python versions and, using a talks Travis

13:45 plugin to aid the Travis side of that, which is cool. I like talks a lot. Use it almost every day.

13:51 We've talked about pyenv before for local Python installation management. And so he's using that.

13:58 And actually I think we've talked about this the other, not too long ago, that if you're using pyenv,

14:04 there is a pyenv dash virtual end plugin to help you with a virtual environments. I'm not using pyenv,

14:12 but, but that's neat. Yeah. Yeah. Yeah. Very cool. And, since you can't use py test,

14:18 he's not, well, he does use py test sometimes, but he also gave a list of his, run tests script to,

14:25 just run everything. That's especially useful. You can have multiple. I like the idea of this in

14:30 any way you can have multiple of these for, let's say you've got a smoke test or suite or different

14:37 suites that run on Jenkins server or some other, or Travis server being able to have one entry point

14:43 is a good idea using coverage also. And he talks about some of his two extra tools. It's not just,

14:49 functional tests, but things like including black and ice sort and flake. And I just appreciate

14:55 people being very open about their testing workflow. I think more people just write in really any

15:01 workflow. Just, I think it's interesting to find out what people are doing for different parts of

15:06 their workflows. Yeah. I find this interesting as well. It's kind of not quite a confessional,

15:11 but Mike, look, you're going to hear all these new, awesome ways of doing things. Are you going to

15:16 hear that you should use this and not that, or you have to do it this way. Here's what's working for me

15:21 really in a nice practical way. And I dig that. Yeah. It's not like, this is the best. It's just,

15:26 it's working for me. This is what I'm doing. Yeah. And there's some cool little extra commands,

15:31 like cleaning up a PyCache files and set up, install local files and pip upgrade. That stuff's nice.

15:37 In building that is, as a talks commands. That's something that I learned. I picked up from

15:42 somebody. I can't remember who, but I'm like, Oh yeah, you don't actually have to run,

15:47 do a complete thing. You can just have some of your utility stuff within, within talks. That's

15:54 nice. Absolutely. Have we talked about GUIs yet? I don't know. Probably not. Yeah. There's actually

15:59 some, interesting news about Remy and some people jumping in and contributing to that,

16:04 that I've seen flying by on Twitter. So that's super cool. But I want to talk about QT, pronounce

16:08 QT. So interesting project here. This is a, I want to talk sort of riff on, I guess is the right way to

16:16 put it. A article by Leo Danis Ramos over at realpython.com. And over there, there's an article

16:22 about Python and PyCute building a GUI desktop calculator. So if you're interested in getting

16:28 into QT, this is a really nice summary, not too long, you know, shorter than a quick little blog

16:34 post, but longer than a little quick little blog post, but shorter than a whole book. Right. But

16:38 you know, like, I think it's a good level that they've got going on over there. So I'm just going

16:42 to talk about a couple of interesting takeaways and basically the, the elements of a Qt application.

16:47 So if you're going to build them up to the Qt apps are made up of three or four different big ideas or

16:54 whatever, one of them are widgets, right? So if you're going to work with Qt, it's basically a wrapper

16:59 around the C++ API. And being that a lot of things are object oriented and whatnot. So if you work with

17:08 a widget, you derive from Q widget, or use something that's already written and driven from Q widget,

17:13 which are like buttons, text boxes, and so on. And a lot of examples you see will like take those

17:20 widgets and put them on the screen and say, this button goes at this XY location and this thing goes

17:26 there. But the other thing that's really interesting there are layout managers. So there's all these

17:32 different kinds of layout managers that you can use. So you could put in something, let me pull up a quick

17:37 little example. So you could put in the elements and it has like a horizontal layout where stuff goes,

17:42 left to right to right based on the size of it. Or you can have a vertical one, or you can have a grid

17:49 one, all these different layout managers you can employ to figure out how it will automatically adjust

17:53 its size as the elements are rearranged or, you know, the size of the windows change and whatnot.

17:58 So that's pretty cool. We got main windows, of course, which is like the essence of your app,

18:04 right? You're going to create a main window and put your layout manager in it and then load it with

18:09 widgets. And of course, you've got an app, Q application for a Qt app. And that's kind of

18:14 like the essence. And then finally, to bring it all together, there's signals and slots, which are

18:19 kind of like events, I guess, or callbacks. So all the widgets, like buttons and whatnot,

18:25 have these event catchers from the GUI system of your OS. And then they'll fire off events like,

18:32 hey, somebody clicked me, hey, somebody typed in me and things like that. So yeah, it's just a quick

18:37 way to get started with Qt that people might want to check out.

18:40 I think there's a really, they've done a really good job. It's pretty cool. The Qt demos and

18:47 tutorials, there are many around, but having it all just in one single page is pretty neat.

18:54 Exactly. I feel like there's a lot of stuff out there, but it's all kind of hit and miss.

18:57 And you're like, I don't feel like I quite have the whole story. And so that's why I wanted to bring

19:01 this up because Dan and crew, Leo Danis, they're doing a good job on this. Now, one caveat I do

19:07 want to throw out there before you spend a week getting this all up and running and find out stuff

19:12 about it. Either you need to have a lot of money to work on this, or you need to have it be open source

19:18 or internal not distributed projects. They can be used at your company, I believe, but they have to be

19:24 not distributed. I think that's the important thing. Oh, because of the Qt licensing? The Qt licensing is

19:30 it's like dual license, either GPL or LGPL, or it's commercial. And I'm pretty sure to use it on

19:37 commercial projects, you have to have a commercial license. And the commercial license is $5,500 per

19:42 year per developer. Okay. That's a lot. To me, that feels like a lot of money for a GUI framework.

19:49 Yeah. Right? When I could go use Java, I could use C++, I could use Windows Forms from .NET.

19:55 There's like a bunch of options that are solid. I don't know. It just, it seems...

19:59 All of those options sounded horrible to me, though.

20:02 I know.

20:02 Well...

20:02 That you just listed.

20:03 I know. I'm with you. But it's not like you pay $5,000 once or you pay $500 once. It's as long as you

20:14 care to own this application. It's $5,500 a year per developer. And that's just, that's

20:19 a lot. So anyway, it's not to say don't do it, right? If your company is like, hey, we

20:23 really want to go with this technology, we want to go that way, that makes sense and we can

20:27 totally justify it. But it's not something I... If I was like, hey, I'd like to create a

20:31 little app, maybe I'll create like a desktop version of the Talk Python player app that does

20:36 cool like offline support and stuff. Maybe I'll use Qt. Like, no, I wouldn't use Qt.

20:41 Okay.

20:41 Right? I mean, because I'm not going to pay, you know, $5,000, $10,000 a year for that because

20:46 it's just... I don't know. That's just the way it is. Anyway, I always want to throw that caveat

20:50 out there because it's not just like, oh, you got to pay a little bit for it. It's like, you

20:53 got to consider that that's a non-trivial amount of money to use it that way. So I just want

20:58 to throw that out there.

20:58 Well, yeah. And if we've gotten this story wrong, please somebody tell us.

21:01 Yep. I did poke around their site a lot and I was looking for the exact quote, but basically

21:06 if you're going to release it commercially, I believe that this is the case. But yeah, if we got

21:10 it wrong, someone tell us.

21:11 I believe you. I just don't want to believe you.

21:13 I know. I know. All right. Cool. Well, yeah. If somebody has more details than that on the

21:20 license, but that is... I spent probably 30 minutes trying to figure this out to make sure

21:23 I got it right. And that's what I took away from what's on their website.

21:26 Okay.

21:27 What about the extra stuff? The things that we're not quite covering, but we're still covering?

21:31 What do you got?

21:32 Well, we did mention PyCascades a couple of times. As of this recording, they don't have

21:37 the individual talks chopped up into videos yet. I don't know if they're going to, but the

21:43 live stream video of day one and day two. So everybody's talk, if you can kind of fast forward

21:49 through it, is available. That was available right away. Actually, they were pretty fast about

21:54 it, which is pretty cool. We're leaving a link to that. And I also just want to do a huge shout

22:00 out and thank you to all of the volunteers for PyCascades. It was a really fun event and

22:05 I appreciate everybody's time.

22:06 Yeah. PyCascades was great and it was really fun to be there and meet all the folks that

22:11 I did.

22:11 I had a moment of panic and anxiety shortly before my talk. And back in the green room,

22:18 Nita Zakarenko noticed and probably because I said, oh my God, I'm freaking out. And she helped

22:26 me through to calm down before the talk and I really appreciate that. So I wanted to thank

22:30 Nina on the show. How about you? Any extras?

22:34 Just a couple of quick things. I did a live webcast that I talked about like a month ago

22:38 on the show for Python for .NET developers. A bunch of people signed up. That was awesome.

22:42 That happened yesterday. And so now the recording is available. So I'll link to that in the show

22:48 notes. People can go listen to that or share it with their friends and whatnot, colleagues.

22:53 And also I've talked about this before, I'm pretty sure, but I sent out a message and a whole

22:58 bunch of people are like, oh, really? So I just want to throw it out that if you go to

23:03 the Talk Python training site and get one of our apps, those apps, you can download them for free.

23:08 And when you open up and log in, it'll give you a list of our free courses and you just tap them.

23:14 You can take a bunch free at the moment, probably more in the future of our free courses on your iPad

23:19 or Android tablet or whatever it is you want to take them on. So check that out if that sounds cool to you.

23:24 When you first released this, I didn't quite get the value, but I really appreciate the mobile app because

23:31 for me, bookmarking stuff on a, I bookmark stuff on my desktop all the time, but bookmarking stuff on my,

23:37 on my mobile phone, I don't really do that. So keeping track of which courses I've been partway through,

23:43 it's really handy to just have this right in the app. I like it.

23:46 Awesome. Yeah. Thanks. That's awesome.

23:48 And also there's a bunch of restrictions, especially around iOS. Like it won't autoplay the next video. So

23:55 you've constantly got to be going like play, play, play in the mobile app and you can't quite full

24:01 screen it as much because there's like a little, you know, the address bar on some browsers. Anyway.

24:05 Yeah. Thank you for that. It's awesome.

24:06 What? So the mobile app can't autoplay?

24:08 No, the mobile app does. But if, if it was alternative or to be to watch it with Safari or Chrome or something

24:13 on iOS, it's kind of restricted. Yeah. Right. Okay. Cool. How about a, how about a joke?

24:19 I would love a joke. All right. I'll take one. You take one. Cause I couldn't decide. I had three

24:22 and I chose two. They're both short. So I figured like that'll round it out. So here you go. Did you

24:28 know that programmers, they sometimes get confused about what holidays are? No. They do because

24:33 especially Halloween and Christmas. And there was, you know, like not a real good reason people

24:40 couldn't figure it out until someone realized that oct 31 is des 25.

24:45 This is so wacky that that's true. That's in plus it's funny.

24:51 Yeah. All right. What's the other one?

24:53 Okay. Let me read it first. Okay. Speed dating is useless. Five minutes is not enough to properly

24:59 explain the benefits of the Unix philosophy.

25:03 It might not be enough to explain the Unix philosophy, but if that's the start to a date,

25:07 it might still be effective in communicating what it's got to. Oh yeah. Oh boy. All right. Well,

25:14 that's pretty funny. So thanks again, as always. Great to be here with you. Thank you. Yep. Bye

25:19 everyone. Bye. Thank you for listening to Python Bytes. Follow the show on Twitter via at Python Bytes.

25:24 That's Python Bytes as in B-Y-T-E-S. And get the full show notes at Python Bytes.fm. If you have a news

25:31 item you want featured, just visit Python Bytes.fm and send it our way. We're always on the lookout for

25:35 sharing something cool. On behalf of myself and Brian Okken, this is Michael Kennedy. Thank you for

25:40 listening and sharing this podcast with your friends and colleagues.

Back to show page