Latest / Talk Python To Me / #535: PyView: Real-time Python Web Apps
Transcript
- 0:00Michael Kennedy: Building on the web is like working with the perfect clay.
- 0:02Michael Kennedy: It's malleable and can become almost anything.
- 0:05Michael Kennedy: Too often, frameworks try to hide the web's best parts away from us.
- 0:10Michael Kennedy: Today, we're looking at PyView, a project that brings real-time power of Phoenix LiveView
- 0:15Michael Kennedy: directly into your Python world while keeping the web elements front and center.
- 0:21Michael Kennedy: I'm joined by Larry Ogrodnek to dive into PyView.
- 0:24Michael Kennedy: This is Talk Python To Me, episode 535, recorded January 9th, 2026.
- 0:47Michael Kennedy: Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
- 0:52Michael Kennedy: This is your host, Michael Kennedy. I'm a PSF fellow who's been coding for over 25 years.
- 0:58Michael Kennedy: Let's connect on social media.
- 0:59Michael Kennedy: You'll find me and Talk Python on Mastodon, Bluesky, and X.
- 1:03Michael Kennedy: The social links are all in your show notes.
- 1:05Michael Kennedy: You can find over 10 years of past episodes at talkpython.fm.
- 1:09Michael Kennedy: And if you want to be part of the show, you can join our recording live streams.
- 1:13Michael Kennedy: That's right.
- 1:13Michael Kennedy: We live stream the raw uncut version of each episode on YouTube.
- 1:17Michael Kennedy: Just visit talkpython.fm/youtube to see the schedule of upcoming events.
- 1:22Michael Kennedy: Be sure to subscribe there and press the bell so you'll get notified anytime we're recording.
- 1:26Michael Kennedy: Hey, everyone.
- 1:27Michael Kennedy: A quick announcement.
- 1:27Michael Kennedy: I recently added a pair of features to talk Python to me to make it work way better with AI.
- 1:32Michael Kennedy: For example, you can ask questions such as, what was the last episode?
- 1:36Michael Kennedy: Or which episodes featured David Lord?
- 1:38Michael Kennedy: The AI can use a couple of endpoints, a new MCP server implemented in Quart,
- 1:43Michael Kennedy: and the emerging llms.txt standard to answer those questions with 100% accuracy and real-time data.
- 1:50Michael Kennedy: If you use an AI that supports MCP, then take just a moment and install our MCP server.
- 1:56Michael Kennedy: If not, you can always point your AI at talkpython.fm/llms.txt to get it started talking about the show.
- 2:04Michael Kennedy: Weirdly, ChatGPT says it can't read that file on our website and it gets a 400 response code,
- 2:09Michael Kennedy: even though asking it to do so results in a 200 okay from the OpenAI bot in our logs.
- 2:16Michael Kennedy: Oh well, for chat, you'll just have to copy the contents into your prompt until they fix whatever weirdness this is.
- 2:22Michael Kennedy: I did a write-up for this on the Talk Python blog called Announcing Talk Python AI Integrations at talkpython.fm/blog.
- 2:29Michael Kennedy: The full link is in your later show notes.
- 2:31Michael Kennedy: I hope you enjoy this new way to interact with our over 7.5 million words of content at Talk Python To Me.
- 2:38Michael Kennedy: Thanks for listening. Now let's get on to the show.
- 2:41Michael Kennedy: Larry, welcome to Talk Python To Me. Awesome to have you here.
- 2:43Michael Kennedy: Yeah, thanks, Michael. It's great to be here.
- 2:45Michael Kennedy: I saw your project, PyView, and you're like, oh, hey, maybe you could just give it a little shout-out.
- 2:51Michael Kennedy: And I'm like, this is super neat, the way this thing works.
- 2:54Michael Kennedy: And as most people know who listen, I'm a big fan of web development.
- 2:58Michael Kennedy: The last episode that we just released, not actually the one,
- 3:03Michael Kennedy: time shifting because of recording podcasts,
- 3:05Michael Kennedy: was with all the creators of the popular Python web frameworks as a panel.
- 3:09Michael Kennedy: And that was super popular.
- 3:11Michael Kennedy: So here we are back with another web topic, PyView.
- 3:14Michael Kennedy: And it's got a really, really unique twist.
- 3:18Michael Kennedy: And I think people are going to dig it.
- 3:20Larry Ogrodnek: It's quite interesting.
- 3:22Larry Ogrodnek: Gosh, I've been doing technology for a long time now,
- 3:24Larry Ogrodnek: and I think the web has always just been amazing, right?
- 3:26Larry Ogrodnek: It's an amazing platform, and so I think that's why people
- 3:28Larry Ogrodnek: kind of gravitate towards web frameworks
- 3:31Larry Ogrodnek: and interesting web technologies and what can you do now
- 3:34Larry Ogrodnek: and how can we make it easier?
- 3:35Larry Ogrodnek: Yeah, it's funny.
- 3:36Larry Ogrodnek: I did think PyView would resonate with you a little bit
- 3:37Larry Ogrodnek: just because I know that, I don't know if this is true,
- 3:40Larry Ogrodnek: but it seems like you do appreciate really not just like,
- 3:43Larry Ogrodnek: you know, obviously Python, but web technologies
- 3:45Larry Ogrodnek: and especially like embracing web technologies
- 3:47Larry Ogrodnek: and maybe not necessarily kind of hiding them.
- 3:50Michael Kennedy: Yeah, exactly. That is one of the things that really appealed to me because there are some Python frameworks that build webmaps, but their goal is to pretend that HTML and CSS is really bad. It's like, you don't want to write a simile. We're going to put that away from you. You don't need to see this HTML or the CSS or any of those things. Get it away. And I feel like something is lost there.
- 4:14Michael Kennedy: Like building on the web is just, it's like the perfect clay, right?
- 4:19Michael Kennedy: It's, it is so malleable and it can become almost anything that you want it to be.
- 4:24Michael Kennedy: And a lot of those frameworks, I think they just miss that.
- 4:26Michael Kennedy: And I don't feel like what you built does.
- 4:28Michael Kennedy: So I'm going to be, I think we're having a good time talking about it.
- 4:31Larry Ogrodnek: No, thanks.
- 4:32Larry Ogrodnek: Yeah, I'm excited to get into it.
- 4:33Larry Ogrodnek: But quick introduction, Larry, who are you?
- 4:36Larry Ogrodnek: Thanks.
- 4:37Larry Ogrodnek: Yeah.
- 4:37Larry Ogrodnek: So my name is Larry Ogrodnek.
- 4:39Larry Ogrodnek: I've been a software developer for, you know, I guess let's just say over 25 years now.
- 4:44Larry Ogrodnek: I don't age myself too much. But through that time, obviously, I've done a bunch of different
- 4:48Larry Ogrodnek: things and worked at startups. I worked at big companies. I've worked at freelancing for a few
- 4:54Larry Ogrodnek: years even. And so my early career, it was more kind of on the C pro side, a lot of backend work,
- 5:03Larry Ogrodnek: diving into Java and then Scala. And when I was doing freelancing, obviously the language of the
- 5:09Larry Ogrodnek: tech kind of depended on the client wanted to do and what the project entailed. But that's kind of
- 5:13Larry Ogrodnek: to get more serious about using Python.
- 5:16Larry Ogrodnek: And nowadays, I work at a startup in the construction industry.
- 5:20Larry Ogrodnek: And we think of ourselves--
- 5:21Larry Ogrodnek: JOHN MUELLER: Oh, really?
- 5:21Larry Ogrodnek: Yes.
- 5:22Larry Ogrodnek: But we're really trying to invest heavily in technology
- 5:26Larry Ogrodnek: and software.
- 5:27Larry Ogrodnek: We're trying to be a technology-enabled home builder.
- 5:29Larry Ogrodnek: And so we have a huge investment.
- 5:31Larry Ogrodnek: And we have-- I mean, not necessarily a huge tech team,
- 5:34Larry Ogrodnek: but spending any money and employment on tech
- 5:38Larry Ogrodnek: is kind of a big deal in this industry.
- 5:41Larry Ogrodnek: And I think it's an industry that hasn't really had technology get great adoption.
- 5:48Larry Ogrodnek: Different people are doing different things, but overall, there's been a hard time to kind of get it in that process.
- 5:53Larry Ogrodnek: But there's a lot of areas for improvement.
- 5:54Larry Ogrodnek: And so, you know, we're trying to make that process better, faster, smoother.
- 5:59Michael Kennedy: I think there's a lot of possibility for pick your underserved by tech specialization and build businesses around there.
- 6:08Michael Kennedy: If you're a Python developer or any kind of developer.
- 6:10Michael Kennedy: But if you really have the skill to build things like connecting APIs and automations and stuff,
- 6:18Michael Kennedy: it's just such fertile ground.
- 6:20Michael Kennedy: It's like, wow, there's nobody building stuff here that is like, good.
- 6:23Michael Kennedy: Let's go.
- 6:24Michael Kennedy: I could do this, right?
- 6:26Larry Ogrodnek: 100%.
- 6:26Larry Ogrodnek: And I think, yeah, like, Tim, maybe to your point, there's a lot of kind of low-hanging fruit
- 6:30Larry Ogrodnek: where it's just like just even getting some of the information in people's heads in a structured
- 6:34Larry Ogrodnek: way and even having, like, different processes defined in a structured way.
- 6:38Larry Ogrodnek: Like, you get huge improvements from that.
- 6:40Larry Ogrodnek: And this is kind of just like why we love technology, right?
- 6:42Larry Ogrodnek: Is you have these building blocks and it's like, oh, now that we have this in a structured
- 6:45Larry Ogrodnek: format, we can actually do these interesting things with it that we couldn't do before
- 6:48Larry Ogrodnek: because it was just on someone's notepad or whatever.
- 6:51Larry Ogrodnek: And so, yeah, you're right.
- 6:52Larry Ogrodnek: I think there's still a lot of issues like that.
- 6:54Larry Ogrodnek: And home building is for sure a big one.
- 6:58Larry Ogrodnek: And yeah, it's been interesting.
- 6:59Larry Ogrodnek: I mean, our main, actually, construction platform that manages our construction projects.
- 7:05Larry Ogrodnek: So we have an interesting part of that, what you were saying, is it can be hard in underserved
- 7:10Larry Ogrodnek: There are underserved areas to sort of have that domain expertise.
- 7:14Larry Ogrodnek: And so you have to find a good partner.
- 7:15Larry Ogrodnek: And one of the things we've done is we actually build the homes.
- 7:18Larry Ogrodnek: So we're not just writing software for other builders to use, but we're building homes ourselves.
- 7:22Larry Ogrodnek: And that's been a huge benefit because we have people building homes that we can sit down with and say, like, does this make sense?
- 7:28Larry Ogrodnek: Like, does it not make sense?
- 7:29Larry Ogrodnek: Like, why, why not?
- 7:30Larry Ogrodnek: And, you know, we have to obviously push on both sides sometimes because we are trying to change things.
- 7:35Larry Ogrodnek: Right.
- 7:36Larry Ogrodnek: But that's been, I think it'd be almost impossible to do without.
- 7:41Michael Kennedy: It's the dog fooding equivalent, the software dog fooding, right?
- 7:45Michael Kennedy: Exactly.
- 7:46Michael Kennedy: You're building.
- 7:47Michael Kennedy: They're building, you're building.
- 7:48Michael Kennedy: So then you can.
- 7:50Larry Ogrodnek: I know.
- 7:50Larry Ogrodnek: And it can be frustrating to get these phone calls like, why is this working?
- 7:54Larry Ogrodnek: Like, you're going to make me late for this or that.
- 7:55Larry Ogrodnek: But, you know, again, like those having those really strong partnerships, like, I don't know, it's critical to be able to get something that actually works.
- 8:02Michael Kennedy: Yeah.
- 8:02Michael Kennedy: Well, it sounds actually super exciting.
- 8:04Michael Kennedy: I mean, I know you sold it.
- 8:05Michael Kennedy: It's like, oh, we're just building.
- 8:06Michael Kennedy: Just working in a building.
- 8:07Michael Kennedy: No, this is cool.
- 8:09Larry Ogrodnek: It's cool, yeah.
- 8:10Larry Ogrodnek: And for the last couple of years, I've been doing a lot on our kind of more AI services team.
- 8:15Larry Ogrodnek: And I'm not a machine learning researcher, but most of the work I've been doing has been around kind of productionizing that work and building services around it.
- 8:24Larry Ogrodnek: And we've done really cool stuff like with, I mean, just like pricing models for the homes, which is kind of more traditional machine learning stuff.
- 8:30Larry Ogrodnek: and then like schedule simulation stuff.
- 8:33Larry Ogrodnek: And more recently, a lot of LLM-based stuff,
- 8:35Larry Ogrodnek: both for kind of like, you know,
- 8:37Larry Ogrodnek: rag style chat workflows.
- 8:38Larry Ogrodnek: Like you can imagine you're in the field
- 8:39Larry Ogrodnek: and you're like, you know,
- 8:40Larry Ogrodnek: is this the right tile pattern?
- 8:42Larry Ogrodnek: And maybe that's buried on like page 500
- 8:44Larry Ogrodnek: of a Google spreadsheet or something like that.
- 8:46Larry Ogrodnek: And being able to pull up quickly is huge.
- 8:49Larry Ogrodnek: And now some of the stuff we're trying to do
- 8:50Larry Ogrodnek: is more around automating schedule updates.
- 8:53Larry Ogrodnek: So someone can kind of walk through a home
- 8:55Larry Ogrodnek: and just, you know,
- 8:56Larry Ogrodnek: do kind of stream of consciousness.
- 8:58Larry Ogrodnek: Like, you know, this is the status of like this, like, you know, this is running late, whatever.
- 9:04Larry Ogrodnek: And then we kind of, we have a multi-stage process, but we kind of, you know, turn the video into images and turn the transcription into notes and then try and like see what we can, what's in the photo, right?
- 9:14Larry Ogrodnek: Like, is that the right tile pattern? Is that the right stove? And use LLMs for different parts of this process to kind of, you know, come up with recommendations at the end.
- 9:23Larry Ogrodnek: like, oh, it actually looks like the drywall is totally installed and we can mark that as done
- 9:27Larry Ogrodnek: or whatever. And, you know, having the automation is actually super helpful because having up-to-date
- 9:33Larry Ogrodnek: schedules drives a lot of stuff, right? It's just like the efficiency of making sure people are on
- 9:38Larry Ogrodnek: site and not delayed is huge. So that's been really-
- 9:41Michael Kennedy: There's so many touch points of so many subcontractors and things, right? Like,
- 9:46Michael Kennedy: when is the plumber going to be here? Well, they need to be here when the inspection for plumbing
- 9:49Michael Kennedy: is here but that got you know like it's people who haven't gone through like somehow some kind of
- 9:55Michael Kennedy: a house like i had a big home home improvement it's not quite the right word but like this big
- 10:00Michael Kennedy: outside project with like a barbecue thing and so on done and wow after doing that i'm like there's
- 10:05Michael Kennedy: i've got a lot of ideas for making this better this is bad no i know right and some of those
- 10:11Larry Ogrodnek: delays are like super costly and it's funny because like a lot of things even in terms of
- 10:14Larry Ogrodnek: like budgeting like right like if you buy too much material that's bad because you're wasting money
- 10:19Larry Ogrodnek: But if you buy too little, that's actually even worse because like maybe, you know, you need more whatever lumber and maybe there's, you know, two weeks, you know, turnaround time to get it.
- 10:28Larry Ogrodnek: And so and again, if you have to reschedule things like inspections, who knows when the next available one is, it might push the project out, you know, weeks.
- 10:34Larry Ogrodnek: And so, yeah, there's a lot of interdependencies, a lot of, like you said, people and communication remains a very tricky problem.
- 10:43Michael Kennedy: That's always one of the things.
- 10:44Michael Kennedy: Well, it sounds awesome. And I'm also interested to see if your project at all touches on that. But let's dive in. Let's dive into PyView. Now, the first thing I want to point out here with PyView is it is not PyWebView, which has been around for three or four years at minimum. And I imagine that like a lot of people have seen this. PyWebView is a way to embed basically a browser into something that you can wrap as a desktop app. PyView, totally different. What's the elevator pitch on PyView?
- 11:13Larry Ogrodnek: Totally different. Yeah. So the later pitch in PyView is basically, you know, it's one of those self-referential things. Hopefully I won't try and say Phoenix LiveView, but, you know, when you're building, when you're building modern web apps, and this is one of the things that I've seen, right, is, you know, if you want to have this rich interactivity, you want to have like a really rich client experience, maybe you reach for something like React or Vue. And, you know, those are great frameworks.
- 11:38Larry Ogrodnek: But then you also have your backend server maybe managing the state and the database and those relationships and maybe talking to other servers.
- 11:44Larry Ogrodnek: Maybe that's in Python or another language, whatever.
- 11:47Larry Ogrodnek: And you kind of have to manage these two different pieces and they each have their own state.
- 11:51Larry Ogrodnek: And it's very, you know, there can be a lot of complexity when you, yeah, the client is showing something slightly different than the server or vice versa and having to synchronize that state and keep them in sync.
- 12:02Larry Ogrodnek: Plus, often there's a lot of glue code in between them, right?
- 12:05Larry Ogrodnek: Like having to just go from the Python backend to the JavaScript frontend and back and forth.
- 12:11Larry Ogrodnek: Even when things are in the same language, like I've worked on TypeScript apps where it's TypeScript backend and frontend,
- 12:16Larry Ogrodnek: it's kind of rare that you actually share a lot of code for that layer.
- 12:20Larry Ogrodnek: Things end up kind of drifting anyway and being different.
- 12:23Larry Ogrodnek: And so PyView, the idea is, you know, what if you can have your backend server manage all your state, you're writing all your application logic in Python, you're just rendering HTML like you would for a static site.
- 12:38Larry Ogrodnek: But when different interactions happen, like when you just click a button or enters a form field or, you know, different things happen on the friend end, we send an event to the server.
- 12:48Larry Ogrodnek: The server processes the event and changes its state.
- 12:50Larry Ogrodnek: So for example, maybe, I mean, this is a simple counter example, but you press plus on the counter.
- 12:55Larry Ogrodnek: Then the server increments the count by one.
- 12:57Larry Ogrodnek: It does a full re-render, but it does kind of a diff and says, oh, actually, looking at this full page, all I need to do is tell the front end to change zero to one.
- 13:06Larry Ogrodnek: And so it efficiently sends that over a WebSocket connection.
- 13:10Larry Ogrodnek: And I feel like there's already a lot there that maybe that wasn't the clearest description.
- 13:13Larry Ogrodnek: But the idea is kind of more like, can we get SPA level interactivity, you know, including things like multi-user presence stuff, server push, really fast UI updates, you know, really fast local navigation, not doing full page reloads.
- 13:27Larry Ogrodnek: But on the back end, our mental model really is something like a traditional static, you know, not static site generator, but like a static rendering thing.
- 13:36Larry Ogrodnek: So I don't know.
- 13:37Larry Ogrodnek: Was that clear?
- 13:39Larry Ogrodnek: I think.
- 13:42Michael Kennedy: Yes.
- 13:43Michael Kennedy: It sounds like a lot.
- 13:44Michael Kennedy: And what I think is cool about PyView
- 13:46Michael Kennedy: is that it takes a lot of that
- 13:49Michael Kennedy: and it just makes it automatic
- 13:50Michael Kennedy: over a simple programming API, right?
- 13:52Larry Ogrodnek: Yeah, exactly.
- 13:53Larry Ogrodnek: So that's the thing is you don't have to think
- 13:55Larry Ogrodnek: about a lot of this kind of plumbing.
- 13:57Larry Ogrodnek: And this is the one kind of,
- 13:58Larry Ogrodnek: I mean, we'll get into this more.
- 13:59Larry Ogrodnek: Like this is something that I,
- 14:01Larry Ogrodnek: an idea that I came up with.
- 14:01Larry Ogrodnek: This is something that has been around
- 14:03Larry Ogrodnek: for a little while on,
- 14:05Larry Ogrodnek: in the Elixir side.
- 14:06Larry Ogrodnek: It comes from this,
- 14:07Larry Ogrodnek: this thing called Phoenix Live View.
- 14:09Larry Ogrodnek: But yeah, you know,
- 14:10Larry Ogrodnek: a framework actually can take care
- 14:11Larry Ogrodnek: of a lot of this for us.
- 14:13Larry Ogrodnek: And so as developers, all we really
- 14:15Larry Ogrodnek: need to worry about is updating our state when events come in
- 14:19Larry Ogrodnek: and rendering, doing a render of this.
- 14:22Larry Ogrodnek: Given the state, what should we render to the back end?
- 14:24Larry Ogrodnek: And the framework manages the WebSocket connection.
- 14:26Larry Ogrodnek: It manages the messages.
- 14:28Larry Ogrodnek: It manages doing the diffing.
- 14:30Larry Ogrodnek: And so we don't have to think about any of that.
- 14:32Larry Ogrodnek: We really just need to think about how do I update my state
- 14:35Larry Ogrodnek: and how do I render the website?
- 14:37Larry Ogrodnek: And so it ends up being really powerful just having
- 14:39Larry Ogrodnek: these very simple building blocks.
- 14:41Larry Ogrodnek: And this is the kind of thing that--
- 14:43Larry Ogrodnek: I mean, I'm not anti-JavaScript in general,
- 14:45Larry Ogrodnek: but obviously we're using JavaScript on the front end.
- 14:47Larry Ogrodnek: But by having this very generic JavaScript layer that just
- 14:51Larry Ogrodnek: knows really simple things like, here's
- 14:54Larry Ogrodnek: how I send messages when a button is pressed
- 14:58Larry Ogrodnek: or when a text field changes.
- 15:00Larry Ogrodnek: There's very simple building blocks,
- 15:01Larry Ogrodnek: but you end up being this very powerful system
- 15:04Larry Ogrodnek: when you bring them together.
- 15:05Larry Ogrodnek: And you don't really have to write JavaScript
- 15:07Larry Ogrodnek: for these interactions because, again, most of the things
- 15:10Larry Ogrodnek: are very simple.
- 15:11Larry Ogrodnek: It's like, you know, I need to change whatever.
- 15:14Michael Kennedy: Your project is pretty new, which I'm hoping to shine a light on it because I think it's going to get a lot of attention.
- 15:20Michael Kennedy: Out in the audience, Alessio points out that, hey, this is kind of like HTMX and Django with fragments, but over WebSockets.
- 15:29Michael Kennedy: And yeah, I feel like it does have some HTMX vibes.
- 15:34Michael Kennedy: And for those of you who haven't tried it, HTMX is like, you sprinkle just a couple of extra attributes on there.
- 15:39Michael Kennedy: And then somehow behind the scenes,
- 15:41Michael Kennedy: there's additional communication that you don't worry about.
- 15:44Michael Kennedy: It's just say, oh, if somebody clicks this image,
- 15:47Michael Kennedy: actually do this server thing and replace part of the page--
- 15:49Michael Kennedy: maybe the image, maybe something else--
- 15:51Michael Kennedy: with the server HTML response.
- 15:54Michael Kennedy: How do you feel that PyView, Phoenix LiveView sort of
- 15:57Michael Kennedy: relates to that and like Datastar, who I'm going to have on the--
- 16:01Larry Ogrodnek: Yeah.
- 16:02Larry Ogrodnek: No, I think that's right.
- 16:03Larry Ogrodnek: I think that's a very thoughtful comment,
- 16:07Larry Ogrodnek: because I think that is a lot of it.
- 16:09Larry Ogrodnek: And if I had to think in terms of comparisons
- 16:12Larry Ogrodnek: to different frameworks, I think doing something with HTMX
- 16:16Larry Ogrodnek: probably is the closest comparison.
- 16:18Larry Ogrodnek: Because again, it's HTML based.
- 16:21Larry Ogrodnek: We are responding to events and wiring up to the server
- 16:25Larry Ogrodnek: and processing them and sending back HTML fragments.
- 16:28Larry Ogrodnek: I think the difference is that PyView
- 16:31Larry Ogrodnek: is a little more structured, right?
- 16:32Larry Ogrodnek: Because with HTMX, you have a lot more control,
- 16:37Larry Ogrodnek: which can be a good thing.
- 16:38Larry Ogrodnek: But it's a little more--
- 16:40Larry Ogrodnek: you're kind of wiring up these things yourself
- 16:42Larry Ogrodnek: to a certain extent, saying like, when you click on this,
- 16:45Larry Ogrodnek: call this back end route and replace the contents of this
- 16:51Larry Ogrodnek: element with the response from that.
- 16:53Larry Ogrodnek: And on the back end, you're sending full HTML
- 16:55Larry Ogrodnek: and things like that.
- 16:56Larry Ogrodnek: So that's one difference.
- 16:58Larry Ogrodnek: So yes, it is over WebSockets with PyView versus HTMX.
- 17:01Larry Ogrodnek: The other thing is we do have this kind of diffing technology
- 17:05Larry Ogrodnek: where we're only sending what actually changed.
- 17:08Larry Ogrodnek: So I mean, we can go into more detail at some point
- 17:13Larry Ogrodnek: about how the templating works.
- 17:15Larry Ogrodnek: But for something like changing the encounter from 0 to 1,
- 17:17Larry Ogrodnek: it's like we're really just sending back the 1.
- 17:21Larry Ogrodnek: And obviously, as the page gets more complex,
- 17:24Larry Ogrodnek: the diffs get more complex.
- 17:25Larry Ogrodnek: But we're just sending the diffs.
- 17:26Larry Ogrodnek: And again, the framework kind of handles--
- 17:28Larry Ogrodnek: no, you don't have-- as a developer,
- 17:29Larry Ogrodnek: you don't have to think about what part of the page
- 17:31Larry Ogrodnek: do I update.
- 17:32Larry Ogrodnek: And it's kind of encoded to a certain extent in your template.
- 17:34Larry Ogrodnek: you know, it's kind of more hands-off.
- 17:38Larry Ogrodnek: And so you do give up some flexibility,
- 17:40Larry Ogrodnek: but then, you know, the framework kind of gets to handle
- 17:43Larry Ogrodnek: a lot of things for you in a smoother integrated way,
- 17:47Larry Ogrodnek: I would say.
- 17:47Michael Kennedy: Just handles it.
- 17:48Michael Kennedy: Yeah.
- 17:49Michael Kennedy: With HTMX, which I am a fan of,
- 17:51Michael Kennedy: you have to think about every little piece.
- 17:53Michael Kennedy: And you say, if somebody interacts with this part,
- 17:56Michael Kennedy: then I want this action to happen.
- 17:58Michael Kennedy: And then this thing over here, you know,
- 17:59Michael Kennedy: these parts of the pages are going to be
- 18:02Michael Kennedy: where the response of the server gets redirected back into.
- 18:06Michael Kennedy: And it seems like it's more just handled a little bit here.
- 18:10Michael Kennedy: Let's talk a little bit about Phoenix Live View,
- 18:13Michael Kennedy: because while your project is pretty new, Phoenix Live View has,
- 18:17Michael Kennedy: I don't know how old it is, a couple of years, it looks like,
- 18:21Michael Kennedy: but it's got 6,700 stars.
- 18:24Michael Kennedy: So it's a really solid foundation.
- 18:26Michael Kennedy: And your project, what's the relationship between
- 18:29Michael Kennedy: PyView and Phoenix LiveView?
- 18:32Larry Ogrodnek: Right.
- 18:32Larry Ogrodnek: So LiveView is obviously the inspiration for PyView.
- 18:35Larry Ogrodnek: I think, you know, when I mean, I don't know, when I started thinking about like,
- 18:40Larry Ogrodnek: you know, there's got to be a better way to building these kinds of apps in Python, I came
- 18:44Larry Ogrodnek: across Phoenix LiveView and kind of really loved this model, especially just, I don't
- 18:48Larry Ogrodnek: know, I kind of, I do like thinking this event kind of base system.
- 18:52Larry Ogrodnek: And it seemed like, yeah, you get all the really nice things for free.
- 18:55Larry Ogrodnek: So definitely was the inspiration.
- 18:57Larry Ogrodnek: And then when I started working on PyView, I had the thought like, well, they've already kind of figured out a good model for how this works and how things fit together.
- 19:04Larry Ogrodnek: And they already have a good client side story for implementing the client side component of this.
- 19:09Larry Ogrodnek: So what I tried to do with PyView is actually use, you know, I ship their Phoenix LiveView front end client JavaScript is what you're running in a PyView app on your front end.
- 19:20Larry Ogrodnek: And I kind of implemented a Python backend.
- 19:23Larry Ogrodnek: So if you think about LiveView as a protocol, which to be clear, it is not.
- 19:28Larry Ogrodnek: There's sort of just some, you know, have to do some reverse engineering of how things work.
- 19:32Larry Ogrodnek: It's not really documented because I think, you know, on their end, it really is an internal implementation detail about how the front end communicates with the back end.
- 19:40Larry Ogrodnek: But, you know, we get the, that really was a huge boost for me because I get to use their client JavaScript, which handles all the diffing.
- 19:48Larry Ogrodnek: And again, a big part of it too is just kind of they do have a really nice design.
- 19:51Larry Ogrodnek: So like you mentioned, Phoenix Live View has been around for a while.
- 19:54Larry Ogrodnek: It's a very popular project.
- 19:55Larry Ogrodnek: I think if you are in this ecosystem, so it's written in Elixir, which is a different programming
- 20:01Larry Ogrodnek: language that runs on the Erlang virtual machine.
- 20:04Larry Ogrodnek: And just to be clear, it's a totally great language.
- 20:08Larry Ogrodnek: It has a lot of really cool features.
- 20:09Larry Ogrodnek: It's nothing against Elixir.
- 20:11Larry Ogrodnek: It's just that for different reasons, I wanted this paradigm in the Python world because I'm
- 20:17Larry Ogrodnek: I'm working, you know, especially at work, I'm working on Python apps.
- 20:20Larry Ogrodnek: And that's the kind of world I live in.
- 20:22Larry Ogrodnek: And, you know, it's, it's, we can't change everything over to different languages.
- 20:26Michael Kennedy: Just, you know, I'll throw it out there for you.
- 20:28Michael Kennedy: You don't have to take the bullets.
- 20:30Michael Kennedy: But I think functional programming languages are super interesting.
- 20:34Michael Kennedy: They apply really well in certain to solve certain problems.
- 20:38Michael Kennedy: And I know some people, it's the hammer for all nails.
- 20:42Michael Kennedy: But for most people, functional programming is, it's just not what they're working in.
- 20:47Michael Kennedy: you know, things where you can change variables and have state turn out to be more productive
- 20:53Michael Kennedy: ways to write code, even if it maybe is not provably as correct or as thread safe or whatever,
- 20:59Michael Kennedy: right?
- 20:59Michael Kennedy: Like, so if most people are going to adopt it, most people are not using functional programming
- 21:05Michael Kennedy: languages and Erlang in particular, Python happens to be more popular than Erlang.
- 21:09Michael Kennedy: Yeah.
- 21:09Larry Ogrodnek: Yeah.
- 21:10Larry Ogrodnek: Well, there's different, I'll let you take those bullets, Michael.
- 21:13Larry Ogrodnek: But yeah, I mean, look, different languages are good for different use cases, right?
- 21:16Larry Ogrodnek: And but again, I think it's a really great idea that I thought, let me steal this.
- 21:20Larry Ogrodnek: And so, yeah, this is something that was written by, I think, Chris McCord is like the author of Live View.
- 21:24Larry Ogrodnek: And it's been around, yeah, for a long time.
- 21:26Larry Ogrodnek: It's gone through different iterations.
- 21:28Larry Ogrodnek: But yeah, it's incredibly popular in that ecosystem.
- 21:32Larry Ogrodnek: And yeah, they've done, I think, really great, great things with it.
- 21:35Michael Kennedy: Yeah.
- 21:35Michael Kennedy: And let's I just want to give a little shout out.
- 21:38Michael Kennedy: If you go to the Phoenix Live View GitHub, which, of course, I'll link in the show notes, there's a live demo on Fly that you can check out.
- 21:46Michael Kennedy: And there's also a two minute video.
- 21:49Michael Kennedy: Watch the two minute video.
- 21:50Michael Kennedy: It really shows like, okay, this is a quite an interesting and quite capable technology.
- 21:56Michael Kennedy: It might sound like, oh, you can't do very much with this because I don't know.
- 22:00Michael Kennedy: It seems like it's only built to make a few things easy.
- 22:03Michael Kennedy: I, after watching what he built there with this app with Phoenix Live View, I was impressed.
- 22:08Michael Kennedy: It's quite flexible.
- 22:09Larry Ogrodnek: No, for sure.
- 22:09Larry Ogrodnek: And there's a lot of, I think it took a lot of work to get there too, right?
- 22:12Larry Ogrodnek: Just to give, you know, them a little more, a lot of credit, like, because a lot of the
- 22:16Larry Ogrodnek: I mean, it's interesting because like once you take this approach to being having everything over WebSockets, well, then actually it's pretty great because it opens up a lot of things that could be hard, like things like, yeah, like presence, like knowing different users that are, you know, on the same documenter page as you or like server pushes.
- 22:29Larry Ogrodnek: You kind of get a lot of that stuff, not, you know, for free, but it's easy when that's kind of your base layer is everything over WebSockets.
- 22:35Larry Ogrodnek: But then some things like file uploads, like as part of this, they invented a way to kind of do file uploads over WebSockets.
- 22:43Larry Ogrodnek: Oh, that's interesting.
- 22:44Larry Ogrodnek: Yeah, because how do you do that, right?
- 22:48Larry Ogrodnek: And WebSockets do support both like text and binary messages.
- 22:51Larry Ogrodnek: So it's not as crazy as you would think, but there is like a limit to, you know, you have to kind of, you know, chunk it and stuff like that.
- 22:55Larry Ogrodnek: But so it supports that.
- 22:58Larry Ogrodnek: And, you know, I mean, again, we can talk more about file, but there are other options for also going like direct to S3 or, you know, different things.
- 23:04Larry Ogrodnek: But, yeah, you know, a lot of work has gone into this and including around the optimization.
- 23:08Larry Ogrodnek: Like, what is that message format?
- 23:09Larry Ogrodnek: Like, how do you send minimal diffs for not just things like, you know, simple template changes?
- 23:14Larry Ogrodnek: but when you have lists or components or maybe you have huge lists of things,
- 23:20Larry Ogrodnek: how do you efficiently manage that on both the server side and the client side? And so I think
- 23:24Larry Ogrodnek: there's a lot of great ideas for dealing with this that were pioneered by Phoenix Live View that I
- 23:29Larry Ogrodnek: get to come along and kind of just steal. That's cool. Here's the downtime version.
- 23:36Larry Ogrodnek: Yeah, exactly. And I think that's kind of was like a lot of the focus early on was trying to
- 23:40Larry Ogrodnek: to stick to this just because, again, PyView, like you said, it is very early days and it is just
- 23:47Larry Ogrodnek: kind of like a personal side project. Although I am using it at my day job for a couple of production
- 23:51Larry Ogrodnek: apps now, which has been fantastic. But as a single developer with a Python web framework as a side
- 23:59Larry Ogrodnek: project, it was great to have a little bit of a roadmap on if I follow these patterns, I'm probably
- 24:03Larry Ogrodnek: going to end up in a good place. And I did. Of course, I did try and make things more Pythonic
- 24:08Larry Ogrodnek: where I could.
- 24:11Larry Ogrodnek: So PyView is very heavily typed.
- 24:13Larry Ogrodnek: So we're using obviously Python types for everything.
- 24:15Larry Ogrodnek: Whereas Elixir, I think they're adding types now.
- 24:19Larry Ogrodnek: It's been an ongoing thing to add some gradual typing
- 24:22Larry Ogrodnek: like Python has done.
- 24:23Larry Ogrodnek: But Python is a little further along
- 24:25Larry Ogrodnek: in terms of the typing story there.
- 24:27Larry Ogrodnek: And I think over time, maybe we'll diverge a little bit
- 24:31Larry Ogrodnek: in terms of making the APIs more Pythonic
- 24:34Larry Ogrodnek: to the extent anything is not.
- 24:36Larry Ogrodnek: But yeah, for sure, having this kind of at least
- 24:38Larry Ogrodnek: this core level protocol has been useful to follow.
- 24:42Michael Kennedy: Yeah, they've kind of worked out how the exchange works
- 24:46Michael Kennedy: and all those different things.
- 24:47Michael Kennedy: You're like, OK, let me do the--
- 24:48Larry Ogrodnek: Yeah, and I sort of have a roadmap to like,
- 24:50Larry Ogrodnek: oh, these are the problems you're going to get into.
- 24:51Larry Ogrodnek: Because that's when I first started PyView.
- 24:55Larry Ogrodnek: So I did start it a couple years ago, just as a very--
- 24:58Larry Ogrodnek: but again, very sparse.
- 25:00Larry Ogrodnek: Like, can I get anything to show up on the page over Websockets?
- 25:03Larry Ogrodnek: And then kind of iterated.
- 25:05Larry Ogrodnek: And it's interesting to--
- 25:07Larry Ogrodnek: when I started the first version of the LiveView client
- 25:09Larry Ogrodnek: JavaScript I used, then figuring out
- 25:10Larry Ogrodnek: what changed between that and the next version
- 25:12Larry Ogrodnek: and the next version and the next version.
- 25:13Larry Ogrodnek: You get to see the gradual progression of like,
- 25:16Larry Ogrodnek: oh, these are some problems we're going to run into,
- 25:17Larry Ogrodnek: because they've sort of addressed that in this future version.
- 25:20Larry Ogrodnek: But I still have to deal with it,
- 25:22Larry Ogrodnek: but I'll get there at some point.
- 25:23Michael Kennedy: Yeah, go look at the closed GitHub issues,
- 25:25Larry Ogrodnek: and you're like, whoa, there's a lot of conversation
- 25:27Larry Ogrodnek: around this one.
- 25:28Michael Kennedy: Yeah.
- 25:29Michael Kennedy: Interesting.
- 25:30Michael Kennedy: So I think a nice thing to do for people
- 25:34Michael Kennedy: would be to just do a quick walkthrough,
- 25:36Michael Kennedy: because you've got a nice little getting started thing.
- 25:40Michael Kennedy: You've just got to be careful that most people are listening, not seeing.
- 25:43Michael Kennedy: But let's talk through, let's maybe talk through what it means to create
- 25:46Michael Kennedy: just like a real simple program in PyView.
- 25:49Larry Ogrodnek: Sure.
- 25:50Larry Ogrodnek: Yeah, so I do, yeah, so the documentation is something, again,
- 25:54Larry Ogrodnek: it's a work in progress, but I did try to get to start getting some things together.
- 25:57Larry Ogrodnek: So yeah, I do have a cookie cutter project.
- 25:59Larry Ogrodnek: And I think, you know, the first one in documentation,
- 26:02Larry Ogrodnek: if you check out the cookie cutter project,
- 26:03Larry Ogrodnek: It gives you like a very quick project setup.
- 26:08Larry Ogrodnek: Sorry, I'm just going to go.
- 26:09Michael Kennedy: Yeah, for people who don't know,
- 26:10Michael Kennedy: like Cookie Cutter is a way to take
- 26:12Michael Kennedy: a pre-structured set of source files
- 26:15Michael Kennedy: of all varieties, even images and other things,
- 26:18Michael Kennedy: and say, I'm going to ask you a few questions,
- 26:20Michael Kennedy: I'm going to do a little text replace,
- 26:21Michael Kennedy: and then I'm going to generate that structure for you.
- 26:23Michael Kennedy: So a very nice way to kind of go like,
- 26:26Michael Kennedy: all right, we got everything set up
- 26:27Michael Kennedy: for you to get started, right?
- 26:29Larry Ogrodnek: Right, exactly.
- 26:29Larry Ogrodnek: Because I really wanted to get, you know,
- 26:31Larry Ogrodnek: And part of the thought with PyView
- 26:33Larry Ogrodnek: is I really do want it to be super easy to get started,
- 26:37Larry Ogrodnek: not just for other people, but also for myself.
- 26:39Larry Ogrodnek: Like, if I have a new idea of something,
- 26:41Larry Ogrodnek: it's like I want to go from zero to one super quickly.
- 26:43Larry Ogrodnek: And that's kind of been part of the motivation.
- 26:45Larry Ogrodnek: And so this cookie cutter is a great way to--
- 26:46Larry Ogrodnek: so you check out the cookie cutter,
- 26:48Larry Ogrodnek: and then you basically have a working example right away
- 26:50Larry Ogrodnek: with just the simple counter.
- 26:51Larry Ogrodnek: And so this example uses poetry for dependency management.
- 26:56Larry Ogrodnek: So if you do poetry install, and then--
- 26:59Larry Ogrodnek: It also includes Just, which is a command line runner.
- 27:02Larry Ogrodnek: So Just, it's kind of like--
- 27:03Larry Ogrodnek: I don't know if you've talked about this before,
- 27:04Larry Ogrodnek: but if anyone's ever used Makefiles or things
- 27:07Larry Ogrodnek: like that for doing common project tasks,
- 27:11Larry Ogrodnek: Just is a tool like that, but specifically written
- 27:14Larry Ogrodnek: for these types of things.
- 27:15Larry Ogrodnek: And so if you use Makefiles, you know
- 27:17Larry Ogrodnek: there's a lot of tricks you have to do
- 27:18Larry Ogrodnek: to kind of get it to work in the way you want
- 27:21Larry Ogrodnek: versus as a build tool.
- 27:22Larry Ogrodnek: And so Just kind of works the right way a lot easier,
- 27:26Larry Ogrodnek: and it's something that kind of--
- 27:27Larry Ogrodnek: Yeah, exactly.
- 27:28Larry Ogrodnek: I'm using more and more.
- 27:29Larry Ogrodnek: So if you check out the-- if you run the cookie cutter,
- 27:32Larry Ogrodnek: run poetry install, and then run just,
- 27:34Larry Ogrodnek: it'll tell you to open localhost to 8,000 in your browser.
- 27:39Larry Ogrodnek: And you'll have a counter example up and running already.
- 27:42Larry Ogrodnek: And the kind of interesting thing,
- 27:44Larry Ogrodnek: if you want to play along with this more--
- 27:46Larry Ogrodnek: and I do have this in the docs in terms of what's going on here.
- 27:48Larry Ogrodnek: But it's a really good example to kind of open up
- 27:51Larry Ogrodnek: in Firefox or Chrome, and then open the developer tools
- 27:57Larry Ogrodnek: and the network tab.
- 27:58Larry Ogrodnek: And when you load the page, what you'll see is--
- 28:02Larry Ogrodnek: and this is kind of the Live View model, right?
- 28:05Larry Ogrodnek: There's an initial page load, which is like the server--
- 28:08Larry Ogrodnek: so it goes to your view, and it runs your templating logic.
- 28:13Larry Ogrodnek: And it returns that as just straight HTML,
- 28:15Larry Ogrodnek: like a normal web page.
- 28:16Larry Ogrodnek: So if you had turned off JavaScript,
- 28:18Larry Ogrodnek: you'd still get the page back.
- 28:20Larry Ogrodnek: But if you have JavaScript on, which is obviously intention,
- 28:22Larry Ogrodnek: then what happens is included in that initial page load
- 28:24Larry Ogrodnek: is some JavaScript that comes back.
- 28:26Larry Ogrodnek: - Oh, obviously you have it open, Michael.
- 28:27Larry Ogrodnek: Yeah, so if you, if you, yeah, exactly.
- 28:29Larry Ogrodnek: So the HTML is right there.
- 28:31Larry Ogrodnek: So that's like the full HTML of the page.
- 28:32Larry Ogrodnek: So yeah, if you had turned off JavaScript,
- 28:34Larry Ogrodnek: that part would still work.
- 28:35Larry Ogrodnek: But then if you click on the,
- 28:37Larry Ogrodnek: do you see in there a WebSocket connection in your--
- 28:39Michael Kennedy: - Oh yeah, somewhere, socket, yep.
- 28:42Larry Ogrodnek: - So if you click on that,
- 28:42Larry Ogrodnek: you can see the messages back and forth.
- 28:44Larry Ogrodnek: So when you click on the messages tab there, yeah.
- 28:47Larry Ogrodnek: And so you can see--
- 28:49Michael Kennedy: - Interesting.
- 28:49Larry Ogrodnek: - Right.
- 28:50Michael Kennedy: - Yeah, so there's a whole set of examples,
- 28:54Michael Kennedy: or live interactive examples,
- 28:56Michael Kennedy: people can just go to pyview.rocks and click live examples and do this to see it right yeah yeah
- 29:02Larry Ogrodnek: okay this is super cool yeah that message you have right there it says diff zero one so like zero is
- 29:07Larry Ogrodnek: like the kind of slot in the template and so it says now that should be one so you click you know
- 29:11Larry Ogrodnek: plus again then the new message will be diff you know whatever and you can see this message says
- 29:14Larry Ogrodnek: event increment so this is what goes to your back end is you're getting a click event for increment
- 29:19Michael Kennedy: and you're sending back a response um and so yeah it's so does it like uh instrument your html with
- 29:26Michael Kennedy: of identifiers or something like that to then be able to do this?
- 29:29Larry Ogrodnek: Yeah, and so that was one of the things that I've been so unhappy with for a while
- 29:34Larry Ogrodnek: with PyView is because when I first started doing this, I was like, okay, I want a nice
- 29:39Larry Ogrodnek: HTML templating language, right? Or maybe even it'd be better if it was pluggable,
- 29:44Larry Ogrodnek: if you could use whatever templating language you want. But the problem is, most Python templating
- 29:49Larry Ogrodnek: languages, the input is your template and some data, and the output is a string.
- 29:55Larry Ogrodnek: And for this, what we're trying to produce is like a render tree.
- 30:00Larry Ogrodnek: And so really the mental model is a lot more like t-strings, if people are familiar with t-strings, where you have like a template, right?
- 30:08Larry Ogrodnek: Your HTML template, and it's separated into static parts, like strings, and dynamic parts, like things to be evaluated.
- 30:15Larry Ogrodnek: And that's kind of the live view model.
- 30:17Larry Ogrodnek: And the pie view model is like, basically, we take a template and we convert it into a list of statics and dynamics.
- 30:22Larry Ogrodnek: And each dynamic, like each evaluation spot itself
- 30:28Larry Ogrodnek: has static parts and dynamic parts.
- 30:30Larry Ogrodnek: And so we have to take an HTML template
- 30:32Larry Ogrodnek: and turn it into this render tree.
- 30:34Larry Ogrodnek: And so again, this is like a huge pain point
- 30:39Larry Ogrodnek: because I couldn't find a templating language that would
- 30:41Larry Ogrodnek: let me kind of get that level of control.
- 30:42Larry Ogrodnek: And maybe there is one, and I'm not familiar with it.
- 30:44Larry Ogrodnek: Or maybe there is a way to get to these internals.
- 30:46Larry Ogrodnek: I'm not familiar with it.
- 30:47Larry Ogrodnek: But what I am doing was there is this library called IBIS,
- 30:52Larry Ogrodnek: which someone had wrote an open source as a tutorial
- 30:56Larry Ogrodnek: on how to write your own templating language.
- 30:57Larry Ogrodnek: And so it's very similar to Jinja 2, but a lot simpler.
- 31:01Larry Ogrodnek: And so that was the initial templating language for PyView
- 31:04Larry Ogrodnek: because I could hack it just enough to get both HTML
- 31:10Larry Ogrodnek: and also this more template-like view that I need.
- 31:15Larry Ogrodnek: This is one of the things that I'm
- 31:16Larry Ogrodnek: very excited about with now that we have t-strings in 3.14
- 31:21Larry Ogrodnek: is that I think that model just maps so directly to this.
- 31:24Larry Ogrodnek: And I'm hopeful that we'll have a lot of different rendering
- 31:27Larry Ogrodnek: libraries or templating language for HTML.
- 31:29Larry Ogrodnek: Like I know there's already a good one,
- 31:32Larry Ogrodnek: or it's a work in progress called T-DOM
- 31:34Larry Ogrodnek: that people are working on to make t-strings more HTML--
- 31:38Larry Ogrodnek: not friendly, not that they're not already,
- 31:40Larry Ogrodnek: but there are certain things you want.
- 31:42Larry Ogrodnek: Like obviously, you want to be able to just
- 31:43Larry Ogrodnek: automatically scaping of user input so it's not malicious.
- 31:47Larry Ogrodnek: Maybe even merging things in HTML attributes.
- 31:50Larry Ogrodnek: Like there's nicer things you can kind of do when you're thinking about the HTML use case, right?
- 31:55Larry Ogrodnek: But I like having like a template as like the core building block, because if you can get to a template, that's super easy to turn into like the structure we need for a live view.
- 32:03Larry Ogrodnek: And I imagine there'll be multiple ways to do that in the future, you know?
- 32:06Michael Kennedy: Yeah, very interesting.
- 32:08Michael Kennedy: It sounds a little bit like almost a concrete syntax tree of the DOM that you've got to like, okay, we've got to understand all the pieces and what parts git pushed down.
- 32:18Michael Kennedy: Like from here down is the chunk we got to send down because this part changed.
- 32:23Larry Ogrodnek: Exactly, exactly.
- 32:24Larry Ogrodnek: And yeah, like you said, it is a little bit like that.
- 32:26Larry Ogrodnek: I mean, because there's, you know, it's not even as simple as like this,
- 32:29Larry Ogrodnek: because there is like some special handling for things like components, you know,
- 32:35Larry Ogrodnek: are sort of managed slightly differently.
- 32:38Larry Ogrodnek: And then even kind of that, like if you had, this is like not a great example,
- 32:41Larry Ogrodnek: but if you had multiple counters on your page, maybe you'd want to optimize like,
- 32:44Larry Ogrodnek: well, they really just need one set of static content for all the counters.
- 32:48Larry Ogrodnek: even though we kind of want to manage them separately.
- 32:50Larry Ogrodnek: And so there's different optimizations like that that are done.
- 32:53Larry Ogrodnek: But yeah, it is.
- 32:54Larry Ogrodnek: Everything comes from this kind of render tree
- 32:56Larry Ogrodnek: is how we can do those diffs.
- 32:58Michael Kennedy: Okay.
- 32:59Michael Kennedy: Let's talk through these examples a tad more.
- 33:01Michael Kennedy: And we don't necessarily need this going.
- 33:03Michael Kennedy: But, you know, back to the Alessio pointed out,
- 33:06Michael Kennedy: the HTMX example.
- 33:07Michael Kennedy: If you go to the HTMX website,
- 33:09Michael Kennedy: there's a bunch of cool live examples there as well.
- 33:11Michael Kennedy: And literally in the page,
- 33:13Michael Kennedy: Carson has put it such that you see these exchanges
- 33:16Michael Kennedy: as you interact with it.
- 33:17Michael Kennedy: You know what I mean?
- 33:17Michael Kennedy: That's how significant that is.
- 33:20Michael Kennedy: So maybe let's pick out just a couple of the examples here
- 33:24Michael Kennedy: that we could talk through that you think are worth pointing out.
- 33:27Michael Kennedy: Some of the capabilities are inspiring, but not insane.
- 33:31Michael Kennedy: I don't know.
- 33:31Larry Ogrodnek: JOHN MCWHORTER: Sure.
- 33:32Larry Ogrodnek: I mean, a really quick one is this volume control,
- 33:35Larry Ogrodnek: like the third one up at the top, which
- 33:36Larry Ogrodnek: it's not a super interesting example.
- 33:39Larry Ogrodnek: But just the thing about it is that it has keyboard control.
- 33:43Larry Ogrodnek: So you can see it's super easy to just do keyboard bindings.
- 33:47Larry Ogrodnek: And this is one of those things where like--
- 33:48Larry Ogrodnek: - Just arrow keys.
- 33:49Larry Ogrodnek: - Yeah, I mean, which seems like a small thing.
- 33:51Larry Ogrodnek: - I'm not using the mouse, right?
- 33:52Larry Ogrodnek: There it goes.
- 33:53Larry Ogrodnek: - Seems like a small thing,
- 33:54Larry Ogrodnek: but it's one of those things when you start to dive into,
- 33:56Larry Ogrodnek: right, like, you know, even like, you know,
- 33:59Larry Ogrodnek: sometimes you might wonder like, you know,
- 34:01Larry Ogrodnek: why are there all these different HTML component libraries
- 34:03Larry Ogrodnek: that do things like a button?
- 34:04Larry Ogrodnek: It's just like, well, you know,
- 34:05Larry Ogrodnek: when you wanna think about things like accessibility
- 34:08Larry Ogrodnek: and different languages and blah, blah, blah,
- 34:09Larry Ogrodnek: like there's actually a lot that goes into it.
- 34:11Larry Ogrodnek: And so something like keyboard bindings
- 34:13Larry Ogrodnek: is something I honestly would never take the time
- 34:16Larry Ogrodnek: to add to all that before because it seems like such an undertaking,
- 34:19Larry Ogrodnek: even though you could say, oh, it's simple.
- 34:20Larry Ogrodnek: You just add event handlers to all your things and blah, blah, blah.
- 34:23Larry Ogrodnek: But yeah, it was just slightly out of adding to an example project.
- 34:27Larry Ogrodnek: But now it's because it's built into the framework.
- 34:29Larry Ogrodnek: It's super easy, and it gets treated the same as any other event.
- 34:33Larry Ogrodnek: So pressing a key up or key down, send it to the event,
- 34:35Larry Ogrodnek: just clicking the button.
- 34:37Larry Ogrodnek: And so it's one of those things.
- 34:39Larry Ogrodnek: It's a simple example, but it's--
- 34:41Larry Ogrodnek: JOSHUA SHARFSTEIN: Yeah, so let me describe it for listeners.
- 34:43Michael Kennedy: So you've got this progress bar looking thing.
- 34:46Michael Kennedy: That's the volume control, like, you know, your standard macOS looking thing.
- 34:49Michael Kennedy: And it's got a mute button, a max volume, an up and down button.
- 34:52Michael Kennedy: And these are like buttons that, you know, you might be used to, but also you can just,
- 34:57Michael Kennedy: you know, use the arrow keys and it's just as if you're clicking the button and it all
- 35:01Michael Kennedy: updates even with like probably one of those CSS transitions to make it feel a little animated
- 35:06Michael Kennedy: instead of jumping.
- 35:07Michael Kennedy: Yeah.
- 35:07Michael Kennedy: Looks really nice.
- 35:08Michael Kennedy: So what about the source?
- 35:12Michael Kennedy: I think there's a couple interesting things here.
- 35:14Michael Kennedy: First of all, the volume.html, this looks Tailwind.
- 35:18Michael Kennedy: Is that right?
- 35:19Larry Ogrodnek: Yeah, this is using Tailwind.
- 35:21Larry Ogrodnek: Yeah.
- 35:21Larry Ogrodnek: Okay.
- 35:21Larry Ogrodnek: Yeah.
- 35:23Larry Ogrodnek: It's interesting.
- 35:24Larry Ogrodnek: I feel like it's one of those things where my first pass of this example's website used
- 35:28Larry Ogrodnek: almost no HTML CSS and was like super ugly.
- 35:30Larry Ogrodnek: But I kind of wanted the focus to be on like what is the, like what is like the really,
- 35:35Larry Ogrodnek: what are you really writing versus like what is, you know.
- 35:38Larry Ogrodnek: But I kind of gave in and used Tailwind because it looks a lot nicer.
- 35:42Larry Ogrodnek: It looks more professional, something people would want to pick up, right?
- 35:45Michael Kennedy: Yeah, I think this gets lost sometimes in different projects because, you know, I look at a lot of people send me projects all the time.
- 35:52Michael Kennedy: And like, hey, do you think this is what we're talking about in various venues or whatever?
- 35:57Michael Kennedy: Having something that looks like, oh, I wish my app looked like that or it did like that is highly inspiring.
- 36:04Michael Kennedy: It's not, you know, if you had like, hey, look, we have all of our live demos and they're exactly like 1993 web view, like appearance, but see how easy the program is.
- 36:17Michael Kennedy: I know if you look at this, the source, it's full of, you know, like P8 for padding eight and, you know, such and such.
- 36:25Michael Kennedy: It's worth it.
- 36:25Michael Kennedy: Right.
- 36:26Michael Kennedy: It's so worth it.
- 36:27Michael Kennedy: And the HTML is just pure HTML, except for you have these sort of attribute-driven things, right?
- 36:35Michael Kennedy: Right, exactly.
- 36:36Michael Kennedy: Can we talk about how is the HTML different then?
- 36:39Larry Ogrodnek: That's exactly it, yeah.
- 36:40Larry Ogrodnek: So for this example, the difference is, right, for a button, we have this phx click attribute,
- 36:49Larry Ogrodnek: which is what tells, you know, wires up with Phoenix Live View that when someone clicks on this,
- 36:53Larry Ogrodnek: we should send this event call.
- 36:54Larry Ogrodnek: So the first one says phx click equals down.
- 36:57Larry Ogrodnek: And so when someone clicks on that button, we send an event to the server that just says,
- 37:00Larry Ogrodnek: like, you know, click down.
- 37:02Larry Ogrodnek: And there's also this PHS, PHX window key down and PHX key.
- 37:07Larry Ogrodnek: So, you know, basically we're sending like a key update, you know, for this arrow down
- 37:12Larry Ogrodnek: is like one of the keys.
- 37:14Larry Ogrodnek: And so these parts are not something that I, again, this is like just the straight Phoenix,
- 37:19Larry Ogrodnek: like if you're an Elixir app, it would work exactly the same way.
- 37:21Larry Ogrodnek: You could take this HTML and run it on Elixir app.
- 37:24Larry Ogrodnek: And if you had the Elixir backend, it would work exactly the same way.
- 37:28Larry Ogrodnek: So that side looks exactly the same.
- 37:30Michael Kennedy: Yeah, I mean, what's the value in renaming that to PYW or something?
- 37:34Larry Ogrodnek: Yeah, I know.
- 37:35Larry Ogrodnek: And actually, I think you could.
- 37:37Larry Ogrodnek: I think they do have it configurable with the client JavaScript
- 37:42Larry Ogrodnek: where you can do a different specifier if you wanted to.
- 37:44Larry Ogrodnek: But it's kind of nice this way.
- 37:46Larry Ogrodnek: I mean, I think the other thing is, too, in the age of LLMs,
- 37:49Larry Ogrodnek: and just even examples, at this point,
- 37:51Larry Ogrodnek: there's a ton more Phoenix Live View code than there is
- 37:54Larry Ogrodnek: And so if you find a good LiveView example,
- 37:56Larry Ogrodnek: it's like you can get it to work in PyView hopefully.
- 37:59Larry Ogrodnek: - Yeah, that's interesting.
- 37:59Michael Kennedy: So in a sense, the front end stuff is API compatible
- 38:04Michael Kennedy: with both backends maybe.
- 38:06Michael Kennedy: Is that it?
- 38:07Larry Ogrodnek: - Yeah, sort of.
- 38:08Larry Ogrodnek: I mean, like, yeah, and like conceptually,
- 38:12Larry Ogrodnek: I mean, I think that the thing is the Phoenix LiveView
- 38:15Larry Ogrodnek: has a different templating language.
- 38:18Larry Ogrodnek: So things like loops or conditionals
- 38:22Larry Ogrodnek: look totally different, right?
- 38:23Larry Ogrodnek: So you might be able to pull up an example and go,
- 38:24Larry Ogrodnek: I see how I'll do it here, but it's not identical.
- 38:27Larry Ogrodnek: Right, exactly.
- 38:28Larry Ogrodnek: Or if you see something in an example where it's just like,
- 38:29Larry Ogrodnek: I'm trying to do a form, but my PHX update isn't firing,
- 38:33Larry Ogrodnek: it's like it's probably the same solution in both places.
- 38:36Michael Kennedy: Got it.
- 38:37Michael Kennedy: Got it.
- 38:38Michael Kennedy: So then you've got the HTML side, which is pretty interesting.
- 38:43Michael Kennedy: Tell us about how this-- what do we write over here on--
- 38:47Michael Kennedy: Yeah, so--
- 38:48Michael Kennedy: The data exchange looks like-- sorry.
- 38:50Michael Kennedy: The data exchange looks like you're exchanging data classes,
- 38:52Michael Kennedy: like the DTO sort of API aspect?
- 38:55Larry Ogrodnek: Yeah, exactly.
- 38:56Larry Ogrodnek: So, well, you can, yeah, so each live view, like page,
- 39:01Larry Ogrodnek: is basically like you would type it to a specific,
- 39:05Larry Ogrodnek: you know, I call it a context,
- 39:06Larry Ogrodnek: like which is like what,
- 39:07Larry Ogrodnek: basically what's going into your template.
- 39:08Larry Ogrodnek: And so you can do, I mean, it doesn't have to be,
- 39:11Larry Ogrodnek: I like using data classes.
- 39:12Larry Ogrodnek: It can be a data class, it can be a type dict,
- 39:15Larry Ogrodnek: it could be a Pydantic class,
- 39:17Larry Ogrodnek: it could probably just be a regular dict.
- 39:19Larry Ogrodnek: I don't know that I've ever tried that,
- 39:20Larry Ogrodnek: but I think that should work.
- 39:21Larry Ogrodnek: But it's just really just for the typing.
- 39:25Larry Ogrodnek: And it's what we'll get past here in template.
- 39:27Larry Ogrodnek: And then so maybe it's worth talking through.
- 39:29Larry Ogrodnek: Like there are these sort of different lifecycle components.
- 39:32Larry Ogrodnek: And so with your view, the first thing that gets called
- 39:37Larry Ogrodnek: is there's this mount command.
- 39:39Larry Ogrodnek: And that gets called any time--
- 39:41Larry Ogrodnek: I mean, when your view gets instantiated.
- 39:43Larry Ogrodnek: So when someone visits the page, we're
- 39:45Larry Ogrodnek: going to create an instance of your class, your LiveView class.
- 39:48Larry Ogrodnek: And mount will get called with the socket,
- 39:51Larry Ogrodnek: which is probably going to be more detailed than that,
- 39:53Larry Ogrodnek: but that's kind of like your interface to the communication.
- 39:56Larry Ogrodnek: It's not the web socket necessarily.
- 39:58Larry Ogrodnek: It's more like how you interoperate with the system.
- 40:03Larry Ogrodnek: And then also the session.
- 40:04Larry Ogrodnek: So if you want to copy stuff over from the HTTP session,
- 40:07Larry Ogrodnek: like user information or whatever,
- 40:09Larry Ogrodnek: you can copy that over in the mount to your data.
- 40:12Larry Ogrodnek: Then after that-- and it actually gets called--
- 40:15Larry Ogrodnek: well, I'll talk about that later.
- 40:17Larry Ogrodnek: But then after that, there's an optional--
- 40:19Larry Ogrodnek: it's not shown in this example, but there's
- 40:20Larry Ogrodnek: optional like handle params change, which gets called with path parameters or URL parameters.
- 40:27Larry Ogrodnek: And the reason that's separate is because your class might get just instantiated once
- 40:31Larry Ogrodnek: on when the page is viewed, but you might have like programmatic navigation that's not real
- 40:36Larry Ogrodnek: navigation. It's like JavaScript navigation where maybe for things like filter options or
- 40:42Larry Ogrodnek: pagination options, you want to put those in the URL so that it's kind of bookmarkable and shareable.
- 40:47Larry Ogrodnek: you don't want to do a full page reload and so anytime those get changed including on the initial
- 40:51Larry Ogrodnek: page load we'll call a handle prams method and you don't have to implement that if you don't care
- 40:55Michael Kennedy: about it um so that gets called in this case a volume is the volume it doesn't matter where
- 40:59Larry Ogrodnek: the volume exactly yeah but you might want to like be able to bookmark like this is a good volume or
- 41:04Larry Ogrodnek: whatever and i think the counting example does does have that just to kind of show how it would work
- 41:08Michael Kennedy: um i see so in that sense you get a bit of a deep linking into it exactly that's cool yeah okay yeah
- 41:14Larry Ogrodnek: Yeah, and again, it takes advantage of this kind of like JavaScript navigation that you can initiate from the front end or from the back end.
- 41:21Larry Ogrodnek: Like on the front end, you can initiate like a navigation transition that will like basically tell the back end, hey, change your prams to this.
- 41:28Larry Ogrodnek: And the browser takes care of like reading the prams and changing the, or the back end takes care of reading the prams and changing the state.
- 41:34Larry Ogrodnek: Or on the back end, you can also tell the front end like, oh, hey, because you did this, I want you to change the URL to be blah, blah, blah.
- 41:41Larry Ogrodnek: And here's what the new URL should be.
- 41:43Larry Ogrodnek: So you can do it both ways.
- 41:44Larry Ogrodnek: And then the render method gets called.
- 41:47Larry Ogrodnek: And it's not shown here because the base class, basically,
- 41:50Larry Ogrodnek: for the render method, it looks for a template
- 41:55Larry Ogrodnek: file called whatever.
- 41:57Larry Ogrodnek: This is volume.py.
- 41:58Larry Ogrodnek: So it looks for volume.html.
- 42:00Larry Ogrodnek: And it uses that as your template.
- 42:01Larry Ogrodnek: It also will look to see if there's a volume.css.
- 42:04Larry Ogrodnek: And it will just inject that in as the CSS for this.
- 42:08Larry Ogrodnek: It exists.
- 42:09Larry Ogrodnek: But if you wanted to override render, you can.
- 42:11Larry Ogrodnek: And that's how the t-string rendering works,
- 42:13Larry Ogrodnek: is you basically do provide a render method
- 42:15Larry Ogrodnek: that returns a T string.
- 42:17Larry Ogrodnek: So after all that is done--
- 42:19Larry Ogrodnek: so that actually happens twice.
- 42:20Larry Ogrodnek: It happens once for the HTML render,
- 42:22Larry Ogrodnek: and then it happens again for the LiveView render.
- 42:25Larry Ogrodnek: And those are handled separately,
- 42:27Larry Ogrodnek: partially because that's how Phoenix LiveView does it,
- 42:29Larry Ogrodnek: but also because some things are different.
- 42:31Larry Ogrodnek: For the initial HTML render, some things are not available.
- 42:34Larry Ogrodnek: You can't do Pub/Sub stuff to subscribe to channels.
- 42:37Larry Ogrodnek: You can't do scheduling stuff.
- 42:40Larry Ogrodnek: It's a little bit more limited to what you can do.
- 42:43Larry Ogrodnek: But anyway, that's a separate step.
- 42:44Larry Ogrodnek: And then after render, if an event comes in,
- 42:46Larry Ogrodnek: this handle event gets called.
- 42:48Larry Ogrodnek: And what you're showing here for the volume control
- 42:50Larry Ogrodnek: is kind of like my V1 of the event method that basically just
- 42:54Larry Ogrodnek: takes an event.
- 42:55Larry Ogrodnek: So there's one method called handle event
- 42:56Larry Ogrodnek: that takes the event and a payload, which
- 42:58Larry Ogrodnek: is like a dict of the options.
- 43:01Larry Ogrodnek: Then you have the socket.
- 43:01Larry Ogrodnek: And so you can see here, it's just a bunch of if else.
- 43:04Larry Ogrodnek: It's like if the event is key update,
- 43:05Larry Ogrodnek: then just take the key as the event name.
- 43:08Larry Ogrodnek: If it's on or off, change the--
- 43:11Larry Ogrodnek: If it's off or they hit the left arrow, then set the volume to 0.
- 43:15Larry Ogrodnek: If it's on or they hit the right arrow, set the volume to 100.
- 43:19Larry Ogrodnek: And then there's some stuff that just bound the volume at the end.
- 43:22Larry Ogrodnek: And so that's all you do is you basically--
- 43:24Larry Ogrodnek: this handle event method gets called.
- 43:27Larry Ogrodnek: You're updating your state.
- 43:28Larry Ogrodnek: And then after this gets called, automatically,
- 43:31Larry Ogrodnek: your render method gets called again.
- 43:33Larry Ogrodnek: And basically, you're just re-rendering with the new state.
- 43:36Larry Ogrodnek: And then again, on the back end, we're figuring out,
- 43:39Larry Ogrodnek: Like, okay, last time you rendered this tree,
- 43:41Larry Ogrodnek: now you're rendering this tree.
- 43:43Larry Ogrodnek: What changed?
- 43:43Larry Ogrodnek: I'm just going to send what changed.
- 43:45Michael Kennedy: It looks very, I don't know, view or data binding like in here.
- 43:52Michael Kennedy: So when things start up, you say the context of this thing is an instance of the volume class.
- 43:59Michael Kennedy: And then all you write in your code is like socket.context.volume equals the various,
- 44:05Michael Kennedy: you know, plus equals 10, minus equals 10.
- 44:08Michael Kennedy: Exactly.
- 44:09Michael Kennedy: And somehow, iView says, okay, I've wrapped this thing in some kind of responsive or something that detects the changes, right, somehow?
- 44:19Larry Ogrodnek: Right. Well, yeah, actually, yeah, I mean, we're not even that smart right now.
- 44:21Larry Ogrodnek: I mean, we could be, and I think Phoenix LiveView is a little smarter about it, where they do wrap and kind of see if they, but like for this, basically, we just always render.
- 44:30Michael Kennedy: I see. So you re-render the page and just go, what is actually different about, oh, I see, when I re-rendered with new data, then the volume value changes.
- 44:38Michael Kennedy: Exactly.
- 44:39Larry Ogrodnek: But it is really nice because like you're saying,
- 44:41Larry Ogrodnek: it's like you don't really--
- 44:42Larry Ogrodnek: like your application logic becomes really simple
- 44:46Larry Ogrodnek: because it's really just, yeah, I update my state.
- 44:49Larry Ogrodnek: And then I know how to render my state object.
- 44:51Larry Ogrodnek: And I don't really care about whatever.
- 44:54Larry Ogrodnek: And even this handle event method, it's not really--
- 44:57Larry Ogrodnek: I mean, I don't know.
- 44:59Larry Ogrodnek: It feels like it'd be a little bit of a stretch
- 45:00Larry Ogrodnek: to call it stateless because you're mutating state.
- 45:02Larry Ogrodnek: But at the same time, you don't really
- 45:04Larry Ogrodnek: care where this state object came from.
- 45:06Larry Ogrodnek: It's like, given this event, how would I
- 45:08Michael Kennedy: this state. Yeah, and it's got a very strong view.js feel like I just changed the properties of the
- 45:14Michael Kennedy: thing and something makes it happen that it goes back to everywhere this value is used. It changes.
- 45:20Larry Ogrodnek: Exactly. And that's really how it works. I mean, that's the kind of cool thing, you know, where
- 45:23Larry Ogrodnek: we're talking about HTMX, where, you know, you have to be really intentional about like, OK,
- 45:27Larry Ogrodnek: like how do I want to segment, you know, what I'm changing? And, you know, when I do this, I know I
- 45:31Larry Ogrodnek: want to change this part of the render, this part of the render. And with this, you don't really have
- 45:34Larry Ogrodnek: to think about it, right? Like you just change what you want to change. And the part of the template
- 45:37Larry Ogrodnek: that needs to change will naturally change
- 45:40Larry Ogrodnek: because we're treating it as this diff operation.
- 45:43Michael Kennedy: Yeah, yeah, cool.
- 45:44Michael Kennedy: Let's do one more example, something that kind of shows
- 45:47Michael Kennedy: off what's possible.
- 45:48Larry Ogrodnek: OK, well, gosh, there's two things I'd want to show.
- 45:53Larry Ogrodnek: But we could do the maps thing, which
- 45:55Larry Ogrodnek: is just a way how to integrate with JavaScript,
- 45:59Larry Ogrodnek: and then also maybe one of the newer things,
- 46:01Larry Ogrodnek: or maybe the t-string version of the counter, just to--
- 46:05Larry Ogrodnek: yeah, so we'd look at the maps one.
- 46:07Larry Ogrodnek: And so this is very simple, but this is a thing that--
- 46:11Larry Ogrodnek: I think the thing with like frameworks with PyView
- 46:13Larry Ogrodnek: and other frameworks is I think maybe people try to bucket
- 46:17Larry Ogrodnek: into like, oh, you hate JavaScript or whatever.
- 46:19Larry Ogrodnek: And like, no, I don't hate JavaScript.
- 46:21Larry Ogrodnek: JavaScript's great at doing JavaScript things.
- 46:23Larry Ogrodnek: And you do need to integrate with JavaScript a lot of the times.
- 46:27Larry Ogrodnek: And there's a lot of really great, rich, interactive JavaScript
- 46:29Larry Ogrodnek: things that wouldn't really make sense to do in the server.
- 46:32Larry Ogrodnek: So this is an example of a Maps thing using leaflet.js,
- 46:36Larry Ogrodnek: It's like a JavaScript library that uses OpenStreet map data.
- 46:39Larry Ogrodnek: We're doing a Google Maps kind of style maps
- 46:43Larry Ogrodnek: view with tiles and stuff like that.
- 46:45Larry Ogrodnek: And so this example just kind of shows the events.
- 46:49Larry Ogrodnek: Basically, there's this hooks system,
- 46:51Larry Ogrodnek: is what they call it on the Phoenix Live View side,
- 46:53Larry Ogrodnek: and call it the same thing.
- 46:55Larry Ogrodnek: But basically, it's a way to kind of--
- 46:57Larry Ogrodnek: we saw things like PHX key click blah, blah, blah,
- 47:02Larry Ogrodnek: is kind of built-in event system.
- 47:04Larry Ogrodnek: So running JavaScript hooks is a way
- 47:06Larry Ogrodnek: to kind of let you integrate custom JavaScript
- 47:10Larry Ogrodnek: and have access to that same event system.
- 47:13Larry Ogrodnek: So for this, there is a JavaScript component,
- 47:15Larry Ogrodnek: which is kind of like a wrapper over--
- 47:17Larry Ogrodnek: not really a wrapper, but a wrapper over some JavaScript
- 47:19Larry Ogrodnek: stuff that handles this.
- 47:21Larry Ogrodnek: And so we have events going two ways.
- 47:23Larry Ogrodnek: And so when you click on one of the things in the sidebar,
- 47:28Larry Ogrodnek: it sends something to the back end saying,
- 47:30Larry Ogrodnek: oh, update your state to say you have this national park
- 47:32Larry Ogrodnek: selected.
- 47:33Larry Ogrodnek: And then the back end also sends a--
- 47:36Larry Ogrodnek: I'm getting mixed up with this.
- 47:38Larry Ogrodnek: I think when you click on the marker,
- 47:39Larry Ogrodnek: that's where the JavaScript sends the event to the back end.
- 47:41Michael Kennedy: MARK MIRCHANDANI: Yeah, yeah.
- 47:42Michael Kennedy: Literally, this is cool.
- 47:43Michael Kennedy: If I click-- so let me describe it for people.
- 47:46Michael Kennedy: So we've got on one side a map of the United States,
- 47:49Michael Kennedy: and on the left a nice list of the different national parks,
- 47:53Michael Kennedy: the famous ones.
- 47:55Michael Kennedy: If I go entirely into this JavaScript thing
- 47:57Michael Kennedy: and I click on something in the map, one
- 48:00Michael Kennedy: of the points of interest, which is one of these parks,
- 48:03Michael Kennedy: It communicates back to PyView and is selecting it in the list, right?
- 48:07Michael Kennedy: The Python bit.
- 48:08Michael Kennedy: But then again, if I click in the Python bit, like Glacier National Park or one near me, the Olympic National Park, right?
- 48:14Michael Kennedy: Then it will then drive the JavaScript.
- 48:17Michael Kennedy: So this is the bi-directional thing you're talking about.
- 48:19Michael Kennedy: This is very cool.
- 48:20Larry Ogrodnek: Right, exactly.
- 48:21Larry Ogrodnek: Yeah.
- 48:21Larry Ogrodnek: So the JavaScript part has access to a similar component system where it's just like, oh, if I get this event, I think I call it highlight park.
- 48:27Larry Ogrodnek: Then I know that, oh, I need to turn this marker on.
- 48:31Larry Ogrodnek: And going the other way, the JavaScript
- 48:33Larry Ogrodnek: has its own handling, like, oh, when this happens,
- 48:35Larry Ogrodnek: then I should call this method on the LiveView.
- 48:38Larry Ogrodnek: And so your LiveView side, like your Python side,
- 48:42Larry Ogrodnek: stays the same where it's still doing event handling
- 48:45Larry Ogrodnek: and also sending events if needed to the front end.
- 48:47Larry Ogrodnek: But you can get access to--
- 48:49Larry Ogrodnek: so maps, drag and drop stuff is a big one,
- 48:53Larry Ogrodnek: even really rich editors.
- 48:54Larry Ogrodnek: I've done something with using CodeMirror,
- 48:58Larry Ogrodnek: which is a really nice IDE kind of editing experience
- 49:02Larry Ogrodnek: in the browser.
- 49:03Larry Ogrodnek: And so you can still--
- 49:04Larry Ogrodnek: I think the thing with PyView, right, is it's not--
- 49:07Larry Ogrodnek: I don't know, for me anyway, it's not
- 49:08Larry Ogrodnek: about technology-focused.
- 49:10Larry Ogrodnek: I only want to use Python.
- 49:11Larry Ogrodnek: It's like, I want to have great web experiences,
- 49:14Larry Ogrodnek: whatever that takes, but in a simple way
- 49:16Larry Ogrodnek: that I can understand and debug and test.
- 49:19Larry Ogrodnek: So yeah.
- 49:20Michael Kennedy: JOHN MUELLER: Yeah, this is a very impressive--
- 49:22Michael Kennedy: that's an app.
- 49:23Michael Kennedy: Yeah.
- 49:24Michael Kennedy: I mean, I look at it, it's like, wow, that would be kind of a big
- 49:27Michael Kennedy: project to build and my feeling is it wasn't that big of a deal with pi. No it's very yeah that's
- 49:32Larry Ogrodnek: kind of part of the fun thing with like making these little examples is like super fun and also
- 49:35Larry Ogrodnek: like pretty easy yeah so similar one there's like that combat and board one just to quickly talk
- 49:39Larry Ogrodnek: it just is a similar thing with drag and drop but the same kind of concept. I want to throw out maybe
- 49:44Michael Kennedy: like just thinking back to that map one real quick before we move on it feels like this would actually
- 49:48Michael Kennedy: be quite relevant for data scientists as well right like I don't think you build it as data science
- 49:53Michael Kennedy: But there's a lot of like, oh, we need to build a dashboard that updates based on whatever.
- 49:59Michael Kennedy: And we need these different visualizations.
- 50:00Michael Kennedy: And with the JavaScript integration, I feel like you probably could do some pretty cool stuff.
- 50:04Larry Ogrodnek: Yeah, no, for sure.
- 50:05Larry Ogrodnek: Yeah, for sure.
- 50:06Larry Ogrodnek: And I've done, and I think there are a lot of really great JavaScript, like graphing libraries.
- 50:11Larry Ogrodnek: Like one that I've used before is something that I learned about just from figuring out that it's what like Google Notebook, like Google Colab, you know, their like Jupyter Notebooks thing uses called Altair.
- 50:20Larry Ogrodnek: And that's something which is cool because there's basically a Python backend for generating the graph data, but then the front end is this JavaScript thing.
- 50:27Larry Ogrodnek: And so I don't think I should put an example of that, but I've used it at work where we just have a very simple graph hook that wraps the Altair library and the backend generates the graph in Python code.
- 50:38Larry Ogrodnek: And it's just super easy to display and things like that.
- 50:41Larry Ogrodnek: And to your point, Michael, one of the really cool things
- 50:43Larry Ogrodnek: with PyView is because everything is over WebSockets,
- 50:47Larry Ogrodnek: any server push stuff, like if data comes in or data changes,
- 50:51Larry Ogrodnek: it's really no work to get to tell the browser
- 50:54Larry Ogrodnek: to update to the new state.
- 50:55Larry Ogrodnek: It's super, super easy to do, which is cool.
- 50:58Larry Ogrodnek: MICHAEL WOLFF: That's awesome.
- 50:59Larry Ogrodnek: MICHAEL WOLFF: Yeah, so the one other thing
- 51:00Larry Ogrodnek: I wanted to touch on quickly is just
- 51:02Larry Ogrodnek: because I think the first example we looked at the volume
- 51:04Larry Ogrodnek: was using the older events.
- 51:05Larry Ogrodnek: So if you look at maybe the basic counter t-string version,
- 51:08Larry Ogrodnek: like the source for that, I mean,
- 51:10Larry Ogrodnek: It's the same kind of counter example.
- 51:11Larry Ogrodnek: But the source is like, I think there's
- 51:13Larry Ogrodnek: a count tstring5 probably to click on.
- 51:16Larry Ogrodnek: And then it's the third one in the list there.
- 51:18Larry Ogrodnek: But so this is just to talk a little bit about--
- 51:22Larry Ogrodnek: again, it's kind of a work in progress.
- 51:23Larry Ogrodnek: But the first version of the events
- 51:25Larry Ogrodnek: was kind of like, oh, there's a handle event method
- 51:27Larry Ogrodnek: that all events go to.
- 51:28Larry Ogrodnek: But that kind of gets to be a little bit of a drag.
- 51:29Larry Ogrodnek: And so we added this @EventDecorator.
- 51:32Larry Ogrodnek: And so you can kind of--
- 51:34Larry Ogrodnek: instead of having handle event, oh, was the method increment?
- 51:36Larry Ogrodnek: Was it decrement?
- 51:37Larry Ogrodnek: You can just say @Event, decrement, @Event,
- 51:39Larry Ogrodnek: increment and have those separate functions.
- 51:43Larry Ogrodnek: And then this is also showing the kind of T string templating
- 51:46Larry Ogrodnek: where you use t-strings to generate it.
- 51:48Larry Ogrodnek: And the cool thing with this too is on line 58,
- 51:51Larry Ogrodnek: you can see basically we're calling self.button,
- 51:55Larry Ogrodnek: which is a T string template, and then we're
- 51:57Larry Ogrodnek: passing in self.decrement, which is the method.
- 51:59Larry Ogrodnek: And so you can kind of--
- 52:00Larry Ogrodnek: I mean, it's basically just doing that binding for you
- 52:03Michael Kennedy: automatically where it ends up--
- 52:05Michael Kennedy: - Okay, hold on, hold on, hold on.
- 52:05Michael Kennedy: So people, you have a T string,
- 52:11Michael Kennedy: which is kind of Jinja-like,
- 52:13Michael Kennedy: and in here you have a format statement,
- 52:15Michael Kennedy: and one of the values you're putting in here
- 52:18Michael Kennedy: is literally the function that has the decorator
- 52:22Michael Kennedy: that is an event,
- 52:23Michael Kennedy: and then that gets called back through all the magic.
- 52:25Larry Ogrodnek: - Yeah, and it's like,
- 52:27Larry Ogrodnek: it's like, I think it's cool that it looks like magic,
- 52:31Larry Ogrodnek: but it's, I mean, it's really not magic.
- 52:32Larry Ogrodnek: I mean, the thing,
- 52:33Larry Ogrodnek: the simplest possible thing where basically it's just it's saving you from um like if you look at
- 52:39Larry Ogrodnek: that that button method um the button template it's saying like button phx click click equals
- 52:46Michael Kennedy: okay so you've created a wrapper function that then basically writes the component
- 52:51Michael Kennedy: yeah that that'll wire up all exactly yeah that's pretty cool yeah but this is something i'm i think
- 52:57Larry Ogrodnek: i'm really excited about because it's like um you know like one of the things that you really want
- 53:02Larry Ogrodnek: want to have, like after you've been making a complex app,
- 53:05Larry Ogrodnek: is a way to have components.
- 53:08Larry Ogrodnek: And that was kind of challenging in the templating system
- 53:10Larry Ogrodnek: that I originally started using, not just to have components
- 53:13Larry Ogrodnek: because you can have includes and stuff like that,
- 53:15Larry Ogrodnek: but to fit into the Phoenix Live View component system.
- 53:17Larry Ogrodnek: But I think t-strings are exciting for me
- 53:19Larry Ogrodnek: because it makes things like this really powerful.
- 53:22Larry Ogrodnek: And you think about just even things
- 53:24Larry Ogrodnek: like having really smart forms and form binding.
- 53:27Larry Ogrodnek: And I have some of that, but it's a little clunky.
- 53:30Larry Ogrodnek: And I think being able to have like really nice,
- 53:32Larry Ogrodnek: reasonable components that leverage t-strings,
- 53:35Larry Ogrodnek: make it so you have something that kind of looks very magically,
- 53:37Larry Ogrodnek: but it's, you know, it's basically just, you know, templating.
- 53:41Larry Ogrodnek: So, but I'm excited about it.
- 53:42Larry Ogrodnek: I think it'll make a lot of things easier
- 53:44Larry Ogrodnek: and easier to kind of share, you know, components.
- 53:46Michael Kennedy: I love it.
- 53:47Michael Kennedy: I really like the programming here, the API.
- 53:50Michael Kennedy: We've got a little bit, not a lot, a little bit of time left here.
- 53:53Michael Kennedy: So let's just, let's touch on actually just a couple of things.
- 53:56Michael Kennedy: I think one of the issues that, you know,
- 53:59Michael Kennedy: I talked about some of the magic, like some of these frameworks,
- 54:01Michael Kennedy: like hide away all the things.
- 54:03Michael Kennedy: Another one where there's these front end, back end,
- 54:06Michael Kennedy: connected all Python, they feel like sometimes you're like,
- 54:09Michael Kennedy: OK, and the way that works is you run it on our cloud system.
- 54:13Michael Kennedy: You know what I mean?
- 54:13Michael Kennedy: Or you run it on our special bit of infrastructure.
- 54:17Michael Kennedy: And then thoughts immediately go to like, well, how durable?
- 54:21Michael Kennedy: How proven is that?
- 54:22Michael Kennedy: Like, could we use Kubernetes?
- 54:24Michael Kennedy: Could we do it there?
- 54:25Michael Kennedy: Like, gosh, I don't even know.
- 54:27Michael Kennedy: So let's talk about some of the internals.
- 54:28Michael Kennedy: And at its heart, this is Starlettete, right,
- 54:31Michael Kennedy: which is the same as FastAPI in a sense
- 54:34Michael Kennedy: in terms of how it runs, right?
- 54:35Larry Ogrodnek: JOHN MUELLER: Exactly.
- 54:36Larry Ogrodnek: Yeah, Starlette is doing all the heavy lifting.
- 54:43Larry Ogrodnek: And it handles the WebSockets and everything for you, right?
- 54:46Larry Ogrodnek: JOHN MUELLER: Yeah, the WebSockets, the HTTP,
- 54:48Larry Ogrodnek: the routing, even middleware, also the authentication,
- 54:51Larry Ogrodnek: like using it for the authentication.
- 54:53Larry Ogrodnek: Like I had to do a little bit of work to kind of make that available at the, you know, the web socket level in terms of like, because it handles like all the routing.
- 55:06Larry Ogrodnek: But just the way live view works is there's really one web socket connection that's getting managed.
- 55:12Larry Ogrodnek: And then internally there's routing that's done by the framework.
- 55:15Larry Ogrodnek: I see.
- 55:16Michael Kennedy: Because you never set that up, right?
- 55:17Michael Kennedy: You don't manage different sockets in like different.
- 55:20Michael Kennedy: Exactly.
- 55:20Michael Kennedy: You're just like, I just want to handle event.
- 55:22Larry Ogrodnek: Exactly.
- 55:23Larry Ogrodnek: Yeah.
- 55:23Larry Ogrodnek: But yeah, but another cover is we're using their auth system and framework.
- 55:29Larry Ogrodnek: And so if you have used that or familiar with it, it's exactly the same.
- 55:34Larry Ogrodnek: It's just that we make it also available at the LiveView specific layer.
- 55:40Larry Ogrodnek: But yeah, so anywhere you can run Starlette.
- 55:43Larry Ogrodnek: And I've been mostly using it.
- 55:46Larry Ogrodnek: So that examples website that we're looking at, that is itself a PyView app that is using just Uvicorn,
- 55:53Larry Ogrodnek: deploy as a Docker container.
- 55:55Larry Ogrodnek: And that's primarily how I've been using it for apps
- 55:57Larry Ogrodnek: that I've been writing or at work is like, yeah,
- 56:00Larry Ogrodnek: it's just a Docker app with Uvicorn.
- 56:04Larry Ogrodnek: But presumably, yeah, any ASGI thing you could use.
- 56:11Larry Ogrodnek: So yeah, there's no magic there.
- 56:12Larry Ogrodnek: Yeah, anywhere you want to run it.
- 56:13Larry Ogrodnek: The one thing is-- this is something that's
- 56:15Larry Ogrodnek: kind of more of a future thing, but part of--
- 56:18Larry Ogrodnek: that you don't have to use for a lot of apps,
- 56:19Larry Ogrodnek: but some of the stuff like presence, like PubSub stuff
- 56:23Larry Ogrodnek: have built in, just because it's kind of something you want to have when you have this kind of
- 56:26Larry Ogrodnek: framework, but you can do stuff very easily. I have an example of this, but like, oh, this user
- 56:32Larry Ogrodnek: joined this page, this user left the page, and doing things like that. I don't have a way right
- 56:35Larry Ogrodnek: now for that to be multi-machine. It's really just single machine pub supplementation. And so
- 56:39Larry Ogrodnek: something I'm kind of working on for the future. But yeah, there's no special requirements. Anywhere
- 56:43Larry Ogrodnek: you're running a Starlette app or FastAPI app or whatever should be totally fine. You do want to
- 56:49Larry Ogrodnek: have sticky sessions set up because it does require you
- 56:53Larry Ogrodnek: going to the same machine because we have this persistent state
- 56:56Larry Ogrodnek: for the user.
- 56:56Michael Kennedy: MARK MANDEL: Yeah, that is tricky with WebSockets.
- 56:59Michael Kennedy: I've been dealing with that for a project I'm working on.
- 57:01Michael Kennedy: And it's challenging because the natural inclination
- 57:05Michael Kennedy: and a lot of the recommendation is, oh, how many workers
- 57:08Michael Kennedy: do you want your uveacorn or your Granian to run?
- 57:12Michael Kennedy: MARK MANDEL: Yeah.
- 57:12Michael Kennedy: MARK MANDEL: And oh, if you need to scale up,
- 57:14Michael Kennedy: you just put it behind a load balancer.
- 57:15Larry Ogrodnek: MARK MANDEL: Yeah, I agree with you.
- 57:18Larry Ogrodnek: It is challenging, but I think it's a solvable challenge.
- 57:21Larry Ogrodnek: And I think also it depends on kind of the app that you want.
- 57:24Larry Ogrodnek: Like for some use cases, I mean, you know, the sticky part you kind of need right now anyway.
- 57:29Larry Ogrodnek: But for some use cases, maybe you don't care about the PubSub or the presence,
- 57:32Larry Ogrodnek: or maybe you have a way to deal with that already.
- 57:35Larry Ogrodnek: Right.
- 57:35Michael Kennedy: If you don't care about PubSub or presence, then as long as it just sticks to.
- 57:38Larry Ogrodnek: As long as it just sticks.
- 57:39Larry Ogrodnek: And even the stickiness, I feel like there's potential solutions there, right?
- 57:42Larry Ogrodnek: Because like with the model, it really is like, you know, like we saw in examples,
- 57:48Larry Ogrodnek: like you get past this context to operate on,
- 57:51Larry Ogrodnek: you make changes to it,
- 57:53Larry Ogrodnek: and you don't really care like where that came from
- 57:56Larry Ogrodnek: or where it's running.
- 57:57Larry Ogrodnek: And so theoretically, I think it feels like
- 57:58Larry Ogrodnek: there could be a situation where that is somehow distributed
- 58:01Larry Ogrodnek: or there's some kind of shared storage or, you know,
- 58:04Larry Ogrodnek: it doesn't seem like impossible.
- 58:05Larry Ogrodnek: I don't know that it'd be worth the complexity
- 58:07Larry Ogrodnek: for a lot of use cases,
- 58:08Larry Ogrodnek: but I feel like there's sort of a challenge.
- 58:10Larry Ogrodnek: And the PubSub stuff, I think is something that, you know,
- 58:12Larry Ogrodnek: I plan to kind of address.
- 58:13Larry Ogrodnek: So I think, again, it's like,
- 58:14Larry Ogrodnek: if you're okay with running Redis,
- 58:16Larry Ogrodnek: that's a very solvable problem too having like multi-machine pub sub um right right right redis
- 58:21Michael Kennedy: or Valkey have like this web socket broker thing kind of which we manage uh basically i imagine
- 58:28Michael Kennedy: like your web socket connection talks to your server which then like puts you in the session
- 58:33Michael Kennedy: of of a Redis or Valkey one but then that thing actually does the pub sub across yeah and that
- 58:38Larry Ogrodnek: could be that could be interesting for like i mean like one of the early things i was thinking is
- 58:41Larry Ogrodnek: like oh could i could deploy this with like AWS Lambda you know which like seems kind of impossible
- 58:46Larry Ogrodnek: And they do have, with their API gateway,
- 58:48Larry Ogrodnek: they have a WebSocket broker.
- 58:52Larry Ogrodnek: They manage WebSocket connections.
- 58:54Larry Ogrodnek: And you just kind of get events like,
- 58:56Larry Ogrodnek: oh, this WebSocket client 125 joined, whatever.
- 59:00Larry Ogrodnek: And then you kind of manage that.
- 59:01Larry Ogrodnek: And it kind of would be cool, just, I don't know,
- 59:03Larry Ogrodnek: if a proof of concept or just if you really wanted to host on Lambda
- 59:06Larry Ogrodnek: or something like that.
- 59:07Larry Ogrodnek: But it's not.
- 59:08Larry Ogrodnek: I don't know that I'll get to that anytime soon.
- 59:10Larry Ogrodnek: Yeah.
- 59:11Michael Kennedy: Well, certainly an interesting project with the way it is.
- 59:15Michael Kennedy: Could certainly go farther.
- 59:17Michael Kennedy: A lot of the frameworks that are good at this scale out,
- 59:19Michael Kennedy: they don't have any presence or collaboration.
- 59:23Michael Kennedy: It's fine, right?
- 59:24Larry Ogrodnek: Yeah.
- 59:24Michael Kennedy: No, it's a good problem to have.
- 59:26Larry Ogrodnek: But yeah, it's something we'll figure out at some point.
- 59:30Larry Ogrodnek: But I think there's still a lot of co-ops you can write without it.
- 59:32Michael Kennedy: So it hasn't been a huge priority.
- 59:34Michael Kennedy: No, it's very, very neat.
- 59:35Michael Kennedy: All right.
- 59:35Michael Kennedy: So I got two quick questions for you here.
- 59:39Michael Kennedy: One, you mentioned LLMs at the beginning.
- 59:42Michael Kennedy: How do LLMs do with writing PyView?
- 59:45Michael Kennedy: and do you have tips for making it more knowledgeable?
- 59:49Michael Kennedy: Are there, do you have like some sort of specification file
- 59:52Michael Kennedy: you can give to, you know, Claude or something and say,
- 59:56Michael Kennedy: I know you might not be familiar with this,
- 59:57Michael Kennedy: but here's what it is.
- 59:59Michael Kennedy: Now I'm going to ask you questions to work with it.
- 1:00:02Larry Ogrodnek: That's a really good push.
- 1:00:04Larry Ogrodnek: I feel like I should do something like that.
- 1:00:06Larry Ogrodnek: So I have used LMS to like write, you know,
- 1:00:11Larry Ogrodnek: like application code, not, you know,
- 1:00:12Larry Ogrodnek: like application code, like using PyView framework
- 1:00:14Larry Ogrodnek: like you're describing at work a lot.
- 1:00:16Larry Ogrodnek: And it's been mostly successful.
- 1:00:19Larry Ogrodnek: I think one of the things is it helps
- 1:00:21Larry Ogrodnek: that the templating language--
- 1:00:23Larry Ogrodnek: we're not using 3.14 at work yet for these projects.
- 1:00:27Larry Ogrodnek: And so we're using the older style templates.
- 1:00:29Larry Ogrodnek: It helps that that language is very, very similar to Jinja 2.
- 1:00:32Larry Ogrodnek: And so that's been great.
- 1:00:35Larry Ogrodnek: It does get confused sometimes where, obviously,
- 1:00:37Larry Ogrodnek: we don't have the same set of built-in filters.
- 1:00:39Larry Ogrodnek: And so I might try to use a filter that's only in Jinja 2
- 1:00:41Larry Ogrodnek: that we don't have or that includes syntax
- 1:00:45Larry Ogrodnek: is slightly different.
- 1:00:45Larry Ogrodnek: So those that gets tripped up on.
- 1:00:47Larry Ogrodnek: I think I've had a lot of success
- 1:00:49Larry Ogrodnek: with just really simple prompts like this is PyView.
- 1:00:53Larry Ogrodnek: It's Phoenix LiveView, but in Python.
- 1:00:55Larry Ogrodnek: And that's gotten a lot of mileage,
- 1:00:58Larry Ogrodnek: just even something basic like that.
- 1:01:00Michael Kennedy: It sounds like you could create a Claude skill
- 1:01:03Michael Kennedy: or an agent or just a set of really structured rules files
- 1:01:07Michael Kennedy: and maybe put it on the docs and say, here, grab it.
- 1:01:09Michael Kennedy: And throw this in.
- 1:01:10Larry Ogrodnek: I for sure should do that.
- 1:01:12Larry Ogrodnek: Yeah, I don't think that'd be helpful for me too.
- 1:01:13Larry Ogrodnek: I think that's something that I kind of,
- 1:01:15Larry Ogrodnek: yeah, just even personally want to get better at
- 1:01:16Larry Ogrodnek: is like, yeah, I've been using these tools
- 1:01:18Larry Ogrodnek: a lot for development and they've been great,
- 1:01:19Larry Ogrodnek: but I've been somewhat, you know,
- 1:01:21Larry Ogrodnek: lazy in terms of like improving my workflow.
- 1:01:23Larry Ogrodnek: And I do see how it's like very successful
- 1:01:26Larry Ogrodnek: when people kind of structure these things
- 1:01:27Larry Ogrodnek: a little better in terms of like
- 1:01:29Larry Ogrodnek: having custom commands or yeah,
- 1:01:30Larry Ogrodnek: like agents that know about specific things.
- 1:01:32Larry Ogrodnek: It does seem like-
- 1:01:33Michael Kennedy: Yeah, but I do think that your cookie cutter helps.
- 1:01:35Michael Kennedy: Right.
- 1:01:35Michael Kennedy: Right.
- 1:01:36Michael Kennedy: Because it says, okay, here's the structure.
- 1:01:38Michael Kennedy: Here's a little working bit of it.
- 1:01:40Michael Kennedy: now keep building on that.
- 1:01:41Michael Kennedy: That goes a long ways.
- 1:01:42Michael Kennedy: So--
- 1:01:42Larry Ogrodnek: - No, for sure.
- 1:01:43Larry Ogrodnek: And I think even like having things like the just file
- 1:01:46Larry Ogrodnek: seemed to help in terms of like,
- 1:01:48Larry Ogrodnek: it doesn't, you know, it knows like,
- 1:01:49Larry Ogrodnek: oh, to run tests, I run just tests.
- 1:01:51Larry Ogrodnek: To run type check, I run just type check.
- 1:01:52Larry Ogrodnek: Like it kind of knows a lot of this stuff.
- 1:01:55Larry Ogrodnek: Doesn't have to guess about it,
- 1:01:56Larry Ogrodnek: but it kind of would be useful.
- 1:01:58Larry Ogrodnek: I do find it like, it's funny.
- 1:01:59Larry Ogrodnek: It seems like the LLM get confused a lot about like,
- 1:02:01Larry Ogrodnek: oh, do I need to run poetry run versus just Python?
- 1:02:04Larry Ogrodnek: And it seems to always forget like
- 1:02:07Larry Ogrodnek: how your project is set up, you know?
- 1:02:09Michael Kennedy: Yeah, I know.
- 1:02:10Michael Kennedy: You got to keep reminding it.
- 1:02:12Michael Kennedy: All right, so that was question one.
- 1:02:14Michael Kennedy: Question two, final question.
- 1:02:16Michael Kennedy: What's the roadmap?
- 1:02:17Michael Kennedy: You open to contributors.
- 1:02:19Michael Kennedy: Where are we?
- 1:02:20Larry Ogrodnek: Yeah, so like you mentioned, it's very early days.
- 1:02:24Larry Ogrodnek: And I've tried to not be conservative about breaking
- 1:02:27Larry Ogrodnek: changes, but I think as we start getting closer to 1.0--
- 1:02:30Larry Ogrodnek: I think I'm at 0.8.0--
- 1:02:32Larry Ogrodnek: there probably will be some breaking changes,
- 1:02:33Larry Ogrodnek: because as we've already seen in some of the examples,
- 1:02:36Larry Ogrodnek: I've gone through multiple iterations of how
- 1:02:38Larry Ogrodnek: do I make this easier?
- 1:02:39Larry Ogrodnek: how do I make this easier?
- 1:02:40Larry Ogrodnek: And that's been a big focus for me
- 1:02:41Larry Ogrodnek: is making it really developer-friendly and simple.
- 1:02:44Larry Ogrodnek: And so I think I'll try and make some stuff
- 1:02:45Larry Ogrodnek: a little more cohesive.
- 1:02:46Larry Ogrodnek: So there may be some breaking changes.
- 1:02:49Larry Ogrodnek: But yeah, I mean, you know,
- 1:02:50Larry Ogrodnek: I want it to be super easy to get up and running.
- 1:02:52Larry Ogrodnek: And I feel like there's work to do there.
- 1:02:53Larry Ogrodnek: I think, you know, the short-term roadmap is,
- 1:02:56Larry Ogrodnek: again, I want to keep working on documentation,
- 1:02:57Larry Ogrodnek: updates, examples.
- 1:02:59Larry Ogrodnek: I saw a really great, you know,
- 1:03:00Larry Ogrodnek: YouTube talk recently called like Verbs, Not Nouns
- 1:03:03Larry Ogrodnek: about Brian McDonald about like
- 1:03:05Larry Ogrodnek: how to make your documentation more kind of like task-based.
- 1:03:07Larry Ogrodnek: Like what is the person trying to do
- 1:03:08Larry Ogrodnek: versus explaining technology.
- 1:03:10Larry Ogrodnek: So I want to do that.
- 1:03:11Larry Ogrodnek: Like I said, I think the T-string templating
- 1:03:13Larry Ogrodnek: is very exciting in terms of making that better,
- 1:03:17Larry Ogrodnek: figuring out the CSS story around that.
- 1:03:20Larry Ogrodnek: That's one thing that's annoying
- 1:03:20Larry Ogrodnek: is writing CSS in t-strings
- 1:03:22Larry Ogrodnek: because you have to double escape all the curly braces.
- 1:03:26Larry Ogrodnek: Better form support.
- 1:03:27Larry Ogrodnek: I have some initial form support
- 1:03:30Larry Ogrodnek: that kind of uses Pydantic.
- 1:03:33Larry Ogrodnek: But I kind of want to make that a little better.
- 1:03:35Larry Ogrodnek: And I've had situations where we have
- 1:03:37Larry Ogrodnek: like very complex, like nested forms.
- 1:03:40Larry Ogrodnek: And I would love to get to a point where it's just like,
- 1:03:41Larry Ogrodnek: yeah, you just throw, here's my Pydantic data model,
- 1:03:44Larry Ogrodnek: make a form with error handling
- 1:03:46Larry Ogrodnek: and all this stuff and validation.
- 1:03:47Larry Ogrodnek: And I kind of want to get there.
- 1:03:48Larry Ogrodnek: And then I think again, like larger examples,
- 1:03:51Larry Ogrodnek: like I think you called out the Phoenix Live View,
- 1:03:54Larry Ogrodnek: like LiveBeats example,
- 1:03:56Larry Ogrodnek: like they have this very big music player.
- 1:03:57Larry Ogrodnek: And I have some things like that
- 1:03:59Larry Ogrodnek: where I have like an AI chat example
- 1:04:01Larry Ogrodnek: that are slightly larger,
- 1:04:02Larry Ogrodnek: but kind of going to some more examples
- 1:04:03Larry Ogrodnek: to kind of inspire people,
- 1:04:04Larry Ogrodnek: like what can actually be done.
- 1:04:06Michael Kennedy: Could you fully implement the LiveBeats thing in PyView?
- 1:04:10Larry Ogrodnek: Yes, I can.
- 1:04:12Larry Ogrodnek: And I was thinking about doing it.
- 1:04:13Larry Ogrodnek: I think it's interesting, the history there, I mean, I don't know.
- 1:04:18Larry Ogrodnek: But my intuition is that part of it was that as they were building certain technologies,
- 1:04:22Larry Ogrodnek: they wanted to show them off and have a good test bed.
- 1:04:24Larry Ogrodnek: And so the way that it works is based on file uploads.
- 1:04:27Larry Ogrodnek: You upload MP3s that you want to play.
- 1:04:30Larry Ogrodnek: And I feel like that's because they wanted to show off the file upload stuff, which was
- 1:04:33Larry Ogrodnek: new at the time, I think.
- 1:04:34Larry Ogrodnek: And I could do that.
- 1:04:35Larry Ogrodnek: support. In fact, I have like even multi-part S3, like very advanced file upload support.
- 1:04:42Larry Ogrodnek: But I was thinking about doing it, but just doing streaming. I found a streaming service that is
- 1:04:47Larry Ogrodnek: for like royalty-free music if you're using it in a non-commercial way. And I think that might be
- 1:04:51Larry Ogrodnek: more exciting to show off like present stuff and even some JavaScript integration stuff and like
- 1:04:55Larry Ogrodnek: synchronizing stuff. And I think also I have a simple AI chat thing, but I think maybe
- 1:05:00Larry Ogrodnek: beefing up a little bit would be kind of cool too, because I know people are into AI stuff.
- 1:05:03Larry Ogrodnek: But you mentioned contributions, and I think, yeah, for sure, I think the thing that, to be honest, would be the most helpful is to have people try it, try writing a simple app or a complex app, whatever.
- 1:05:16Larry Ogrodnek: And I really want to hear what works well, what's rough, what's confusing, what could be better, any feedback.
- 1:05:24Michael Kennedy: Yeah, more than people contributing features is people just using it to make sure it works and giving feedback on how it should be, right?
- 1:05:30Larry Ogrodnek: Yeah, no, and contribution features are good, too.
- 1:05:32Larry Ogrodnek: I mean, I recently set up, like, also just a call, like, on GitHub, the repo.
- 1:05:36Larry Ogrodnek: There's also, like, a discussions thing.
- 1:05:38Larry Ogrodnek: It doesn't have a lot of things or anything.
- 1:05:39Larry Ogrodnek: I mean, there's two topics right now.
- 1:05:41Larry Ogrodnek: But, you know, because I do want to get more feedback and encourage feedback.
- 1:05:44Larry Ogrodnek: And, like, I think that's a great place to put features suggestions.
- 1:05:46Larry Ogrodnek: But, yeah, I mean, contributions are also welcome.
- 1:05:50Larry Ogrodnek: But, yeah, I just can't underscore enough how much, like, I want to have feedback.
- 1:05:55Larry Ogrodnek: Because, again, I want it to be, like, I mean, I want it to be a really great app that people feel is fun to use.
- 1:06:00Larry Ogrodnek: And they like using it.
- 1:06:01Larry Ogrodnek: And it's easy to get started.
- 1:06:02Larry Ogrodnek: And I know that it's not there yet,
- 1:06:05Larry Ogrodnek: but any help to getting there would be great.
- 1:06:08Michael Kennedy: Yeah, very cool.
- 1:06:09Michael Kennedy: Larry, thanks for being on the show.
- 1:06:10Michael Kennedy: Very cool project.
- 1:06:11Michael Kennedy: I think people should certainly at least give it a look
- 1:06:14Michael Kennedy: to see maybe it'll help them go get their app up
- 1:06:17Michael Kennedy: and running a nice little interactive app
- 1:06:19Michael Kennedy: way quicker than maybe they thought they could.
- 1:06:21Larry Ogrodnek: Yeah, thanks so much, Michael.
- 1:06:21Larry Ogrodnek: Yeah, I really appreciate the chance to come on
- 1:06:23Larry Ogrodnek: and talk to you about this.
- 1:06:24Larry Ogrodnek: It's been a lot of fun.
- 1:06:25Larry Ogrodnek: I can't believe how much we talked about
- 1:06:28Larry Ogrodnek: and how much more we could talk about.
- 1:06:29Larry Ogrodnek: So it was really fun.
- 1:06:31Michael Kennedy: We've got a browser full of tabs of things we didn't even get to.
- 1:06:34Michael Kennedy: So yeah, sorry.
- 1:06:37Michael Kennedy: Now that's how it goes.
- 1:06:37Michael Kennedy: All right.
- 1:06:38Michael Kennedy: Thanks for being here.
- 1:06:39Michael Kennedy: Catch you later.
- 1:06:39Michael Kennedy: Bye everyone.
- 1:06:40Michael Kennedy: Bye.
- 1:06:41Michael Kennedy: This has been another episode of Talk Python To Me.
- 1:06:44Michael Kennedy: Thank you to our sponsors.
- 1:06:45Michael Kennedy: Be sure to check out what they're offering.
- 1:06:46Michael Kennedy: It really helps support the show.
- 1:06:48Michael Kennedy: If you or your team needs to learn Python,
- 1:06:50Michael Kennedy: we have over 270 hours of beginner and advanced courses on topics ranging from
- 1:06:55Michael Kennedy: complete beginners to async code, Flask, Django, HTMX, and even LLMs.
- 1:07:01Michael Kennedy: Best of all, there's no subscription in sight.
- 1:07:04Michael Kennedy: Browse the catalog at talkpython.fm.
- 1:07:06Michael Kennedy: And if you're not already subscribed to the show
- 1:07:08Michael Kennedy: on your favorite podcast player,
- 1:07:10Michael Kennedy: what are you waiting for?
- 1:07:11Michael Kennedy: Just search for Python in your podcast player.
- 1:07:13Michael Kennedy: We should be right at the top.
- 1:07:14Michael Kennedy: If you enjoyed that geeky rap song,
- 1:07:16Michael Kennedy: you can download the full track.
- 1:07:17Michael Kennedy: The link is actually in your podcast blur show notes.
- 1:07:20Michael Kennedy: This is your host, Michael Kennedy.
- 1:07:22Michael Kennedy: Thank you so much for listening.
- 1:07:23Michael Kennedy: I really appreciate it.
- 1:07:24Michael Kennedy: I'll see you next time.
- 1:07:35I thought of me, and we ready to roll, upgrading the code, no fear of getting whole, we tapped
- 1:07:46into that modern vibe, overcame each storm, talk Python and me, I-sync is the norm.
- 1:07:54you