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 your earbuds.

00:05 This is episode 169 recorded February 12, 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/datadog.

00:18 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 Yeah, well, yeah, I've got a detail.

00:28 So this was a suggestion on Twitter by, oh gosh, David Douglas something?

00:35 Maybe David Douglas Smith?

00:36 How do you think you pronounce that?

00:38 David Douglas Smith.

00:39 Yeah.

00:40 That's what I'm going with.

00:41 If you can trust the Twitter name to be the real name.

00:43 Yeah, right.

00:44 This is a little tool, which is pretty darn cool.

00:46 Detail.

00:47 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 analyze pandas data structures. It integrates seamlessly with IPython notebooks and Python IPython terminals. Currently this tool supports such pandas objects as DataFrame, Series, MultiIndex, DateTimeIndex, and RangeIndex. Okay so there's a live demo linked from the readme and you can go to that and there's a little arrow on the top left so you end up with something that looks like a spreadsheet whole thing but in the demo you if you click on the little play button there's a whole bunch of different tools that pop up. One of them, like even just the describe button, if you click that you can select different columns and it gives you statistics and a little graph of what what data is in there and top 100 values that are in there. That's even cool enough but that's just a start. This tool also gives you, you can filter your data, do correlations, charts, heatmaps, 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.

01:58 And playing with a live demo really is the way to check it out, isn't it?

02:01 Yeah, I mean, after playing at the demo a little bit, and then going back to the readme with all of the information, there's just so much that you can do with this thing.

02:10 And it's all open source, so you can run it on your own servers or whatever.

02:14 But it's cool. I like the idea of having a live demo linkable.

02:17 Yeah, I do too. It makes it real.

02:19 and it's a really cool, smooth, interactive framework for visualizing data.

02:24 I like it a lot.

02:25 I really, I think it's like, if I did more with Panda DataFrames, I'd be all over this.

02:29 - Yeah. - Cool, cool.

02:29 Speaking of the data science side of things, there's a pretty cool project that just came out called Carnets.

02:37 Have you heard this?

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

02:40 - Oh man, it's pretty awesome.

02:41 I actually learned about this at PyCascades.

02:43 We were hanging out there with some folks and somebody sent this in to me over email, "Hey, check this out," or over Twitter or something like that.

02:51 And yeah, everyone was uniformly impressed and thought this was quite cool.

02:55 So, you probably heard of Pythonista.

02:57 Pythonista is not a description of a person who likes Python, but Pythonista being the app in the App Store that lets you do automation and stuff with Python on your iOS device, okay?

03:10 - Okay. - So, what was cool about that is 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.

03:22 But this is Jupyter notebooks on your phone or maybe more importantly, on your tablet, like on your iPad.

03:30 Yeah.

03:31 This is pretty slick.

03:32 I can't wait to try this out.

03:34 Yeah.

03:34 And it's, it's super, super smooth.

03:36 So what's, you know, obviously these days there's options for running and writing Python through your iPad, if like that's like that differentiation makes sense.

03:46 We can use Visual Studio Code online, which will just basically put the front end into a web browser and then it runs somewhere on Linux and Azure, or there's some other ones like Coder.com and what not.

03:59 But this is no internet required running Jupyter Notebooks locally.

04:05 And it has built-in IPI packages, NumPy, Matplotlib, SciPy, and Pandas.

04:12 Pandas, Pandas already installed.

04:15 So you don't have to install them or anything.

04:17 So it's not just, oh, here's a thing you can run Python.

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

04:25 - Yeah, it really looks really clean too.

04:28 - Yeah, for sure.

04:29 And it also has file sharing ability.

04:31 So you could like share your stuff through iCloud, right?

04:35 So you save your notebooks there, edit them somewhere else, pick them back up again.

04:39 over there, you can import IPYNB files or whatever the Jupyter extension is.

04:45 Yeah, so it's really quite neat and it looks like a proper Jupyter app running over there.

04:50 I think it's great, I'm impressed.

04:52 It also extends the keyboard on iPad to give you a couple of actions, some hotkeys that are like, sort of, I guess like the Mac touch bar, sort of.

05:01 So that's pretty cool.

05:02 One different thing from Pythonista is Pythonista, I believe, you have to pay for on the App Store, this one is open source and free.

05:10 So just go click install and you have it.

05:13 - And you can pip install stuff.

05:14 I don't even know how that works.

05:15 - Yeah. - That's amazing.

05:16 - It's awesome.

05:17 There's a restriction on the pip install stuff.

05:19 So with Jupyter, you can say %pip install a thing or whatever, issue that to the shell.

05:24 But this one, you can do that as long as the thing you're pip installing is pure Python.

