Python is used to solve a large and varied set of problems.
One of its core pillars is web APIs.
Another one is ML and data science.
Those two important pieces were brought together in an unexpected and yet magically futuristic
way by Rod Senra's team working with the Gatorade Sports Science Institute.
They created a patch that you wear while working out once or twice.
It analyzes your perspiration, combines it with other factors like running distance, sleep
quality, and more.
Then it provides recommendations using Python about how to get more effective fitness.
This is Talk Python to Me, episode 324, recorded July 8th, 2021.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the
ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter where I'm @mkennedy.
And keep up with the show and listen to past episodes at talkpython.fm.
And follow the show on Twitter via at Talk Python.
This episode is brought to you by Sentry and Linode.
And the transcripts are brought to you by Assembly AI.
Please check out what they're offering during their segments.
It really helps support the show.
Rod, welcome to Talk Python to Me.
Thank you.
Super to have you here.
There's a lot of things you've been building for different companies through your work.
That's going to be really fun to explore.
I think one of the really neat things here is you're not just working for one company, working
on one team the way it works, but you're kind of interacting with a bunch of different projects
and types of technologies.
So you'll have a good, broad perspective on what went well, what didn't, what you would
change, and so on.
That's true.
Python is the one thing that stuck with me since 1997 across different companies, let's
say like five different companies, two different continents.
But Python was the one thing that remained the same.
That's fantastic.
A good choice indeed.
Well, let's start this conversation by talking about your story and how you got into programming
Python.
Python, it sounds like you were one of the early adopters.
What version of Python?
That was probably a version one type of thing.
It was 1.5.2.
It was in 1997.
At that time, I was almost finishing my undergraduate course in computer engineering, and I already
engaged in my master's post-graduation course.
What were you studying?
What was your degree?
Well, my undergraduate degree was computer engineering.
But for the master's thesis, I was studying computational reflection.
In the end, it's the line of research that led to Aspect J and other things.
But it was all about object-oriented protocols.
So how you organize object orientation in programming languages, those kind of things.
Okay.
Cool.
And Aspect J, that's like aspect-oriented programming?
Exactly.
Aspect-oriented programming was like a byproduct of the research in computational reflection.
At the time, we were, academically speaking, we were trying to figure out what can you do
with reflection.
Java was one of the languages that made it popular to do introspection and reflection
in programming languages.
Of course, we had that in Lisp since back to the 70s.
But Java made it known to the wide world world.
So then we became researching more formally.
And I started probing supports for reflective programming in programming languages.
And that meant not only Java, but at the time, Perl, Python, Tcl.
And once I saw Python, it felt like a glove to my hands.
And then I stuck with it.
Yeah.
Oh, that's really neat.
Maybe you could just talk a little tiny bit about what reflection is for people listening
who maybe haven't done a lot of Java or .NET.
They have it as well.
And in Python, we have it in the sense that you can go in and explore the types.
And so, you know, give it an object.
What if it's class?
And like, what is it?
It's meta class.
And you can like dig into it and even change it.
But I don't typically hear it referred to as reflection in the Python ecosystem.
Right.
Yeah.
Introspection became a more common term used.
But at the time, reflection was about creating programs that reason about programs.
So it was about this meta level reasoning.
And it was very popular to do non-functional aspects.
So you want to write your code and the code has the functional aspects, what it do, how it
like transform things.
And then the non-functional aspects like logging, persistency, monitoring, those kinds of things.
People were exploring how to detach, decouple those things from your actual program and do
that on a separate layer.
And that was what reflection was all about.
It was about having as inputs your own code and as outputs changing the behavior of your program.
And the way we attacked that at the time was by an interception mechanism.
So Python always had that.
I think they called the DOM buildry hook or something like that, where you could like intercept
like anything that was happening there.
We do have the bugging hook in the Sys module that allow us to like pause your computation and
see what's happening.
Other programming languages.
And at the time we're talking about the 90s, the popular ones were statically compiled
programming languages.
Right.
C, C++, they generally don't have this behavior.
Yeah.
Sometimes they had runtime type information when you compiled your source codes enabling that.
That's right.
I remember there was an RTTI.
RTTI.
And C++, but it was off by default.
Exactly.
But in the interpreted world, you had everything, right?
You had the interpreter during runtime.
Sometimes you had the compiler as well, which was true for Java, which was true for Python,
Perl, all the interpreted dynamically languages.
And then that became more of a thing.
Of course, in time, people realized there were other ways to achieve the same goals, which
were more effective because one of the main things with introspection and interception
is that everything that is happening in your program, it's kind of being reified, delivered
to this meta level and then handled as data.
So that is like a major break in speed, right?
So it was not the answer for everything, especially when you wanted to have like runtime performance.
But for things that were offline batch or analysis, it was not a problem.
And one thing that an exercise that I'd done at the time, which is kind of interesting, was
to introduce a debugger during runtime.
So because we had this reflection mechanism that works just like this, you could take possession
of an object and then any interaction with these objects would go to its guardian angel,
which I call the meta object of this object.
And then the meta object decided what to do.
To lie about what was happening, to just delegate back to that object down there, do something else,
become a proxy, solve the computation.
So you could do anything.
And in that case, we could install a debugger just for a given class or a given instance of your program,
and then propagate like a virus for anything either that class or instance touched.
So that was kind of interesting, a new dimension of programming, but became more as an academic exercise.
And the only thing that I remember that's kind of succeeded into the industry was aspect oriented programming of sorts.
Well, that's very interesting.
It seems to me a little bit like decorators.
Yes.
Decorators are wrappers.
But the thing is, they are not transparent.
So whenever you create a decorator or a proxy, what's happening is that the references you had to the original objects now need to point to the wrapper, to the decorator.
Right?
So the key insights for reflectional computation that we were exploring at the time was how do we make this proxy totally transparent?
So if you have a pointer or a reference to an object before it became reflective, it would still be valid.
So you can turn on and off those introspection mechanisms and interception mechanism, and it's totally transparent.
So to achieve that, we had to change the interpreter.
So that's how we've done it for Java.
And that's how I was exploring at the time for Python itself and Perl, to change the interpreter, to add the hook in there and do transparent wrapping.
Yeah.
It seems like some of the new peps might make it possible to plug in now rather than actually change it.
I know there's that JIT plugin that they're working in where you can intercept the method parsing compilation bits and stuff.
I don't remember the number.
Yeah.
I haven't explored, like, doing it to modern Python.
At the time, I did some exercises using the debug hook.
Yeah.
It kind of works, but it was kind of messy and super slow.
So I kind of stopped.
But it will be interesting to revisit that again.
I'm sure.
I do remember how interesting all the research was around that time.
And I feel like a lot of what's happening now is it's getting a little more structured, a little less dynamic with things like decorators and other types of wrappers and inner functions and stuff.
But yeah, quite an interesting time.
So how about now?
Maybe we can talk about what you're doing these days.
Nowadays, I'm a technology director at Working Co.
Working Co.
is a digital products company where we not only do designs and strategy, but we also do implementation and quality assurance for the projects that we take on.
So that's what makes us different from just an agency, a design agency, because the founders of Working Co.
realize that it's much better for the clients to hire a single entity to do the full digital products turnkey.
And then we can make sure that whatever we design, it's possible to build.
So that is the vision for Working Co.
We were very successful, I must say.
In a few years, Working Co. won many prizes.
It became famous for the Virgin America app for booking passages with Virgin America, I guess, five or six years ago.
But we're doing things for like Apple, Google, Chase, you name it.
I know that involves a lot of Python.
Does it involve other technologies?
It's worth it.
Probably other technologies as well, right?
Somebody comes and says, well, we want this thing designed and four of our Java shops don't make it for Java.
Whatever happens is usually there are projects that are just designed, projects that are designed plus front-end work.
Like projects that go all the way through to back-end.
Sometimes back-end is just like a mediator for some infrastructure that the clients already have.
But there are other times where we have to do everything, like the full digital platform for the client.
And in those cases, Python becomes a key technology for us.
Because what Python gives you most, in my experience, is optimizing for development time, right?
People are very much concerned about Python runtime efficiency.
But the key problem is development efficiency, right?
Most of the time, if it's a little bit slower, like in comparison, a Formula One car and a regular vehicle, one is much faster than the other.
We don't need Formula One cars most of the time, right?
That's right.
So it's like fast enough.
And that is the point.
So for many things, Python is fast enough.
But in terms of development time, Python is the Formula One vehicle.
It's like super fast.
It's super easy to throw things away.
It's super easy to explore.
It can touch every niche in computer size.
And I kind of have...
Yeah, exactly.
It has PyPI, right?
For example, you can install this and go.
Exactly.
So it was a key technology for us in those cases that we have an extremely agile cycle of development.
Lots of changes because design was sometimes moving along the way.
And we need to rebuild the backend infrastructure overnight.
So because for those scenarios, it was key.
I think the conversation around performance in Python is super interesting because there's just so many layers and variations.
Yeah.
And what are you trying to do?
Well, if you're trying to do a tight loop that does math, guess what?
Python's bad at that.
But maybe you shouldn't be doing that.
Maybe you should be using NumPy and the SciPy stuff.
And then all of a sudden, it's C speed again.
Yes.
Maybe you're doing some data-driven web API.
And it's like, well, it might be slow.
Well, actually, what you're doing is you're orchestrating exchange of JSON and talking to a database server or cluster.
And it's almost exactly the same speed as if it were written in C because you're mostly waiting on the database and waiting on the network.
And there's all of those things.
And then on top of it is this thing that you talk about that often gets ignored.
There's a really interesting story that was recounted in Mike Driscoll's Python interviews book about the competition between Google Video and YouTube and how Google Video had like 100 C++ engineers.
And YouTube, this little startup, had 20 Python developers.
And YouTube was just blowing away all the Google engineers because they could add features faster.
And if Google would do something, they could copy it, re-implement it really quickly.
And so Google fixed the problem by buying YouTube.
It's still Python to some degree there.
So that's a really good point.
Yeah.
My experience, there are two factors.
One factor that you just mentioned is having it under control when it grows.
Right?
So software is like a living thing.
You start a project.
It gets, it's born.
It starts to grow.
Right.
Does it become a sequoia or does it become blackberry bushes?
Exactly.
This portion of Talk Python, I mean, is brought to you by Sentry.
How would you like to remove a little stress from your life?
Do you worry that users might be having difficulties or are encountering errors in your app right now?
Do you even know it until they send that support email?
How much better would it be to have the error and performance details immediately sent to you,
including the call stack and values of local variables and the active user recorded in that report?
With Sentry, this is not only possible, it's simple.
In fact, we use Sentry on all the Talk Python web properties.
We've actually fixed a bug triggered by a user and had the upgrade ready to roll out as we got their support email.
That was a great email to write back.
We saw your error and have already rolled out the fix.
Imagine their surprise.
Surprise and delight your users today.
Create your Sentry account at talkpython.fm/sentry.
And if you sign up with the code talkpython2021, it's good for two months of Sentry's team plan,
which will give you up to 20 times as many monthly events as well as other features.
So just use that code talkpython2021 as your promo code when you sign up.
So it has this life cycle, right?
At some point, depending on its history, it gets out of control.
So if you didn't have the proper team, the proper guidance, it can become the problem.
Not the problem it was supposed to solve, but the software itself becomes a problem.
And then people tend to, oh, let's throw this away and get something else because this is unmanageable.
And I don't think it's an intrinsic problem on any programming language or infrastructure.
It's more between the matching of did the team that was doing this really master the technology at the time.
If they do, it could be Fortran, COBOL, C++, or Python.
You have good results.
If they didn't, they might get into this one-side, one-way road in the opposite direction.
Then they are screwed, right?
So this is one thing.
The other thing, it's all about flexibility and the performance that you mentioned.
For example, in this latest project that we are tackling, the GX project, we have it all.
We had CPU-bound problems that we are tackling, IO-bound problems.
And in both cases, Python was behaving just fine.
We have like 16,000 users right now.
We have three API instances.
And when it's a performance problem, we change the algorithm, we introduce caching, we're using MongoDB for scalability, and we have zero performance issues so far.
But because we have the software under control, we know what's happening in there.
Technology is not a mystery.
Then it's easy to pinpoint what's wrong and then replace it for a new version fast.
And that's it.
It's bringing results.
That's a fantastic point.
You know, you've got the architectural considerations as well as just the raw technology, right?
Oh yeah, for sure.
It's a single thing.
That's why I use the metaphor of like a living organism, because it's on an ecosystem.
Your software is not an island anymore.
In the past, we had like this release to the desktop, install, and it's all on your machine.
But today, it's interacting with the operating system, with the cloud, with the user.
So it's alive, right?
It's a dynamic ecosystem.
So it's all about those interactions and understanding the dynamics on each of these interfaces, and then optimizing for the Feng Shui, for the flow.
Very cool.
And I want to dive into this first API, because I think it's super interesting, and people are going to be really surprised by it, I'm sure.
Oh, that's good.
Yeah, it'll be fun.
But before I do, I do want to ask you one more sort of big picture question.
You're working with Work & Co., you're working with all these clients as this digital agency doing this end-to-end work, which I think makes a lot of sense.
What is the trends for Python that you've seen across the last five years or so?
I see.
What has stood out to you from these conversations?
Maybe you had five, ten years ago, you're having now, you're thinking about the future.
The two things that are my reality, at least, and that doesn't mean like, it's a broad world that we have out there.
So there are many cases, right?
So I'll speak just from my experience in the last three years.
So there are two things that come to mind.
One of them is this mediator thing.
So because everything is in the cloud, because you're not writing any more software from scratch,
you have to do integration, like gluing.
Python, back in the early days, became famous as a glue language.
And it was kind of gluing things in the desktop.
Now Python is gluing things in the cloud.
Because Python is such a versatile language in terms of a huge ecosystem of libraries,
because the language itself allows you to compute like anything,
it became an excellent technology for a glue language.
And for us, it's critical, because any project we're dealing with, okay, we have to talk to a database, for sure,
but we also have to talk to a forecasting weather service.
We have to talk to a push notification service.
We have to talk to analytics system platform.
So you need to send signals there.
So this ecosystem thing is great for that, because you find the connectors, you find the drivers, you find examples.
So all of that speeds up the cycle of development and gives you confidence that you achieve whatever you need in success.
In terms of ecosystems, still, we're not talking about just the computer right now.
So we did a project for Google, the new store in Google.
There are some embedded devices there.
So that's another niche, embedded systems, IoT, things for the television.
We did things for Marriott, where it was like embedded on a setup box.
So this is one thing that I think we're going to see more and more often.
Now that we see like CPUs in your lamps, and people playing boom in their lamps.
Right.
The other thing, it's the data-driven aspect.
So one of the flags that I carry at Working Co is the data-driven design.
So data-driven design is like, okay, we are not doing design just based on the inspirational thing from designers and their creativity and their capacity for innovation, but anchor in data from the real world.
Sometimes that approach goes all the way through conceptual design into the end product, which we are seeing with these machine learning, deep learning-based products.
Email model in production behind Flask or something.
Exactly.
So that's another trend that Python is great, right?
Not only for the business analytical aspects, but also for the pipelines to build models in production.
Very neat.
The way you described Python as a glue language is super interesting compared to the way it's traditionally been described.
Traditionally, glue language meant something like, well, I've got a C library and I'm talking to Linux.
And so I could write this stuff in Python that'll do some shell stuff with Linux and that it'll also like pull in the C API and just move that data from here to there and go.
And it's come across a little bit as a second class thing.
It's like the very best scripting language you can imagine.
And it's kind of not perfect for apps, but well, we'll do this.
But what you described was, we're going to take the database, we're going to take these APIs, we're going to take the web requests, we're going to glue that together.
I mean, that is the application.
And it's like, it's thinking, yeah, it's thinking of, well, really, what is a modern API app other than a thing that takes a little data from an inbound request,
maybe pulls some, pushes something over to Celery, grab something out of the database, calls these APIs and bundles it back up as a response and sends it back with a status code.
That's the entire application.
And yet this idea of gluing these pieces together is a really interesting way to think of it.
That's what I learned.
It's about like gluing systems and gluing data.
And of course, these things are connected, but sometimes you can have gluing data in a asynchronous way, right?
In batch processing or local processing or for analysis or human interaction.
But it's still like gluing data from several sources.
And there's this other approach, which is like gluing live systems.
And of course, data is flowing across them, but also the connectivity aspect is key, right?
Can I authenticate and talk to all of these systems?
In the way they expect to interchange information.
The real power is how well does it perform that combination, not how well does that one millisecond versus two milliseconds in the actual WebView method runtime behave, right?
Yes.
It's super interesting to see it that way.
All right, well, let's jump into the first API that we're going to talk about.
Right.
Yeah.
So this has to do with Gatorade, which is the sports drink company.
And they have created this really interesting idea of the quantified self for fitness here with this thing called the GX Sweat Patch.
Exactly.
This is something that blew my mind when I saw it first.
Yes.
This is something that is like really in the beginning.
We launched this in production in March 1st this year.
It has been in development since 2019.
And the research inside Gatorade goes even far back.
So what they are trying to do, Gatorade has this subunit called GSI, the Gatorade Sports Science Institute.
I had the opportunity to visit one of their physical instances in Sarasota, Florida in 2020.
And they do like amazing work there, like bridging sports science, like students, actual experiments.
And they are helping to develop this concept of how do you bring some of the metrics used by high performance athletes to a more general, broad audience?
Right.
We've probably all seen pictures of Olympic athletes or, you know, pick your favorite sport athletes with a couple of doctors or researchers around with a clipboard and like a big breathing thing.
And they're on like a workout bike or they're doing and they're like studying all these different things.
Right.
And they get really interesting feedback on, well, under this situation, this is where you're hitting your limits in cardio or in like breathing at altitude or something.
And for the rest of us, we just put on shoes and run or, you know, get on a bike or whatever it is.
And we just have no idea.
In a specific case of the, what you're showing now on the screen, the sweat patch, this thing that you can put in your forearm and it's going to capture your sweat in your micro pores in your skin.
And then you lead that sweat into two channels.
One channel, which is the orange channel that fills up in a zigzag form.
It's the volume of sweat you're producing.
The other channel is a slightly bar on the lower side that will react in colors to reflect the amount of sodium that is in your sweat.
And those two things, they will be super critical to understand how much fluid you're losing from your body while you're performing some sports activity and the concentration of sodium you're losing as well.
Because sodium, as everybody knows, it's critical for the performance of muscles, the potassium sodium pump that exists and control all muscles.
So learning about those things can help you improve your performance.
And of course, this is more impactful if you are a professional athlete, but I think everybody can benefit from it.
And the biggest challenge was to take that out of the lab where you mentioned, Michael, where you have an apparatus that is easier to capture all the signals and bring that out in the field where anybody can use under any conditions.
And that was the challenge that we took up to help Gatorade to achieve that.
And it's had a lot of obstacles for us to overcome.
And Python was super helpful because not only it had the tools for us to build APIs, but also there's a ton of formulas that we need to compute to achieve that.
And Python had NumPy, Pandas, and Stats, and all the tooling that we needed to make it happen.
So let me just describe this really quickly for people who are watching.
It's like a band-aid, maybe two and a half inches.
Yeah, like four fingers.
Three or four fingers, something like that.
Maybe about the size of the palm of most people's hands.
You stick it on to your arm and it changes these colors and reads out.
And then you scan it with this iOS app and it gives you an analysis that you're talking about here.
Yeah.
Exactly.
The app, of course, serves for other purposes as well.
So you can like track your workouts.
It does integrate multiple sources of information.
Garmin, Strava, HealthKit.
And then it creates this timeline of events in your day that understands if you're like doing multiple workouts a day, very early in the morning, very late on the evening, and how they interfere in each other.
Because if they are too close apart, maybe you shouldn't drink anything between the two of them.
If they are too far apart, maybe you need supplemental hydration.
So all of those effects, we perform that analysis in Python at the back end.
And the app becomes like the avatar that conveys that information to the athlete in real time.
Yeah.
When I first heard about this, I thought it specifically would just be like, well, Gatorade recommends this.
So here's how much Gatorade you should buy.
You should get the lime flavor, not the cool or whatever.
But it takes in data from, like you said, like Apple HealthKit and Garmin and these other things as well.
How do you get that data out of it?
That's a great question.
So the plan was to go as broad as possible.
We even investigated Fitbit and other providers.
But for the MVP, we went for three sources.
Two external sources, Strava API and Garmin API.
So if you're a Strava user or a Garmin user, you can, in a web view, connect to Garmin and Strava through our app.
And then we created this data feed from Garmin and Strava into our system.
Like some OAuth.
Backend sort of API type of thing?
Okay.
Yeah.
And then it starts popping up in the app.
You don't need to.
The app becomes a read-only thing.
You just look into it and you perform your exercise.
But the information comes by through the backend.
So these are the main channels.
But we also talk to Apple HealthKit, the platform in the iOS that consolidates information from multiple apps.
Health related, of course.
And then in that case, if you have like a sleep tracker or other sports tracker.
For example, I use RunKeeper.
So I go to that application.
I allow that application to export information to HealthKit.
And then, of course, Apple Health, the app, will see it.
But also any other app registered as a reader for the HealthKit platform.
And that's how we grab and consolidate all your activity, sleeping and workouts, into this single timeline.
And then we provide recommendations on top of that.
Right.
So you might be able to correlate workout with sleep.
Yes.
How well you're sleeping or something like that.
Yes.
That's one of the things we do.
That was one of the challenges.
Dealing with this events timeline became this, we needed a time series database to do time series analysis.
Because time is super relevant.
We have to handle conflicts.
Because you may have like many trackers reporting the same thing.
So the same physical event comes as multiple digital events.
Sometimes there are applications that break up a single event into multiple events.
Sleep trackers typically do that.
So for us, you have a single night of sleep.
You go to bed and you wake up.
Right.
But actually what happens is multiple cycles of sleep that you wake up in the middle of night.
But we don't handle them logically as multiple sleeping periods.
For us, logically, it's a single sleeping period.
So this is another thing we have to handle in the system.
Yeah.
It seems really useful, actually, the more I hear about it.
So let's talk about some of the tech behind the scenes for this one.
Cool.
There's probably some data science side.
There's obviously the API and database side.
What do you got going on here?
Okay.
So in the beginning, we went down to GSSI, the Gateway Sports Science Institute.
And together with their scientists, we started to create a model.
Not only for the way the sweats patch works.
The sweats patch was developed by a Boston company named Epicor, the physical patch.
And also the driver that kind of captures the basic information from the patch.
That is embedded on the mobile app.
And then when you take a picture of the patch, we do some image processing and we extract the two bits of information that we want.
The volume channel.
That's probably something like Swift or something on the app, right?
Today, it's a C# Xamarin.
But it was a modern restriction from PepsiCo.
They were already using that technology.
And it was supposed to be a framework cross-platform.
So later, when we decide to go to Android, it would be a possibility to reuse that framework.
So that was a constraint that we had to accommodate for.
But those modules are Objective-C and Swift, for sure.
They are native.
Yeah.
And so what we do after we have that, we have to translate whatever you read, which is your local sweat rate.
How much your forearm is sweating.
A single micropore in your forearm.
And we have a statistical model developed by GSSI to translate that into your whole body sweat rate.
So that is the first machine learning, statistical learning bit that is embedded on the system.
And we need to take into consideration what's the weather like?
What's your weight?
What type of sports you are doing?
What's the humidity?
Yeah.
Humidity we are not using right now because it's hard to capture.
So we had to create a less accurate model.
But for sure, humidity is critical.
But it was a product decision to leave that one out.
Because of the facility to grab the information, to capture that.
Right, right.
And once we have your whole body sweat rate, that acts as a crystal ball for future workouts.
So when you're performing a new workout, you don't need to use the sweat patch again.
You can use the sweat profile, the crystal ball, to predict, given the conditions of this new workout, how much you're going to sweat.
And then base recommendations on that.
So, of course, if there are some constraints that if they do not match, you have to do a new sweat test, create a new profile for those new conditions.
For example, I create a patch for running and now I'm doing bike.
So it's a different activity.
It should be best if I create a new profile.
This portion of Talk Python to me is sponsored by Linode.
Visit talkpython.fm/Linode to see why Linode has been voted the top infrastructure as a service provider by both G2 and TrustRadius.
From their award-winning support, which is offered 24, 7, 365 to every level of user, to the ease of use and setup,
it's clear why developers have been trusting Linode for projects both big and small since 2003.
To pull your entire application stack with Linode's one-click app marketplace or build it all from scratch and manage everything yourself with supported centralized tools like Terraform,
Linode offers the best price-to-performance value for all compute instances, including GPUs as well as block storage, Kubernetes, and their upcoming bare metal release.
Linode makes cloud computing fast, simple, and affordable, allowing you to focus on your projects, not your infrastructure.
Visit talkpython.fm/Linode and sign up with your Google account, your GitHub account, or your email address, and you'll get $100 in credit.
That's talkpython.fm/Linode, or just click the link in your podcast player's show notes.
And thank them for supporting Talk Python.
How does the app know what you're doing?
Do you tell it?
Just right now I'm doing this, so take a scan.
You have two options.
One of them, the app asks the user, when you're scheduling manually a workout, you can say, I'm planning to use a sweat patch on this particular workout, so be prepared.
That's one option.
The other option is, after you finish a workout, the app asks you, did you use a sweat patch?
So if you did, let's go with the flow of scanning.
If you're not, there is a fallback mechanism called way in, way out, where we can compare your rates and subtract them and see how much fluid you lost.
The downside of this is that we do not capture sodium loss.
So you cannot take sodium in consideration.
So when it gets to the server side, what's the API framework?
So the app is talking to the backend all the time.
We kind of use the backend for frontend metaphor of sorts.
So the API not only does the reasoning for the whole system, but sometimes it even helps the app a little bit with layout.
So the app talks to the backend to get user profile, to get the timeline of events, and then it renders those timeline of events, captures additional information, for example, your motivation and your fatigue, and reports that information to the backend.
The sweat scans and manually schedule workouts.
Everything else happens at the backend.
By everything else, what do we mean?
Grabbing weather information.
So translating your latitude and longitude into a temperature, if your workout was outdoor.
One thing.
Sending push, scheduling push notifications to remind you that you have this recommendation or there's an upcoming workout.
Things like that.
It also computes the local to whole body transformation.
It manages your sweat profiles and it triggers some product recommendation engines that will tell you not only Gatorade products,
but also general foods that could be suitable for your nutritional needs.
So we can say, for example, if you need this amount of carbs, this amount of protein, maybe you should take a little bit of caffeine or casein.
And then we give it a list of generic food like rice, coffee.
And then you can plan accordingly to fulfill those recommendations.
All of that comes from the backend.
And the backend is Flask?
The backend is Flask.
We were in doubt in the beginning being between FastAPI and Flask.
I wanted to fight the problem domain, not the technology.
So I decided to go fully synchronous.
And because in that case, it's super easy to debug.
It's much less prone to like problems.
I was not concerned with performance in the beginning.
What we learned was that Flask was performance enough for all our needs.
So that went well.
We had a separate API just for integrations with Garmin and Strava.
After we entered production in March, we realized that the team was too small to maintain it.
So we merged the two APIs into a single monolith.
But those two APIs, one of them was asynchronous.
So we did that asynchronous API with Quart.
And that was the one talking to Garmin and Strava because that one was purely IO bound, not CPU bound.
Right.
You're entirely waiting on Strava and Garmin and the internet.
And so you should be able to scale that many, many times out because all you're doing is waiting on their APIs.
And you're completely at the mercy of their performance picture as well.
Right.
So Async makes a lot of sense, but it turns out it wasn't needed.
Yeah.
The thing that we realized was that, of course, there are tradeoffs.
So if you go for a job interview and you present that as like a conceptual problem, I think the answer is no.
Do it asynchronously.
Do it as a separate API because then you can scale independently.
You have better IO throughput, lower latency, etc.
But in the real world, you have to balance all those things with the size of your team, the resources that you have, other external conditions.
So in the end, we decided to consolidate everything into a single technology in a single stack because it was simpler.
If we need to like to onboard new people trained instead of knowing Flask and Cart, now they only need to know a single framework.
And because scalability was not a problem, we were using like Kubernetes in production and it's like horizontally scalable.
We decided to reverse that and build a monolith, single stack, Flask all the way.
And that's what we have today.
How interesting.
So you decided you can just solve it by running more worker processes for container and then just running more containers if you need to.
Exactly.
That was a better solve for the conditions we had in the project.
I think that makes a lot of sense.
There's so often these recommendations of using microservices, breaking stuff into a bunch of pieces, having just the right technology for just this slice of what you're doing.
And then you've got your app.
Your app is talking to the different services.
Now you're trying to coordinate.
It just gives me chills to even think about it.
Releasing this through the Apple app approved process and coordinating that with the versions of multiple APIs.
Exactly.
That sounds so bad.
It becomes a nightmare really fast.
And in my mind, my experience is that microservices is an answer for a given team size.
So if you have like 100 developers like, I don't know, or a thousand developers like Netflix or Shopify, then it makes every sense in the world to break it up in individual components because you have individual teams.
Conway's law, right?
The software you build reflects the architecture of the people in the company and how they build the software.
But when you have a very tiny little team, the monolith is great.
It simplifies everything.
So that's like a lesson we learned that we kind of over-engineered in the beginning, trying to go with two APIs, and we took the route of bringing the monolith.
I think that makes a lot of sense for small teams.
And here's the thing, if you run into performance problems that really needs async stuff, you know, when you considered to use Flask and not FastAPI, FastAPI was brand new.
And who knows if it would survive another six months or if it would go the way of other really promising projects like Jepronto or something, which as far as I could be wrong, but as far as I know, it hasn't gotten a ton of traction.
It was really exciting for a while, and it just kind of fizzled out, right?
Yes.
You want to build on that.
So I think Flask is a totally reasonable choice.
But I guess what I was going to say is, you know, it's not that different if you need to re-translate that, if you're going to convert that to FastAPI.
Like, that's a thing you as a team of a couple of people could do in a few days.
Yes.
And it would be fine.
There were other, like, circumstances.
For example, as a big fan of Talk Python to me, I watched the episode on FastAPI.
I watched the episode on Pydantic.
And I knew of the symbiosis between the two of them.
But for us, we started with Kerberos as a schema validation technology.
Which comes out of the Eve project from my friend Acola, by the way.
Yeah.
And we evolved into using Marshmallow, replacing Kerberos.
We compared with Pydantic.
And at the time, we didn't want to, like, extract Pydantic from FastAPI and use FastAPI with Marshmallow.
So we went with Flask that was, like, not opinionated about what the schema should look like.
And we went with Flask and Marshmallow.
Nice.
Some other interesting building blocks that you highlighted is Pint, P-I-N-T for units.
Pint is super cool.
Tell people a bit about Pint.
Exactly.
So one of the things that we're doing on this particular project was it's supposed to be international.
And it's, like, heavy on the physics.
So we're dealing with rates and concentrations.
There's a lot of chemistry going on.
We're talking about the metric system, U.S. customary, imperial systems.
So converting between units was going to be a big part of the system.
And then we find out about Pint.
I was, like, in the Pint community for over 20 years.
I shook hands with Guido von Russell in 2005 when I translated his tutorial to Portuguese.
But I never heard of Pint in those 20 years.
But when I had the need, I did a quick research and I found exactly the solution that we wanted.
So Pint uses the excellent object orientation that we have in Python to transparently create
this, like, new integers and floats.
They're just not numbers.
But they also have a unit together with them.
It's so fantastic.
Let me maybe describe this little example on the Pint homepage.
So if I wanted to have three meters plus four centimeters, instead of saying three times 100 plus four or vice versa, you know, divide by 100.
You have three times meter plus four times CM.
And then what you get back is a quantity, which is 3.04 meters.
It's fantastic.
Exactly.
You could even do something horrible like three meters plus seven inches if you had to.
And it becomes even more powerful when you're talking about different kind of dimensions.
For example, if I want a concentration and I'm going to like to divide mass per volume, and then I need to make sure that my calculation makes sense.
So Pint allows you to do that.
So you do those conversions and the units are preserved.
And because the units are preserved, it's easier to test.
It's easier to compute.
So it's really a lifesaver that saves us a lot of time while coding this API.
Yeah, this is not something that in my world I do anything with these days, really.
But if I did, boy, I'd be all over Pint.
That thing's cool.
Also, there was Unit.
Yes.
I've also just recently heard about, and I don't know really how they can, UNYT, but this is also something similar in that regard as well.
Yeah, we, at the time, and I'm talking about early 2020, we evaluated a couple.
I don't remember if Unity we checked, but there were three others besides Pint.
But in the end, Pint sound the most robust one.
But I'll check Unity again.
Yeah.
I guess, what's your assessment now that you've been actually using Pint?
It's good?
We're super happy.
If we have like zero issues with Pint, it saved our lives time and again.
Yeah.
Another one that you'll run into is Time.
So you used Pendulum for that.
I was even a little bit resistant in the beginning because I was using date time forever.
And of course, members of my team were suggesting, hey, why don't we use Pendulum?
It has a really nice interface.
And the deal breaker for me was that the Pendulum object, it inherits from the regular daytime objects.
So they are completely interchangeable.
The one thing I didn't want to happen was to have like these two kind of libraries dealing with time.
And in that case, daytime is standard in the standard Pint library.
Something else external would be a cause of concern for me in my experience.
But in that case, it was seamless.
So I can use either Pendulum or daytime.
It doesn't matter because they all inherit from the same root.
So that was key.
And to be honest, it was convenient, especially for time zones.
But remember that that was before, I think it was on Python 3.9, that we had better support for time zones.
And at least in the standard Python.
And at that time, I think Pendulum was having a better way to handle with time zone conversion.
That was key for us in terms of the solution.
We never know where our athletes are going to be in the world.
So that was the key reason.
And we're happy with Pendulum.
Yeah, this is super neat.
You know, I didn't really put it together when I was looking at this before, but the time zone stuff is quite interesting.
Like something that's always a challenge that I deal with is when I'm working with some of the web apps that I have,
or other things, just where is the server versus where is the person accessing the server?
And it turns out to be way more annoying than you think, right?
Like another thing we're going to talk about is using MongoDB for the backend on this.
And so am I.
And I'm just a super fan of MongoDB.
It's been such a nice way to make fast, easy to maintain apps.
But it stores stuff at like UTC, whereas the server, I think, is in Eastern time zone.
And I'm in the Pacific time zone.
And so if I want to pull something up, so this event is going to happen then, or it happened at what time?
It's not easy to say, well, that was an hour ago.
Like something so simple as here's a list of activities.
And this one was an hour ago.
It's challenging.
And this is really cool.
So you can say, instead of daytime now, I can say pendulum.now and then pass in the base time zone.
And I say, well, what is now in, you know, inbound time zone or something like that, right?
Would be really, really nice.
The strategy we took, which is kind of traditional strategy, is that at all the edges of the system, we convert to UTC.
And inside, we're just reasoning on UTC.
And only when we're kind of exporting information through this membrane of the system back to close to the user, then we translate back to their time zone.
However, it gets tricky when we're talking about not real time, but nominal time.
What is nominal time?
For example, I wake up at 7 a.m.
So 7 a.m. for me, it's a nominal time.
It's not anchored on any place on Earth.
It's like the time that I'm supposed to wake up.
The nominal time becomes trickier because it's not anchored on a particular place.
So you have to deal with those kind of things a little bit differently.
But other than that, Pendle was very ergonomic in terms of their API.
It's super easy.
You can keep it on your mind.
And it's compatible with date time.
So it was a plus.
We're happy.
That's a really neat point because if you've got some other API that takes a date time, you can just pass in the Pendle time and it just, it is a date time.
Yeah.
Right?
So you don't have to major, oh, I forgot to convert here.
So it's broken.
So the lander crashed into the ground because, you know, whatever.
Exactly.
All those units and conversion types are weird.
Yeah.
And the arithmetic.
Right?
So I think that is the other aspect that Pendle makes a little bit easier.
The arithmetic one is like, as a day subtract minutes, this duality between a point in time and a delta that we do have on like the time and time delta and all the Python API.
But Pendle also helps you in that sense to do those conversions in terms of like scale and arithmetic.
So it was really interesting.
Yeah.
One quick thought I'll throw out there that because this was such a surprise to me.
I just had, it's so undiscoverable, but it's good once you know it.
Yeah.
It's good to know it.
Let's put it that way, at least.
That when you're doing, forget Pendle for a minute, if you're just doing raw date times and time deltas.
So time deltas always have a seconds, right?
Yeah.
So I create a time, a difference between two times or I take a time and add a time delta.
I get a new time delta or you get new time.
But if you have a time delta and it's in seconds, which is basically the only option you get.
And you want to know, well, I need this in hours.
I would always just go two total seconds divided by 60.
Exactly.
Divided by 60 again.
What you can do is create another time delta and say time delta hours equals one and then divide one by the other.
And then you get a number of hours.
Or if you want like weeks, time delta is seven days and you divide your time delta by that and it'll give you the days.
And that's really handy.
But boy, is it hard to discover to know that that's possible.
Exactly.
And that's where I think Python shines as well.
Because since the beginning, one of the arguments in favor of Python, it was when people said Python is pseudocode that runs.
They were telling you Python brings you closer to the domain of the problem.
Right.
And that matters.
Syntax sugar matters.
Because the way you express software, it means you make less mistakes.
So when you read it, you fully understand it.
Yeah.
It's easy to do a review.
It's easy to do maintenance.
It's easy to throw in and write it again.
That matters.
So it's not just about if you know the logic, if you know the theory, but in the way you express the logic and the theory matters a lot.
Absolutely.
Totally agree.
All right.
Let's talk one more element here on this one.
And that's the database side of things.
Why did you choose MongoDB?
What's your experience working with it?
That's a great question.
That's an example.
That's a great question.
So I came while I was at the university, I was working with the database group and I had a lot of experience with like database.
I played with object oriented database in 1993, the French object database called O2.
As time went by, we had Zope and Zodb.
I played a lot with Zodb.
I even made a tiny little contribution to Zope.
So I've been exposed to NoSQL before NoSQL became a thing.
But of course, SQL was still there.
But what we wanted was, again, development time.
So as a director at Working Co., my main consideration is, can I make this project fit the budget and the schedule before I exactly know what we have to do?
Because details will only be captured at the end of the conceptual design phase.
But at that point in time, the money is defined, the schedule is set.
So it's like, okay, I'll build the pyramids, but I don't know what's going to be like bringing those blocks of rock across the Nile.
So because of that, I wanted to go for flexibility first.
And going for a NoSQL database, it gives you speed in terms of development time, right?
So you can put anything in there.
Mongo is storing information in the same formats as the applications are consuming then, which today are like...
You don't have that object relational impedance mismatch.
You just have it's in Python.
Now it's in Mongo.
Now it's back in Python.
It's the arms of the world.
I always was let down by arms.
Because in the beginning, when you know nothing, they are great because you don't need to learn the actual language of the database.
After you evolve, they become a barrier because they are never as sophisticated as the data manipulation language of the database, right?
And then you say, oh, why they don't support this and that?
My challenge has been more operational with ORMs is they're pretty good.
And a lot of times, if you have the right indexes, you know, the speed can be okay.
If you make sure you do the joins instead of the lazy N plus one type of queries, you'll be okay.
But you build up your classes and everything's easy.
And then you want to add a field to a class.
You want to create a relationship.
Well, now you try to run your app.
It doesn't just not work well.
It fully crashes until you do a database migration.
And are you doing that migration in production and staging and dev?
And then what's the downtime story as you roll out the changes to your multiple servers that all got to talk to that database?
It's like, ah.
And for me, something like Mongo that is just so much more likely to adapt.
Like I haven't run a database migration or anything like that for years.
You know, people talk about Mongo for like it's web scale and it's all this data.
And that's great.
I mean, like my database probably has seven gigs of data for like talk by done training and the podcast.
And that's a non-trivial amount of data, but it's not so much about the data.
It's about the flexibility.
Like it's easy to make it fast and it doesn't require DevOps at the extreme to do it well.
You know?
That is a great point because managing the database.
I mentioned DevOps.
So because Mongo, they also provide the Atlas service where you have like database as a service.
That was key for us because then we can like forget about this.
We simply connect to Atlas.
They manage our cluster.
They have the dashboards, everything in place.
It was one click of a button to migrate from one version of Mongo to another version of Mongo.
So those things are priceless when you're doing like quick-paced development.
There was another reason though.
In the beginning of this project, PepsiCo asked us to use Azure.
So that meant we were doing our Python services within Azure and we had to do a database within Azure.
And we went for CosmoDB because CosmoDB was compatible with Mongo.
If at any point in time we needed to move out of CosmoDB, we would have Mongo as a fallback.
And that's exactly what happened.
So a couple of months, there were some political changes within PepsiCo.
They decided to go like AWS out of Azure and then boom, we had MongoDB in Atlas and we had like the same cluster in AWS for Python.
We were happy.
Totally agree.
Fantastic.
So I know we're going to talk about a bunch of APIs, but we spent all our time talking about this one.
Sure.
But I think this is really a super interesting thing to dive into.
We can touch on some of the other ones maybe a little bit, but I guess before we move off of this,
like what's one of the big takeaways you took from this project here?
Oh, that's such a big question.
There are like many things.
The biggest perhaps is at the core of the agile mindset.
After you implement stuff, it's really when you start to understand the problem.
It's really, really hard to kind of design on paper and then it just works.
So what we did for this project was many, many cycles of software rewrite.
When the project started back in 2019, like over the weekend, when they presented me the problem over the weekend, I was able to, on a Friday afternoon, Saturday and Sunday, to work on a tiny little full-blown solution.
I had a timeline.
I had a recommendation system.
I had recommendations.
It was kind of mockery a little bit, but I was able to cook that up in three days, show that to the clients and say, this is more or less what you're going to do.
And they really understood what was in there.
And then we threw all of that away and built like the new version, like on Troy, many cities built one on top of the other.
So that's what happened on this API.
Like we're doing microservices, like let's do Monolith.
We're doing Cosmo.
Let's do Mongo.
We're doing Quartz.
Let's just do Flask.
We're doing Kerberos.
Let's do Marshmallow.
Being able to throw things away and kind of rebuild, refactor, the power of refactoring made us to have a system that's always performing, that's manageable, that's minimal technical debt.
And I think that was the key learning that I was able to fully apply in this long-term projects, like two years.
That is not common for a working coach to have this two long projects.
Usually our project is like three months, six months, maybe a year.
But in the case of Gatorade, it's a retainer project.
We're for the long run with them.
And in this case, you really need to evolve the platform.
It's like maintenance-driven development.
Does that actually give you a different mindset when you're creating?
You're like, I am going to have to live with this.
Not they.
We're going to have to live with it.
I think that is the most difference between what I consider seasoned developers and new developers.
We have like junior developers that they are very competent.
They are very capable.
They master really quickly new technologies.
But the difference is to fully understand the impacts of decisions, not just based on theory, but based on social events that may or may not happen, based on what the future may bring.
And experience counts a lot in that sense.
And the maintenance-driven development mindset, when you know you're the one that you're going to do the maintenance, changes things a lot.
You think about stability, robustness, task coverage in a completely different way.
I totally, it seems like it absolutely would if you're the one who's got to live with it.
Because you go to some of these consulting projects and they're like, oh, we really want to use this specific database.
We want to use this framework, but in this odd way.
And you're like, well, they're the customer.
They're always right.
But if it's going to be you, you're like, yeah, we better build this the way that we're going to be happy in a year.
You know, there's that, it reminds me of that funny quote, like, always code as if a person who ends up maintaining your code will be a violent cycle path.
That's where you live, right?
Very good. That's good advice.
Yeah, a little bit morbid, but do think about that you'll have to live with it, I guess.
And I think that talks to the trend they call boring codes, right?
There's a bunch of like speeches and talks on the internet.
People talk about, oh, right, boring codes.
Codes are easy to understand, easy to do maintenance.
It has this mindset that when you're learning things and you're not concerned about production stuff, you are much more bold to try new things, right?
Because then the project is done, you move away.
So there's no cost, there's no risk, there's no penalty for trying new stuff that may prove inadequate.
But when your success measurement is considering the maintenance phase, the long-term success of the project, the mindset is a different one.
It's what is stable, what's guaranteed.
If you're chasing the shiny new thing, you could end up saying, well, I'm going to build this six-month project.
I'll do that in React.
And this one is going to be in Vue.
And this one will be in Angular.
And this is going to have this backend and that backend.
And then all of a sudden, you end up maintaining every JavaScript front-end framework in the world.
Exactly.
And yeah, you don't want to be like that.
I think the other thing you touched on is really interesting.
One of the things that I try to preach a lot is it often doesn't matter too much how you get started so much as you get started on a project.
I see a lot of people saying, you know, they'll get frozen.
They're like, well, I just can't decide between Django and Flask or FastAPI or this or Postgres or Mongo.
And they just, they think and they think and they think and they don't get anywhere.
Like you highlighted with your, I did it over the weekend prototype.
A lot of times those people who are stuck, if they just fully internalize, like you can just go on a path and then evolve it with refactoring and change it and throw it away and rewrite it with more knowledge.
The time you spent worrying about what to do, you would already have a working example, probably.
And then you have so much more information to build from and decide from.
I think that's a really important takeaway.
God is in the details.
Nobody stumbles and mouthings.
It's the little things that make your fault.
That's a good quote.
I like it.
Nice.
All right.
Well, I think rather than diving into the other APIs that we're going to cover, I think maybe just this deep one into the DXSWet patches is probably a little bit more constructive and useful.
So maybe we'll leave it here for the APIs.
Cool.
Really, really neat work.
A lot of moving parts, right?
You've got your mobile apps.
You've got your mobile apps in Xamarin.
You've got your ML models.
You've got the APIs, the other external API integration, the other app integration.
A lot of stuff going on here, right?
So I think it's a pretty good case study.
It is.
One bit that we didn't mention, I'd like to really quickly mention, is that we have another engine for product recommendations that use constraint problem solving.
And this was, we're reusing a module, a colleague of mine called Gustavo Niemeyer.
He's a core developer for Python, now working for Canonical.
And he was with me in Europython 2005.
And on Europython 2005, he presented a Python module that now we're using to solve those constraint-based problem optimization.
And that was really cool because it's a really powerful mechanism.
And the problem we were solving was that you have all of these needs, right?
Needs for carbs, needs for protein, needs for hydration, needs for electrolytes.
And then you have all of these products that have different combinations of those elements.
So what is the optimal amount of products and types of products?
And what is the minimal amount that you need to kind of fulfill all your nutritional and hydrational needs?
And for that, we use Python Constraint.
There are other engines there, but we want it to be like fully Python solution.
And that is another hint that I want to share with people.
That is, it solves like a big problem and it's really easy to use.
And this is Python-Constraint on PyPI?
Yes, exactly.
This one you have on screen, Python-Constraint.
Looks really cool.
It reminds me a little bit of linear programming.
It is.
The difference is, well, actually, you have linear programming like simplex, where you're kind of going into the plane and trying to optimize numerically.
This is one kind of thing.
This other one is more on exploring a discrete space of solutions.
So you define your variables, the domain of values for each of these variables, and the constraints that validate, is this combination of values a solution to the problem or not?
If not, it's refuse.
So then it's a search space.
Yeah.
So there's like a chess problem, the rook.
Exactly.
Which clearly is not a continuous problem.
It's a very discrete.
The rook can be in one of, you know, 100 places or whatever on a chessboard, and that's it.
Very cool.
One final thing on this project here.
Now that you've created it, how many people are keeping it going and working on it?
What's the team size at the beginning and the end?
I mean, we talked about the monolith versus microservices, but not really the details there that made you decide the monolith side.
That's a great question.
So first of all, all the time we're talking about the GX consumer.
So for like you and me, we also have another app that talks to the same API called GX Teams.
And the GX Teams is for practitioners, coaches, personals, that they are managing a group of athletes.
So this is another thing that Gatorade launched, I guess, this month.
Both apps are up to the same API that we call GX Rack Engine.
So just for GX Rack Engine, our development team is today for people.
It's me, João Gomes, Nicolas Moya, Rodrigo Merlo, and Sachari Moreno.
So it's me plus four.
That is the whole backend team.
For frontend, for PM, strategy, business, product, then it's kind of gross, right?
But the things that we talk about in the Python world, we're talking about five people.
You know, that's super common.
If we look at the Python developer survey from the PSF and we go down and look at the team size,
the average team size, 75% of the time was two to seven people.
Yeah, it's the pizza rule, right?
Yeah.
If you get out to what I would call the microservice side, you know, that's maybe 20 people or so.
And 20 people or more on the team size is only 4% of all software developers doing Python.
So keep that in balance when you hear about like, you know, how Netflix or Google or Instagram is doing some amazing thing, right?
That context doesn't necessarily apply to like your context.
Exactly.
And they break down.
I worked for global.com, which is the biggest news company in Brazil.
We had a audience of 4 million people like daily going through like our websites, etc.
And the teams internally, they were like four or five people.
We none above seven because it becomes unmanageable.
The communication overhead becomes so high that it's not worth it.
Super interesting.
And I think we're going to leave it there, but I'm going to ask you the two final questions.
Before I do that, let me just call out a couple comments from the live stream.
Go ahead.
Black and White said, this video is so great to be frank.
Thank you.
And Vincent, hello, hello.
Love your show.
Keep up the work, please.
All your guests are on point.
Very interesting.
Yeah.
Thank you all for being here.
That's great.
All right, Rod.
Working on these projects and others, you're going to write some Python code.
What editor would you fire up?
Well, that's a great question.
So I'm a big fan of PyCharm.
So I've been using PyCharm forever.
It has some features that I kind of love, like class hierarchy, like usages of functions,
the debugging.
It's super well polished.
So I use PyCharm for professional work.
But having said that, I use everything else.
So I dabble with Visual Studio Code, great tool.
I use Vim a lot when I'm on the shell or doing stuff.
And of course, I use Jupyter Notebooks as well.
And sometimes I code stuff in Jupyter Notebooks, straight on Jupyter Notebooks.
And it's like lots of code.
All of those.
Fantastic.
I agree with all that.
And notable PyPI package.
Well, we mentioned like a couple there, right?
Like Pint and Pendulum and Python Constrain.
One that I heard in your show and I explored a little bit is called Rich.
So I think it was Brad Cannon that mentioned Rich, but I'm not sure right now.
But that was really awesome as well.
Really interesting.
So these are like my picks.
Yeah.
Rich is coming along as quite an interesting project.
It's going, you know, Will there is doing such interesting work.
And it just has super opened up what you can do in the terminal, I think, in a much more
approachable way.
Have you seen Textual?
No, I haven't.
I think that Textual is like a layout engine for Rich.
Oh, that's cool.
That is coming on here.
So what you can do is you can break up your terminal and to have like a toolbar, like a
left docking thing, a footer, and then a main area.
And then you render into each of those with Rich.
Fancy.
You can do like even arrow keys and only like move the main window section.
Oh, it's yeah.
There's a lot of cool stuff going there.
So super cool.
Yeah.
It's awesome.
All right.
Well, final call to action.
What's your final advice for people building these APIs thinking about these decisions for
their own projects?
Well, one I already have given, it's like be hands on, like try it out, see how it feels,
get your hands dirty.
This is crucial in my mind.
The other one is start thinking about maintenance driven development.
So when you start, because even if it's not you, somebody will have to like give maintenance.
So at least balance the costs and benefits of exploration and the advantages and downsides
of reusing well-established technology.
Right.
Look for the Zen, the yin-yang, the balance on these forces.
Good advice.
Definitely second it.
Rod, thanks for being on the show.
Thank you so much, Michael.
Yeah, you bet.
This has been another episode of Talk Python to Me.
Our guest on this episode was Rod Senra.
It's been brought to you by Sentry and Linode and the transcripts are brought to you by Assembly
AI.
Take some stress out of your life.
Get notified immediately about errors in your web applications with Sentry.
Just visit hawkpython.fm slash Sentry and get started for free and use the promo code
hawkpython2021 when you sign up.
Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines.
Develop, deploy, and scale your modern applications faster and easier.
Visit hawkpython.fm slash Linode and click the create free account button to get started.
Transcripts for this and all of our episodes are brought to you by Assembly AI.
Do you need a great automatic speech to text API?
Get human level accuracy in just a few lines of code.
Visit hawkpython.fm slash assembly AI.
Want to level up your Python?
We have one of the largest catalogs of Python video courses over at Talk Python.
Our content ranges from true beginners to deeply advanced topics like memory and async.
And best of all, there's not a subscription in sight.
Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play,
and the direct RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days.
If 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.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
I'll see you next time.
Thank you.