Latest / Talk Python To Me / #226: Building Flask APIs for data scientists
Transcript
- 0:00If you're a data scientist, how do you deliver your analysis and your models to the people who need them?
- 0:04A really good option is to serve them over Flask as an API.
- 0:07But there are some special considerations you might want to keep in mind.
- 0:12How should you structure this API?
- 0:13What type of project structures work best for data science and web apps together?
- 0:18That and much more on this episode of Talk Python To Me with guest AJ Pryor.
- 0:22It's episode 226, recorded August 5th, 2019.
- 0:26Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 0:46This is your host, Michael Kennedy.
- 0:47Follow me on Twitter where I'm @mkennedy.
- 0:50Keep up with the show and listen to past episodes at talkpython.fm.
- 0:53And follow the show on Twitter via at Talk Python.
- 0:56This episode is brought to you by Linode and Rollbar.
- 0:59Please check out what they're offering during their segments.
- 1:01It really helps support the show.
- 1:02Hey, Jay, welcome to Talk Python To Me.
- 1:04Hi, Michael. How are you doing?
- 1:05I'm doing super well. Thanks for being on the show.
- 1:07Yeah, absolutely. I'm super excited.
- 1:09Yeah, it's going to be a lot of fun.
- 1:10We get to talk about some things that are really popular in Python, web development, and data science.
- 1:18And then we're going to intersect them together, which I don't know is going to make them mega popular.
- 1:22Because if you look at the Python space, all the surveys and sort of where people are working, it seems like it's mostly web development or data science, and then just like a whole bunch of others, right?
- 1:35So we're hitting both of those today.
- 1:36Yeah, I mean, you've got on one hand sort of most of the code that's written is for the web.
- 1:40And then you've got this meteoric rise of Python coming beside it.
- 1:43So I figure why not just do both?
- 1:45And then you're pretty much positioned at the top.
- 1:47Yeah, it's definitely a good place to be, I would say.
- 1:49One way to look at it, at least, right?
- 1:51Yeah, it's a positive way for sure.
- 1:52So before we get into that, though, let's go ahead and start with your story.
- 1:55How do you get into programming in Python?
- 1:57Sure.
- 1:57Actually, I didn't grow up around programming at all.
- 2:00I grew up in the middle of nowhere, Georgia.
- 2:02I played sports as a kid.
- 2:04You know, I was always into math and science, but never programming.
- 2:07And I went to college undergrad at Georgia Tech.
- 2:10And my first semester there was declared as an engineering major and took a MATLAB course.
- 2:16And immediately, just everything about it clicked.
- 2:18I was hooked.
- 2:19And of course, you know, MATLAB is MATLAB.
- 2:21And so I changed my major immediately to computer science.
- 2:26And then I got about one semester further and started taking some of the sort of pure CS classes.
- 2:33You know, it's very theoretical and that's fine and all, but I didn't feel as hands-on with it.
- 2:38And simultaneous to that, I started taking some physics classes, which had an application of Python.
- 2:43So we were kind of modeling gravitational systems and whatnot.
- 2:46And that really resonated with me because it had both the math side of things that I gravitated towards,
- 2:51but I was also building things using code, which was new.
- 2:55And I got really excited about that.
- 2:56So I remember we had this lab where we built like an orbital system of the moon and a rocket and earth.
- 3:02And, you know, before I know it, I had this little couple of dots on a screen moving around.
- 3:06And I'm convinced that I'm like landing Apollo 11.
- 3:08And I just, it was really gratifying.
- 3:10And so I've been hooked ever since.
- 3:11And the rest is history.
- 3:12Yeah, that's cool.
- 3:13It's really interesting how some of these early wins, like this three-body problem you're simulating
- 3:18in physics or whatever, like it's not a big deal, right?
- 3:20Like the little simulation is probably pretty limited, but at the same time, it feels like
- 3:25so gratifying, right?
- 3:26Yeah, absolutely.
- 3:27And then, you know, of course that starts off as sort of the baby problem.
- 3:30And then as I went on to grad school and my PhD, and this was all physics, the coding got
- 3:35more complicated.
- 3:36The algorithms got more complicated, but at the core, it was still, it was still the same
- 3:39problem, right?
- 3:40You're solving some kind of computational problem through coding.
- 3:44And although that wasn't always Python these days, it's pretty much moved from that.
- 3:47You know, I kind of diverted along the way and did some C++ and did CUDA and GPU programming,
- 3:53but Python is a lot of what I do day to day now.
- 3:55Yeah, cool, cool.
- 3:56You know, I followed a bit of a similar path.
- 3:59Like I was working my PhD in math and doing a lot of math stuff, but then also analyzing
- 4:04and programming.
- 4:05And I guess I should have known that I was not really intended to finish my degree, my PhD
- 4:11anyway, and go into math because I would find when I'm working on these projects, like I was
- 4:18really excited, especially about the programming.
- 4:20And it was so cool, kind of like you described this, like how awesome it felt to have this
- 4:24simulation running.
- 4:25And then I'd always kind of get like a little bit less excited and like, oh, here comes the
- 4:30drudgery work part of it when I got to the math and then you go back to the program and
- 4:35I get really excited again.
- 4:36I'm like, I should have been a sign that I could have.
- 4:38That's what you know.
- 4:39Yeah.
- 4:39Yeah.
- 4:39But no, it was all good.
- 4:40So for you, what are you doing these days?
- 4:42So I work for a company called American Tire Distributors.
- 4:45It's the largest distributor of replacement tires in the world.
- 4:49So the tire industry is very interesting because tires are something that pretty much everybody
- 4:54has to buy.
- 4:54You don't buy frequently.
- 4:56And it's an overwhelmingly miserable experience for most people.
- 4:59Yeah.
- 4:59And it's an antiquated industry.
- 5:01So it turns out that they have a ton of data, but technologically speaking, it's not particularly
- 5:06modern.
- 5:08And so my company has spun up a pretty new analytics team that's data scientists, engineers,
- 5:13and developers to kind of build out applications to try to revolutionize that industry and bring
- 5:19it up to the modern world in terms of analytics, increasing supply chain efficiency and all of
- 5:23this.
- 5:24And so as a data scientist, particularly one who is interested in web development and app
- 5:28development, like I am, it's kind of like being a kid in a candy store because there's tons of data,
- 5:33both historical and streaming every day.
- 5:35And basically no solutions other than the traditional sort of BI descriptive backward
- 5:41looking stuff, which is good.
- 5:43And you need that.
- 5:43But we're also looking to build more predictive analytics and doing forecasting and finding
- 5:48other optimization techniques to kind of squeeze efficiency because as a distributor, you're a
- 5:52middleman and efficiency is the name of the game.
- 5:54So I find myself sort of stuck between I build backends in Python.
- 5:58I write a lot of SQL, interact with databases.
- 6:01Sometimes that means building new databases on our cloud resources.
- 6:04And then I spend a lot of time building front ends to actually expose those applications in a way
- 6:10that's consumable.
- 6:11And that's actually a very important part of this whole process because at the end of the day,
- 6:14if you're building an app for somebody, it doesn't matter how fancy your mathematics is.
- 6:19If the consumer who's actually making an actionable decision on that can't do anything useful,
- 6:24it's not worth your time.
- 6:25So that's where I find myself spending my time.
- 6:28I write a lot of code and talk to a lot of people.
- 6:30Yeah, yeah.
- 6:31That sounds so fun.
- 6:32I mean, almost any industry that has like tons of data and yet no one is doing anything with it.
- 6:39Not really.
- 6:40It just sounds really fun.
- 6:41You can come and go, all right, let's see what we can do here.
- 6:43We can bring in a little TensorFlow to do this.
- 6:45We can bring in some APIs to modernize that.
- 6:48Like, why are you seriously emailing me an Excel spreadsheet?
- 6:51Is that really what's happening?
- 6:53Oh, that's the story of my life.
- 6:56Do you guys use SharePoint?
- 6:56You're hitting home.
- 6:57Do you like share Excel docs through SharePoint?
- 7:01Yeah.
- 7:02I mean, we use a bit of everything, which is part of the problem.
- 7:05There's historical reasons that it's an Excel spreadsheet or it's emailed.
- 7:08And, you know, consolidating, that's a lot of work.
- 7:10And that's something that we've got people working diligently on.
- 7:13But it keeps things interesting.
- 7:14You know, you learn about tech from the lens of like your big tech companies.
- 7:18And the reality is there's an awful lot of business out there that are not nearly that refined.
- 7:23And so it's a different problem.
- 7:25It's fun, though.
- 7:26I really love my job.
- 7:27Yeah, it's definitely a different problem.
- 7:28I mean, if you're working at Netflix as a data scientist, it would be very different.
- 7:32Or, you know, somewhere like that, right?
- 7:34Just as an analogy.
- 7:35But I do think it sounds really fun to come in and have kind of this blank slate and say, okay, it's 2019.
- 7:42These are the tools we're using.
- 7:44We could easily apply them here.
- 7:46Because it happens to be open source, you don't even have to get budget approved to like buy the $2,000 license for this or that.
- 7:54Like you just say, okay, you know, let me go after it.
- 7:57I'll do it.
- 7:57Yeah.
- 7:57I mean, our analytics team functions basically like a startup inside of a very sizable company.
- 8:03So we have freedom to pick the tech we want to use.
- 8:06A lot of those decisions get to be made sort of last minute on the fly.
- 8:08We get to use whatever the latest and greatest tech is.
- 8:11So it's a lot of fun.
- 8:12Yeah, that's actually, you know, I find those types of environments are really, really good for actually learning a whole lot of technology and techniques.
- 8:20Because you're not dropped into like, well, we already have an enterprise architect.
- 8:25And they say we use this technology.
- 8:27And then we use it in this way and not in that way.
- 8:29Now you go work on a small sliver, right?
- 8:31Like you're there to just explore.
- 8:33And I don't know what it's like for you.
- 8:36But the times I've been in those situations, like people don't really care what technology you're using or how you're using it.
- 8:43If you're showing results and you're like, I've tried these things and look what we're doing.
- 8:46Like last week we couldn't do this.
- 8:48This week we can.
- 8:49That's all they really care about.
- 8:51And they're super happy.
- 8:51Is that kind of the experience?
- 8:52Yeah, I mean, more or less, like you were saying earlier, if you worked at a company like a Netflix or an Uber, you can have a whole data science team, you know, whatever, 10, 20, 100 people dedicated to making tiny incremental improvements to an algorithm.
- 9:05And that might be worthwhile because it's a half percentage point across an enormous profit base, right?
- 9:11And so that might justify it.
- 9:12But in a smaller team, you might have more of the kind of 80, 20 approach where you're trying to get most of the benefit with the least amount of work so that you can touch a lot of different points.
- 9:22Because the surface area of your problem space is just huge compared to how many people you have.
- 9:27As a company grows over time, that dynamic shifts.
- 9:30Yeah.
- 9:30There's like seasons.
- 9:32It's also brings up some sort of team structure issues.
- 9:34Yeah, for sure.
- 9:35Yeah, exactly.
- 9:36Like seasons, it kind of changes as the evolution of the company progresses.
- 9:39Yeah.
- 9:39Cool, cool.
- 9:41So one of the things that we're going to talk about, and I would like to start off the conversation with, you touched on it before.
- 9:47It's really cool to have these libraries and these predictions and all of this tooling in place.
- 9:54But if you can't share it and expose it over, say, like a web service or something like that, then it's not super valuable, is it?
- 10:02No, not at all.
- 10:02So let's talk about your work that you're doing with Flask and data science, right?
- 10:08This is the web dev side of the intersection that I was talking about.
- 10:12Right.
- 10:13Basically, you know, what is a data science application and how is that different from a traditional, quote, web app?
- 10:19The biggest difference is that a data science application is going to have some kind of computational predictive machine learning element embedded into the actual API results.
- 10:28So if I'm purely a front end developer and I'm used to a workflow of building an app, hitting an endpoint, receiving data and displaying it, there's basically no difference between a traditional app and something that's driven by data science.
- 10:41Other than maybe you're cooking up more graphs and visualizations, depending on the context.
- 10:45But from the back end perspective, you're going to be generating these API results, calling some kind of prediction method.
- 10:51And so one of the great things about Python with machine learning, which is, in my opinion, one of the reasons it's become so popular, is that it has scikit-learn, which is a very understandable interface to sort of churn out predictions repeatedly across many different models, many different parameters.
- 11:07And so it makes the kind of plug and play nature of how the data science industry needs to work very friendly.
- 11:14And that means that we can have multiple data scientists trying to solve the same problem.
- 11:18Each have their own models.
- 11:19They can be tuning it.
- 11:20We might combine them.
- 11:21But at the end of the day, we can have some kind of predict method that generates data and that that data can be JSONified.
- 11:28It can be sent back through an API.
- 11:30And so it's really in the nature of the meaning of the data and where it comes from and what problems it's trying to solve.
- 11:37It's really the only main difference.
- 11:39Yeah, for sure.
- 11:40When you're talking about APIs, I suspect consuming them looks very similar to working with the GitHub API or the Stripe API or whatever, right?
- 11:49Yeah, exactly.
- 11:49You've got some authentication.
- 11:50You call some methods.
- 11:52You get a JSON answer back and you say, they recommend this tire or they recommend it's time to buy or not time to buy or whatever, right?
- 11:59Like whatever it is you're trying to predict.
- 12:00Yeah, exactly.
- 12:01When it comes to web applications, though, I suspect that also means bringing in other interesting elements.
- 12:08Like, for example, there's probably more charting and graphing and interactive data display on something that is data science backed than something that's not.
- 12:19You know, like my site that does like training, right?
- 12:22It shows you videos, but I don't think there's a graph on the site.
- 12:25Like there's no graphs, nothing like that, really.
- 12:27Right, exactly.
- 12:28Maybe on some of your like admin dashboards or whatever.
- 12:30Possibly, yeah.
- 12:31It depends on the context.
- 12:32So, for example, we might be making a pricing tool, right?
- 12:36So, let's say you want to do some machine learning analytics to figure out how should I adjust my pricing on different products?
- 12:42Well, the way somebody in the tire industry or the shoe industry are going to handle those problems are very different because they have different problems.
- 12:50So, to pull from tires, there's an enormous number of different kinds of things.
- 12:55And so, it's tens of thousands of things that you might be making a decision about pricing.
- 13:00A human can't understand that.
- 13:01A human can't understand that.
- 13:01But if you make an application that makes it very easy to slice and dice that ecosystem and bubbles to the top the things that are maybe the most egregiously mispriced one way or the other, you allow a human to then make decisions about the important parts of that.
- 13:16But that kind of interaction might not be so meaningful if you're in a product space where there's not so many things and, you know, it's not as hard for a human to make a decision, but you have other problems.
- 13:26So, it's kind of a dynamic business because it very much depends on the context.
- 13:31And that's why the user, their use case matters so much in how you design an app because it's one thing to just solve the same pricing problem twice, but the user experience might be vastly different.
- 13:41And that completely changes the front end that makes it a good product.
- 13:44Sure. And maybe whether or not it should be just a server-side Flask type of application, or maybe you need to bring in some funky JavaScript for interactivity once you pull down the data or something like that.
- 13:54One thing I did want to ask you about is how does hosting and deployment look relative to, like, for a data science web app rather than a standard web app?
- 14:05Like, I know in data science, there's lots of computation.
- 14:09There's often leveraging GPUs, but is that more done in the preparation phase?
- 14:15Like, do you train a model up or something?
- 14:16But then the actual execution of it, it doesn't need any special hardware in the deployment stage?
- 14:22Or what does that look like?
- 14:22Great question. It depends.
- 14:24So, in some cases, you have a problem where the computational load can be done in advance.
- 14:30Great example is image classification.
- 14:32So, Google has trained a number of models that they open source for image classification, like the Inception series of models that you can go download and use them to classify things that they already out of the box know how to do, cats and dogs and things like this.
- 14:46And to get there, Google threw a whole bunch of compute at that, you know, tons of nodes, many GPUs, and it takes a long time to get that model weighted the way it is, get it trained to where it is.
- 14:58But from that point, another data scientist could pick that up where it left off and basically finish out the rest of a model to repurpose it.
- 15:05So, in that case, the data scientist workload is mitigated because Google did some front-end work.
- 15:11But at the same time, you might take that final trained model that data scientist adds their specific use case to, and once that's trained, you might be able to just throw that into a Docker container and then make predictions with it very quickly, trivially quickly.
- 15:24It was the training that was the hard part.
- 15:26So, in this case, you would just Dockerize it and you can deploy the application as is.
- 15:31However, there are other cases where the actual computation you need to do in the web server is where the complexity is.
- 15:38So, for example, I have some apps I've built where they're built around optimizations where you have lots of free variables and the problem that you're solving is completely dependent on the state of the app.
- 15:48You have to do that on the fly.
- 15:50And so, your Python server, your Flask app is now either doing that computation directly or offloading it to some other server via something like a task manager with Celery or some other serverless hook that you've put together, microservice architecture, whatever you're using.
- 16:04There's many different ways to do it.
- 16:06Yeah, yeah.
- 16:06That definitely makes a lot of sense.
- 16:07So, I guess depends is the answer, right?
- 16:10Yeah.
- 16:10It depends.
- 16:11Very interesting.
- 16:12How does serverless fit into the world here?
- 16:16I know serverless is good for async stuff, right?
- 16:18Like, I want to send an email.
- 16:19Like, nobody needs to wait in that.
- 16:20I can shoot off something to say AWS Lambda or Azure Functions and just have it go.
- 16:24How does that work in your world?
- 16:26Personally, serverless doesn't affect me too much.
- 16:29First off, the name serverless, I don't really understand because there's always a server there.
- 16:33It just means serverless in the sense that you don't have to manage partitioning and setting that up.
- 16:39And so, it's a valuable thing, especially if you're more of building like a front-end only type app.
- 16:44You know, if you want to use a Firebase or something, that kind of model.
- 16:47In my case, I came from more of a back-end development side first.
- 16:51And so, I've never had an issue with creating those endpoints myself.
- 16:55And so, I tend to have not needed the serverless model.
- 16:58It's not to say it's not good and useful.
- 17:00It just hasn't affected me very much ever.
- 17:01Yeah, it's interesting.
- 17:02The way I kind of see it the same way as well.
- 17:05And I think it's because I came from the back-end development side first, possibly.
- 17:08So, to me, I think there's a lot of value in serverless.
- 17:12It makes a lot of sense some of the time.
- 17:14But my perception, speaking only for me, if I'm going to build something for me, is I am trading code complexity, an application that has multiple things, all of it going on.
- 17:26It's got to keep running.
- 17:27I'm trading that code complexity for infrastructure complexity, right?
- 17:32I might now have 30 Lambda functions that all have to be versioned and migrated and kept in sync.
- 17:39But they're all separate things up in the cloud.
- 17:41And I have to deal with that somehow.
- 17:43And how do I keep them all running?
- 17:45And so, I always feel like I'm trading code complexity for infrastructure complexity.
- 17:49And I feel like I'm better at code than I am at infrastructure.
- 17:51So, I lean towards not going that way.
- 17:54Same thing with microservices, right?
- 17:56I just feel like I'm better at managing code complexity than DevOps-y infrastructure complexity.
- 18:01So, let me play to that, you know?
- 18:05This portion of Talk Python To Me is brought to you by Linode.
- 18:08Are you looking for hosting that's fast, simple, and incredibly affordable?
- 18:12Well, look past that bookstore and check out Linode at talkpython.fm/Linode.
- 18:17That's L-I-N-O-D-E.
- 18:19Plans start at just $5 a month for a dedicated server with a gig of RAM.
- 18:23They have 10 data centers across the globe.
- 18:26So, no matter where you are or where your users are, there's a data center for you.
- 18:30Whether you want to run a Python web app, host a private Git server, or just a file server,
- 18:34you'll get native SSDs on all the machines, a newly upgraded 200 gigabit network, 24-7
- 18:40friendly support, even on holidays, and a seven-day money-back guarantee.
- 18:44Need a little help with your infrastructure?
- 18:46They even offer professional services to help you with architecture, migrations, and more.
- 18:50Do you want a dedicated server for free for the next four months?
- 18:53Just visit talkpython.fm/Linode.
- 18:56Totally get it.
- 18:59I think Docker is really the game changer there because nowadays,
- 19:03if you can throw it into a Docker container, there are services like Google App Engine
- 19:07or AWS Elastic Beanstalk where it can sort of transparently scale up and down.
- 19:12And yes, of course, there's differences between Lambda and those services.
- 19:15But at least as far as I have found, you can get pretty far just by having Docker
- 19:21and using whatever managed service on top of that to handle your kind of auto scaling.
- 19:24Yeah, that's cool.
- 19:25Docker is nice because you can do basically anything that Linux can do.
- 19:28Right.
- 19:29You don't have the restrictions like...
- 19:31Yes, which makes me happy.
- 19:31Yes, it has to run within 30 seconds or 10 seconds or whatever it does for service.
- 19:36And you can only do work with these dependent...
- 19:39Like you can do whatever you want, right?
- 19:40You need to install some like C library.
- 19:43It doesn't matter.
- 19:43Absolutely.
- 19:44Do you use Docker much for your work?
- 19:46Yes.
- 19:46Oh, yeah.
- 19:47Both myself and my team, we Dockerize anything that we can Dockerize pretty much.
- 19:51It just makes life so much easier.
- 19:52It's easier deployments.
- 19:54It's easier going from a VM to something like App Engine if you're on Google Cloud or whatever
- 19:59your service is.
- 19:59The installations, especially with some of the data science libraries that we're using,
- 20:03for example, CVXPy is an optimization framework, and it has some potential gotchas with compiling
- 20:10it.
- 20:10Putting that in a Docker container solves that problem.
- 20:12I don't have to worry about some obscure GCC version on the Linux box I'm deploying to
- 20:16or my Jenkins server if I just have it in Docker.
- 20:19So I'm a huge fan.
- 20:20Yeah, you get it working once and then you just never have to touch it again.
- 20:24You containerize it and you just say, I depend on that.
- 20:26That works.
- 20:27And your team can have one guy who's good at it.
- 20:29You know, everybody doesn't have to learn it because it's a super copy-pastable kind of
- 20:33thing.
- 20:33Yeah, yeah, absolutely.
- 20:34What I found interesting about Docker was as I learned to create the Docker files and
- 20:39build the images and containers and whatnot, it's like, well, what you really need to know
- 20:44is Linux, right?
- 20:46Here's a bunch of commands that you're issuing to configure Linux.
- 20:49It just happens to be you issue them in a Docker file format rather than on the terminal
- 20:55association.
- 20:56But it's basically like the complexity is not Docker.
- 20:59The complexity is Linux.
- 21:01And if you're comfortable with that, then Docker is actually a small step.
- 21:04Yeah, exactly.
- 21:05So do you use something like Swarm or Docker Compose or Kubernetes on top of that?
- 21:10Yeah, so generally for those kinds of things, we're either going to be using Kubernetes,
- 21:15but a lot of times we'll just operate within App Engine just because it's so simple.
- 21:20If you get your Flask app, whether it's a single application or whether you've got a front and
- 21:25back end separately, you Dockerize it, you can push it to App Engine, and then it will deal
- 21:29with scaling it up, down, making sure it stays up.
- 21:32And then you can also add rules on top of it, like for static files that they'll map to some
- 21:37internal Nginx configuration you never have to deal with.
- 21:39That works pretty well.
- 21:40But Kubernetes, if it needs to be a full cluster or integrated microservices, for sure.
- 21:44Yeah, yeah.
- 21:45Like they've got to talk to each other.
- 21:46That's where it gets complex with Docker.
- 21:48All right.
- 21:49Thanks for the diversion.
- 21:50Yes.
- 21:50That was interesting.
- 21:50So if I'm building a data science web app, I would say, you know, if you went out to the
- 21:56street and just started interviewing random people where all these people were knowledgeable
- 22:00about data science, they would probably say like, well...
- 22:03I want to live there.
- 22:03Yeah, for sure.
- 22:05So probably the first thought or the most popular answer of like, how do I take my
- 22:09data science stuff and present it on the web?
- 22:11It would be Jupyter Notebooks.
- 22:12What do you think?
- 22:13Yes.
- 22:13I have such a love-hate relationship with Jupyter.
- 22:16And I think other data scientists and my team would hate me for saying this, but Jupyter
- 22:20Notebooks just cause a lot of problems.
- 22:22They are super great for interactive data science, exploratory analysis, initial data cleansing
- 22:29and whatnot.
- 22:29They're great.
- 22:30But for anything you need to pipeline, productionalize or make repeatable, the native Jupyter Notebook
- 22:36space just doesn't really work very well.
- 22:38I mean, how many...
- 22:39I guarantee you, if you're listening to this and you have shared a Jupyter Notebook with
- 22:43a team before, you've gotten one back at some point that you ran and it immediately errors
- 22:47out because you don't have some file or whatever.
- 22:49Just make sure your Jupyter Notebook runs start to finish.
- 22:53So yeah, you're right, Michael.
- 22:55Jupyter Notebooks and apps are very different.
- 22:57And how you kind of connect those thoughts to production is not trivial.
- 23:02Yeah, it took me a while to appreciate Jupyter Notebooks and just the whole notebook style
- 23:08of programming.
- 23:08Because to me, coming from a more app building type of software development, like I was all
- 23:15about having different files for the different purposes and like factoring an app.
- 23:21So like the data access stuff is over here and then I can test this part and I put them
- 23:25together and then here's the app.
- 23:27And when I looked at Jupyter, I'm like, all that stuff is missing.
- 23:30I mean, even to some degree, like a lot of times, even functions are missing.
- 23:33And that like kind of made me a little, gave me the willies a little bit.
- 23:38But then, you know, I saw people...
- 23:39Yeah, how do I modularize?
- 23:40Exactly, right?
- 23:41Like how do I, how is this maintainable, right?
- 23:43So...
- 23:44Unit test it, yeah.
- 23:45Yeah, exactly.
- 23:45So, but then I saw people working with it and I'm like, they're just working differently.
- 23:49They're solving different problems than the problem I'm trying to solve.
- 23:53And the notebook space makes more sense for them.
- 23:57But to be able to push it actually into full production, I don't know, it's, it doesn't
- 24:02seem like really necessarily the right answer.
- 24:04There are some projects trying to leverage notebooks for production that are pretty interesting.
- 24:12I want to ask you if you had any experience with them, not saying that I would recommend
- 24:16like ditching flasks to use them, but they are interesting.
- 24:18Things like Paper Mill, have you seen that?
- 24:20Yes, I think Paper Mill is exactly the kind of solution to the problems because it kind
- 24:25of hammered on Jupyter Notebooks.
- 24:27I'm actually a big fan of them.
- 24:28It's just that it can be misused.
- 24:30And what Paper Mill does is it provides you a way to parameterize your notebook and then
- 24:35execute them in a more programmatic way.
- 24:38And if nothing else, this forces the developer of the Jupyter Notebook to kind of think about
- 24:43abstracting parameters out where it makes sense.
- 24:45Right.
- 24:46What are the inputs?
- 24:47What are the outputs?
- 24:47And it makes it a lot easier to productionalize these things.
- 24:51Yeah.
- 24:51There's an interesting article I'll link to from Netflix, how they're using Paper Mill to
- 24:57sort of productionalize their Jupyter stuff and do a lot of data science still with the notebooks.
- 25:03But yeah, I would say like, if you really want to put something online and really make it
- 25:07accessible, right?
- 25:08You need an API or at least a website is probably the final end game.
- 25:14What do you think?
- 25:15Yeah.
- 25:15But I think that, I mean, whether or not it's Paper Mill, I think some kind of integrated tooling
- 25:20is going to be the solution.
- 25:21Whether it's something that makes it easy to go back and forth between notebooks and Python
- 25:26files or whether it's a Paper Mill or something like that.
- 25:29I think that where that will take you is a place where it's simpler to move from the data science
- 25:34that you're doing in the notebook to production, because we also can't just say, oh, well,
- 25:38you do your exploratory analysis in a Jupyter notebook and then we productionalize it,
- 25:42which is a whole scratch rewrite.
- 25:44Like that's a huge waste of time.
- 25:45And so you have to sort of trade off how painful is it to refactor this versus how easy is it to
- 25:52just kind of build a tool that can make those dots connected for you.
- 25:55I think eventually we'll land on something that's kind of an integrated workflow and that's
- 25:59going to get picked up very quickly because of how beneficial that time save is.
- 26:02Yeah.
- 26:03It's going to be pretty interesting.
- 26:04Now, I do think one of the challenges that people run into in the data science space is
- 26:11incredible growth of Python really does have a lot to do with data science.
- 26:15And I think that's because Python itself appeals a lot to people who are not necessarily programmers
- 26:22first, but they use programming to do something else amazing, right?
- 26:26Like a biologist or a physicist or a statistician or something.
- 26:29But it also means like a lot of folks come without necessarily a rigorous software engineering
- 26:38background.
- 26:39That's not a dig against them or anything negative.
- 26:41It just happens to be like we all come from different perspectives.
- 26:44But I do feel like there's probably a lot of teams and folks I talk to, it seems like
- 26:48they could use a little bit of help or some pointers on taking things like testing and maintainability
- 26:57and factoring.
- 26:58And you talked about continuous integration and whatnot and all that into their workflow.
- 27:03What are some of the software engineering techniques you think data scientists should pay attention
- 27:08to?
- 27:08Number one is testing.
- 27:09Why do we care about unit testing?
- 27:12And I like to tell people that testing is actually important mostly for refactoring purposes.
- 27:19It's actually a side effect of writing tests that you verify that your code works.
- 27:23So what I mean is that, you know, if I have my test built and I've got good coverage and I've
- 27:28got the little auto reloader over and every time I change something, hit control S to save it
- 27:33and I get those little dots, I can be extremely aggressive with coming in and just gutting
- 27:37whole parts of the app and changing them around because I know I'm backed by those tests.
- 27:42And I can't tell you how many times I have done a refactor that would either have taken a long
- 27:47time to piece by piece change it and make sure nothing broke or simply would have just not done
- 27:52because it was like, oh, I don't want to touch that because it's going to be super painful.
- 27:55So testing is one.
- 27:57And along with that comes sort of how you write code, because if you're writing code
- 28:01for tests, you will do things like lift variables up or abstract things out to be either a dependency
- 28:08injection type flow.
- 28:09Yeah.
- 28:10You'll think about small functions versus large functions because large ones are super hard
- 28:14to test.
- 28:15What you'll see, and this is not a knock on people who are not quote software engineers,
- 28:19but you get these big long functions and then somewhere embedded in the middle is like a
- 28:23hard coded call to some API and the endpoint and credentials are buried in there.
- 28:27And maybe in source control.
- 28:28And it just becomes very difficult when you want to come in and change something, which
- 28:32inevitably, you know, your client wants you to do.
- 28:35And you come in there and you're like, oh man, this is such a mess.
- 28:37It's going to take me a while to dig myself out.
- 28:39Whereas if you take a little bit more time to set yourself up from the beginning, it just
- 28:43flows way faster.
- 28:44Yeah, for sure.
- 28:45So if I had to pick one or two, it's those, but I could go on and on about design patterns
- 28:49and whatnot, but I'll cut it there.
- 28:51Yeah, no, that's good advice.
- 28:53The one I see also often missing is like proper source control.
- 28:57Maybe, I don't know.
- 28:58It depends on the team, right?
- 29:00But if they're like mostly scientists who are started, you know, like leaving MATLAB and
- 29:05going into say Jupyter and Python, like source control.
- 29:08That's actually a good point.
- 29:10And I almost feel like source control gets overlooked as being just assumed that you know it, but
- 29:16very interesting.
- 29:16Most people coming fresh out of school, you know, they've only seen a limited amount of
- 29:20exposure to it, but you're completely right.
- 29:23It's a huge part of it.
- 29:24I actually am extremely interested in Git as a separate aside.
- 29:27You know, I kind of, our Slack channel, we have run a Git tip of the day.
- 29:30So you can look at some of the blogs that we'll link.
- 29:32We've actually published a couple of those just to kind of as a way of keeping everybody's
- 29:35brains fresh on source control.
- 29:37Or how do I revert this branch in a particular way?
- 29:40Or what is Git ref log?
- 29:41And so I completely agree.
- 29:43If you're fluid in source control, it's also a big time saver.
- 29:46Yeah.
- 29:46Well, I mean, all these things go, like everything we're touching on goes really well together.
- 29:50Testing so that I can change my code, writing code that is testable and easy to maintain
- 29:56so I can have these tests.
- 29:57And then having source control so that I can, you know, like commit it and tag it and then
- 30:02go crazy and go, you know what?
- 30:03It was a horrible idea.
- 30:04We're either dropping this branch or we're rolling it back and we're going to skip over
- 30:09this bit or whatever, right?
- 30:10Like even if you forgot to branch, you can still go back to your last commit or a couple
- 30:15commits back.
- 30:15Yeah.
- 30:16They all kind of hit at the same core essence.
- 30:19Yeah.
- 30:19And then you add your CI/CD on top of that.
- 30:21And now you've got it.
- 30:22So when every time I push changes or whatever circle or Travis or Jenkins grabs it, builds
- 30:27it, pushes it out.
- 30:28And I can be deploying five, 10 times, a hundred times a day.
- 30:31Model works extremely well.
- 30:33You catch bugs more quickly and you're not afraid to change stuff.
- 30:35Yeah, for sure.
- 30:36Cool.
- 30:37That's good advice.
- 30:38So when we're building these apps, I have a pretty good sense for when it makes sense
- 30:42to have, say, one of these JavaScript rich web apps.
- 30:48I'm thinking of AngularJS, React, VueJS, something where like a lot of the application logic is actually
- 30:56written in JavaScript.
- 30:57And then there's a bunch of services probably written in Python that you're talking to behind
- 31:02the scenes, like we were talking about with Flask.
- 31:05I have a good sense for when that maybe makes sense versus when a more server-side backed
- 31:11framework, Flask, Pyramid, Django, something like that.
- 31:14You can just stick with that and not add that extra complexity.
- 31:18I always feel like there's a little bit of glitchiness in the front-end apps somewhere and
- 31:23some setup with some plugin or whatever.
- 31:26But I do feel like there's actually a tendency for people to assume they need more JavaScript
- 31:31than they actually need.
- 31:32And they need these front-end frameworks more than they actually need.
- 31:35Like you can go a long way with the server-side framework, but there are times.
- 31:38So maybe what are your thoughts in the data science web space around that?
- 31:43It's a good question.
- 31:44We do both.
- 31:45There's a time and a place for both kind of the single Flask app that does both the front
- 31:49and the back end.
- 31:49And then when you need to bring JavaScript in, the biggest thing that JavaScript gives
- 31:53you, and it's the whole magic of the web really, is the interactivity.
- 31:57So if you've got, from a data science perspective, some kind of application that's maybe kind of
- 32:03like a dashboard where you've got a number of visualization widgets and maybe you change
- 32:06something and it re-aggregates data and it's responsive.
- 32:10That kind of thing really sings as a JavaScript app, whether it's React, Angular, whatever you,
- 32:16jQuery, whatever you use.
- 32:17When it's more of sort of static content, you know, a blog or a report or some kind of anything
- 32:23even that could be served with just a SQL query.
- 32:25Right.
- 32:26Even if it's data-driven, it's like not static per se.
- 32:28But once it hits the page, you don't need it to be interactively changing unless you like
- 32:34open another page, right?
- 32:35Like here's a list of things and I click on the book and I have the book details, right?
- 32:38Like all that doesn't need any JavaScript, probably.
- 32:40Yeah.
- 32:41And since sometimes those lines get blurred because what happens if that SQL query is either
- 32:46really complicated or it returns a huge number of rows, I still kind of want to interact with
- 32:51on the front end.
- 32:51Maybe I want to paginate it.
- 32:53Right.
- 32:53Filter it or something.
- 32:54Yeah.
- 32:54Going back to the server, I'd have to run that huge heavy query.
- 32:56Well, that's not great.
- 32:57But if I also have to fit a bunch of data into the browser, that might not work.
- 33:01So where do I put that pagination is now not always trivial.
- 33:04And so those kinds of things tip the decision, whether you want to go JS or pure Python.
- 33:08Well, yeah, probably also heavily depends on your team, right?
- 33:11If you have a bunch of people and they just love Python and they don't want to touch JavaScript,
- 33:15like saying, you know, it's probably better if we do this in JavaScript and we just force
- 33:20everyone to now do JavaScript.
- 33:21Like that might not actually be better given the people working on it, right?
- 33:26Like it's, I think the team's desires and capabilities also should be considered, right?
- 33:31Yeah.
- 33:31Because data scientists typically don't know JavaScript, right?
- 33:34They know Python and depending on their background, they might have some exposure to HTML, CSS,
- 33:39but you can't really depend on it.
- 33:41You can depend on Python or R and hopefully SQL.
- 33:44So sometimes it's just the nature of who's going to be working on this project.
- 33:48They might choose the technology that fits.
- 33:50So it might be, this is Python only because I'm really good with Jinja.
- 33:52So I'm going to use those.
- 33:54And it might be that we've got dedicated front end engineers who are really good with JS and
- 33:57we put them on those heavier interactivity type projects.
- 34:00And so it's, it's, it's also very much about sort of where your team's at.
- 34:04We're, we're a small team.
- 34:05And so you kind of play to your strengths.
- 34:07Yeah, that's definitely a good idea.
- 34:08One of the ways you can add interaction to these apps and not go and write all that stuff
- 34:15in D3 or HTML5 Canvas and JavaScript, God forbid, is to use something like Bokeh or Plotly
- 34:23or some of these other interactive stuff.
- 34:25There's like things you can add to your site as well that may get you close enough for this
- 34:30exploration.
- 34:31What do you think?
- 34:32This stuff is magical because it unlocks that interactivity that I was saying is so good about
- 34:37the web to people who don't know JavaScript.
- 34:39So Bokeh is a great example.
- 34:41Plotly is also a one that I'm a big fan of.
- 34:43Plotly is nice because the charts that you create in Python are serializable to JSON.
- 34:48That's actually how it renders it into JavaScript eventually.
- 34:52But if you interact with Plotly within JavaScript itself, it's the same data structure.
- 34:57And so it plays very nicely when we have pure web devs and pure data scientists that they
- 35:01can both interact with the same objects.
- 35:03So I'm a big fan of Plotly.
- 35:05There's also a cool project called Dash.
- 35:07That's part of the Plotly umbrella.
- 35:09I don't know how you'd call it that.
- 35:10That is a declarative way to create dashboards and visualizations that actually renders into
- 35:16a React app.
- 35:17So the internals are pretty cool.
- 35:19You create this layout, serializes it, and there's a React app that generates that into
- 35:23charts.
- 35:23So that's another cool way to unlock sort of interactivity.
- 35:26You can hook up widgets and whatnot.
- 35:27So those kind of ecosystems and tools, I see more and more of that.
- 35:31I think it's a great place to go again because it just enables people.
- 35:35Yeah, for sure.
- 35:36I think that's one of the things that you learn as you progress in software development
- 35:39is we probably all had the experience of, I had this problem.
- 35:44I wrote all this code to solve it.
- 35:46And then I realized there was a library that would solve it in two lines.
- 35:49And it took me a week to solve it.
- 35:51Like there's all these things you can find and add in.
- 35:53I guess the challenge there is knowing when adding in something like that will get you 80%
- 35:59of the way there and there'd be a complete pain trying to finish it.
- 36:02Or is it going to be good enough and you'll be happy with it?
- 36:05You know, like that's a real challenge, I think.
- 36:07But a lot of these data science visualization tools you can drop into your website do seem
- 36:12really nice.
- 36:13Yeah, that's honestly one of the biggest things I think that makes experience matter is knowing
- 36:18when do I look for another tool?
- 36:20When should I pay for something?
- 36:22When do I roll my own?
- 36:24Or when do we go with the 80-20?
- 36:25And you can over-architect things to the point where nothing gets done.
- 36:30And then on the flip side, you can create this spaghetti monster mess that's completely
- 36:33unmaintainable.
- 36:34And I think being pragmatic is the biggest thing you hope to get with experience.
- 36:38Yeah.
- 36:39And coming back to what you were touching on before, if it's testable, maintainable, and
- 36:43you can evolve it quickly, you can make one choice and then change your mind, right?
- 36:49Because it's easy to change.
- 36:50Because you have the test that'll tell you, no, it's not actually broken yet.
- 36:53And things like that, right?
- 36:54There's also that aspect of it, I think.
- 36:56Yeah, you're paying for technical debt, basically.
- 36:59And if you write unit tests and all these other things, you're getting rid of that.
- 37:02You catch up later.
- 37:05This portion of Talk Python To Me is brought to you by Rollbar.
- 37:08Got a question for you.
- 37:09Have you been outsourcing your bug discovery to your users?
- 37:12Have you been making them send you bug reports?
- 37:14You know there's two problems with that.
- 37:16You can't discover all the bugs this way.
- 37:18And some users don't bother reporting bugs at all.
- 37:21They just leave, sometimes forever.
- 37:22The best software teams practice proactive error monitoring.
- 37:27They detect all the errors in their production apps and services in real time and debug important errors in minutes or hours, sometimes before users even notice.
- 37:35Teams from companies like Twilio, Instacart, and CircleCI use Rollbar to do this.
- 37:40With Rollbar, you get a real-time feed of all the errors so you know exactly what's broken in production.
- 37:46And Rollbar automatically collects all the relevant data and metadata you need to debug the errors so you don't have to sift through logs.
- 37:53If you aren't using Rollbar yet, they have a special offer for you, and it's really awesome.
- 37:57Sign up and install Rollbar at talkpython.fm/Rollbar.
- 38:01And Rollbar will send you a $100 gift card to use at the Open Collective,
- 38:06where you can donate to any of the 900-plus projects listed under the Open Source Collective or to the Women Who Code organization.
- 38:14Get notified of errors in real time and make a difference in open source.
- 38:17Visit talkpython.fm/Rollbar today.
- 38:20You recently wrote an article called Flask Best Practices, Patterns for Building Testable, Scalable, and Maintainable APIs,
- 38:29really from the perspective that we're coming from here, from the data science side of things, but also the web developer side.
- 38:37So maybe we could touch on that a little bit.
- 38:38Sure.
- 38:39So the idea with that blog post was for structuring these kind of applications, you know, Flask is very unopinionated, which is great.
- 38:47You know, it's kind of like in the front end world, you have this sort of React versus Angular, and there's also Vue, but a lot of discussion between those two.
- 38:54And one of the biggest differences, React is very unopinionated and kind of call it plugin-based.
- 39:00And then Angular is full weight and sort of opinionated, but kind of has all the bells and whistles included.
- 39:06And in the Python world, Flask kind of fits that sort of plug-and-play type thing, where you have the freedom to make all of these decisions and do things the way you want, but you also have the burden to make all these decisions and do things the way you want.
- 39:18And so it can cut both ways.
- 39:20One of the things that's always bugged me about Flask is I felt like it was presented artificially simplistic.
- 39:28And what I mean by that is like, they always, Django is super complicated.
- 39:32And look at all the stuff you do for Pyramid with this cookie cutter thing.
- 39:35But what you get, you just, for Flask, you just create one file, app.py, you create the app, you put app.route, one function, boom, we're done.
- 39:43And that's true, it does say hello world on the screen, but like, that's not maintainable.
- 39:47That's not how real apps work.
- 39:48They get big and complicated.
- 39:49And like you were saying, there's just an absence of any guidance on the next step, right?
- 39:57How does that not become a 4,000 line app.py?
- 40:00Well, that's what happens.
- 40:01I mean, Armin Roneher is very humble.
- 40:04So he tends to give talks and basically downplay Flask and say, look how simple it is.
- 40:08But you can build big systems with it.
- 40:11You just have to make the right decisions.
- 40:13And because there's not a whole lot of direction out there, you do end up with these multi-thousand line monstrosities that, you know, you end up having to control F for whatever endpoint you're hitting.
- 40:23And it's very difficult to sort of grok.
- 40:24And yeah, so this blog post is basically, after having tried a lot of different things and having some sort of core philosophies like testing that I needed out of the end product.
- 40:34It was a pattern that I landed on that we tried for several months.
- 40:39And it really sung.
- 40:40I'm very happy with it.
- 40:41And so this blog post is basically kind of just sharing that experience because it was working within a team on a code base that was a mixture of Python, TypeScript, JS, all this kind of things.
- 40:51Yeah, so you basically talk about a set of tools, a way of organizing all the files that you actually have on real actual Flask apps, like data access layers and models and whatever, right?
- 41:02Test files and whatnot.
- 41:04The structure is really interesting.
- 41:05I think it's especially good for APIs.
- 41:08It's not the structure that I use for my website, but I do have a very structured way that like kind of has similar goals to what you have.
- 41:15So maybe we could just start first talking about this with some of the packages.
- 41:19So you have Flask, obviously.
- 41:21pytest is pretty de facto these days.
- 41:25SQLAlchemy, I think, is probably the most common ORM if you're going to talk to a relational database.
- 41:29What? There's another one?
- 41:30There are.
- 41:32You know, we got PeeWee ORM and some other interesting little ones.
- 41:36Oh, yeah, yeah, yeah.
- 41:37I know.
- 41:37Yeah, I know.
- 41:38But yeah, you have to choose, though, right?
- 41:40With Flask, you've got to go look them all up and decide, right?
- 41:43Django is just Django ORM or whatever.
- 41:44But then some other interesting ones, you have Flask REST+, which is interesting.
- 41:50You have Flask Accept and also Marshmallow.
- 41:53So maybe touch on some of the other ones like Marshmallow, Flask REST+, and so on.
- 41:59Well, specifically, I wanted to integrate these things.
- 42:02So Marshmallow is not really outside of Flask.
- 42:06It's a serialization and deserialization library.
- 42:08And so it has a really rich way of declaring that there are these fields and they have a
- 42:14certain type.
- 42:15And some things might be required, some not.
- 42:17Some might have defaults, some might not.
- 42:19And furthermore, it gives you all these hooks for it.
- 42:22Yeah.
- 42:22So I give you like a Python dictionary, which may be originated from a JSON file.
- 42:26And then Marshmallow will answer the question like, is this valid data?
- 42:30Something like that?
- 42:31Exactly.
- 42:32And if it's not, it will give you good error messages.
- 42:35So let's say you give me a JSON file.
- 42:37You post it to my server and I've declared that I want to make a widget.
- 42:41And a widget has these fields that I declare with the Marshmallow schema.
- 42:44I call it the load method and it will take the input data and create either a dictionary or you
- 42:50can give it a hook to create some kind of actual Python class.
- 42:53And if one of those input fails validation, it gives you a really nice error message that,
- 42:57oh, this is not a valid int.
- 42:58And so on the front end, the front end devs, it really helps them out because they say, oh,
- 43:03okay, AJ's schema has kicked back an error because I'm passing a float instead of an int or whatever
- 43:08it is.
- 43:08So there's Marshmallow.
- 43:10And then it also does the serialization on the way out.
- 43:13So for example, you have a user model that has a password.
- 43:17You probably don't want to send the password back to the front end.
- 43:21So you can set certain fields that are, you know, read or write only to solve that kind of problem.
- 43:26So it's very flexible.
- 43:27It's on the flip side.
- 43:29There is Flask REST plus, which I was very excited about, which basically just makes it easier to write
- 43:36endpoints where you're going through the full, you know, get post put delete flow,
- 43:41because otherwise you're writing a raw Flask endpoint.
- 43:44You have to sort of declare the methods it takes and effectively do a switch case on that.
- 43:48But with Flask REST plus, you create these resources that are class-based and you put the methods that
- 43:53they need for each of the different type of HTTP protocols.
- 43:56And it just makes it less code.
- 43:58And so combining these two though was not trivial because on one hand, Flask REST plus has its own
- 44:06validation scheme that although they declare is going to be deprecated,
- 44:11it doesn't seem like that's ever actually going to happen.
- 44:12They even referenced that we're deprecating this because we would like to switch to Marshmallow.
- 44:17But if you look through the Git history, there's years of conversation where they're like,
- 44:22eh, well, it's kind of hard and we've got this and that problem.
- 44:24Sure.
- 44:24And so I'm sort of at this frustration point where I want to use both of these cool technologies.
- 44:29And so Flask accepts is a library.
- 44:32It's just a couple of decorators really that allows me to unify REST plus and Marshmallow.
- 44:37Because what REST plus gives you in addition to those resources is Swagger docs.
- 44:41And the Swagger docs allow it to turn your API into a webpage that I can go to and it shows me all the endpoints and I can interactively hit them.
- 44:50Basically, it's like almost imagine if you had some kind of export config that would let you load into Postman and it just pre-populated every one of your endpoints with a click and it would just hit them with the right parameters and whatnot.
- 45:03And so in order to get both of those, this Flask accepts library allows you to sort of mix the two.
- 45:09So you would just have an endpoint.
- 45:11You put this accepts decorator, give it a Marshmallow schema.
- 45:14It will apply that validation on the way in, attach something to the Flask request object that you can then go on your merry way and use.
- 45:20And it also supports those Swagger docs.
- 45:22Yeah, it looks really nice.
- 45:23And this Flask accepts is something that you wrote because of your work with Marshmallow and Flask REST plus.
- 45:30And you're like, these need to live better together, right?
- 45:32Yeah, it was purely a personal pain point.
- 45:34And I wrote it over like a weekend to solve a problem I had at work.
- 45:38And naturally then since it's 2019, you open source things.
- 45:42Yeah, it's cool.
- 45:43I don't know if people will find it useful or not.
- 45:45There's other things, but it solves my problem.
- 45:47Yeah, super.
- 45:47So those are all really good.
- 45:49And you talk about those in there.
- 45:50One other thing I want to throw out there is people are just thinking about their Flask, like a new Flask project potentially is secure.py.
- 45:59So there's a lot of recommendations from OWASP and other web security companies and organizations saying, you know what?
- 46:05You should really add the header XSS protection and turn it on and set the mode to block.
- 46:12Or the iframe option should by default be set to same origin so nobody can embed you into their sites and make it look different or whatever.
- 46:20So like with one line of middleware for Flask, Pyramid Django and a whole bunch of others, you can just add this thing and it'll automatically add all those headers.
- 46:27So that's pretty cool.
- 46:28So if you're security conscious, that might be worth checking out.
- 46:31Yeah, I think especially with security, it's really smart to delegate that to third parties and allow them to be the experts because it's a full-time career to keep up with that.
- 46:41And every day there's some new hack people come out with and just delegate that stuff.
- 46:45Yeah, and you'll sleep slightly better.
- 46:46Yeah, slightly better.
- 46:47Slightly.
- 46:48Like it's no fantasy, but it's better than not.
- 46:51You wake up for other problems.
- 46:53Exactly.
- 46:53So we don't have a whole ton of time to spend on this, but I do want to talk just a little bit about this and then touch on some high-performance computing bits as well.
- 47:01But maybe give us a quick overflow of how you're structuring your Flask app because I think it's, like I said, it's different than what I'm doing and it's a little bit unique and people can think about whether it makes sense, but I think it's definitely worth considering.
- 47:13What are you doing there?
- 47:15And you were right that this is kind of more thought about from an API perspective.
- 47:18So if you're doing a lot of view rendering, this is not directly the same approach.
- 47:22But in essence, the philosophy is you want to be able to break up each of your, call them entities, it's a thing you're going to interact with from the server, into separate directories.
- 47:33Like this is the core tenet of your idea of organizing your code and your files and whatnot.
- 47:38And the reason I think this makes more sense for APIs than it does for apps is APIs are often centered around these entities, right?
- 47:46Like I want to go talk about the users or talk about these, right?
- 47:50Like this is like the essence of what APIs do often.
- 47:53Yeah, but I mean, even if I were to go set up a site that was more view-based, I would still think about it this way in the sense of if I had some kind of module that was like my users, I'm still going to change each of the pages maybe within the users module to be their own single folders.
- 48:08Yeah, I agree.
- 48:09So go ahead and tell us about this.
- 48:11Yeah, so the idea that you have a model, which is basically probably your SQLAlchemy layer, you know, your persistent storage.
- 48:17You have some kind of interface that we called it an interface.
- 48:21It's because it is basically what a TypeScript interface is.
- 48:23So it defines the type, what are the attributes that need to make this object?
- 48:28And there's a whole discussion there around why typing is super beneficial.
- 48:33So there's great tools out there like mypy and static analysis tools, and they save you an enormous amount of bug finding by highlighting errors where you've typoed something or missed a parameter.
- 48:44And so that gives you a layer to sort of make sure that your functions are behaving the way at least you're using them the way you've defined them.
- 48:50There's the schema, which is the marshmallow schema that I referred to.
- 48:54And so that handles the serialization layer on the way in and out of the application.
- 48:59That's where you can do last minute transforms, change names, export things, pick fields off, whatever.
- 49:05There is the controller.
- 49:08The controller is what's response.
- 49:10It's actually is the route.
- 49:11The controller, the way I think about it is it takes all these other pieces, and it kind of is the glue.
- 49:16It gets the parameters, calls the service, which I'll discuss in a second, gets the data, wrangles it, and outputs it.
- 49:23And then lastly, you have the service, which is what's responsible for actually manipulating the entity.
- 49:29Now, whether the entity is like a user you're storing your database or whether it is the result of some optimization calculation, it doesn't really matter.
- 49:36It's just a way for you to organize all this code.
- 49:39And then internally, you can use Pandas or NumPy or C++ or whatever, just how you think about it.
- 49:44Because the last place that those database queries or those Panda calculations should be is like in the route view method.
- 49:52Under your route, yeah.
- 49:54It shouldn't be crammed in there.
- 49:55It should be separate.
- 49:56The route should be pretty simple, right?
- 49:57Yes, exactly.
- 49:58You know, five, ten lines.
- 49:58It should be orchestration.
- 50:00Get the data call service.
- 50:01Exactly.
- 50:01It should be orchestration between all these other pieces is the way I see it.
- 50:04Yeah.
- 50:04Cool.
- 50:06And then tests go alongside with that.
- 50:08Yeah.
- 50:08So your main philosophy here is that instead of having a services section and a controller section and a data section and whatnot,
- 50:16is to have like a user section with a service controller model kind of in its own self-contained area, right?
- 50:25Yes.
- 50:26So how long would it take you to delete everything related to users?
- 50:30There's basically your sanity check.
- 50:32If you've got to go through and dig eight trees down into every other directory and find it, you're not compliant with what I am proposing.
- 50:39Okay.
- 50:40Yeah.
- 50:40It's an interesting article and people can check it out for sure.
- 50:43The gory details.
- 50:44Yeah.
- 50:44Yeah, exactly.
- 50:45But I definitely think, you know, if nothing else, like FlashRest Plus, Marshmallow, all these things are pretty interesting.
- 50:54And it's cool to see how you're putting them to use there.
- 50:56Great.
- 50:57So let's talk a little bit about computation.
- 50:59You know, I touched on this at the beginning when I said, like, what is the deployment story, right?
- 51:03Do I need to like deploy to a cluster that has GPUs because I got to have GPUs in production or something like this, right?
- 51:10Let's talk a little bit about that.
- 51:12I mean, I think one of the things that's interesting to just touch on first is Python performance.
- 51:17Like people will tell me sometimes, usually they're not Python people.
- 51:21They'll tell me Python is slow.
- 51:23So I can't use Python for X, right?
- 51:26The performance story of Python is actually complicated and it depends, right?
- 51:32Like, yes, maybe this part of Python, if I wrote it in pure Python is slower than, say, Java.
- 51:37But if I were to write it in C, it would actually be faster than Java.
- 51:42And so I could actually do something like a Cython version of this code, which then, you know, maps over to C++ or C and then compiles down to native instructions.
- 51:53So is it fast or is it slow?
- 51:55I don't know.
- 51:55Like it's like this blend.
- 51:57And so you can do a lot of tricks to make it fast where it matters.
- 51:59Use things like NumPy and whatnot.
- 52:01But maybe like, like, how do you see that world from somebody who does way more computation than I do?
- 52:05Right.
- 52:06This whole topic of HPC, high performance computing is something I'm super passionate about.
- 52:10It was my whole grad experience.
- 52:12As far as Python's performance, you should compute from Python, but not with Python.
- 52:17So Python is slow.
- 52:19If you're talking about doing numeric computation in Python, you should invoke Python libraries that push that computation down to C.
- 52:29So, I mean, I write loops all the time.
- 52:32But anytime you're writing a loop to accomplish something that has a lot of IJs and Ks in it, you should at least kind of get the heebie-jeebies and think maybe there's a NumPy or Pandas method that's going to push this down to a C or C++ layer that's super fast.
- 52:45Right.
- 52:45And if there's not, could you make that one function a Cython function and really change it, right?
- 52:51Right.
- 52:52Yeah.
- 52:52So Cython's the way to go if you have a custom operation that you want to do that you can't do out of the box with NumPy.
- 52:59Because basically all you do is you provide a set of annotations to create the Cython file and then you run a transpiler that converts that into valid C, C++, and then brings that back into Python.
- 53:11Because Python, if you don't know, is ultimately written in C.
- 53:14So this kind of gives you a way to write Python and compile it and then bring it back in.
- 53:19Or you could also just write directly in C++.
- 53:22And that's kind of what you have to do if you want to do custom computing with GPUs.
- 53:27You're almost, and again, unless you're using a library that enables GPU routines, if you're doing custom stuff, you're going to have to go to the C++ level and bring in like a shared library or something like that.
- 53:39At that point, it's pretty much unavoidable.
- 53:40Yeah.
- 53:40It's interesting.
- 53:41I have yet to need to go to C++.
- 53:44But I'm happy when the libraries that I use have C extensions or parts of them are somehow using C speedups to make them much faster.
- 53:55And I don't have to worry about it.
- 53:57Yeah.
- 53:57So I find writing in raw C++ is helpful if you need to deal with a lot of multi-threaded stuff.
- 54:02Multi-threaded in the C++ context, not in the GIL context.
- 54:06So if you have an algorithm that you want to manually deal with pushing out threads and multi-procking something and bringing them back, I find it's easier to do in C++.
- 54:15But to be honest, I don't have to do that very much day to day.
- 54:18I did that in the past life.
- 54:19But in industrial data science, I don't need to do that.
- 54:23Pretty much NumPy, SciPy, Pandas gives me everything I need more or less.
- 54:26It takes a lot of time, right?
- 54:28It's developer time versus compute time at the end of the day.
- 54:30Yeah.
- 54:30Yeah.
- 54:30It's another one of those define fast, right?
- 54:32Like if it takes you two days to write the C++ code that then runs in five minutes, or it took you half an hour to write the Python code and it runs in 20 minutes, who solved that problem first, right?
- 54:46Like it depends how many times you're running it.
- 54:48Like there's a lot of considerations there.
- 54:50But if you're working for a hedge fund where a tiny increment of performance is whatever, put a bunch of zeros after a dollar sign, then maybe it matters and it makes sense to spend weeks on this tiny micro optimization.
- 55:01It's all about context.
- 55:02The whole hedge fund algorithmic trading space is crazy.
- 55:05Like when you consider like server co-location and stuff so that you can like drop a few milliseconds of latency because that changes your profit margins.
- 55:14Like that's a bizarre industry.
- 55:15Yes.
- 55:16But that's how it is, right?
- 55:17Cool.
- 55:18All right.
- 55:19So you talked about GPUs.
- 55:20Like what are, I mean, what are some of the things that we compute with GPUs?
- 55:24You know, the real simple ones are like, I'm doing machine learning training, like a training machine learning model.
- 55:31And I'm going to do that, say with GPUs or something like that.
- 55:33But what are some of the more, what are some of the other things I might go and write GPU code with for rather?
- 55:39Well, in practice, you might not need to.
- 55:41You probably don't need to until you have a problem that you don't have a better solution for.
- 55:46So I don't necessarily think it's sort of the general audience, but for the people that it's the right solution for, it's probably the only good solution.
- 55:54So GPUs are very good at doing enormous computations in parallel.
- 56:00So interestingly, I mean, they started out as graphics cards, right?
- 56:02And I think people here make the connection between like my video game engine and how am I doing science?
- 56:07Well, what actually happened was scientists realized that they could use these native graphics card APIs for like text or vertex shading.
- 56:16And they wrote problems like whatever, an earthquake simulation or something using these vertex APIs because along the way it did the math they needed.
- 56:24Yeah.
- 56:24And that was sort of where CUDA came out.
- 56:26So the kinds of problems they solve are things that you can do heavily in parallel.
- 56:31So for example, matrix math, GPUs are very good at.
- 56:34Aggregations, GPUs are very good at.
- 56:37Sorting, not very good at because sorting is sort of inherently in general interdependent on the state of the rest of the algorithm.
- 56:45And although there's GPU sorting algorithms at a high level, those are the kinds of problems.
- 56:50So it's the right tool for the right job.
- 56:52Yeah, cool.
- 56:53You know, I didn't appreciate how much computation GPUs could do until I started working in 3D graphics, which I did a long time ago.
- 57:01But you think I'm loading up all these models.
- 57:03I'm applying all these, like every time you want to rotate or move any item that is on the screen, it's a matrix multiplication on all the vertices of it to make that happen.
- 57:15And there's usually multiple ones.
- 57:16And then just if you start to think about like a modern graphical simulation, a game or some other 3D environment, and then the amount of matrix multiplications per second at 120 frames a second.
- 57:29It's mind boggling.
- 57:30Like the human mind cannot grasp how much math is happening per second.
- 57:34It's just unbelievable.
- 57:35Yes.
- 57:36I mean, the physics engines in games these days do, you know, ricochets and everything on the fly.
- 57:40And then there's also the memory management.
- 57:43You've got memory on the host and the GPU, and it's constantly going back and forth.
- 57:47I mean, all of this, it's extremely complex.
- 57:48So, yeah, it's really amazing technology.
- 57:50Yeah, if you can turn that computational engine on to like more direct problems like you're talking about, it's pretty interesting.
- 57:57So, some other options, you know, like there's grid computing.
- 58:01We could set up like 50 computers in AWS or GPC or GCP, something like that.
- 58:08Like what's a good story for that, right?
- 58:09Like maybe you don't need all these clusters, or if you do have them, maybe you can use something like Dask, and you don't actually have to program against it.
- 58:17It just magic happens if you set them up right.
- 58:19Yeah, Dask is a great project because it's basically solving these kinds of problems for you.
- 58:24You know, as the user, you just say, I have a thing.
- 58:26I need it to run fast.
- 58:28I don't want to know about how you have your nodes networked together for running an MPI job.
- 58:34But originally, that was what you had to do.
- 58:36So, I think the more projects like Dask evolve, and you kind of write what feels like maybe pandas, and it can just scale outwards, it's going to be really good for the community.
- 58:45Yeah, that's cool.
- 58:46You know, I always thought Dask was something that would make no sense for me because I don't really have these large cluster type computations that I ever have to do.
- 58:53But when I was talking to Matthew Rocklin, I realized, he pointed out to me, that you can run Dask on a single CPU, or a single machine, and it'll actually do the multiprocessing and parallelism and all that.
- 59:06And so, it's just another interesting use case where you might not think of it.
- 59:09Yeah.
- 59:10I mean, all that comes with overhead, too, though.
- 59:11So, it's always the right tool for the right job.
- 59:13You wouldn't take an airplane across the street, even though it's faster than a car, right?
- 59:18Because by the time you went through all of that, it doesn't make any sense.
- 59:21The overhead's too high.
- 59:22But at some point, it catches up, right?
- 59:24Yeah, for sure.
- 59:25Super interesting.
- 59:26Okay, well, I guess let's leave it at this.
- 59:29You have a few other libraries to leverage HPC without too much expertise.
- 59:34You want to take us through those really quick, and then we'll close it out?
- 59:37Yeah, so it's just the idea is if you're not somebody who knows CUDA and is obsessed with all these little micro-optimizations, like I've been for a long time,
- 59:46which is the vast majority of the normal work encoding population, how do you get the advantage of these is to just use those tools like Dask.
- 59:54That's one option.
- 59:55There's libraries that are inherently parallel.
- 59:57NumPy has some multi-core support and whatnot.
- 1:00:00There's also a lot of analytics, sort of more managed services, like Google BigQuery is basically a SQL-like engine that just scales out transparently to you to lots of nodes.
- 1:00:12It comes back very quickly.
- 1:00:14There's another one called CitusDB that Microsoft, I think, recently acquired, and it's very good for that kind of thing.
- 1:00:19So there's technologies that you can leverage, and I think, by and large, that's the most straightforward way to get into that without getting a PhD in the subject.
- 1:00:27Yeah, start there.
- 1:00:28Then go custom if you got to, right?
- 1:00:30Exactly.
- 1:00:31All right, cool.
- 1:00:31Well, this has been really fun to talk about all these things.
- 1:00:33Now, before we wrap it up, I've got to ask you the two final questions, of course.
- 1:00:39If you're writing some Python code, what editor do you use?
- 1:00:41VS Code these days.
- 1:00:43I used to be diehard Vim because I knew the shortcuts.
- 1:00:46I could get around faster.
- 1:00:48And something about VS Code, I found myself outpacing my productivity.
- 1:00:53And then at that point, I was sold.
- 1:00:55I mean, I still use Vim when I'm in a remote terminal.
- 1:00:57But I'm a big VS Code fan, yeah.
- 1:01:00That's cool.
- 1:01:01Yeah, it's definitely got the momentum these days.
- 1:01:02And there's a lot of effort to make it better.
- 1:01:05So I think it's only going to get better.
- 1:01:06It's great for TypeScript.
- 1:01:08If you're writing Angular, it's very good for TypeScript.
- 1:01:10I mean, Microsoft makes both products.
- 1:01:12Go figure it out.
- 1:01:12Yeah, and it's literally even the Python extension is written in TypeScript.
- 1:01:17So it's no surprise that it's good at writing in TypeScript, right?
- 1:01:21Yeah, Electron apps.
- 1:01:22Yeah, I mean, they use TypeScript for that.
- 1:01:23Yeah, absolutely.
- 1:01:24Cool.
- 1:01:24And then notable PyPI packages?
- 1:01:26So there's one called pytest Watch.
- 1:01:29I mentioned, I mean, I like pytest.
- 1:01:31This one's super simple.
- 1:01:32It just gives you a terminal watcher.
- 1:01:34So you pip install pytest Watch.
- 1:01:36And there's like a PTW command that just on reload will run your test again.
- 1:01:41Super simple, but I use it all the time.
- 1:01:43That's really cool.
- 1:01:43So if you just hit save, like your test run, basically.
- 1:01:46Yep, yep.
- 1:01:46And so I just leave that running pretty much 24-7 and just sit there, change code,
- 1:01:51control S, and just glance over and make sure my tests are good all day long.
- 1:01:54That's pretty solid.
- 1:01:55Very helpful.
- 1:01:55Cool.
- 1:01:56Another is, I mentioned mypy.
- 1:01:59And then specifically, there's a flake 8 mypy extension for VS Code.
- 1:02:03The mypy is a static type analysis.
- 1:02:06So it will do things like, if I write a function in Python, and I say, this takes a parameter
- 1:02:10that is a string.
- 1:02:12And then I later call that function with a parameter that's an int.
- 1:02:15I get a little red squiggle, and it says, you know, error, you've called this function
- 1:02:18incorrectly.
- 1:02:19And it catches a whole class of bugs that you might not find until runtime because, well,
- 1:02:24it's a dynamic language.
- 1:02:25So this is a newer thing for me.
- 1:02:29It's mostly born out of using TypeScript for a while and moving from JavaScript to TypeScript
- 1:02:34and realizing, like, wow, this is a huge productivity boost.
- 1:02:37And so now that Python seems to be moving towards more of this type annotation stuff, I'm just
- 1:02:42completely jumping on the bandwagon.
- 1:02:43That's cool.
- 1:02:44Yeah.
- 1:02:44I'm a fan of type annotations as well.
- 1:02:46Yeah.
- 1:02:47I really think they add a lot.
- 1:02:48And then if you're interested in performance, there's mypyc, which compiles that code, the
- 1:02:53type annotated Python 2C code as well.
- 1:02:56So those people looking for performance, that's another option.
- 1:02:59Is that a Facebook thing?
- 1:03:00It is.
- 1:03:01Where is it?
- 1:03:02It's under its own organization.
- 1:03:05I don't remember.
- 1:03:06There was one like that, I think, from Facebook and one like that from Dropbox.
- 1:03:11And I don't know which.
- 1:03:12Now there's somebody listening to it and just cursing my name for that.
- 1:03:15So apologies.
- 1:03:15It's under its own organization.
- 1:03:17It's not like under a different organization.
- 1:03:20Yeah.
- 1:03:21So I'm not sure.
- 1:03:21That's a great idea, though.
- 1:03:22The idea that you annotate this and now it's almost like Cython, you know, it knows more about
- 1:03:27what you meant and now it could potentially convert that into better code.
- 1:03:30See it going there.
- 1:03:31Yeah.
- 1:03:31I don't think it's generally useful yet, but it's getting close.
- 1:03:35So it's pretty cool.
- 1:03:36Yeah.
- 1:03:36You need critical mass.
- 1:03:37Yeah.
- 1:03:38I think they use it to build mypy itself.
- 1:03:40At a certain point, there's enough adoption.
- 1:03:41Yeah, exactly.
- 1:03:41Yeah.
- 1:03:42Super cool.
- 1:03:42And then you have one more you want to throw out there before we hit that.
- 1:03:44I have one more.
- 1:03:45It's called RxPy.
- 1:03:46So reactive extensions, you should go to reactivex.io.
- 1:03:51It's a whole pattern of programming that's been around for a while, but it's based on the
- 1:03:56idea of observable streams.
- 1:03:58So rather than imperatively saying, I want my program to do X and Y, you say, I want to
- 1:04:03sort of declare what my program should do in response to data changes.
- 1:04:07And it makes certain types of problems tremendously easier to reason about and program.
- 1:04:12And there's a JavaScript counterpart, RxJS, that's super popular in Angular.
- 1:04:16And this is the Python implementation.
- 1:04:18It's not nearly as mainstream, even though that repo has a lot of stars, but it's something
- 1:04:23I'm experimenting a lot with just because I've seen some of the problems it solves in front
- 1:04:28end development and found a couple of interesting cases where it can be used in Python.
- 1:04:33Yeah, it looks interesting.
- 1:04:34I haven't used that before, but the whole observable data notification stuff is kind of cool.
- 1:04:40Nice.
- 1:04:42Good recommendation.
- 1:04:42So, all right.
- 1:04:43So people are out there.
- 1:04:45Maybe they're doing some data science.
- 1:04:46They want to get it on the web.
- 1:04:47What's the final call to action?
- 1:04:49Where do they start?
- 1:04:50So, well, one place you could start is there's another project that sort of was born out of
- 1:04:55a weekend thing that would be very, it's sort of in its infancy called Flaskerize.
- 1:04:59And the idea there was we have front end apps and back end apps that you traditionally deploy
- 1:05:05separately, or you make a Python only app.
- 1:05:08But in principle, you could serve your React front end from the same Flask API.
- 1:05:13And if you have a single app, it makes deployment a lot easier.
- 1:05:16It makes scaling a lot easier.
- 1:05:17And so we sort of had this idea, like, why don't I just make a command line tool that could
- 1:05:22take a static site that you built with whatever, whether it's a JavaScript thing like React or
- 1:05:26Angular, or whether it's a Jekyll or Gatsby or whatever.
- 1:05:30And you want to basically embed that in your existing API and potentially Dockerize it with
- 1:05:35like one command.
- 1:05:36And so that's what this Flaskerize project is about is sort of making a code generation and
- 1:05:42templating and DevTool sort of Flask command line interface.
- 1:05:47And at this point, I've sort of played around with it a bit and I'm using some of it as its
- 1:05:53DevTool form in production.
- 1:05:55I think there's a lot that could be done with this, but I don't necessarily always have the
- 1:05:59time.
- 1:05:59So I have a lot of ideas around that.
- 1:06:01So it'd be interesting for people to check that out or potentially contribute.
- 1:06:06You know, there's a rich CLI in some of the front end communities that doesn't exist in
- 1:06:12Python.
- 1:06:12I think that could be a real productivity boost in Python.
- 1:06:15We don't really have a good like templated generator.
- 1:06:19It's not that I've found particularly useful.
- 1:06:21That's pretty interesting.
- 1:06:21Take your stuff and basically convert it to Flask.
- 1:06:24That's cool.
- 1:06:24All right.
- 1:06:25Yeah, nice.
- 1:06:26And then I'm going to have a bunch of links from various articles and libraries that you've
- 1:06:30talked about here.
- 1:06:31So throw those all in the show notes.
- 1:06:33People can just click on them in there and their player.
- 1:06:34Yeah.
- 1:06:35And then I'm speaking at a conference at the end of the month.
- 1:06:37If you want to hear me ramble on more about this type of stuff, if you're near the Charlotte
- 1:06:42area, there's the Data Science North Carolina 2019.
- 1:06:45I guess we'll put a link in the show notes below for that as well.
- 1:06:48Yeah.
- 1:06:48Do you know if they record those videos and put them online?
- 1:06:50They do.
- 1:06:51I'll make a reminder to myself once that's out to put that up.
- 1:06:54The conference is at the end of August.
- 1:06:56So it'll be around shortly after this airs.
- 1:06:59The closest time this comes out.
- 1:07:00Yeah, for sure.
- 1:07:00Through the magic of time travel, we can put that link retro back in.
- 1:07:05Yeah, that sounds good.
- 1:07:06And then credit where credit's due.
- 1:07:08mypyc is developed by Dropbox.
- 1:07:10Thank you for preventing me from getting sued.
- 1:07:11Appreciate that.
- 1:07:12Yeah, no problem.
- 1:07:14All right.
- 1:07:14Well, AJ, it's been really fun to talk about this intersection of data science.
- 1:07:18And web development.
- 1:07:19And thanks for sharing with everyone.
- 1:07:20Yes, sir.
- 1:07:21Thank you for having me.
- 1:07:23This has been another episode of Talk Python To Me.
- 1:07:26Our guest on this episode was AJ Pryor.
- 1:07:28And it's been brought to you by Linode and Rollbar.
- 1:07:31Linode is your go-to hosting for whatever you're building with Python.
- 1:07:35Get four months free at talkpython.fm/Linode.
- 1:07:39That's L-I-N-O-D-E.
- 1:07:41Rollbar takes the pain out of errors.
- 1:07:44They give you the context and insight you need to quickly locate and fix errors that might have gone unnoticed.
- 1:07:49Until users complain, of course.
- 1:07:51Track a ridiculous number of errors for free as Talk Python To Me listeners at talkpython.fm/rollbar.
- 1:07:57Want to level up your Python?
- 1:08:00If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 1:08:04Or if you're looking for something more advanced, check out our new async course that digs into all the different types of async programming you can do in Python.
- 1:08:13And of course, if you're interested in more than one of these, be sure to check out our Everything Bundle.
- 1:08:17It's like a subscription that never expires.
- 1:08:19Be sure to subscribe to the show.
- 1:08:21Open your favorite podcatcher and search for Python.
- 1:08:24We should be right at the top.
- 1:08:25You 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:08:34This is your host, Michael Kennedy.
- 1:08:36Thanks so much for listening.
- 1:08:38I really appreciate it.
- 1:08:39Now get out there and write some Python code.
- 1:08:40I really appreciate it.