05:30 It doesn't have like a C compiler or something like that in your phone.

05:34 - Well, that makes sense.

05:35 - Yeah, yeah.

05:36 Isn't this cool though?

05:36 - Yeah, it's very neat.

05:37 - Yeah, I definitely want to put it on my iPad and check it out.

05:40 And it has a separate dedicated iPad app that's slightly different, which is nice.

05:45 Honestly, a lot of times you can kind of get away with both the same app, or it's not really that big of a difference, but this is the kind of thing where it's most relevant on iPad or a larger device, and then it just happens to also work on the phone is the way I would see it.

05:59 I wouldn't really want to develop on my phone.

06:01 I don't know.

06:02 Doesn't seem great.

06:03 Harder to hook an external keyboard to your phone and whatnot as opposed to an iPad.

06:07 But yeah, this is really cool.

06:08 People should check this out and it's open source.

06:09 People can go download it and play with it and whatnot.

06:12 Speaking of really cool, Datadog's pretty cool.

06:14 They're doing really good stuff supporting the show as they have been for a long time.

06:19 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 can watch one log or another or look at the performance of one part or another, but it's hard to put that all together in an overall request.

06:34 Well, Datadog's what you want, to put all those pieces together.

06:37 You can trace requests across service boundaries and that sort of stuff.

06:40 And they're tracing client auto-instruments, popular frameworks like Django, AsyncIO, and Flask, so you can quickly see the health and performance of your Python app.

06:49 Get started today with a 14-day free trial and a complimentary free t-shirt with a cute little dog on it over at pythonbytes.fm/datadog.

06:57 - Wonderful, thanks Datadog.

06:58 - Yeah, thank you Datadog.

06:59 Brian, you spent some time on a podium not long ago, didn't you?

07:02 - Yeah, just this last Sunday.

07:03 Or I mean like, you know, a Sunday ago, depending on time travel.

07:07 So yes, and this actually came from PyCascades.

07:10 I got this suggestion from Katie McLaughlin.

07:13 I did my talk using, there's a lot of people that use HTML5 based presentation frameworks and that's what I was using.

07:21 I was using remark.js.

07:23 I chose it because I like Markdown and so I can write my slides in Markdown and then present it.

07:30 But there was difficulty.

07:31 So in order to get this all to work, maybe some people know some other secrets to it, but I had to go in a little early and then go into the extended display mode so that I can drag the version of the presentation that's going to be on the display, drag that web browser window into the other window that's on the display, and then maximize it.

07:56 But I'm not in front of it, so I've got to use the mouse to try to go to the maximize button and then on the other my laptop display I have my presenter notes and timer and stuff and it actually worked really good but that setup was a little bit of a pain and so Katie McLaughlin told me about Podium which is a Beware application and I gotta tell you I love the Beware stuff but one and they know it also is that the documentation they need more help with documentation because there's not much there but this is cool it's a native application it It currently supports, there's builds for Linux and for macOS, which, bummer for Windows people but it works for me for macOS.

08:39 And since it's not a browser thing, it's a native app, it can have control over going to different screens and stuff.

08:46 So when you hit like Command P, it just goes into presentation mode.

08:50 You've got your notes on your computer and the presentation on the extended one, it's automatic, you don't have to fight it.

08:57 They've also simplified the syntax of the markdown.

09:00 So remark.js has a bunch of boilerplate HTML stuff on the top and bottom, but the Podium, Beware Podium has removed that.

09:10 So your markdown file with all your slide content is just content.

09:15 It's not a bunch of other stuff.

09:16 So I'm really happy about this.

09:18 - Yeah, this looks nice.

09:19 It's cool to not see it all just a bunch of JavaScript, right?

09:22 And it's cool to have a little bit more of a native app that can do more than just something in your browser.

09:27 - Yeah, so this isn't specifically a Python related topic, but in watching other people's slides, I know a lot of people are using Remark because I recognize it when people do it.

09:37 So I'm hoping this might help other people too.

09:39 - Yeah, absolutely.

09:40 If anyone wants to help out with the documentation, a little Giphy or video or something of what this looks like and what it does would go a long way.

09:48 Just like, you know, the D type detail that you had before would be quite cool.

09:54 So, or the carnets, right?

09:56 Just the B-Word stuff is cool, but it's always, you know, it's just text, usually talking about something visual.

10:01 So that would be great.

10:03 Now, this one, I feel like this topic is cheating on you, Brian, I'm gonna cover a pytest thing.

10:09 - I love it.

10:10 - So this is pytest mock resources.

10:13 So this comes from Daniel Carden, and his company recently open sourced some of their internal pytest tools to help them do more pytest goodness.

