Latest / Talk Python To Me / #464: Seeing code flows and generating tests with Kolo
Transcript
- 0:00Do you want to look inside your Django requests?
- 0:02How about all of your requests in development and see where they overlap?
- 0:06If that sounds useful, you should definitely check out Colo.
- 0:10It's a pretty incredible extension for your editor.
- 0:13VS Code at the moment, more editors to come most likely.
- 0:16We have Wilhelm Klopp on to tell us all about it.
- 0:19This is Talk Python in May, episode 464, recorded May 9th, 2024.
- 0:25Are you ready for your host, here he is!
- 0:28You're listening to Michael Kennedy on Talk Python To Me.
- 0:31Live from Portland, Oregon, and this segment was made with Python.
- 0:35Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:41This is your host, Michael Kennedy.
- 0:43Follow me on Mastodon, where I'm @mkennedy,
- 0:45and follow the podcast using @talkpython, both on fosstodon.org.
- 0:50Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
- 0:56We've started streaming most of our episodes live on YouTube.
- 0:59Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.
- 1:06This episode is sponsored by Sentry.
- 1:09Don't let those errors go unnoticed.
- 1:11Use Sentry.
- 1:12Get started at talkpython.fm/sentry.
- 1:16And it's also brought to you by us over at Talk Python Training.
- 1:20Did you know that we have over 250 hours of Python courses?
- 1:24Yeah, that's right.
- 1:25Check them out at talkpython.fm/courses.
- 1:28Well, welcome to Talk Python To Me.
- 1:31Hello.
- 1:32Yeah, excited to be here, Michael.
- 1:33I've been listening to Talk Python like for, I can't even remember how long,
- 1:36but I'm pretty sure it was before I had a first Python job.
- 1:38So, yeah, a long, long time.
- 1:41That's amazing.
- 1:42Well, now you're helping create it.
- 1:44Yeah, exactly.
- 1:44We're going to talk about Colo, your Visual Studio Code, Django.
- 1:49I don't even know what to call it.
- 1:50It's pretty advanced, pretty in-depth.
- 1:52Extension seems to be not quite enough.
- 1:54So, what any project?
- 1:56People are going to really dig that, people who Django.
- 1:58And we'll see what the future plans are if we can talk you into other ones.
- 2:04But for now, Django plus...
- 2:06100%.
- 2:07Yeah, Django plus VS Code is going to be super interesting.
- 2:09When we get to that, of course, you must know the drill.
- 2:12Tell us a bit about yourself.
- 2:13Yeah, for sure.
- 2:14So, my name is Will.
- 2:15I've been using Django since...
- 2:18Well, I guess I've been using Python since about 2013, I want to say.
- 2:22So, a little over 10 years.
- 2:23And, yeah, I just kind of fell in love with it.
- 2:26Wanted to make websites.
- 2:28Started using Django.
- 2:29And, yeah, I guess never really looked back.
- 2:32That was in school back then.
- 2:34But kind of always had a love for tinkering and building side projects.
- 2:38I actually studied...
- 2:39I did a management degree in university.
- 2:41But I really loved hanging out with all the computer science kids, all the computer science
- 2:44students.
- 2:44And I think a part of me really wanted to impress them.
- 2:47So, I was always building side projects.
- 2:49And one of them was actually a Slack app called Simple Poll.
- 2:53And, yeah, we were trying to, like, organize something in Slack and really felt like the
- 2:57need for polls.
- 2:57So, built this little side project just, like, during university.
- 3:00And then it became really, really popular.
- 3:02And a few years later, it became my full-time job.
- 3:06So, for the past, like...
- 3:08Awesome.
- 3:08Yeah.
- 3:08Four years, I've been running Simple Polls, a Slack app, building out the team up to,
- 3:12like, seven, eight of us.
- 3:13And I had a great time doing that.
- 3:16In the middle, I actually worked at GitHub for two years, working on Ruby and Rails.
- 3:20And that was super fun.
- 3:20Like, a great company, great people, huge code base.
- 3:23Learned a lot there.
- 3:24That was really fun.
- 3:25But, yeah, I left after about two years to work full-time on Simple Polls.
- 3:29So, Simple Polls have been running as a side project kind of in the background.
- 3:32And actually, it's interesting, like, I think kind of the order of events, thinking back,
- 3:35Microsoft was...
- 3:38Acquired GitHub while I was there.
- 3:39And then suddenly, all of my colleagues started talking about buying boats and leaving the company.
- 3:45And I thought, hmm, I don't quite have boat money.
- 3:50But how can I...
- 3:52What's an ace I might have up my sleeve?
- 3:54And it was Simple Poll, which had got, like, tons of users, but I never monetized it.
- 3:58So, I set out to monetize it.
- 4:00And then a year later, it was actually bringing in more revenue than my salary at GitHub.
- 4:04So, I decided to quit.
- 4:06So, that's kind of the Simple Poll backstories.
- 4:08So, Simple Polls, a Django app, reasonably sized now, a bunch of people working on it.
- 4:12And then, yeah, at some point in the journey of building Simple Poll, I kind of started playing around with Colo.
- 4:18So, Colo also kind of, just like Simple Poll, started as a side project.
- 4:21But now, not to make polls in Slack, but instead to improve my own developer experience building Simple Poll.
- 4:28So, kind of built it as my own tool for making Django, working with Django more fun, give me more insight, give me access to some of the data that I felt was so close.
- 4:37But that I had to just, like, manually get in there and print out.
- 4:41So, the reason Colo started out as supporting just Django and VS Code is because that's what I was using.
- 4:47And it was an internal side project.
- 4:48And now, actually handed over Simple Poll to a new CEO.
- 4:53I'm no longer involved day to day, and I'm working full-time on Colo.
- 4:58Man, congratulations on, like, multiple levels.
- 5:01That's awesome.
- 5:01Thank you.
- 5:02Yeah.
- 5:02I want to talk to you a bit about Simple Poll for just a minute.
- 5:05But before then, you pointed out, like, look, I made this side project.
- 5:09And how many hours were you spending on it?
- 5:11A week, maybe?
- 5:12Oh, it was interesting.
- 5:13So, honestly, like, so this was, like, right at the beginning, like, when it was first started.
- 5:16Yeah, it's a good time.
- 5:18It's a good question.
- 5:19I always joke that the best thing about my management degree was that I had a lot of free time to, like, do, build side projects.
- 5:25Honestly, I think it could have been, like, 20, 30, 40 hours a week.
- 5:28Yeah.
- 5:29Yeah.
- 5:29That was, yeah.
- 5:30I think, yeah, it definitely varied week to week.
- 5:32And then later on?
- 5:33Yeah.
- 5:33And then while I was working, when I had a full-time job as a software engineer, yeah, that was a lot tougher.
- 5:37It was, like, nights and weekends.
- 5:39Rarely had energy during the week to work on it.
- 5:41And then, honestly, like, since it was a real project with real users, I ended up spending a lot of the weekend doing, like, support.
- 5:48Like, support stuff.
- 5:49Yeah, absolutely.
- 5:50Support.
- 5:50And, like, then you charge, and then now you have finance stuff and, like, legal stuff to do.
- 5:55So that wasn't super fun.
- 5:56It really slows down the features and the creation of stuff, doesn't it?
- 6:01Yeah.
- 6:01I would say I probably spent fully 50% of my full-time job doing email support, that kind of stuff.
- 6:09You know, just, like, there's tons of people taking courses and listening to podcasts.
- 6:12Yeah, yeah, yeah.
- 6:13And they'll have questions and thoughts.
- 6:15And, you know, it's awesome.
- 6:16But it also is really tricky.
- 6:18So the reason I ask is I always find it fascinating.
- 6:21You'll see, like, news articles.
- 6:24I don't know.
- 6:24They're always click-baity or whatever.
- 6:26This person makes three times their job working 10 hours a week on this other thing.
- 6:31Like, you make three times what you make for your job.
- 6:33What are you doing at your job?
- 6:34You know what I mean?
- 6:35Right?
- 6:36The ability to say you can make that step where you go from kind of tired at night's
- 6:41extra time and squeezing on the weekends to full-time, full energy.
- 6:44Yeah.
- 6:45If it's already doing well, you know, on, like, a very thin life support, like, then give it
- 6:49full-time and energy.
- 6:51It's just, of course, it's going to be better, right?
- 6:53It's so interesting.
- 6:53I actually have a lot of thoughts about this.
- 6:55Maybe I should write something about this at some point.
- 6:57But yeah, I actually think running, like, a bootstrap side project kind of business as
- 7:01you have a job can be really good because it really forces you to prioritize and build the
- 7:07most important things.
- 7:08Yeah.
- 7:08It's kind of like having kids.
- 7:09Oh, nice.
- 7:10Yeah, yeah.
- 7:10I need to try that someday.
- 7:11Oh, you'll be real tired.
- 7:13I tell you, you'll love to prioritize your time.
- 7:15Yeah, I think it really forces you to prioritize.
- 7:17So I actually sometimes recommend when folks ask me, like, for advice, like, should I quit my
- 7:21job to go all in or not?
- 7:23I actually sometimes think there's a lot of nice stability and that comes from having a
- 7:28job.
- 7:28Plus, it's actually really nice to have coworkers.
- 7:30It's nice to have structure.
- 7:32Like, you actually need to take all of that, well, work in a way on yourself.
- 7:36Like, it's, you know, if you have to make your own structure, like, if you're building your
- 7:39own thing, and that can actually be a bit tricky.
- 7:41Like, I really struggled with that at the beginning.
- 7:43So I think there's something to be said for, yeah, for spending, like, limited time on something,
- 7:47basically, and prioritizing just the most important.
- 7:49That's an interesting angle.
- 7:50And I don't necessarily disagree with that.
- 7:52That's interesting.
- 7:52So for me, it was interesting, like, in terms of like, how much, like, you know, life support
- 7:57energy you put in versus like, full time energy.
- 8:00It was growing decently, like while I was still at GitHub.
- 8:04And I thought, okay, I'm gonna go in on this full time.
- 8:07And if I go from like, 10 hours a week, or less to like 40 hours a week, that would probably
- 8:134x the growth rate as well.
- 8:14That's how it works.
- 8:16Right?
- 8:16And like, totally didn't.
- 8:17Like, it totally didn't work.
- 8:19In fact, like, the month after I left, I had like my first down month, where like the revenue
- 8:25decreased.
- 8:26And I was like, wait a minute, what's going on here?
- 8:28How that doesn't make any sense.
- 8:29That's not fair.
- 8:30So I think that also points that like, there, yeah, you can definitely spend more hours on
- 8:34something.
- 8:35And it can be like the wrong things or not doubling down on something that's really working.
- 8:40So, but overall, obviously, you at some point, like just being able to like test out more
- 8:44ideas is like really valuable.
- 8:45And for that, like, if you only have time to do support on your project, that's really working
- 8:50well, and your full time job is the rest of the how you spend your week, then yeah, feels
- 8:55like you should give yourself some time to build features and maybe quit the job.
- 8:59Yeah.
- 8:59It's also an interesting point about the structure, because not everyone is gonna get up at eight
- 9:06o'clock, sit at their desk, and they're gonna be like, you know, I kind of can just
- 9:09do whatever.
- 9:10And it's, it's a, it's its own discipline, its own learned skill.
- 9:14100%.
- 9:14Yeah.
- 9:14I remember like one of the first weeks after I was full time on simple call, I woke up in
- 9:20the morning and said, well, the money's coming in.
- 9:22I don't need to work.
- 9:23I don't have a boss.
- 9:24And I just sit in bed and watch YouTube videos all day.
- 9:26And then I just felt miserable at the end of the day.
- 9:29Like the, I was like, this is supposed to feel great.
- 9:31Why all this freedom I've wanted and dreamt about for so long?
- 9:34We're like, why does it not feel great?
- 9:36Yeah.
- 9:38It also, also feels like risk and more different kinds of responsibility.
- 9:42All right.
- 9:42So simple poll.
- 9:43The reason I said it'd be worth talking about a little bit is, you know, Slack's a popular
- 9:48platform and this is based on Django, right?
- 9:50So simple poll is a full on Django app.
- 9:52Yeah.
- 9:52And it's funny.
- 9:53Sometimes people joke that, I don't know if you've gone through the official Django tutorial,
- 9:58but in there you actually make a polls app in the browser.
- 10:00Sometimes people joke, wait, did you just turn this into like a Slack app?
- 10:05And then you productize the getting started tutorial.
- 10:07Yeah.
- 10:08Exactly.
- 10:09But yeah, like it turned out that like polls and then, yeah, getting, you know, your team
- 10:14more connected and Slack and more engaged are like things people really care about.
- 10:18So it came to the Slack, simple poll joined the Slack platform like at the perfect time and
- 10:24has just been growing super well since then.
- 10:27Tell people a little bit about what it takes technically to make a Slack app.
- 10:32I mean, Slack is not built in Python as far as I know.
- 10:35And it's probably JavaScript and Electron, mostly the people interact with, right?
- 10:40So what is the deal here?
- 10:41It's actually super interesting.
- 10:42So the way you build like a Slack app, it's actually all backend based.
- 10:47So when a user interacts in Slack, Slack sends your app, your backend, like a JSON payload
- 10:52saying like this user clicked this button.
- 10:54And then you can just send a JSON payload back saying, all right, now show this message.
- 10:59Now show this modal.
- 11:00And they have their own JSON based block kit framework where you can render different types
- 11:05of content.
- 11:06So you don't actually have to think about JavaScript or React or any of their stack at all.
- 11:10It's basically all sending JSON payloads around and calling various parts of the Slack API.
- 11:15So you can build a Slack app in your favorite language, any kind of exotic language if you wanted
- 11:20to.
- 11:20But yeah, I love Python.
- 11:23So I decided to build it in Python and Django.
- 11:25So yeah, actually building Slack apps is a really like pleasant experience.
- 11:29What's the deployment backend story look like?
- 11:33Is it a pass sort of thing?
- 11:35Serverless?
- 11:36VMs?
- 11:37At the time, it was Heroku.
- 11:39Simbup was running on Heroku.
- 11:41And then I think a few years ago, we migrated it to AWS.
- 11:45So now it's running on AWS and ECS.
- 11:48Nice.
- 11:49Okay.
- 11:49So Docker for the win.
- 11:51Right on.
- 11:51How does it work in TalkBison?
- 11:52I'm curious.
- 11:53How, what's, where are you deployed?
- 11:54It's all DigitalOcean.
- 11:55And then I have one big, like eight, eight CPU server running, I think, 16 different Django
- 12:03apps.
- 12:04Not Django, sorry.
- 12:05Docker apps.
- 12:05No, sorry.
- 12:06Docker apps that are all, all doing like, you know, some of them share database that's in
- 12:12Docker and some of them do sort of have their own self-contained pair of like web app and
- 12:19database and so on.
- 12:20But it's all, it's all Docker on one big server, which is fairly new for me.
- 12:25And it's, it's glorious.
- 12:26It's glorious.
- 12:27That's awesome.
- 12:27Very cool.
- 12:28Yeah.
- 12:29All right.
- 12:30So again, congrats on this.
- 12:32Very, very neat.
- 12:33Let's talk Colo.
- 12:35Let's do it.
- 12:35I first came across this, I've come across it independently twice.
- 12:42Once when the Django chat guys recommended that I talk to you because they're like,
- 12:47Will's doing cool stuff.
- 12:49You should definitely talk to him.
- 12:50This Django thing for VS Code is super cool.
- 12:53But also I can't remember there's somebody on your team whose social media profile I came
- 12:58across and I saw this and I'm like, oh, this is, this is pretty neat.
- 13:01I think we even covered it on the Python Bytes podcast.
- 13:04Oh, no way.
- 13:05Let's see.
- 13:05Yeah, sure.
- 13:06In January we did.
- 13:07So that's what we talked about a little bit, but this just looks like such a neat thing.
- 13:12And it's, I encourage people to, who may be interested in this, to visit colo.app because
- 13:17it's a super visual sort of experience of understanding your code, right?
- 13:21Would you agree?
- 13:22Yeah.
- 13:22I mean, a hundred percent.
- 13:23Yeah.
- 13:23A funny thought.
- 13:24I hadn't really thought that a podcast is going to be a hard way to describe the visual
- 13:29beauty and magic that Colo can bring to your code.
- 13:32But yeah, a hundred percent.
- 13:33Yeah.
- 13:33So Colo like very much started as like the idea of, Hey, like I should be able to see
- 13:38like how my code actually flows.
- 13:40I think like all of us, as we build software, as we write our Python code, we have this kind
- 13:45of like mental model of how all the different functions like fit together.
- 13:49How like a bit of data ends up from like the beginning, like to the end, like it passes through
- 13:54maybe a bunch of functions.
- 13:55It passes through a bunch of like classes, a bunch of loops.
- 13:58All the state gets like modified and we have this kind of like mental picture of all of
- 14:03that in our head.
- 14:04And the kind of very beginning of Colo, the question I asked myself was like, is there a
- 14:09way we can just like visualize that?
- 14:11Is there a way we can just actually print that out onto a screen?
- 14:15So if you go to colo.app, it kind of looks like this funny sun chart with like lots of kind
- 14:20of a sunny tree chart with lots of nodes going from the center and like going off into the
- 14:26distance, which I think is like, yeah, similar to like what folks kind of might already have
- 14:30in their head about like how the code flows.
- 14:32Maybe another way to describe it is imagine like you enable a debugger at the beginning
- 14:40of every function and at the end of every function in your code and you print out like what was
- 14:46the function name?
- 14:47What were the input arguments?
- 14:48What was the return value?
- 14:49And then you arrange all of that in a graph that then shows which function called which other
- 14:54function.
- 14:55It almost looks like what you get out of profilers.
- 14:57Right.
- 14:57You know, where you say like, okay, this function took 20%, but if you expand it out, I'll say,
- 15:02well, really spent 5% there, 10% there, and then a bunch of it.
- 15:06And you can kind of traverse that.
- 15:08100%.
- 15:08Yeah.
- 15:09I'm guessing you're not really interested in how long it took, although maybe you can probably
- 15:12get that out of it.
- 15:13It's the important is more what is the dependency?
- 15:16What are the variables being passed and like understanding individual behavior, right?
- 15:21Or maybe.
- 15:22Yeah.
- 15:22What do you think?
- 15:23Yeah, 100%.
- 15:23I think like, it's interesting because Colo actually uses under the hood, like a bunch
- 15:26of the Python profiling APIs.
- 15:28And I think people often think of Colo as a profiler.
- 15:31We do actually have a traditional profiling based chart, which puts the timing at the center.
- 15:36But you're absolutely right that the focus of our like main chart, the one that we're both
- 15:41looking at that has like this idea of the function overview and like which function calls which.
- 15:46The idea there is like absolutely the hierarchy and seeing like giving yourself that same mental
- 15:52model that someone who's worked on a code base for three months has in their head immediately
- 15:56like yourself by just looking at it.
- 16:00This portion of Talk Python To Me is brought to you by Sentry.
- 16:03Code breaks.
- 16:04It's a fact of life.
- 16:05With Sentry, you can fix it faster.
- 16:07As I've told you all before, we use Sentry on many of our apps and APIs here at Talk Python.
- 16:13I recently used Sentry to help me track down one of the weirdest bugs I've run into in a long
- 16:18time.
- 16:19Here's what happened.
- 16:20When signing up for our mailing list, it would crash under a non-common execution pass, like
- 16:26situations where someone was already subscribed or entered an invalid email address or something
- 16:31like this.
- 16:32The bizarre part was that our logging of that unusual condition itself was crashing.
- 16:38How is it possible for our log to crash?
- 16:41It's basically a glorified print statement.
- 16:43Well, Sentry to the rescue.
- 16:45I'm looking in the crash report right now, and I see way more information than you'd expect
- 16:50to find in any log statement.
- 16:51And because it's production, debuggers are out of the question.
- 16:54I see the traceback, of course, but also the browser version, client OS, server OS, server
- 17:01OS version, whether it's production or Q&A, the email and name of the person signing up.
- 17:06That's the person who actually experienced the crash.
- 17:08Dictionaries of data on the call stack and so much more.
- 17:11What was the problem?
- 17:12I initialized the logger with the string info for the level rather than the enumeration.info.
- 17:20which was an integer based enum.
- 17:22So the login statement would crash saying that I could not use less than or equal to between
- 17:27strings and ints.
- 17:28Crazy town.
- 17:30But with Sentry, I captured it, fixed it.
- 17:33And I even helped the user who experienced that crash.
- 17:36Don't fly blind.
- 17:38Fix code faster with Sentry.
- 17:39Create your Sentry account now at talkpython.fm/sentry.
- 17:43And if you sign up with the code TALKPYTHON, all capital, no spaces, it's good for two free
- 17:50months of Sentry's business plan, which will give you up to 20 times as many monthly events
- 17:54as well as other features.
- 17:57Usually in the way these charts turn out, you can notice that there's like points of interest.
- 18:02Like there's one function that has a lot of children.
- 18:04So that clearly is coordinating like a bunch of the work where you can see kind of similarities
- 18:09in the structure of the some of the subtrees.
- 18:12So you know, oh, okay, maybe that's like a loop and it's the same thing happening a couple
- 18:15times.
- 18:16So you can essentially, I get this overview and then it's fully interactive and you can
- 18:21dive in to like what exactly is happening.
- 18:23Yeah.
- 18:24Is it interactive?
- 18:25So I can like click on these pieces and it'll pull them up.
- 18:28We actually, and this is what's, it'll be live by the time this podcast goes live.
- 18:32We actually have a playground in the browser.
- 18:34This is also super fun.
- 18:36We can talk about this.
- 18:36Let me drop you a link real quick.
- 18:38This will be at play.colo.app.
- 18:40So with this, yeah, this is super fun because this is fully Python just running in the browser
- 18:45using Pyodide and like WebAssembly.
- 18:47Nice.
- 18:48Okay.
- 18:48But yeah, so this is the fully visual version where you can, yeah, it defaults to loading
- 18:53like a simple Fibonacci algorithm.
- 18:55Yeah.
- 18:55And you can see like what the cola visualization of Fibonacci looks like.
- 19:00And you can actually edit the code and see how it changes with your edits and all of that.
- 19:03We have a couple other examples.
- 19:05Wow.
- 19:05The pandas one and the whack-a-mole one are pretty intense.
- 19:08They're pretty wild pictures.
- 19:09They look like sort of Japanese fans or whatever.
- 19:12You know, those little paper ones.
- 19:13We once had a competition at a conference to see who could make like the most fun looking
- 19:18algorithm and visualize it with Kolo.
- 19:20But yeah, like it's fun.
- 19:22Like visualizing code is really great.
- 19:23That's awesome.
- 19:24So this is super cool.
- 19:26It's just all from scratch.
- 19:28It's besides Pyodide here.
- 19:31Not like VS Code in the browser or anything like that.
- 19:34I think it's using Monaco in this case or CodeMirror.
- 19:37But otherwise, this is all is Pyodide and a little bit of React to like pull kind of the
- 19:41data together.
- 19:42Uh-huh.
- 19:43But yeah, we're really, yeah.
- 19:44Wow.
- 19:44It's otherwise homemade.
- 19:46This is kind of like the kind of what Kolo has been for like the past like two years or so has been this kind of side project for our SimplePol to help like just visualize and understand code better.
- 19:57The SimplePol code base, to be honest, has grown so large that like there's parts of it that I wrote like five years ago that I don't understand anymore.
- 20:04And it's like annoying to get back to that and having to spend like a day to re-familiarize myself with everything.
- 20:10It's a lot nicer to just like to actually kind of explain like end to end how it works.
- 20:15You install like in a Django project, you install Kolo as a middleware.
- 20:19And then as you just browse and use your Django app and make requests, traces get saved.
- 20:27So Kolo records these traces.
- 20:28They actually get saved in a local SQLite database.
- 20:32Then you can view the traces, which includes the visualization, but also like lots of other data.
- 20:37Like you can actually see in the version you have there.
- 20:39Like we show every single function call, like the inputs and outputs for each function call.
- 20:43So that main idea of Kolo is to like really show you everything that happened in your code.
- 20:48So in a Django app, that would be like the request, the response, like all the headers, every single function call, input and output, outbound request, SQL query.
- 20:57So really the goal is to show you everything.
- 21:00You can view these stored traces either through VS Code.
- 21:04And this is also will be live by the time this episode goes live through like a web middleware version, which is a bit similar to Django debug toolbar.
- 21:12Not sure if you've played around much with Django debug toolbar.
- 21:15Yeah, a little bit.
- 21:15Yeah.
- 21:16And those things are actually pretty impressive.
- 21:17Right.
- 21:18I played out with that one in the pyramid one.
- 21:20And yeah, you can see more than I think you would reasonably expect from just a little thing on the side of your web app.
- 21:27Yeah, yeah, exactly.
- 21:27And that's very much our goal to like very kind of deep insight.
- 21:31In our minds, this is almost like a bit like old news.
- 21:34Like we've been using this for like a few years, basically.
- 21:36And then at some point, like last year, we started playing around with this idea of like,
- 21:41OK, so we have this trace that has information about like pretty much everything that happened in like a request.
- 21:48Is there any way we could use that to solve this like reasonably large pain point for us, which is like writing tests?
- 21:54I'm actually curious.
- 21:55Do you enjoy writing tests?
- 21:56I'll tell you what I used to actually.
- 21:58I used to really enjoy writing tests.
- 22:01I used to enjoy thinking a lot about it.
- 22:03And then as the projects would get bigger, I'm like, you know, this is these tests don't really cover what I need them to cover anymore.
- 22:10And they're kind of dragging it down.
- 22:12And then, you know, the thing that really kind of knocked it out for me is I'd have like teammates and they wouldn't care about the tests at all.
- 22:18So they would break the tests or just write a bunch of code without tests.
- 22:23And I felt kind of like a parent cleaning up after kids.
- 22:27You're like, why is it so?
- 22:28Can we just pick up?
- 22:29Like, why are there dishes here?
- 22:30You know, just going around.
- 22:32I'm like, this is not what I want to do.
- 22:34Like, I want to just write software.
- 22:35And like, I understand the value of tests, of course.
- 22:38A hundred percent.
- 22:39At the same time, I feel like maybe higher order integration tests often, for me at least, serve more value.
- 22:47Because it's like, I could write 20 little unit tests or I could write two integration tests.
- 22:52And it's probably going to work.
- 22:53I'm actually completely with you on that.
- 22:54Okay.
- 22:55Right on.
- 22:55The bang for the buck of integration tests are like great.
- 22:59Like really, really useful.
- 23:00You can almost think of tests as having like two purposes.
- 23:04One being like, well, actually, I think this would be too simple in explanation.
- 23:08Let me not make grand claims about all the uses of tests.
- 23:11I think the use of it that most people are after is this idea of like, what I've built isn't going to break by accident.
- 23:20Yeah.
- 23:20Like you want confidence that any future change you make doesn't impact a bunch of unrelated stuff that it's not supposed to impact.
- 23:27I think that's what most people are after with tests.
- 23:32And I think for that specific desired result, like integration tests are the way to go.
- 23:37And there's some cool writing about this from, I wrote a little blog post about Kolo's test generation abilities.
- 23:43And in there, I linked to a post from Kent C. Dodds from the JavaScript community who has a great post about, I think it's called write tests, not too many, mostly integration.
- 23:53Kind of after this idea of like,
- 23:54Nice.
- 23:55Yeah, yeah, yeah.
- 23:56Eat not too much, mostly vegetables.
- 23:58I think that's the, yeah, exactly.
- 24:00Exactly.
- 24:00Yeah.
- 24:01I'm a big fan of that.
- 24:02And actually it's interesting.
- 24:03I've speaking to a bunch of folks over the past like year about tests.
- 24:06A lot of engineers think about writing tests as vegetables.
- 24:10And obviously some people love vegetables and some of us love writing tests, but it seems like for a lot of folks, it's kind of like a obviously necessary part of creating great software, but it's maybe not like the most fun part of our job.
- 24:24Or you pick up some project, you're a consultant, or you're taking over some open source project.
- 24:30You're like, this has no tests.
- 24:31Right.
- 24:31It's kind of like running a linter and it says there's a thousand errors.
- 24:35You're like, well, we're not going to do that.
- 24:36Yeah.
- 24:37We're just not going to run the linter against it because it's just too messed up at this point.
- 24:42Right.
- 24:42It's interesting.
- 24:42You mentioned the picking up like a project with no tests, because I think within the next three months, we're not quite there yet.
- 24:48But I think in the next three months with Colo's test generation abilities, we'll have a thing where, yeah, all we need is a Python code base to get started.
- 24:55And then we can bring that to like a really respectable level of code coverage just by using Colo.
- 25:01Okay.
- 25:01How?
- 25:03I was kind of describing a second ago how like we, SimplePol has tons of integration tests.
- 25:08SimplePol actually is about 80,000 lines of application code, not including migrations and like config files.
- 25:15And then it's about 100,000 lines of tests.
- 25:17And most of that is integration tests.
- 25:20So SimplePol very well, very well tested.
- 25:22Lots of, you know, really mostly integration tests.
- 25:24But it is always a bit of a chore to like write them.
- 25:27So we started thinking about like, hmm, this like Colo tracing we're doing, can that help us with making tests somehow?
- 25:34And then we started experimenting with it.
- 25:36And like to our surprise, it's actually, yeah, I'm still sometimes surprised that it actually works.
- 25:40But basically the idea is that if you have a trace that has, that captures everything in the request, you can kind of invert it to build a integration test.
- 25:53So let me give an example of what that means.
- 25:55The biggest challenge we found with creating integration tests is actually the test data setup.
- 26:02So getting your application into the right shape before you can send a request to it or before you can call a certain function.
- 26:09That's like kind of the hardest part.
- 26:11Writing the asserts is almost like easy or even like fun.
- 26:15Right.
- 26:15There's the three A's of unit testing.
- 26:17Range, assert, and act.
- 26:19Wait, arrange, act, and assert.
- 26:21Exactly.
- 26:21The first and the third one that you kind of have data on, right?
- 26:25Exactly.
- 26:25Yeah.
- 26:25So we're like, wait a second.
- 26:28We actually can like kind of extract this, like the act.
- 26:32So like the setting, sorry, the arrange, setting up the data, the act, like actually making the HTTP request.
- 26:38And then the assert, like to ensure the status change or that the request go to 200 or something.
- 26:43We actually have the data for this.
- 26:44It's reasonably straightforward.
- 26:46Like if you capture in, you know, just your like normal, like imagine you have a local to-do app and you browse like a to-do kind of demo, simple to-do app.
- 26:54And you browse to the homepage and the homepage maybe lists the to-dos.
- 26:57And if you've got Kolo enabled, then Kolo will have captured the request, right?
- 27:01So like the request went to the homepage and it returned a 200.
- 27:05So that's already like two things we can now turn into code in our integration test.
- 27:09So first step being, well, I guess this is the act and the assert in the sense that the assert is the 200.
- 27:15And then the act is firing off a request to the homepage.
- 27:19Now the tricky bit, and this is where it gets the most fun, is the arrange.
- 27:23So if we just put those two things into our test, in our to-imaginary test, there wouldn't have been any to-dos there, right?
- 27:30So it's actually not an interesting test yet.
- 27:32But in your local version where the trace was recorded, you actually had maybe like three to-dos already in your database.
- 27:39Does that make sense so far?
- 27:40Yeah, yeah, absolutely.
- 27:41On the homepage, like your to-do app might make a SQL query to like select all the to-dos or all the to-dos for the currently logged in user.
- 27:50And then Kolo would store that SQL query, would store that select, and would also store actually what data the database returned.
- 27:57This is actually something where, yeah, Kolo goes beyond a lot of the existing kind of like debugging tooling that might exist.
- 28:03Like actually showing exactly what data the database returned in a given SQL query.
- 28:07But imagine we get like a single to-do returned, right?
- 28:11We now know that to replicate this like trace in our test, we need to start by seeding that to-do into the database.
- 28:20That's where like the trace inversion comes in.
- 28:22If like a request starts with a select of like the to-do table, then the first thing that needs to happen in the integration test is actually a like creating like an insert into the database for that to-do.
- 28:35And now when you fire off the request to the homepage, it actually goes through your real code path where like an actual to-do gets loaded and gets printed out onto the page.
- 28:44So that's like the most basic kind of example of like how can you turn like a locally captured trace of a request that like made a SQL query and return 200 into like an integration test.
- 28:56Yeah, that's awesome.
- 28:57One of the things that makes me want to write fewer unit tests or not write a unit test in a certain case is I can test given using mocking, given my, let's say SQLAlchemy or Beanie or whatever Django Rm model theoretically matches the database.
- 29:15I can do some stuff, set some values and check that that's all good.
- 29:19But in practice, if the shape, if the schema in the database doesn't match the shape of my object, the system freaks out and crashes and says, well, that's not going to work, right?
- 29:29There's no way.
- 29:30And so it doesn't matter how good I mock it out.
- 29:32It has to go kind of end to end before I feel very good about it.
- 29:36Oh, yeah.
- 29:37Okay.
- 29:37It's going to really, really work, right?
- 29:39Exactly.
- 29:39That's an interesting story.
- 29:40Like you're saying to like, let's actually see if we can just create the data, but like let it run all the way through, right?
- 29:46I'm totally with you.
- 29:47And I think I've often seen like unit tests pass and say, I mean, there's like lots of memes about this, right?
- 29:52How like unit tests say everything is good, but the server is down.
- 29:55Like, how is that possible?
- 29:56I think in Django world, it's reasonably common to write integration tests like this, as in like the actual database gets hit.
- 30:03You have this idea of like the Django test client, which sends like a, you know, real in air quotes, HTTP request through the entire Django stack, as opposed to doing the more unit test approach.
- 30:15So it hits the routes.
- 30:16It hits like all of the, that sort of stuff all the way.
- 30:19Yeah.
- 30:20And the template.
- 30:21Yeah.
- 30:21Yeah.
- 30:21And then at the end, you can assert based on like the content of the response, or you can check, like, imagine if we go back to the to-do example, if we're testing like the add to-do endpoint or form submission, then you could make a database query at the end.
- 30:36And Colo actually does this as well, because like, again, we know like that you inserted a to-do in your request.
- 30:42So we can actually make an assert.
- 30:44This is a different example of the trace inversion.
- 30:47If there's an insert in your request that you've captured, then we know at the end of the integration test, we want to assert that this row now exists in the database.
- 30:56So you can assert at the very end to say, does this row actually exist in the database now?
- 31:01So it's a very nice kind of reasonably end to end, but still integration test.
- 31:05It's not like a brittle click around in the browser and kind of hope for the best kind of thing.
- 31:10It's like, as we said at the beginning, I think like integration tests just get you great bank for your buck.
- 31:14They really do.
- 31:16It's like the 80-20 rule of unit testing for sure.
- 31:20Yeah.
- 31:20Talk Python To Me is partially supported by our training courses.
- 31:24If you're a regular listener of the podcast, you surely heard about Talk Python's online courses.
- 31:29But have you had a chance to try them out?
- 31:31No matter the level you're looking for, we have a course for you.
- 31:34Our Python for Absolute Beginners is like an introduction to Python, plus that first year computer science course that you never took.
- 31:41Our data-driven web app courses build a full PyPI.org clone along with you right on the screen.
- 31:48And we even have a few courses to dip your toe in with.
- 31:51See what we have to offer at training.talkpython.fm or just click the link in your podcast player.
- 31:56So is this all algorithmic?
- 31:59Yep.
- 31:59Great question.
- 32:00Is it LLMs?
- 32:01Like how much VC funding are you looking for?
- 32:04Like, you know, like if you've got LLMs in there, like they're coming out of the woodwork.
- 32:07No, I'm just kidding.
- 32:08No, how does this happen?
- 32:10It's actually all algorithmic and rule-based at the moment.
- 32:14So this idea of a select becomes like an insert and an insert becomes like a select assert.
- 32:21We were surprised how far we could get with just rules.
- 32:24The benefit we have is that we kind of have this like full-sized SimplePol Django code base to play around with.
- 32:30And yeah, like generating integration tests in SimplePol just like fully works.
- 32:36There's a bunch of tweaks we like had to make to as soon as I guess you work in kind of like outside of a demo example.
- 32:42You want like time mocking and HTTP mocking and you want to use your like factory boy factories.
- 32:49And maybe you have a custom unit test like base class and all of this.
- 32:53But yeah, it like it actually works now.
- 32:55I gave a talk at DjangoCon Europe last year.
- 32:58It's kind of like a bit of a wow moment in the audience where, yeah, you just click generate test and it generates you like a hundred line integration test and the test actually passes.
- 33:07So that was like people started just started clapping, which was a great feeling.
- 33:11I'm still a bit surprised that it works on it.
- 33:14But yeah, no LLM at all.
- 33:15I do think like LLMs could probably make these tests like even better.
- 33:19Or you know how I was saying a second ago, like in three months, we could go take a code base from like zero test coverage to maybe like 60%, 80%.
- 33:28I imagine if we made use of LLMs, that would help make that happen.
- 33:33Yeah.
- 33:33Yeah.
- 33:34You could talk to it about like, well, these things aren't covered.
- 33:37Right.
- 33:38What can we do to cover them?
- 33:39Yeah.
- 33:39I don't know if you maybe could do fully, fully automated.
- 33:43Just push the button and let it generate it.
- 33:45But, you know, it could also be like a conversational, not a conversation, sort of a guided.
- 33:49Let's get the rest of the test.
- 33:51You know, like, okay, we're down to 80.
- 33:53We've got 80%, but there's the last bit are a little tricky.
- 33:56Like what ones are missing?
- 33:57Right.
- 33:57So how do you think we could do this?
- 33:59Is that, no, no, you need to, that's not really the kind of data we're going to pass.
- 34:02You know, I don't know.
- 34:03It seems something like that.
- 34:04Right.
- 34:04I really like that.
- 34:05I had not thought about like a conversation as a way to generate tests, but that makes so much sense.
- 34:10Right.
- 34:10It kind of bringing the developer along with them where it's gotten too hard or something, you know?
- 34:15Yeah.
- 34:16There's something cool about just clicking a button and see how much code coverage you could get to.
- 34:19But chatting to it.
- 34:21I think also, honestly, like so far, like our test generation logic is a bit of a black box.
- 34:27It just kind of like works.
- 34:29Yeah.
- 34:29Until the point where like it doesn't.
- 34:31So we're actually kind of in the process of like shining a bit more of a light into like,
- 34:35like essentially the like internal data model that Colo keeps track of to know what the database state should be like in this arrange part of the integration test.
- 34:46And yeah, we're actually like in the process of like, yeah, talking to a bunch of users who are already using it and also finding like companies who want to increase their increase their test coverage or who have problems with their testing and want to improve that.
- 34:59And kind of working closely with them to make that happen.
- 35:03That's kind of a huge focus for us as we figure out, like, how do we want to monetize Colo?
- 35:07Like so far, Colo has just been kind of supported by SimplePool as a side project, but we're kind of making it real, making it its own business.
- 35:14So and we think the test generation is going to play a big part in that.
- 35:18Right.
- 35:18Like that could be a certainly a premium team feature sort of thing.
- 35:21Exactly.
- 35:22Yeah.
- 35:22Yeah.
- 35:22Yeah.
- 35:23Enterprise.
- 35:24Enterprise version comes with auto testing.
- 35:26Yeah, exactly.
- 35:28Something like that.
- 35:28Yeah.
- 35:29Yeah.
- 35:29If there's anyone listening and like they're keen to increase their code coverage, please email me.
- 35:33Maybe we can leave my email in the in the notes or something like that.
- 35:35Yeah, I'll put your contact info in the show notes for sure.
- 35:37It's actually really nice.
- 35:38It's just W at Colo dot app.
- 35:40Oh, very nice.
- 35:41So yeah, if anyone's listening and wants to kind of like increase their code coverage or has a lot of code bases that have zero coverage that would benefit from getting to like some level of coverage, we'd love to help you and talk to you.
- 35:52Even if the solution doesn't like involve using Colo, just really, really keen to talk to anyone about like Python tests and what can be done there.
- 35:59So yeah, please hit me up.
- 36:01Awesome.
- 36:01Yeah, I'll definitely put some details in the show notes for that.
- 36:04I have some questions as well.
- 36:05Please.
- 36:05Yes.
- 36:06Right here.
- 36:06I'm looking at the web page and the angle bracket title is Colo for Django.
- 36:12But in the playground thing you sent me, it was on plain Python code.
- 36:17It was on algorithms.
- 36:19It was on pandas, which I thought was pretty interesting how much you could see inside pandas.
- 36:23Makes me wonder, you know, if you look at the web frameworks, there's two or three more that are pretty popular out there and they all support middleware.
- 36:30Yeah, 100%.
- 36:30So Colo kind of started as like this like side project for our Django app.
- 36:35And I think that that's why we kind of went there first.
- 36:37It's kind of the audience we know best.
- 36:40You can do dogfood as well.
- 36:41Yeah.
- 36:41Exactly.
- 36:42Dogfooded.
- 36:43Lily, who's an engineer on the team, and who's been building a lot of the Python side of Colo, is like a core contributor to Django.
- 36:53So Django is like really where we're home.
- 36:55And to be honest, I think when building a new product, it's kind of nice to keep the audience somewhat small initially.
- 37:01Keep like building for very specific needs as opposed to going like very wide, very early.
- 37:06That was kind of very much, very much the intention.
- 37:08But there's no reason why Colo can't support Flask, FastAPI, the scientific Python stack.
- 37:15As you can see in the playground, it does totally work on plain Python.
- 37:19It's really just a matter of honestly, like FastAPI support would probably be like a 40 line config file in our code.
- 37:28And there's actually, yeah, we're thinking of ways to make that actually a bit more pluggable as well.
- 37:34There's only like so many things we can reasonably support well ourselves.
- 37:39I was going to say, if somebody else out there has an open source project, they want it to have good support for this, right?
- 37:44Like, hey, I run HTTPX or I run Litestar or whatever.
- 37:49And I want mine to look good here too, right?
- 37:50Totally.
- 37:51So the thing you can do already today is there's a little bit of config you can pass in.
- 37:55And actually, if you look back on the pandas example, you'll see this.
- 37:58By default, Colo actually doesn't show you library code if you use it in your own code base.
- 38:03But you can tell it, show me everything that happened, like literally everything.
- 38:07And then it will do that for you.
- 38:09So in this example you're looking at, or if anyone's looking at the playground, if you look at the pandas example, it'll say like include everything in pandas.
- 38:16And that'll give you like a lot more context.
- 38:19The thinking there is that most people don't really need, like the issues you're going to be looking at will be in your own code or in your own company's code base.
- 38:27You don't really need to look at the abstractions, but you totally can.
- 38:30But yeah, to answer the question, like we have this like internal version of a plugin system where, yeah, like anyone could add FastAPI support or like a great insight into PyTorch or what have you.
- 38:42The way it all works technically really is it's totally built on top of this Python API called set profile.
- 38:48I'm not sure.
- 38:49Have you used, have you come across this before?
- 38:51It's a bit similar to set trace actually.
- 38:52Yeah, I think so.
- 38:53I think I've done it for some C profile things before.
- 38:58I'm not totally sure.
- 38:59Yeah.
- 38:59Yeah.
- 39:00It's a really neat API to be honest, because Python calls back to your, like the callback that you register on every function, enter and exit.
- 39:08And then Colo essentially looks at all of these functions, enters and exits and decides which ones are interesting.
- 39:13So the matter of like supporting say FastAPI is basically just telling Colo, these are the FastAPI functions that are interesting.
- 39:21This is the FastAPI function for, for like an HTTP request that was served.
- 39:25This is the HTTP response or similarly for SQLAlchemy.
- 39:28This is the function where the query was actually executed and sent to the database.
- 39:33This is the variable, which has the query result.
- 39:35Like there's a little bit more to it.
- 39:37And I'm definitely like, yeah, generalizing, but it's kind of like in principle, it's as simple as that.
- 39:43It's like telling Colo, here's the bits of code in a given library that are interesting.
- 39:46Now just kind of like display that and make that available for the test generation.
- 39:50Excellent.
- 39:51Yeah, I totally agree with you that getting focused, it probably gets you some more full attention from the Django audience.
- 39:58And the Django audience is quite a large and influential group in the Python web space.
- 40:03So that makes a ton of sense, especially since you're using it.
- 40:05By the way, it was Lily's Mastodon profile, I believe, that I ran across that I first discovered Colo from.
- 40:12So of all the places, yeah.
- 40:13Or a post from her or something like that.
- 40:16That's awesome.
- 40:17Cool.
- 40:17All right.
- 40:17So let's talk about a couple other things here.
- 40:20Let's do it.
- 40:20For people who haven't seen it yet, like you get quite a bit of information.
- 40:24So if you see like the get request, you actually see the JSON response that was returned out of that request.
- 40:31And it integrates kind of into your editor directly, right?
- 40:35If you've seen CodeLens before, it's kind of like CodeLens, right?
- 40:38Yeah, this is another thing which I think is pretty novel with Colo.
- 40:41Like I think it's reasonably common for existing debugging tools to show you like, oh yeah, this is the headers for the request.
- 40:48Or this is like the response status code.
- 40:50But especially working with the Slack API in SimplePol, you're constantly looking at payloads and what were the values for things and what are you returning.
- 40:59In production, you don't directly get to even make those or receive those requests, right?
- 41:03There's some like system in Slack who was like chatting with your thing.
- 41:07You're like, well, what is happening here, right?
- 41:09Not that you would actually run this in there, but you know.
- 41:12I mean, it's funny you mentioned this because there is one experiment we want to run of kind of actually enabling these extremely deep and detailed Colo traces in production.
- 41:21We haven't explored this too much yet.
- 41:23And I think we're going to focus a little bit more on the test generation.
- 41:26But you could imagine like a user who's using, who's on the Talk Python site and they've got some incredibly niche error that no one else is like encountering.
- 41:38And you've tried to reproduce it, but you can't reproduce it.
- 41:41Maybe there's a little bit of information in like your logging system, but it's just not enough.
- 41:45And you keep adding more logging and you keep adding more logging and it's just not helping.
- 41:49Like imagine a world where you can say just for that user, like enable Colo and enable like these really deep traces.
- 41:55And then you can see whenever the user next interacts, like the value for every single variable, for every single code path that executed for that user.
- 42:05That's just like, yeah.
- 42:06I think one of our users described it as like a debugger on steroids.
- 42:09Yeah, yeah.
- 42:10It's pretty interesting.
- 42:10Sounds a little bit like what you get with Sentry and some of those things, but maybe also a little bit different.
- 42:18So, you know, you could do something like, here's a dear user with problem.
- 42:23Here's a URL.
- 42:24If you click this, it'll set a cookie in your browser and then all subsequent behavior, it just, it's on it.
- 42:30You know what I mean?
- 42:31It's like recording it.
- 42:32Yeah.
- 42:32That'd be pretty interesting.
- 42:33Yeah.
- 42:34I think it makes sense in the case, like if a user, it could even be an automated support thing, right?
- 42:39Like if a couple of sites have this where you can like do like a debug dump before you submit your support ticket.
- 42:45This is almost like that.
- 42:47And then as an engineer who's tasked with digging into that user's bug, you don't have to start with like piecing together.
- 42:54What was this variable at this time when they made that request three days ago?
- 42:58You like, you can just see it.
- 43:00If an error ever encounters an exception on your site, you just set the cookie.
- 43:04Right.
- 43:04Everything else they do is now just recorded until you turn it off on them.
- 43:07Oh my gosh.
- 43:08You're giving me so many good ideas.
- 43:09That'd be fun, right?
- 43:10Start writing this stuff down.
- 43:11Hey, let's record it.
- 43:13It'll be fine.
- 43:13That's awesome.
- 43:14Yeah.
- 43:14There's a bunch of stuff that's interesting.
- 43:16People can check it on the site.
- 43:18It's all good.
- 43:19However, we talked a little bit about the production thing.
- 43:22Like another thing you could do for production, this requires both a decent amount of traffic and maybe you could actually pull this off on just a single server.
- 43:30But you could do like, let's just run this for 1% of the traffic so that you don't kill the system.
- 43:37But you get, you know, if that's why you have enough traffic is like statistically significant sampling of what people do without actually recording a million requests a day or something insane.
- 43:48A hundred percent.
- 43:49I think there's really something there.
- 43:50Or like I could go on about this whole idea of like runtime data and like improving software understanding for days because I just think like it's really this like missing layer, right?
- 43:59Like all of us constantly imagine like what is like we play computer looking at our code, imagining what the values can be.
- 44:05But like, yeah, say you're looking at some complex function in production and you want to understand how it works.
- 44:10Like how useful would it be if you could see like the 10, the last 10 times it was called, like what were the values going into it and what were the values coming out of it?
- 44:18Like that would be, I just think like, why do we not have this already?
- 44:22Like why does your editor not show you for every single function in the code base?
- 44:26Give examples of like how it's actually used like in production.
- 44:30Yeah.
- 44:30And then use those to generate unit tests.
- 44:32And if there's an error, use that to generate the edge case, like the negative case, not the positive case, unit test, right?
- 44:38There you go.
- 44:38Exactly.
- 44:38It's all like kind of hanging together.
- 44:40Like, yeah.
- 44:41Yeah.
- 44:42Once you have the data, you have interesting options.
- 44:44Yeah.
- 44:44Business model.
- 44:45This is not, this, I maybe should have started sooner with this, but it's not entirely open source.
- 44:50It may be a little, little bits and pieces of it, but in general, it's not open source.
- 44:54That's correct.
- 44:55Yeah.
- 44:55Yeah.
- 44:56No, I'm putting that out there as a negative, right?
- 44:57This looks like a super powerful tool that people can use to write, write code it.
- 45:00And that's fine.
- 45:01Yeah.
- 45:02I think the open source question is super interesting.
- 45:03Like it's always been like something we've thought about or, or considered.
- 45:08I think there is, yeah, with, with developer tools, I think business models are always super interesting and we want to make sure that we can have a business model for Colo and like run it as like a sustainable thing, as opposed to it just being like a simple pole side project kind of indefinitely.
- 45:22Be great if Colo could like support itself and yeah, have a business model.
- 45:26I think that's how it can like really fulfill its potential in a way, but that's not to say that like Colo won't ever be open source.
- 45:32Like I think there's a lot to be said for open sourcing it.
- 45:35I think especially like the capturing of the traces is maybe something like I could see us open sourcing.
- 45:42I think the open source community is fantastic.
- 45:44I do also think it's not like a thing you get for free, right?
- 45:48Like as soon as you say, Hey, we're open source, you open yourself up to contributions, right?
- 45:54And to like the community actually getting involved and that's great, but it also takes time.
- 45:59And I think like, that's a path I would like to go down when we're a little bit clearer on like what Colo actually is and like where it's valuable.
- 46:08If that makes sense.
- 46:09Yeah, sure.
- 46:10If it turns out that no one cares about like what, how, like how to visualize code, then like, that's a great, like learning for us to have made, but I'd rather get there without like a lot of work in the middle that we could have kind of avoided, if that makes sense.
- 46:25So for sure.
- 46:25It feels like once we have a better sense of the shape of Colo and what the business model actually looks like, then we can be a bit more.
- 46:34Yeah.
- 46:34We can invest into open source a little bit more, but to be honest, like based on how everything's looking right now.
- 46:39I would not be surprised at all.
- 46:41If like big chunks, it was like Colo becomes open core or big chunks of it are like open source.
- 46:46It makes sense to me.
- 46:47It is fully free at the moment.
- 46:49So I should, that's worth calling out.
- 46:51There's no cost or anything.
- 46:52You can also like, you know, you download the Python package and guess what?
- 46:55You can look at all of the code.
- 46:57Like it actually is all of theirs.
- 46:59It is all kind of visible.
- 47:01That kind of leads into the next question is I've never used GitHub Copilot and a few of those other things because it's like here, check this box to allow us to upload all of your code and maybe your access keys and everything else.
- 47:15That's interesting.
- 47:15So we can one trainer models and two, you know, give you some answers.
- 47:19And that just always felt a little bit off to me.
- 47:21What's the story with the data?
- 47:24At the moment, Colo is like entirely like a local product, right?
- 47:27So it's all local.
- 47:29Like you don't have to, you can get like all of the visualization, everything just by using local Colo in VS Code.
- 47:36We do have a way to like upload traces and share them like with a colleague.
- 47:40This is actually also something I think is like kind of playing with the idea of like writing a little like Colo manifesto.
- 47:46Like what are the things that we believe in?
- 47:47One of them that I believe in, and this goes back to the whole like runtime layer on top of code.
- 47:52And like there's this whole dimension, this like third dimension to code that we're all simulating in our heads.
- 47:58I think like it should totally be possible to not just like link to a snippet of code like on GitHub, but it should be possible to have a like link like a URL to a specific execution of code, like a specific function and actually talk about that.
- 48:13It's kind of wild to me that we don't have this at the moment.
- 48:16Like you can't send a link to a colleague saying, hey, look at this execution.
- 48:20That looks a bit weird.
- 48:22We ran this in continuous integration and it crashed, but I don't understand.
- 48:25Let's look at the exact.
- 48:26Right.
- 48:27The whole deal.
- 48:28You can link to like CI runs.
- 48:29You can link to like sentry errors.
- 48:31But like if you're just seeing something slightly weird locally or like even something slightly like weird in production where there's no area, you can't really like link link to that.
- 48:40Anyway, like this is kind of a roundabout way of me saying that like I think that totally should be a thing.
- 48:45Like you should be able to link like generically to like an execution of a function or execution of a request.
- 48:51Like that would totally have to live somewhere.
- 48:54Right.
- 48:54So this is where there's some idea of like Colo cloud comes in and this is where you could like connect your repository.
- 49:00And then Colo would like as part of that, you know, just like GitHub does have access to your code and like show you the code in like the Colo cloud.
- 49:08So I think there's definitely like useful things that are possible there.
- 49:13But at the moment, it's a fully local experience.
- 49:15Like your code doesn't ever leave your system.
- 49:19You can if you want to like upload traces and then Colo stores the like trace data, not the code, just the trace data.
- 49:26But yeah, very local experience right now.
- 49:28Yeah.
- 49:29A little SQLite database.
- 49:30Exactly.
- 49:31Yep.
- 49:31Yeah.
- 49:31SQLite's pretty awesome.
- 49:32It's a credible piece of software.
- 49:34Yeah, it really, really is.
- 49:35Let's close out our conversation here with a little bit of a request from Michael.
- 49:39Right now it's VS Code only.
- 49:41Any chance for some PyCharm in there?
- 49:43This is our top request, like PyCharm support.
- 49:46Yeah.
- 49:46And we've decided super small team, like we want to kind of support everyone.
- 49:50But we've been working very heavily actually the past few months on a web-based version, which is, I'm happy to say, like very much nearing completion.
- 49:58And there's a few bits and pieces where like it's really nice to be integrated super deeply into the editor, like the code lenses and all of that.
- 50:06And I think there's a chance we'll have that for PyCharm eventually as well.
- 50:09But we actually found that like building out this web version, there's a few things that are actually much nicer when you have the full control over the UI in terms of like browsing around a trace, highlighting little bits of code.
- 50:20So for example, in Colo, like a given function call, we call a frame.
- 50:24And you can look at a given frame, both in VS Code, but also in the web version and see the code and see all of the data that passed through the code.
- 50:33But something we can do in the web version we can't do in VS Code is actually show where the current function was called from and actually show like a preview of that code.
- 50:40In VS Code, you can't really show like, you can link to it.
- 50:43Yeah, you can layer multiple files together or a difference.
- 50:45Yeah, exactly.
- 50:46Yeah.
- 50:47There's actually a lot of, like I was surprised by how many different novel, like kind of ways we had in the web that we just never even considered with like a direct editor integration in terms of displaying this runtime data.
- 50:59So like long story short, like you, you know, you want a PyCharm integration.
- 51:03Let me give you something even better.
- 51:05Yeah.
- 51:05A web version.
- 51:06So would that work like you run a certain command or something when you run your web app and then it just generates the SQLite file and then you could just explore it with a web view or what are you?
- 51:18Yeah, it's actually kind of cooler than that.
- 51:19So if you're using Django or in the future, like other things with a typical middleware, you would just like go to your, you would just go to localhost 8000 slash Colo.
- 51:29Yeah, yeah, yeah.
- 51:29Kind of like you do for open API docs.
- 51:33Yep.
- 51:33And then the whole experience is just there.
- 51:35If you're not using a middleware, we'll have a command like Colo serve or something like that.
- 51:40And that'll host the same experience for you.
- 51:43Just make sure it's off by default or it only responds on localhost or something like that.
- 51:49Yeah, exactly.
- 51:50Don't let people ship it on accident.
- 51:52That would be bad news.
- 51:54No production use of this.
- 51:55Yeah.
- 51:55I mean, people already know about the Django debug settings, but I guess you could sort of layer onto that, right?
- 52:02Probably.
- 52:03Yeah, I think we actually do that at the moment.
- 52:05But yeah, it's worth remembering.
- 52:06I know.
- 52:07I'm just thinking of like, oh, this is really cool to explore.
- 52:11A hundred percent.
- 52:12CNN.com is awesome.
- 52:14Look what it's doing.
- 52:14Look at all these requests and all this.
- 52:16Yeah, exactly.
- 52:18A hundred percent.
- 52:19Yeah.
- 52:19Yeah.
- 52:19Oh, and the API key is so interesting.
- 52:21Anyway, that's a bit of a side conversation.
- 52:25So let's just wrap it up with final call action.
- 52:28People are interested.
- 52:29What do they do?
- 52:30Yeah, colo.app and check it out.
- 52:32We have the Playground link there.
- 52:33Play.colo.app.
- 52:34Easiest way to kind of see what Colo is and what Colo does.
- 52:37But we'll say the most powerful way to actually see Colo in action is to use it on your own code base.
- 52:44So seeing the visualization and the test generation capabilities is just like, yeah, the most useful when you use it on your code base.
- 52:51So hopefully the Playground can entice that a little bit.
- 52:54And yeah, really the main, most important thing for us right now is, yeah, chatting to folks who want to increase their test coverage, want to like build automated testing as part of their workflow.
- 53:02And yeah, work very closely with you to make that happen.
- 53:05So if that's you, please email me at w at colo.app.
- 53:10You need that pause for the W. That's right.
- 53:12The two ads.
- 53:13Awesome.
- 53:14Will, thanks for being on the show.
- 53:16Congrats on both of your projects.
- 53:18They look really neat.
- 53:19Thanks so much for having me.
- 53:19Yeah.
- 53:20So excited to have been on.
- 53:21Yeah, you bet.
- 53:21Bye.
- 53:22Bye.
- 53:22This has been another episode of Talk Python To Me.
- 53:26Thank you to our sponsors.
- 53:28Be sure to check out what they're offering.
- 53:30It really helps support the show.
- 53:31Take some stress out of your life.
- 53:33Get notified immediately about errors and performance issues in your web or mobile applications with Sentry.
- 53:39Just visit talkpython.fm/sentry and get started for free.
- 53:44And be sure to use the promo code talkpython, all one word.
- 53:48Want to level up your Python?
- 53:49We have one of the largest catalogs of Python video courses over at Talk Python.
- 53:54Our content ranges from true beginners to deeply advanced topics like memory and async.
- 53:59And best of all, there's not a subscription in sight.
- 54:01Check it out for yourself at training.talkpython.fm.
- 54:04Be sure to subscribe to the show.
- 54:06Open your favorite podcast app and search for Python.
- 54:09We should be right at the top.
- 54:10You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 54:16and the direct RSS feed at /rss on talkpython.fm.
- 54:20We're live streaming most of our recordings these days.
- 54:23If you want to be part of the show and have your comments featured on the air,
- 54:26be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 54:31This is your host, Michael Kennedy.
- 54:33Thanks so much for listening.
- 54:34I really appreciate it.
- 54:35Now get out there and write some Python code.
- 54:37I'll see you next time.