Latest / Talk Python To Me / #394: Awesome Jupyter Libraries and Extensions in 2022
Transcript
- 0:00Jupyter is an amazing environment for exploring data and generating executable reports with Python.
- 0:05But there are many external tools, extensions, and libraries to make it so much better and to make you more productive.
- 0:12On this episode, we're going to cover a ton of them.
- 0:15We have Marcus Shanta, the maintainer of the awesome Jupyter list on the show,
- 0:19and we'll highlight a bunch of Jupyter gems.
- 0:21This is Talk Python To Me, episode 394, recorded December 1st, 2022.
- 0:27Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:43This is your host, Michael Kennedy.
- 0:45Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython, both on fosstodon.org.
- 0:53Be careful with impersonating accounts on other instances.
- 0:55There are many.
- 0:57Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
- 1:01We've started streaming most of our episodes live on YouTube.
- 1:05Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.
- 1:13This episode is sponsored by the AWS Insiders podcast.
- 1:17AWS is changing fast.
- 1:19Listen in to keep up over at talkpython.fm/AWS Insiders.
- 1:25And it's brought to you by Sentry.
- 1:27Don't let those errors go unnoticed.
- 1:29Use Sentry.
- 1:30Get started at talkpython.fm/sentry.
- 1:33Transcripts for this episode are sponsored by Assembly AI, the API platform for state-of-the-art AI models that automatically transcribe and understand audio data at a large scale.
- 1:44To learn more, visit talkpython.fm/assemblyai.
- 1:48Marcus, welcome to Talk Python To Me.
- 1:50Hi, Michael.
- 1:51Thanks for having me.
- 1:52This is going to be a very broad, not necessarily super deep episode, but we're going to talk about a ton of cool little extensions and widgets and libraries that you can plug into your Jupyter work and make it awesome.
- 2:06I really like talking about these topics where it's like, oh, that's only a 10-minute commitment to see if it's going to help me out or not, right?
- 2:12And not like some huge framework you got to learn.
- 2:14And there's going to be a lot for people to take away if they do anything at all with notebooks, I think.
- 2:18Yeah, and I think one of the nice things about notebooks is they're very easy to use.
- 2:23I think the barrier to entry to you just being able to do something tangible with them is very low, much more so than maybe a lot of other things.
- 2:32Yeah, they're very, very welcoming environments, especially if someone set them up for you, if it's one of the hosted ones, or if you're not in there trying to configure a kernel with a special virtual environment, like, how do I get to the right installs?
- 2:45And why is this thing not there?
- 2:46Or a whole super-nature hub running on Kubernetes.
- 2:49Yes, exactly.
- 2:50But once you're kind of beyond that shell and many people have that set up for them, then it's ready to roll.
- 2:55All right, so going to be tons of fun to talk about these things.
- 2:58But before we get to them, let's start with your story.
- 3:00How did you get into programming in Python?
- 3:01How did I get into programming?
- 3:03I think it sort of started when my parents decided to buy a computer when I was eight years old, back in the 90s.
- 3:11And then sort of at 12, I started to realize, oh, you can program these things.
- 3:16And some well-intentioned adult, like, bought me a book on C and, you know, like 12-year-olds and pointers.
- 3:23It doesn't mix.
- 3:24C, the easy parts.
- 3:26Yeah, exactly.
- 3:27Just void, star, star.
- 3:28Come on, kids.
- 3:29Get with it.
- 3:29Yeah.
- 3:29Yeah.
- 3:30That was just, like, conceptual a bit too much for a 12-year-old.
- 3:35But then luckily, like, once I got into high school, they actually taught us Boral and Delphi.
- 3:40I don't know if she ever came across that.
- 3:42It was a very safe, easy-to-use, like, GUI-driven way to get into programming.
- 3:48And you could do a lot of things even that, like, a 14-year-old would find exciting, right?
- 3:54Just, like, C-style, hello world, and I can create numbers in a loop, but actually, like, fun GUI-like stuff.
- 4:00You know, I never used that, but I used Visual Basic and some Windows Forms and other stuff.
- 4:06And I really think, even today, that style development, it's kind of withered and it's too bad, right?
- 4:13It used to be so amazing.
- 4:16You would just go over there, you know, button, text box.
- 4:19I click on this thing.
- 4:20Here's what it calls.
- 4:21The interaction was so simple.
- 4:23And now you're doing, you know, maybe you're doing the web, and it's like, I'm going to do Webpack.
- 4:28And then, you know, bring in all these things, and I'm doing TypeScript, and then it's all CSS and HTML.
- 4:34And I'm not bemoaning that style of development, but it's like, that's kind of replaced this.
- 4:39Just give me a visual of what it looks like, and let me build something simple.
- 4:43It has been replaced with...
- 4:44I feel like it was a very good pedagogical tool to teach programming and GUI development.
- 4:50Like, I remember we did find things like rectangles on the screen that just chased each other around, right?
- 4:56Yes.
- 4:57That was a fun way into programming.
- 4:59Yeah.
- 5:00And I think there's some bits like that still around, isn't it?
- 5:03What's the, like, programming learning language?
- 5:06Something with an animal?
- 5:07Is it small talk?
- 5:08Or the thing with a turtle?
- 5:10Yeah, yeah.
- 5:10The turtle where you can do some drawing.
- 5:12There's that.
- 5:13Yeah, yeah.
- 5:13There's Anvil, actually, which is a Python sort of front-end and back-end web framework that has this.
- 5:19It's really, really similar.
- 5:21My daughter used that to play with it a lot.
- 5:23But yeah, I would love to see like a Visual Basic Pi or something, you know?
- 5:29Something like that would be so amazing.
- 5:30Maybe it exists, yeah.
- 5:32But that's where I really started developing or programming on my own.
- 5:37Then I went to university.
- 5:38That was in the early 2000s.
- 5:41And they taught us mostly Java, but also sort of a weird mix of like logic-oriented programming, functional programming.
- 5:49And I really only ever got in touch with Python when I did my master's in the States during some courses.
- 5:55And then professionally, I learned proper Python when I was working in London.
- 6:00And that was a company, Man Group, with a lot of really good Python developers.
- 6:05And there I picked up like proper Python.
- 6:08Yeah.
- 6:08And stuck with it ever since.
- 6:10If I have a choice, I will stick to it.
- 6:13It's interesting that we come from, you know, my background was not that different than yours in some ways.
- 6:17I did like C++ in the early days.
- 6:20And you think as you advance in your career and you get more technically capable and stuff, you would think, well, you're going to be doing more intense stuff and more like deep dive.
- 6:29Like now you're writing like kernel drivers.
- 6:31Like it's for me at least, and it sounds like you a little, quite the opposite.
- 6:34Like more towards some of these higher level languages that let you build really amazing things.
- 6:39But you're not juggling like pointers to pointers and like all this crazy aspects, right?
- 6:44I think the first thing, like your expectation that you're describing is maybe a function of sort of technical expertise.
- 6:50In the second development, what actually what you end up doing, right, is a function of age, right?
- 6:55That you like, as you become older, you focus more on the high levels things.
- 6:59You just want to get stuff done.
- 7:01You don't care about showing off.
- 7:02Exactly.
- 7:02You can make this compile, right?
- 7:03What's the shortest way for me to be?
- 7:05And very often that's Python.
- 7:07Absolutely it is.
- 7:08All right.
- 7:08So some real-time follow-ups.
- 7:10The audience has helped us out here.
- 7:11Don says, Delphi is a wonderful way back into Pascal from the college days.
- 7:15Indeed.
- 7:15And some of those languages, Logo was one of these visual building ones, as well as the one with the cat is Scratch, which, what an amazing name.
- 7:25I haven't really used Scratch, but.
- 7:26I think the cats or animals in general seem to be good metaphors for teaching programming.
- 7:30Yes, they do.
- 7:32And the O'Reilly publishers, the publisher O'Reilly, has built their entire book series on unique animals and programming.
- 7:39All right.
- 7:39Well, how about now?
- 7:40What are you doing these days?
- 7:41Right now, I am a founding partner at Blue Balance Capital.
- 7:45We are a small, independent, alternative asset management firm based in Vienna, Austria.
- 7:51I started this company three years ago with my partners.
- 7:55Before that, I worked at an asset management firm in London.
- 7:59Yet before that, I worked at Goldman Sachs as a quantitative analyst.
- 8:05And so basically, during my professional career, I was always more a sort of data analyst rather than a systems developer.
- 8:14So everything or most of the things I use Python for are more from the perspective of here's a piece of data.
- 8:20And I want to sort of analyze that data set to better understand, like, I don't know, a company or an economic trend or an industry or a particular trade.
- 8:31So I was always interested in Python in the context of, like, some data set and some insight that you can glean from analyzing that data set.
- 8:40How much of that was taking a block of historical data, like, here's the last quarters and, you know, reports or whatever, versus trying to make predictions, you know, like real-time trading or other types of real-time information?
- 8:55So I think sort of the starting point is almost always some kind of like time series.
- 8:59And then the asset management firm, Mancobura, they were actually developing automated trading systems.
- 9:07So it was like very much the first thing you described, where you have an input that is a time series, you apply some transformation, and then a computer actually produces trades on the back of that.
- 9:18Whereas at other times, more like what I do now is you think about it, you get some insight from the data, but then there's also some other real-world considerations or exogenous factors that you think about as a human person and then make your decision.
- 9:33So I think for me, it was the whole gamut of sort of the product is a direct trade that the machine puts on or trade that you put on or maybe just some advice that you give to a company.
- 9:44Right, right. We're thinking that tech, generally, that the tech indexes are going down over the next three months versus buy today and sell tomorrow, yeah?
- 9:53Or buy now, sell tomorrow.
- 9:53Predictions are hard, especially about the future.
- 9:56Yeah, well, especially now with COVID and wars and like...
- 10:01I have been in finance for more than 10 years now, but I've never seen anything like the last two years.
- 10:07Yeah, that's nuts.
- 10:07I think much more happened in the last two years than in the 10 years before.
- 10:11It is living through some history, isn't it?
- 10:13Yeah.
- 10:14One more question on this background side of things.
- 10:16You did a lot of work for these other companies like Goldman, and now you're founding a smaller company.
- 10:22How do you feel that your programming and data science background has suited you to be more of leading this new company?
- 10:30I think I have a great sort of education from both Goldman as well as Man Group.
- 10:39They're both very technically capable organizations with a lot of very smart people.
- 10:44And as I was starting out together with my partners as a very small team, one of the things that gave me comfort is that I have this stack of things that I know work together.
- 10:54I understand how they work together and how to sort of apply them to do useful things.
- 10:59So having that sort of under your tool belt or ready to go and not having to figure out sort of how they go together.
- 11:07But just on day one, here's an AWS instance or EC2 instance.
- 11:11Spin it up, get a notebook running and produce some nice charts.
- 11:15That was something very valuable for me to just be able to do very quickly.
- 11:19Cool.
- 11:19That's what I would think.
- 11:21And I feel even if you have these skills, even if you're not the one writing, if you hire a team or you find a consultant, being able to speak with them and understand like, yeah, no, no, I have a recommendation.
- 11:32And I think actually this, you know, like, let me tell you, that tool is good, but this one is better and it would fit because X, Y.
- 11:38I think just that's super valuable.
- 11:40So I just wanted to kind of check in with you on that.
- 11:42Yeah, like I tried and test a stack of tools and every once in a while you get to branch off and try some new shiny and see if it works, see if it sticks.
- 11:51But having this trusted thing that you know and how it works is valuable.
- 11:55Yes.
- 11:55Like if you're doing JavaScript, you want to have a really trusted tool that's been around for at least a month.
- 11:59Yeah.
- 12:00I mean, just kidding.
- 12:01Luckily, we don't have it quite that bad in Python.
- 12:04It's a lot more stability there.
- 12:05Okay.
- 12:06Well, let's talk about this list, which is why we got together and I invited you here.
- 12:11Is this awesome Jupyter list.
- 12:14You know, what is it?
- 12:14Where did it come from?
- 12:15I mean, most people are familiar with awesome lists, but maybe what's the philosophy of yours?
- 12:20Yes.
- 12:21So awesome lists, they're just like curated lists with resources that are useful or pertinent to some particular topic.
- 12:30And then in this case, it's Jupyter notebooks.
- 12:33So this is really a list of things that I started with 20 entries and then just put it up on GitHub.
- 12:40And then over time, just more people added to that list of things they find useful and have some relationship with Jupyter.
- 12:48And I think that up to this point, I think more than 100 people have collaborated on other things that they find useful to this list.
- 12:55So it's just like living, breathing thing of whatever people find useful that has a relationship to Jupyter.
- 13:01I still find these very valuable, even though a good part of my job is like to track what is new, what's interesting, what's trending.
- 13:08Still, I find so many things that are new here.
- 13:10And when I first got to Python, I was like, wow, look, it just keeps going.
- 13:15I just thought there was three web frameworks.
- 13:17There's one way to talk to a database.
- 13:19Look how many there are.
- 13:20It's so amazing.
- 13:21And it's always delightful.
- 13:22You probably remember like back in the old days of the internet, you had directories, right?
- 13:28I mean, that was Yahoo.
- 13:29That was the first search engines, right?
- 13:31Yes.
- 13:31You had these like catalogs of things.
- 13:33And here's a website that is about cats.
- 13:36And here's one about dogs.
- 13:37And in some ways, it feels like in this day and age, we have come back to like you actually have a person who is keeping some kind of like directory of things that are useful or pertinent to a particular topic.
- 13:48It's kind of funny that way.
- 13:50And what's quite interesting for me is sort of one of the benefits that I have from doing this is that I see like what other people find useful.
- 13:58And so for myself, I just know, hey, these are the things that people are using.
- 14:02And so I've got a pretty good radar of the whole Jupyter and Notebook ecosystem just because I'm sort of curating this thing.
- 14:09Yeah.
- 14:09You probably have had people recommend things and you're like, no idea what that is, but that looks awesome.
- 14:15So it belongs on awesome Jupyter.
- 14:16I try to be very inclusionist to this.
- 14:19So when people include things on this list, more often than not, I exclude them.
- 14:25And even in the cases where I'm like, I don't see myself using that, but I'm sure there's some category of people who might find that useful.
- 14:33And it just goes on the list.
- 14:35Yeah.
- 14:35You don't want to over-index on your specific use of Jupyter and your vertical, right?
- 14:42Because we've got astronomers who are using this stuff.
- 14:44We've got economists.
- 14:45We've got biologists.
- 14:47We've got students, right?
- 14:49It's publishers.
- 14:50All sorts of folks.
- 14:51Yeah.
- 14:51Yeah.
- 14:52Yeah.
- 14:52People who care more about, I don't know, like keeping, turning their computation on a cluster.
- 14:57Other people are more into visualization.
- 14:59You name it, you have it.
- 15:00Yeah.
- 15:01Right.
- 15:01Like ML folks might have one concern over others.
- 15:05A lot of people who use it in education, that's actually one of the sections in there is a whole section dedicated to education, people teaching courses using notebooks and what the best tools around that is for it.
- 15:18Like, I don't know.
- 15:19It may be even grading homework assignments that you distribute to people in the form of notebooks.
- 15:24Yeah.
- 15:25I definitely want to highlight that because my, I haven't talked about it very much, but I was a graduate TA.
- 15:30So, boy, I graded a lot of, a lot of calculus, a lot of linear algebra and various other applied calculating type things like MATLAB type of stuff and automating.
- 15:40Oh, it would have been good.
- 15:42Okay.
- 15:42So.
- 15:43You just replace yourself with a regression test.
- 15:45Exactly.
- 15:47Submit your calculus test to the continuous integration.
- 15:51We'll see how you did.
- 15:52This portion of Talk Python is brought to you by the AWS Insiders podcast.
- 16:00When was the last time you ordered a physical server to host your functions as a service, your latest API, or your most recent web app?
- 16:08I remember the last time I did.
- 16:10That was around the year 2001.
- 16:12And yes, it was quite the odyssey.
- 16:14Of course, we don't do that anymore.
- 16:16We run our code in the cloud with near instant provisioning and unparalleled data centers.
- 16:22And the most popular cloud provider is AWS.
- 16:25But for all the ways that AWS has made our lives easier, it has also opened a massive box of choices.
- 16:32Should you choose platform as a service?
- 16:34Or maybe it's still VMs with IaaS.
- 16:36What about your database?
- 16:38Maybe you should choose a managed service like RDS with Postgres.
- 16:42Or is DynamoDB better?
- 16:43Maybe Aurora?
- 16:44No, wait.
- 16:45I hear good things about Amazon DocumentDB too.
- 16:48And that's where the AWS Insider podcast comes in.
- 16:51This podcast helps technology leaders stay ahead of Amazon's constant pace of change and innovation.
- 16:56Some relevant recent episodes include Storage Wars Database Edition, Microservices or Macro Disaster,
- 17:04and Exploring Computer Vision at the Edge with AWS Panorama.
- 17:08They bring on guests to debate the options and the episodes are vibrant and fun.
- 17:13So if you want to have fun and make sense of AWS, head on over to talkpython.fm/AWS Insiders.
- 17:20Yes, I know you probably already have a podcast player and you can just search for it there.
- 17:25But please use the link so that they know you came from us.
- 17:28Thank you to the AWS Insider podcast for keeping this podcast going strong.
- 17:36So there's a couple of sections that I'm not sure I really want to dive into because I think,
- 17:40I don't know, they're not exactly the notebook ones.
- 17:43But one is this collaboration education stuff.
- 17:47So maybe we could start there.
- 17:49And let me just set the stage by saying if a little while ago I met with Sam Lau and talked with him.
- 17:55He and Philip Guo, they did a research project where they studied 60 different network environments,
- 18:02not just Jupyter, but like Google CoLab and 58 others.
- 18:07And so just kind of putting it out there, like you might think just Jupyter versus JupyterLab is the discussion,
- 18:14but there's a whole lot of different places where you can do notebooks, right?
- 18:19Yeah, and some of them, like you can run on your own machine.
- 18:23That's sort of what I have in this runtime slash environment section.
- 18:26Those things tend to go in there.
- 18:28And there's a separate category of, I call them in the list, hosted notebook solutions.
- 18:34Those are things that you don't really run on your own machine, but they run somewhere in the cloud.
- 18:39So I think basically that is one way you can break them down into categories.
- 18:44It's just do you run them yourself or do they run in the cloud somewhere else?
- 18:47One thing that I didn't see on the list, but maybe would be kind of its own special.
- 18:53Open a pull request.
- 18:54Yeah, right.
- 18:54Here we go.
- 18:55Is the JupyterLab desktop app.
- 18:58Have you seen this?
- 18:59Not sure I've seen that.
- 19:01Yeah.
- 19:01So what it is, is it's an ElectronJS app that bundles the runtime environment to be JupyterLab.
- 19:08And it comes with its own Python and everything.
- 19:11So it's a thing you can hand to somebody that runs locally that lets them do notebook stuff
- 19:16without them having to have Python installed and set up the environments.
- 19:20And it just kind of has a little wizard to get it started, which is, I'm not sure I would
- 19:24use it personally, but it's pretty interesting.
- 19:25It sounds like a very low barrier to entry notebook environment.
- 19:30Yeah.
- 19:30I think it could be good for, you know, like in a school environment where you're like,
- 19:34all right, kids, just take this and run it.
- 19:36I don't want to have to debug why you can't install Python 3.10, but you need 3.7, you know, whatever.
- 19:42Lots of different people have different kinds of Jupyter or notebook setups.
- 19:47Mine personally tends to be, I've got to, I actually run mine in the cloud because I find it convenient
- 19:54to be able to access it from different machines.
- 19:57So like I access it from work and then I can access it from my notebook.
- 20:02Even like when I'm at a friend's place or something, all I need is a browser to access it.
- 20:07And I can just like continue where I left off on the other machine.
- 20:11Other people prefer.
- 20:12You can probably be closer to the data, right?
- 20:15Exactly.
- 20:15Right.
- 20:16Yeah.
- 20:16And you've got a lot faster pipe and you're not that dependent on what your own network
- 20:22situation looks like wherever you are.
- 20:24Yeah.
- 20:24Yeah.
- 20:25You're just shipping the answer, not the gig of data required.
- 20:29Exactly.
- 20:29I get the answer.
- 20:30Exactly.
- 20:30Right.
- 20:31And you've got a pretty easy machine on the other end that can deal with all the calculations.
- 20:36Yeah.
- 20:36So I find that pretty cool.
- 20:37At some point I overdid it and even dockerized the whole thing.
- 20:42And then I felt like that was getting more in the way of it than being helpful.
- 20:47Yeah.
- 20:48You're like, I gave myself a DevOps job.
- 20:50Why did I do that?
- 20:51Yeah, exactly.
- 20:52I only maintain one of these installations.
- 20:54Why do I dockerize them?
- 20:55Yeah.
- 20:56That's actually a really good point.
- 20:57I have the same philosophy on web apps.
- 20:59It's like, well, if there's just going to be one of them and it's just me, how much flexibility
- 21:03does this thing really need?
- 21:04Okay.
- 21:04Yeah.
- 21:04So there's a whole section on these with honestly many places I haven't heard of and ways
- 21:11to run it.
- 21:11But let's talk about two things in this collaboration education section.
- 21:16Three actually, but two are kind of in my mind, put them together.
- 21:19One is NB grader, like real quick.
- 21:21Like this is a pretty cool project.
- 21:23Tell people about this.
- 21:24This is pretty much what I described before in the abstract.
- 21:26Right.
- 21:27If you are a person in education and you teach a course and you want to want your students
- 21:33to do a particular assignment and then they send in their submissions, you don't want to
- 21:38hand grade them one by one.
- 21:40What you can do is formalize basically what you want the answers to look like in a form
- 21:45of regression tests.
- 21:46And that is basically what NB grader is.
- 21:49So like you get one notebook and you define what you want the answers to look like.
- 21:53And then it just does the rest of it for you.
- 21:56That's pretty interesting.
- 21:57I've never used it myself because I'm not working in academia.
- 22:01Yeah.
- 22:01Like the value prop is obviously obvious with that one.
- 22:04Well, I think there's two values here.
- 22:06Obviously the less effort on the instructor.
- 22:10There's also a little bit of more fairness.
- 22:13Yeah, sure.
- 22:14There's an interesting angle.
- 22:15Like I'm sure that this is true for grading.
- 22:17You know, is it morning and you're rested and patient or is it late and you're in a rush
- 22:22and you're frustrated?
- 22:23I don't know which affects which in terms of how the grades go, but it's got to have an
- 22:27effect, right?
- 22:28I was talking to some folks who did machine learning for discovering planets on Talk Python and they
- 22:34said after the afternoon coffee and cake or cookies or whatever it was they had at this
- 22:41university, more exoplanets to be discovered than in the morning.
- 22:45Okay.
- 22:46I was always told to like call people after lunch.
- 22:50That's when they are usually most contained and most open to.
- 22:54Exactly.
- 22:55And so there's probably a thing about grading.
- 22:57So the fact that this doesn't care, it doesn't get coffee.
- 23:00It gets electrons.
- 23:01That's good.
- 23:02And I think there's also like a social science paper on like jury verdicts and sort of the
- 23:07harsh use of jury verdicts over time of date.
- 23:10Right.
- 23:11That's a little bit, that's a little bit harsh to think about, isn't it?
- 23:14Like I got an extra year in prison because they were grumpy, right?
- 23:17That's not how justice should work.
- 23:19Yeah.
- 23:19They didn't have their coffee yet.
- 23:21So the other angle that I think is interesting with this is if you're a student, you get
- 23:26to know whether or not you passed that question.
- 23:29Right.
- 23:29A lot of times when you're doing complicated things, it's like, I think this is right.
- 23:33But if it's not just really straightforward, like a calculus, here's what the formula derivative
- 23:39is.
- 23:39Right.
- 23:39But it's a slightly more nuanced.
- 23:41It's hard to know what the right answer is.
- 23:42And so here you're like, well, the test passed.
- 23:43So we're good to go.
- 23:44I like that.
- 23:45I had a course like that at university once where you could do multiple submissions and
- 23:50the system would tell you like how many points you scored.
- 23:53And it actually sort of was very motivating to sort of keep going until you score a perfect
- 23:58answer.
- 23:58I think having something like that in a course would be super cool.
- 24:02I totally agree.
- 24:03Before we move on real quick in the audience, David says, I use NB Grader for my teaching.
- 24:07It's super helpful.
- 24:08NB Grader identifies wrong answers and then you can go in and assign partial credit.
- 24:12Yeah.
- 24:13I love it.
- 24:13That's actually really neat.
- 24:14Really neat.
- 24:15Okay.
- 24:15The other one that's more of a educational demonstration or exploration is NB Tutor here.
- 24:22So NB Tutor lets you go in.
- 24:25Will you tell people about it if you're familiar with this one?
- 24:28No, I haven't used it lately, but it looks like we're dancing.
- 24:31I mentioned Philip Guo and Sam Lau.
- 24:34They did Python Tutor, which lets you go and write some Python code.
- 24:40And it shows you basically how it executes and how variables are related with pointers and
- 24:45stuff.
- 24:45And this is inspired by that.
- 24:47So what it lets you, not this one, it lets you basically run a, what is it?
- 24:52A magic command with a percent?
- 24:54Cell magic.
- 24:55Cell magic.
- 24:55You run some cell magic to turn it on.
- 24:57And then to the right of the cell.
- 24:59It starts showing the pointers and how things are relating.
- 25:02So if you're trying to understand computer science and things, I think this would be cool for teaching.
- 25:07And you have your code and all you have to stick on to get the visualization is this one short cell magic and you get the rest for free.
- 25:14That's pretty cool.
- 25:15Yeah, it's really cool.
- 25:16They give credit right here to OnlinePythonTutor.
- 25:18There's some other ones.
- 25:20The Jupyter Drive one to integrate Google Drive looks pretty neat.
- 25:24I think it's a little bit expired when I opened it.
- 25:27It is definitely more of the experimental flavor.
- 25:31Yeah.
- 25:31And I imagine sort of whoever develops this is also on the mercy of Google Drive keeping their API stable.
- 25:39Absolutely.
- 25:39I think that is one way or it's in general, it's a non-trivial question figuring out how to best store your notebooks.
- 25:46I mean, if you're just one person, you can probably stick them into Google Drive.
- 25:49Yeah.
- 25:50But as soon as you have more than a handful of people working on the same set of notebooks, you probably want a solution that is a bit more sophisticated than that.
- 26:00I totally agree.
- 26:01One of those solutions might be a proper Git story, right?
- 26:06And some of the tools we'll talk about are going to cover that, right?
- 26:08Yes, exactly.
- 26:08The other one could be a collaborative, like a Google CoLab or some other, one of these other environments where it's like Google Docs.
- 26:16There's hosted environments that sort of have that as a built-in or you basically, the other way is you roll your own and make it Git-based and both have their advantages and disadvantages.
- 26:27I think with Git, you always know a little bit better what you have and what it does.
- 26:33Whereas with the other one, that might come with some other fringe benefits like being able to comment on it or having versions of the notebook very nicely integrated with your GUI.
- 26:44Yeah.
- 26:44And it's like whatever you prepare for sure.
- 26:46Like both work.
- 26:48Yeah.
- 26:48The online ones often have like infrastructure that comes with them too, right?
- 26:52When the ability to press go and run it on a GPU if you're willing to pay or whatever.
- 26:57Yeah.
- 26:57Cool.
- 26:57Okay.
- 26:58Let's, I think that probably is the interesting ones that jumped out at me from there.
- 27:03And then next one is visualization.
- 27:06I mean, this is at the heart of the value of notebooks in the first place.
- 27:10So Altair, tell us about that one.
- 27:13I'm biased, even though I certainly, I'm not a developer of Altair.
- 27:17I think what that team has developed is pretty amazing.
- 27:21I use it for most of the things, for most of my visualization needs or almost exclusively.
- 27:27What's neat about Altair is that it is declarative and it is built on top of a technology, on top of another package, which is called Vega.
- 27:37And Vega is a platform agnostic visualization framework.
- 27:43So basically what you have to do is if you want to have a chart like that, you just write some JSON declaration of basically, here's your data set.
- 27:52This is the URL to the data set.
- 27:54It's a tabular format.
- 27:56The variable that I want on the X axis is called Foo.
- 28:00The variable that I want on the Y axis is called Bar.
- 28:03And I want a scatter plot.
- 28:05And please make origin in this example here.
- 28:08Please make that the color of the dots.
- 28:10And you just specify that in a declarative format.
- 28:13And then you can, what that allows you to do is you can create this declaration from Python.
- 28:21But it might just as well be JavaScript or even like a handwritten JSON, right?
- 28:27Right.
- 28:28There's some kind of JSON data definition that goes to Vega and that drives the picture.
- 28:32So basically Altair generates that data set that goes down to the next layer, right?
- 28:37Exactly.
- 28:37So like Altair is the Python binding on top of Vega.
- 28:41And I think sort of declarative systems, most of the time they have a higher level of abstraction.
- 28:48They have more concise notation.
- 28:51And the way I always explain this to people when they ask about it is Vega and Altair is to visualization what SQL is to data query, right?
- 29:01Your SQL query, you can execute that from within Python.
- 29:04You can execute it from within a GUI.
- 29:07It's sort of a language agnostic specification of what data you want to query.
- 29:12And this is basically the same thing for visualizations.
- 29:16Yeah.
- 29:16It looks really great.
- 29:17There's a beautiful picture of a scatterplot with a legend and multiple colors kind of pulling out some nuance in the data.
- 29:26And it's like, I don't know how many lines of code you put that in.
- 29:29Maybe four if you didn't multi-line one of them.
- 29:32I mean, it's really.
- 29:33You can probably golf it together in four lines if you're.
- 29:37Without semicolons.
- 29:38So if you did semicolons, you could do it one, but that would be wrong.
- 29:41But like four reasonable lines, you could do this beautiful picture here, including the important.
- 29:46And that already gives you a reason.
- 29:47They're quite impressive visualization.
- 29:49I think it has some nice defaults.
- 29:52Like it knows how to nicely space the labels of the axes and stuff like that.
- 29:56And then what it still allows you to do is build pretty complex visualizations too.
- 30:02So there is this one example where you basically have a scatterplot on top.
- 30:07And then on the bottom, you have something like a histogram and you can select the range in the histogram at the bottom.
- 30:14And there you go.
- 30:16And then you get this beautiful interactive animation and you don't actually have to write any imperative code.
- 30:22You just specify what you want and Altair and Vega kind of like do the rest for you.
- 30:28So I write some JavaScript, but years ago, I used to see these like really nice and beautiful animations that were built of D3.
- 30:37And I'm like, I want to do cool stuff like that.
- 30:40That's really pretty.
- 30:41But I don't know any JavaScript.
- 30:42And I feel like this is like leveling the playing field a little bit more.
- 30:47And it allows you to do similar things from within Python.
- 30:51It's really nice.
- 30:51One of the things that I think is a little ironic is for the people who create these tools, like the people who created Altair, they have to write so much JavaScript.
- 31:01And not that much Python, right?
- 31:03Because they're building these interactive, beautiful experiences on the front end for us.
- 31:07We get to write the Python and there's like a lot of that complex JavaScript is encapsulated into these tools that we don't have to think about, but we get to use, which is great.
- 31:17It's a dirty job, but somebody's got to do it.
- 31:20And I have a lot of appreciation what those folks are doing for the rest of us.
- 31:24I do too.
- 31:24All right.
- 31:26So Altair is number one, right?
- 31:27On the visualization.
- 31:28I mean, it doesn't hurt that it starts with A, but also maybe one of the best ones.
- 31:32Some of the other shout out.
- 31:36In all fairness, like these things are sort of usually alphabetized.
- 31:40These every once in a while, like things in the wrong place.
- 31:44And by now I even built myself a linter that keeps the lists nicely alphabetized.
- 31:49I'm sure that makes a lot of sense.
- 31:50Yeah.
- 31:51So Bokeh is one that's out there.
- 31:53That's pretty well known.
- 31:54People use a lot.
- 31:55Yeah.
- 31:55Yeah.
- 31:56Yeah.
- 31:57There's a lot of them, right?
- 31:58There are.
- 31:58And I think when you talk about visualization, the other very popular ones are probably MatBlootlib,
- 32:05which probably was one of the first plotting engines for our backends for Python.
- 32:10And then Seaborn, which kind of like builds on top of that.
- 32:13Yeah, absolutely.
- 32:14Seaborn is nice.
- 32:15One that I've seen just recently on notebooks is TQDM.
- 32:19I've always used this from CLI applications.
- 32:23And TQDM is a way to just take a for loop and whatever you're going to loop over, you just
- 32:29put that in TQDM, bracket that thing, and it becomes this live animated progress bar, which
- 32:37is really neat.
- 32:37But I've only thought of this as a terminal CLI type of thing.
- 32:41But it works in notebooks too, I just learned, right?
- 32:43Yes, it does.
- 32:45TQDM is one of those, like, does exactly what it says on the team kind of things.
- 32:49It does one thing and it does it very, very well.
- 32:51Yeah, it's not an incredible output.
- 32:53But at the same time, it's like, you know what?
- 32:54I want to have a little bit of feedback for the users or for myself.
- 32:59And you're like, OK, it's just literally wrap your iterator in TQDM and it's good to go.
- 33:06It's a very natural thing to want.
- 33:07Just imagine you've got like some long running computation over a loop, right?
- 33:13And you just don't want to stare at a blank screen for two minutes.
- 33:16Yes.
- 33:16You can kind of see how maybe the idea developed from there.
- 33:19I've got a lot of those type of things.
- 33:21This portion of Talk Python To Me is brought to you by Sentry.
- 33:27How would you like to remove a little stress from your life?
- 33:29Do you worry that users may be encountering errors, slowdowns, or crashes with your app right
- 33:35now?
- 33:35Would you even know it until they sent you that support email?
- 33:38How much better would it be to have the error or performance details immediately sent to
- 33:43you, including the call stack and values of local variables and the active user recorded
- 33:48in the report?
- 33:49With Sentry, this is not only possible, it's simple.
- 33:52In fact, we use Sentry on all the Talk Python web properties.
- 33:56We've actually fixed a bug triggered by a user and had the upgrade ready to roll out as we
- 34:01got the support email.
- 34:02That was a great email to write back.
- 34:05Hey, we already saw your error and have already rolled out the fix.
- 34:08Imagine their surprise.
- 34:09Surprise and delight your users.
- 34:11Create your Sentry account at talkpython.fm/sentry.
- 34:15And if you sign up with the code talkpython, all one word, it's good for two free months
- 34:21of Sentry's business plan, which will give you up to 20 times as many monthly events as
- 34:26well as other features.
- 34:27Create better software, delight your users, and support the podcast.
- 34:32Visit talkpython.fm/sentry and use the coupon code talkpython.
- 34:39Brian out in the audience says, HV plot, hollow views, bokeh, and panel are all awesome and
- 34:46tightly interconnected.
- 34:47Yeah.
- 34:48And those are really nice.
- 34:49All right.
- 34:49So next one is the publishing.
- 34:51This might be also a little bit at the very heart of notebooks.
- 34:55The original idea of the notebook was, I want to have some explanation and then some executable
- 35:01code and then some visualization.
- 35:03Almost like I want to tell the story of a research project or something like that.
- 35:08Right.
- 35:08And so this section, it's right there, isn't it?
- 35:11Yeah, exactly.
- 35:12I think it's sort of less clear cut what this category is as compared to some of the others.
- 35:17But it is basically anything in sort of that space of how do you run it?
- 35:24How do you tell a story with a notebook?
- 35:26How do you point out little things inside those notebooks?
- 35:30One of the entries in there that I find quite interesting and useful, and it's also pretty
- 35:37awesome from a technical perspective, is binder.
- 35:40So what binder allows you to do is you can basically take any GitHub or even GitLab or
- 35:47other hosted Git solution URL and put it in there.
- 35:52And then what binder does is it builds a Docker image that has all the dependencies of those notebooks
- 36:00and builds that image, finds an executable node somewhere in the cloud in their infrastructure,
- 36:07and then points you to a Jupyter instance that has that notebook running.
- 36:12So what it allows you to do is you see a notebook of GitHub and you're like,
- 36:16geez, what if I want to poke around with this thing?
- 36:18You just go on binder, put in the URL, and you can play around with a notebook interactively.
- 36:24It's really cool.
- 36:25So if people have seen the launch binder, a little tag or whatever you call that on like
- 36:30a GitHub repo or somewhere else, I guess it could even be in an article that then just
- 36:35points back over to one of these.
- 36:37If you click it, just as you said, it's going to create an executable environment with the
- 36:40right dependencies and let you run your code there, which is kind of impressive that that's
- 36:45available to the world openly, publicly without authentication, right?
- 36:49It's an incredible engineering feat, right?
- 36:51Yeah.
- 36:52Just all the considerations of like finding a node that has like sufficient sort of resources
- 36:58available to be able to do that.
- 37:01Assembling.
- 37:01Basically, you don't know what people are going to throw at you in those repos, right?
- 37:06Doing a pretty good job at sort of making a whole lot of notebooks executable.
- 37:11I had Carol Willing, among others on the show recently to talk about Mastodon.
- 37:16And we talked about like the federated storing.
- 37:18You know, there's a bunch of people who are creating servers and allowing others to use it,
- 37:23sort of volunteering to add a little bit of resources.
- 37:26And she said, you know, a lot of what she sees over there actually was there's some parallels
- 37:32over in the binder space about how certain universities and other places are like, we'll set up the
- 37:37ability to run some of these binders to, you know, add a little bit of compute and resource
- 37:42to the world.
- 37:43And yeah, it's similar.
- 37:45It's pretty amazing.
- 37:46Like from what I can see, like what goes on behind the scenes, there is some of this,
- 37:51I think is the execution is run on Google hardware.
- 37:56So like, and then beyond Google, they have three other hardware providers.
- 38:01So not only do they manage to sort of make all those code notebooks executable, but they
- 38:06even run them on four different sets of infrastructure, which is pretty amazing.
- 38:11Very cool.
- 38:12Okay.
- 38:12So a couple of others.
- 38:14Another one here that really jumps out at me is Jupyter Book over.
- 38:19Let me pull up there.
- 38:20So build beautiful publication quality books and documents from computational content.
- 38:26Now, really nice, huh?
- 38:27I think there's a couple of sort of projects that try and do similar things, which is basically
- 38:33you create a set of notebooks and then you either get a webpage or you get a book.
- 38:40And two of the things that these are useful are, well, one, you're trying to write a book
- 38:46about some subject matter, a machine learning book or something like that.
- 38:50And the other, the other case where it's really useful is documentation, right?
- 38:56If you are a developer or a maintainer of a software package and you want to document your
- 39:01API, something like that can be very useful.
- 39:05So what this gives you is not only the ability to write documentation, but also to include
- 39:11code in that documentation.
- 39:13And then in some cases, if you have the binder link, you can even set it up so that you've
- 39:18got a piece of code in there and people by clicking a tab next to it can even try out
- 39:24what that code does, fiddle with it a little bit, and then see what that does.
- 39:28That's it allows you to do some pretty cool stuff.
- 39:31That's a pretty interesting way to bring it back around.
- 39:33Like we've taken this computational thing, got it going, turned it into a static book that
- 39:38you have.
- 39:38But if you click this button, you can go back and kind of.
- 39:40What we just talked about also sounds very much like NBDIV, which is actually a project
- 39:45that I use in, has a very similar flavor where it's specifically geared towards people who
- 39:52write software packages.
- 39:54And the idea there is that you take your code and you define your classes inside of
- 40:01a notebook.
- 40:01And then people can, so you can both actually have your code lives inside that notebook.
- 40:09You can also define your tests in that notebook.
- 40:12And then some added benefits that you get from that is you can run your tests from a notebook.
- 40:18And these things don't live in seven different places, like your code base and then your test
- 40:23base and then your documentation repo.
- 40:26But they all live together in one space.
- 40:29And if you make a change that influences or has an impact on all three of them, you don't
- 40:34need to do it in three places, but you can just do it in the notebook where it's all together.
- 40:38Of all the things that plug into Jupyter, I think I'm most impressed with NBDIV.
- 40:43It's pretty nuts.
- 40:44Yeah.
- 40:44I think this is Donald Newt, right?
- 40:47He called this a literate programming environment.
- 40:50And I feel like this is the kind of stuff he envisaged where he back in like 83, when he
- 40:56wrote his book around about literate programming, right?
- 40:59This is really what he had in mind.
- 41:01It took a while to get there.
- 41:02Yeah.
- 41:02The tools he was working with, they weren't like these.
- 41:04Yeah.
- 41:05Yeah.
- 41:05So with NBDIV, you can have your documentation, you can publish, you can take your notebook
- 41:09and export it or convert it into or build it into a Python package or a Conda package.
- 41:15You can publish it to PyPI and Conda.
- 41:18You can have tests, you can have continuous integration.
- 41:20Then also you can, if you've got complicated code that you need to integrate in other ways,
- 41:26you can sync it to Python files and then back.
- 41:29I think that two-way integration is pretty cool.
- 41:31Yeah.
- 41:31For this, I really need to get this out of the notebook into Python directly, but then
- 41:36don't just carve it off, like keep them sort of connected, right?
- 41:39Exactly.
- 41:40That's one of the key points there is that NBDIV allows you to do all of these things
- 41:45in the same place, right?
- 41:47Sure, you can do all of these things separately and a lot of people do them separately, but then
- 41:52having them all in one place is just so much easier when you say make an API change.
- 41:58Yeah.
- 41:58Another one which wasn't really even shouted out there in that highlights that they have
- 42:02is NBclean, which if you're doing, and we talked about the two possible ways for collaboration,
- 42:08if you're doing the Git way, you know, these notebooks, their files contain the output,
- 42:14which could completely vary from run to run.
- 42:16So like every time you save it or rerun it, it's a merge conflict, right?
- 42:20And so this will strip out that kind of information to avoid merge conflicts.
- 42:24So it can be a real good way to sort of prepare it.
- 42:27I suspect that could be a Git pre-commit hook.
- 42:29I'm not sure of it, probably.
- 42:30That's one way to do it.
- 42:31And sort of, I think sort of the fact that the notebook format contains the cell output
- 42:37and also some many information.
- 42:39It's a bit of a blessing and a curse at the same time.
- 42:42On one hand, it sort of, when you have a notebook file, you can load it up and you immediately
- 42:47see the output without having to run the cells, right?
- 42:51So imagine someone sends you a notebook file and you cannot run it on your machine.
- 42:55You still get the benefit of seeing what their output was when they generated it.
- 43:00So it's nice for that.
- 43:01It's also nice for the fact that if you put it up on GitHub, GitHub can render this notebook
- 43:07file with the output in a very nice and sensible way.
- 43:10You immediately see what the output was.
- 43:11But the disadvantage of doing that is that whenever you rerun it, sort of the contents of that file
- 43:18change and it doesn't produce clean diffs.
- 43:22For example, if you just change one line and then that line produces a block, your diff might
- 43:27be a couple of kilobytes long, right?
- 43:29If you don't want that.
- 43:30And one of the tools that sort of deals with that is something we had on the list, ChupyText.
- 43:37So ChupyText is basically, so ChupyText deals with this problem by basically giving you paired
- 43:45notebooks.
- 43:46So you have an IPNB file and you tell your Jupyter IDE.
- 43:51In addition to that IPNB file, I also want a markdown file or a PY file that contains just
- 43:59the input cells.
- 44:00And then what you can do is if you want to version your notebook is just check in that
- 44:06clean or stripped PY file or markdown file and rather ignore the IPNB.
- 44:12So that is what we actually do in our company.
- 44:16We have a couple of notebooks that serve as reports and we edit them collaboratively.
- 44:21And the way we version them is by stripping out the output via ChupyText.
- 44:27And so you really get nice, clean diffs.
- 44:29And when someone makes a change, you can tell what they changed in a reasonable way.
- 44:33That's super valuable.
- 44:34Do you want to go back to the MB dev for just one second?
- 44:37Because there's a big, long list here that you would get if you just ran MB dev help.
- 44:41And so many of these are like, as a standalone command, they'd be like, oh my gosh, what
- 44:46an amazing tool.
- 44:47Like another one I just saw is MB dev changelog, which will create a changelog.md file just from
- 44:53like your closed and labeled GitHub issues.
- 44:56And, you know, like that's a cool feature on its own.
- 44:58I could see installing that and never even using a notebook and just running that on my
- 45:02Git repo, which is, you know, so there's a bunch of, bunch of neat things here.
- 45:06You look at the list and what MB dev does for more than five minutes and it makes you want
- 45:12to build a software package.
- 45:13Yes, it does.
- 45:15Which you could do with MB dev, by the way.
- 45:17So that's, that's kind of meta.
- 45:19Yeah.
- 45:19Another one around there is NB convert.
- 45:21NB convert is, I mean, it's, it's almost there in the name, right?
- 45:26Basically one thing it gives you is a command line command where you can do NB convert for
- 45:33dot IP and B and say, like, I want to convert this notebook to HTML.
- 45:38So you can script the conversion of notebook on a command line level.
- 45:43And then beyond that, what you can do with NB convert is it's also accessible as a Python package.
- 45:49So you can control that notebook conversion from within your Python code.
- 45:55And that is useful for a number of things when you really want fine grained control over how you
- 46:02execute or convert your notebook.
- 46:05So one of the things that I have built with that is basically a way to convert notebooks
- 46:10without the input cells.
- 46:12So if you want to build a report out of a notebook and you have a non-technical audience and you
- 46:18want to get the code out of their way and you really want to just show them the output,
- 46:23that is something you can build with NB convert.
- 46:25That's really cool.
- 46:26I hadn't realized it did that.
- 46:28So here's what I want to show you.
- 46:30And if you actually want to see the code, click on this binder version or view it statically
- 46:35on GitHub.
- 46:35But for most people, they just want to see here's the description and here's the figures.
- 46:40It's still potentially accessible at least.
- 46:43Totally.
- 46:43And I think notebooks are actually quite a nice way to design a report, right?
- 46:49Because what you have is building blocks.
- 46:51And my report is I want the total number of orders for the last week and I want to chart.
- 46:58And then I want like the number of orders by zip code or whatever.
- 47:03And you build that in a notebook and then you just like NB convert it with the input stripped
- 47:10out and you get an HTML file that you can serve on a web server and have something like a dashboard
- 47:16for your team.
- 47:17Very good.
- 47:18So it's super cool for building things like that.
- 47:20Yeah.
- 47:21Yeah.
- 47:21Very neat.
- 47:22One more in this section before we move on.
- 47:24There's a bunch, but I think Paper Mill is pretty unique.
- 47:28You want to tell people about Paper Mill?
- 47:30I haven't.
- 47:31To be honest, I haven't used it that much.
- 47:32I haven't either, but I did read this Netflix Paper Mill article about what they were doing.
- 47:40And they were basically using...
- 47:44Ah, Kyle Kelly.
- 47:44Yeah.
- 47:45Yeah.
- 47:45They were doing some work to take notebooks and use those as like building blocks for managing
- 47:51their infrastructure.
- 47:51So there were a lot of interesting benefits and Paper Mill will let you basically turn the
- 47:58variables at the top of the notebook into inputs.
- 48:01And then the variables at the end of the notebook as outputs.
- 48:04And you could treat it like a function.
- 48:05So they're chaining these together for all sorts of crazy DevOps-y type things, I believe.
- 48:12It basically sounds like something I once rolled my own of where basically what I just described
- 48:18that I'm doing with NB Convert, I once built a version where sort of you could in the first
- 48:23cell have a variable and serve that like a function input.
- 48:26And it sounds like they probably did a much better job of sort of imagining you have a
- 48:31dashboard and then you've got one for the US and you want one for international orders,
- 48:36right?
- 48:36Or for Canadian or what have you country, right?
- 48:39You can basically do that out of the same notebook file, but just say, hey, these are two separate
- 48:45versions.
- 48:46One for the US, one for Canada, one for Mexico, whatever.
- 48:49Exactly.
- 48:50One of the benefits that they said they were getting was if something goes wrong, like if
- 48:55a step crashes, because as you described the notebook, as it executes, it stores the exact
- 49:01output and the inputs.
- 49:02It's a snapshot in time of what happened when it went wrong.
- 49:06So instead of just having a log message of it went wrong and here was the input, it's like,
- 49:09well, here are all the steps and you can see the variables and the output coming.
- 49:13And then here's the crash.
- 49:14You're like, oh, look, these are the three inputs.
- 49:16And here's how this one got.
- 49:17And actually gives you nice diagnostics.
- 49:20Yeah.
- 49:20It's like a report of what went wrong.
- 49:22It's almost like a, you know, you have these parametrized tests, right?
- 49:27It is.
- 49:28Yes.
- 49:28Parametrized tests with some diagnostic output about what went wrong during that execution.
- 49:34That's pretty cool.
- 49:35It's unique.
- 49:35I think worth a shout out, I suppose, there.
- 49:38How about the version control side?
- 49:40Anything you want to give a shout out to there?
- 49:41That is a section that is a bit more sort of well-defined and clear what goes in there.
- 49:46It's basically all sorts of tools for diffing, merging, code reviewing, changes in notebooks.
- 49:53NB Dime is probably one of the more well-known packages in that category that looks very well-built.
- 50:00Right.
- 50:01The diff and merge tools.
- 50:03Yeah.
- 50:03So imagine you have an image, right, in an IPMB file, you would usually get like a horrendously large diff if one of the things in that image changes.
- 50:14And it just displays that that diff not has 50 lines that change, but just like a neat, here is something that changed one line and doesn't mess up your whole diff.
- 50:25Right.
- 50:25This plot change, not these 700 lines of plot definition change.
- 50:30Yeah.
- 50:30Yeah.
- 50:31Yeah.
- 50:31Very cool.
- 50:32And merging as well, which is neat.
- 50:34Yeah.
- 50:34All right.
- 50:34We're getting a little short on time.
- 50:37Let's see.
- 50:37I want to, I know you want to give a shout out to Deep Note, both because you like them, but also they're a sponsor of the...
- 50:44They support the list.
- 50:44Yes.
- 50:45They support the list.
- 50:45Yeah.
- 50:46So maybe tell us about them.
- 50:47Deep Note is basically one of these hosted notebook solutions.
- 50:50We already mentioned Binder.
- 50:52We already mentioned Colab.
- 50:54And they have built one that is a bit more centered around collaboration of teams.
- 51:00You also get an execution environment with different sets of hardware from them.
- 51:07And they really emphasize collaboration.
- 51:09So you can comment and have discussions about individual cells in your notebook.
- 51:15You can very nicely see what changes other people did to your notebook and all of that in a very well done, very dense GUI that makes a lot of things very easy for you.
- 51:27If you're not already using one of these environments and you have a team that is maybe also not particularly technically focused on where it runs, how it runs.
- 51:37This is a very turnkey solution.
- 51:39Less DevOps, more Google Docs type of style.
- 51:43They solve a lot of those problems for you.
- 51:46It looks really neat.
- 51:47The collaboration seems very, very nice.
- 51:49I think that's a pretty unique thing to do in a polished way.
- 51:52Yeah, and they also have nice integrations for a lot of data sources.
- 51:57So you can directly query SQL from their GUI and pipe SQL results into a data frame, right?
- 52:05So you have one cell where you write your SQL and that goes directly into the data frame that you can then visualize in the next cell.
- 52:12So the ergonomics of Deep Note are probably better than many other notebook solutions.
- 52:18That's pretty neat.
- 52:19And so like you said, it's worth pointing out they're a sponsor of your list, not of our show, but they are a commercial thing, but they are a commercial venture, but they do have a free version.
- 52:28There's something for me where I feel like it's, I kind of like to support companies that are purpose built, right?
- 52:38Like Deep Note is built for running notebooks and collaboration, whereas a lot of these big tech things, it's like, well, I know Facebook's a social media company, but I could also do this other thing that runs on, or I could run this on Google.
- 52:50And there's something about like, okay, there's a company whose only job is to do this versus like, I'm not sure I could ever get support.
- 52:59Like if I had a problem with my Gmail, I don't know that I could ever get help, ever, right?
- 53:03Whereas like, you know, if I went to an email company and got email from them, they would help me with email because it's their thing, right?
- 53:09I think where it shows is that they spent a lot of time thinking about how people use notebooks and what they want to do with those notebooks.
- 53:17They think a bit beyond just sort of the Jupyter technical, but more the ergonomics of how you actually use a notebook within a team.
- 53:27And I think sort of, you can definitely tell that they know how to use notebooks and have thought about all the ways in which people use notebooks and how to make that better.
- 53:36Nice.
- 53:36Well, I've never used them, but if I have the need, I'll check it out.
- 53:40Sounds good.
- 53:41All right.
- 53:42What else?
- 53:43Maybe we've got time for one more.
- 53:45Is there one we haven't talked about yet that you're like, oh, we really got to cover this one?
- 53:48Let's do cell magics, right?
- 53:50Okay.
- 53:50If you maybe just Google for IPython cell magics.
- 53:54I'll kaggy for it.
- 53:54Yeah.
- 53:55They are not strictly a Jupyter thing, but I think they're a not so well-known thing that is super neat.
- 54:04And they are, since Jupyter itself started in, from, was born out of IPython, these are things that are also built into IPython.
- 54:13So one of them is, for example, a percent debug.
- 54:17So when you have a notebook open and you get an exception and your code gives you an error message, you can then, in a cell directly below that, type Terset debug.
- 54:28And that will open up a debugger session that takes you directly to the point where your code fail.
- 54:36Right?
- 54:36So if you write something like, I don't know, I accessed true, the array true at an index position of five, right?
- 54:44And that's where your code fails.
- 54:46You can do percent debug and look at, well, at that point in the execution, what was actually stored in the list full?
- 54:54Right.
- 54:54And did it actually have five elements or did I run out of bounds?
- 54:57So, like, whenever I get an error during an execution of a notebook and it's not obvious, I like to use percent debug to find out what's going wrong with my code.
- 55:07Very nice.
- 55:08Another one that is very useful is percent time, which is, have you used that?
- 55:13No, but I often want to answer this question of, like, is this getting a little bit faster, a little bit slower?
- 55:19And I don't really want to go into a profiler and I don't want to go to, like, write the date time or timestamp code to, like, print it out myself.
- 55:26It's just, like, yeah.
- 55:27I use it a lot in those situations where, like, I've got, I've got way A to do something and way B to do something, right?
- 55:34And then I wonder, is this actually faster or is this actually performance-wise worse than doing it the other way?
- 55:42And this gives you just a very quick and dirty answer to, like, orders of magnitude.
- 55:47Is this the same level or should I be doing things differently?
- 55:50It's very useful for that.
- 55:51Yeah.
- 55:51Percent time and some function call and see what it takes.
- 55:54It's brilliant.
- 55:55And then another one I want to mention is just exclamation point and then the shell command.
- 56:01Yeah.
- 56:02It's very useful for, I think it's also available as %sx.
- 56:07Yeah.
- 56:08So it's basically a shorthand.
- 56:09So you can do exclamation point LS to get to a directory listing just to see what is in the directory.
- 56:17Or you can do, like, I don't know, who am I to see what user you're running something as.
- 56:22Or you can do ping a machine to see if it's up directly from your notebook.
- 56:27So this is a quick and dirty way of running command line commands without having to leave your notebook.
- 56:35It's really cool.
- 56:35It's really cool.
- 56:36You know, if you wouldn't just interact with the file system or you see what files are available to me or all these things, right?
- 56:41Yeah.
- 56:41Yeah.
- 56:41You wouldn't know because this hasn't published yet.
- 56:43But in the sequence of when these shows come out, I just talked to, or you're ruined from data science at the command line.
- 56:51Wait, have you seen this book?
- 56:52No.
- 56:52Yeah.
- 56:52So it's got a bunch of interesting things that you can do on the command line for, like, querying data or running things in parallel.
- 56:59And a whole bunch of these, these sort of ideas of, like, how do I do really cool stuff with the shell?
- 57:06Just use your bang command and they become integrated into your notebook, right?
- 57:10Which is, I think that's super cool.
- 57:12You can even take it to do things like you do an LS and then your Python session gets past the contents of that directory as a list.
- 57:21And you can then use it as a variable and assign that list of variable.
- 57:25So it's like, that is a really, like, easy, but also, like, very shoddy way of listing the directory contents very quickly.
- 57:33Yeah.
- 57:33I mean, you should probably use pass a little bit or something.
- 57:35We shouldn't even mention that.
- 57:36We should not encourage that.
- 57:37But if there's, like, really interesting stuff that's happening on the shell you want to use, like, for example,
- 57:42there's this symbol that says total lines equals.
- 57:44That's a brilliant one.
- 57:45Yeah.
- 57:45Which is a Jupyter level command.
- 57:48And this says bang arrow to redirect input of some text file word count dash L.
- 57:53And that tells you how many lines are there.
- 57:54Like, yeah, maybe you want to make this all Python so it doesn't, it's not platform dependent, right?
- 57:59Sure.
- 58:00If you want to package this up, right?
- 58:02In that package.
- 58:03But if you only end up doing it once and you just want to know how many lines there are, that's a way to do it.
- 58:08Right.
- 58:09You're in, like, an exploratory situation, right?
- 58:11And you just generated this file and now you want to know.
- 58:13I don't know.
- 58:14So there's, that's a really powerful one.
- 58:16I'm glad you brought that up.
- 58:17And then just the last one from there is, because it definitely saved me in a couple of very hairy situations, is percent history.
- 58:25So that basically gives you a history of the 20, 10, or however many last commands you executed in a Python session.
- 58:35Why it's sometimes useful is just imagine you accidentally delete a cell in a notebook.
- 58:41I mean, you can always undo that, right?
- 58:44But every once in a while, your undo history is so horribly messed up that you somehow sort of lost that cell forever.
- 58:52And there was, like, a lot of finely tuned code in that.
- 58:55So you can go back to that with percent history and get your deleted cells from beyond the grave.
- 59:01Yeah.
- 59:02And you can do percent history dash in five.
- 59:05Just show me the last five changes.
- 59:06Yeah.
- 59:07Yeah, it's really nice.
- 59:08Cool.
- 59:09All right, Marcus.
- 59:10I think we might be out of time, but, you know, what a cool project this awesome list is.
- 59:15We've got a lot of people listening in.
- 59:17I'm sure there's a lot more awesome packages, tools, resources that could and should go on this list.
- 59:25So if whoever is watching or listening to this has a package that they feel should be mentioned there, it's just as easy as doing a pull request and adding your favorite tool or resource to that list.
- 59:38We're very inclusionist on the list, right?
- 59:41And we like to include people's suggestions.
- 59:43Yeah, fantastic.
- 59:44There's a couple that I could see showing up there, like a few comments in the live stream that those could be PR.
- 59:50So have at it.
- 59:51That'd be awesome.
- 59:52Yeah.
- 59:53Awesome.
- 59:53All right.
- 59:53Final two questions before I let you out of here, though.
- 59:55If you're going to write some Python code, what editor do you use these days?
- 59:59Jupyter.
- 59:59Of course.
- 1:00:00I overuse it.
- 1:00:01Beautiful.
- 1:00:02And then notable PyPI or Conda package or something out there or even a Jupyter plugin.
- 1:00:08I know basically this entire show has been one after another, but something you want to give a shout out to.
- 1:00:13If I can just give one a shout out, it's Altair.
- 1:00:16Yeah.
- 1:00:17You should be doing the plotting in Altair.
- 1:00:18Altair right on.
- 1:00:19Yeah, it's quite nice.
- 1:00:20All right.
- 1:00:21Well, thank you so much for being here.
- 1:00:22It's been great to have you on the show.
- 1:00:24Thank you for having me.
- 1:00:25Yeah, you bet.
- 1:00:25Bye.
- 1:00:26Have a good one.
- 1:00:26Bye.
- 1:00:26This has been another episode of Talk Python To Me.
- 1:00:30Thank you to our sponsors.
- 1:00:32Be sure to check out what they're offering.
- 1:00:34It really helps support the show.
- 1:00:35AWS is the lead cloud for developers, but with over 250 services, it's an overwhelming set of choices.
- 1:00:43That's where the AWS Insiders podcast comes in.
- 1:00:47Their job is to help you make sense of all those AWS options.
- 1:00:51Listen to an episode at talkpython.fm/AWS Insiders.
- 1:00:55Take some stress out of your life.
- 1:00:57Get notified immediately about errors and performance issues in your web or mobile applications with Sentry.
- 1:01:03Just visit talkpython.fm/sentry and get started for free.
- 1:01:08And be sure to use the promo code talkpython, all one word.
- 1:01:12Want to level up your Python?
- 1:01:13We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:01:17Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:01:23And best of all, there's not a subscription in sight.
- 1:01:25Check it out for yourself at training.talkpython.fm.
- 1:01:28Be sure to subscribe to the show.
- 1:01:30Open your favorite podcast app and search for Python.
- 1:01:33We should be right at the top.
- 1:01:34You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
- 1:01:44We're live streaming most of our recordings these days.
- 1:01:47If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:01:55This is your host, Michael Kennedy.
- 1:01:57Thanks so much for listening.
- 1:01:58I really appreciate it.
- 1:01:59Now get out there and write some Python code.
- 1:02:01I'll see you next time.