10:23 And I think it's cool that the team at the company put the effort into open source this project.

10:28 So basically this is something to help out with testing external resources.

10:33 Now, testing external resources is one of the tricky, challenging bits of testing code, right?

10:40 I'm gonna call the credit card API, but I don't really wanna charge it.

10:44 I just wanna simulate calling it and get the response back.

10:48 Or I'm gonna query the database and I don't really wanna hit the database.

10:51 I just want to simulate getting this data back.

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

10:57 - Yeah.

10:58 - But this is a way that you can test if you do need to actually get some data back from the database or from some other service and just go like, I really need it to give me this data back to see that the part that actually processes the query, that is working correctly.

11:15 So basically its job is to set up Docker containers and manage the lifecycle of those around your tests.

11:23 So it'll fire up a little Postgres server or it'll fire up a MongoDB server inside of a Docker instance, get it set up for your tests, let your tests query against it and then throw it away.

11:32 Sometimes it makes sense to have tests that are abstracting away or hiding or patching or mocking the dependencies, like we described, that probably makes sense most of the time, but there's a little slice where it really needs to interact with those resources and you might wanna test that, right?

11:49 Like, did my SQLAlchemy class get out of shape with the way the database thinks it is?

11:55 Well, I can mock that out all day, but the only way I'm gonna find out that it doesn't work is try to do a query and have the relational database throw an exception and say, this column that you're querying for doesn't exist.

12:06 And then I'll find out, right?

12:07 So I think it's cool for testing that level.

12:09 - Oh, that's neat.

12:10 - What's your take on this?

12:11 - It's not a domain that I'm in having to utilize, But I love that people that solve a problem are willing, even in a company setting, are willing to open source it to let other people benefit as well.

12:26 - Yeah, pretty cool.

12:26 I can definitely see using this around the websites and stuff like that.

12:30 There's certain parts where it really would be easier if it just would generate the sitemap.xml correctly so then I can use that to poke back at some of the elements and whatnot.

12:42 It seems pretty interesting.

12:43 I haven't used it for anything yet, but it looks cool.

12:45 - Yeah, nice.

12:46 - Let's keep rolling and testing, huh?

12:47 - Yeah, I guess we got two testing things in a row.

12:50 This is an article, I wrote the title as How James Bennett is Testing in 2020.

12:55 The actual article title is How I'm Testing in 2020, but it isn't how I'm testing, so it's James Bennett, 'cause it's his article.

13:03 So anyway, he wrote an article called, I forget what it's called, but it's an article about testing Django applications in 2018 and so he's following it up again to see, you know, kind of what changed.

13:16 Sounds like he's testing more things than just Django, but it still is.

13:21 I'm gonna go through a few of these.

13:23 Using, still using unit test over pytest, and I respect that.

13:28 There's a lot of people that just think in the X unit style and for some reason have trouble thinking in pytest, and that's fine.

13:36 We can both coexist.

13:38 He's using Tox to be able to test over multiple Django Python versions and using a tox Travis plug-in to aid the Travis side of that which is cool. I like tox a lot, use it almost every day. We've talked about pyenv before for local Python installation management and so he's using that and actually I think we talked about this the other not too long ago that if you're using pyenv there is a pyenv-virtualenv and plug in to help you with virtual environments.

14:11 I'm not using pyenv, but that's neat.

14:14 - Yeah, yeah, yeah, very cool.

14:16 - And since you can't use pytest, well, he does use pytest sometimes, but he also gave a list of his run tests script to just run everything.

14:27 That's especially useful.

14:28 You can have multiple.

14:29 I like the idea of this in any way.

14:32 You can have multiple of these for, let's say you've got a smoke test or suite or different suites that run on Jenkins server or some other or Travis server.

14:41 Being able to have one entry point is a good idea.

14:44 Using coverage also.

14:46 And he talks about some of his extra tools.

14:48 It's not just a functional test, but things like including black and isort and flakate.

14:54 And I just appreciate people being very open about their testing workflow.

14:58 I think more people just write and really any workflow just, I think it's interesting to find out what people are doing for different parts of their workflows.

15:07 Yeah, I find this interesting as well.

15:08 It's kind of not quite a confessional, but I'm like, look, you're gonna hear all these new, awesome ways of doing things, or you're gonna hear that you should use this and not that, or you have to do it this way.

15:20 Here's what's working for me, really in a nice practical way, and I dig that.

15:24 - Yeah, it's not like this is the best, it's just, it's working for me, this is what I'm doing.

15:29 - Yeah, and there's some cool little extra commands like cleaning up a PyCache files and set up, install local files and pip upgrade.

15:36 That stuff's nice.

15:37 - In building that as a TOX commands, that's something that I learned, I picked up from somebody, I can't remember who, but I'm like, oh yeah, you don't actually have to run, do a complete thing.

15:50 You can just have some of your utility stuff within TOX, that's nice.

15:55 - Absolutely.

15:56 Have we talked about GUIs yet?

15:57 - I don't know, probably not.

15:58 - Yeah, there's actually some interesting news about Remy and some people jumping in and contributing to that that I've seen flying by on Twitter.

16:05 So that's super cool.

16:06 But I want to talk about Qt, pronounced cute.

16:09 So interesting project here.

16:12 This is a, I want to talk sort of riff on, I guess is the right way to put it, a article by Leo Danis Ramos over at realpython.com.

16:21 And over there, there's an article about Python and PyQt building a GUI desktop calculator.

16:26 So if you're interested in getting into Qt, This is a really nice summary, not too long, shorter than a quick little blog post, but longer than a little quick little blog post, but shorter than a whole book, right?

16:38 But I think it's a good level that they've got going on over there.

16:41 So I'm just gonna talk about a couple of interesting takeaways and basically the elements of a Qt application.

16:47 So if you're gonna build them up.

16:49 So the Qt apps are made up of three or four different big ideas or whatever.

16:54 One of them are widgets, right?

16:56 So if you're gonna work with Qt, It's basically a wrapper around the C++ API.

17:02 And being that a lot of things are object oriented and whatnot.

17:06 So if you work with a widget, you derive from QWidget or use something that's already written and driven from QWidget, which are like buttons, text boxes, and so on.

17:17 And a lot of examples you see will like take those widgets and put them on the screen and say, this button goes at this XY location and this thing goes there.

17:27 But the other thing that's really interesting there are layout managers.

17:31 So there's all these different kinds of layout managers that you can use.

17:35 So you could put in something, let me pull up a quick little example.

17:38 So you could put in the elements and it has like a horizontal layout where stuff goes left to right to right based on the size of it.

17:47 Or you can have a vertical one, or you can have a grid one, all these different layout managers you can employ to figure out how it will automatically adjust its size as the elements are rearranged or the size of the windows change and whatnot.

17:59 So that's pretty cool.

18:00 We got main windows, of course, which is like the essence of your app, right?

18:05 You're gonna create a main window and put your layout manager in it and then load it with widgets.

18:10 And then of course, you've got an app, queue application for a Qt app.

18:14 And that's kind of like the essence.

18:15 And then finally, to bring it all together, there's signals and slots, which are kind of like events, I guess, or callbacks.

18:22 So all the widgets like buttons and whatnot have these event catchers from the GUI system of your OS and then they'll fire off events like, hey, somebody clicked me, hey, somebody typed in me and things like that.

18:35 So yeah, it's just a quick way to get started with Qt that people might wanna check out.

18:40 - I think they've done a really good job.

18:42 It's pretty cool.

18:45 The Qt demos and 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 this up 'cause Dan and crew, Leo Danis, they're doing a good job on this.

19:06 Now, one caveat I do want to throw out there before you spend a week getting this all up and running and find out stuff about it.

19:13 Either you need to have a lot of money to work on this, you need to have it be open source or internal, not distributed projects.

19:22 They can be used at your company, I believe, but they have to be not distributed.

19:26 I think that's the important thing.

19:28 - Because of the Qt licensing?

19:30 - The Qt licensing is, it's like dual license, either GPL or LGPL, or it's commercial.

19:36 I'm pretty sure to use it on commercial projects, you have to have a commercial license.

19:40 The commercial license is $5,500 per year per developer.

19:44 To me that feels like a lot of money for a GUI framework.

19:48 Yeah.

19:49 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:01 I know.

20:02 Well...

20:02 That you just listed.

20:03 I know, I'm with you.

20:04 But it's not like you pay $5,000 once or you pay $500 once.

20:12 once, as long as you care to own this application, it's 5,500 a year per developer.

20:17 And that's a lot.

20:19 So anyway, it's not to say don't do it, right?

20:22 If your company is like, hey, we really want to go with this technology, want to go that way, that makes sense and we can totally justify it.

20:28 But it's not something, if I was like, hey, I'd like to create a little app, maybe I'll create a desktop version of the Talk Python player app that does cool offline support and stuff, maybe I'll use Qt.

20:38 Like, no, I wouldn't use Qt.

20:41 - Right, I mean, 'cause I'm not gonna pay, you know, five, $10,000 a year for that, 'cause it's just, I don't know, that's just the way it is.

20:48 Anyway, I always wanna throw that caveat out there, 'cause it's not just like, oh, you gotta pay a little bit for it, it's like, you gotta consider that that's a non-trivial amount of money to use it that way.

20:57 So I just wanna 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, if you're gonna release it commercially, I believe that this is the case, But yeah, if we got it wrong, someone tell us.

21:11 - I believe you, I just don't wanna believe you.

21:14 - I know, I know.

21:16 All right, cool, well, yeah, if somebody has more details than that on the license, but that is, I spent probably 30 minutes trying to figure this out to make sure I got it right, and that's what I took away from what's on their website.

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 Pi Cascades a couple times.

21:35 As of this recording, they don't have the individual talks chopped up into videos yet.

21:41 I don't know if they're going to, but the live stream video of day one and day two, so everybody's talk, if you can kind of fast forward through it, is available.

21:51 That was available right away, actually.

21:53 They were pretty fast about it, which is pretty cool.

21:56 I like, we're leaving a link to that.

21:58 And I also just want to do a huge shout out and thank you to all of the volunteers for Pi Cascades.

22:04 It was a really fun event, and I appreciate everybody's time.

22:07 - Yeah, Pied Cascades was great and it was really fun to be there and meet all the folks that I did.

22:11 - I had a moment of panic and anxiety shortly before my talk and back in the green room, Nina Zakarenko noticed and probably because I said, "Oh my God, I'm freaking out." And she helped me through to calm down before the talk and I really appreciate that.

22:30 So I wanted to thank Nina on the show.

22:32 How about you, any extras?

22:34 - I'll do a couple quick things.

22:35 I did a live webcast that I talked about like a month ago on the show for Python for .NET developers.

22:41 Bunch of people signed up, that was awesome.

22:43 That happened yesterday.

22:45 And so now the recording is available.

22:47 So I'll link to that in the show notes.

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

22:54 And also I've talked about this before, I'm pretty sure, but I sent out a message and a whole bunch of people were like, "Oh, really?" So I just wanted to throw it out that if you go to the Talk Python Training site and get one of our apps, those apps you can download them for free 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, three at the moment, probably more in the future, of our free courses on your iPad or Android tablet or whatever it is you wanna take them on.

23:22 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 for me bookmarking stuff on a, I bookmark stuff on my desktop all the time, but bookmarking stuff on my mobile phone, I don't really do that.

23:39 So keeping track of which courses I've been partway through, it's really handy to just have this right in the app.

23:46 I like it.

23:47 - Awesome. - I use it a lot.

23:47 - Yeah, thanks, that's awesome.

23:48 And also, there's a bunch of restrictions, especially around iOS.

23:52 Like it won't autoplay the next video, so you've constantly gotta be going like play, play, play in the mobile app and you can't quite full screen it as much because there's like a little, you know, the address bar on some browsers.

24:05 Anyway, yeah, thank you for that, that's awesome.

24:06 - What, so the mobile app can't auto play?

24:08 - No, the mobile app does, but if it was alternative were to be to watch it with Safari or Chrome or something on iOS, it's kind of restricted.

24:15 - Yeah, right, okay.

24:17 - Cool, how about a joke?

24:19 - I would love a joke.

24:20 - All right, I'll take one, you take one, because I couldn't decide.

24:22 I had three and I chose two.

24:23 They're both short, so I figured like that'll round it out.

24:27 So here you go.

24:28 - Did you know that programmers, they sometimes get confused about what holidays are?

24:32 - No. - They do.

24:33 Because especially Halloween and Christmas.

24:36 And there was, you know, like not a real good reason people couldn't figure out until someone realized that Oct 31 is Des 25.

24:46 (laughing)

24:47 - This is so wacky that that's true.

24:50 That's, and plus it's funny.

24:51 - Yeah.

24:52 All right, what's the other one?

24:53 - Okay, let me read it first.

24:55 Okay, speed dating is useless.

24:57 Five minutes is not enough to properly 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, it might still be effective in communicating what it's got to.

25:12 Oh, yeah.

25:13 Oh, boy.

25:14 All right.

25:15 Well, that's pretty funny.

25:16 So thanks again, as always.

25:17 Great to be here with you.

25:18 Thank you.

25:19 Bye, everyone.

25:20 Bye.

25:21 Thank you for listening to Python Bytes.

25:22 Follow the show on Twitter via @PythonBytes.

25:24 That's Python Bytes as in B-Y-T-E-S.

25:27 and get the full show notes at pythonbytes.fm.

25:30 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

25:34 We're always on the lookout for sharing something cool.

25:37 On behalf of myself and Brian Okken, this is Michael Kennedy.

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

Back to show page