Monitor performance issues & errors in your code

#460: Dropbase: Build Internal Tools with Python Transcript

Recorded on Tuesday, Mar 12, 2024.

00:00 Do you find yourself for your team building internal apps frequently for your company?

00:04 Are you familiar with the term forms over data?

00:07 They can be super empowering for your organization, but they can also be pretty repetitive

00:12 and you might find yourself spending more time than you like working on them rather than core products and services.

00:19 I've invited Jimmy Chan from DropBase to tell us about their services, whose tagline is build internal web apps with just Python.

00:27 It's a cool service and a fun conversation.

00:30 This is Talk Python to Me, episode 460 recorded March 12th, 2024.

00:36 - Are you ready for your host, Daniels?

00:39 - You're listening to Michael Kennedy on Talk Python to Me.

00:42 Live from Portland, Oregon, and this segment was made with Python.

00:46 - Welcome to Talk Python to Me, a weekly podcast on Python.

00:53 This is your host, Michael Kennedy.

00:55 Follow me on Mastodon, where I'm @mkennedy and follow the podcast using @talkpython, both on mastodon.org.

01:03 Keep up with the show and listen to over seven years of past episodes at talkpython.fm.

01:07 We've started streaming most of our episodes live on YouTube.

01:12 Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows

01:18 and be part of that episode.

01:19 This episode is sponsored by Mailtrap, an email delivery platform that developers love.

01:26 Try for free at mailtrap.io.

01:29 And it's brought to you by us over at Talk Python Training.

01:33 Did you know that we have over 250 hours of Python courses?

01:36 Yeah, that's right.

01:37 Check them out at talkpython.fm/courses.

01:41 Hey, Jimmy.

01:43 - Hey, Michael, how are you doing?

01:44 - I'm doing well.

01:45 Welcome to Talk Python to Me.

01:46 It's fantastic to have you here.

01:48 - Thank you, I'm really excited.

01:48 - Yeah, I am too.

01:49 I saw DropBase, I saw what you all were building.

01:52 I'm like, that is pretty darn interesting.

01:54 I think people will want to check it out.

01:56 So we'll dive into this app and this platform that you made for app building, basically.

02:03 We'll have a lot of fun.

02:04 Now, before we get into that, though, just give us a quick bit of background on yourself.

02:08 How'd you get into programming?

02:09 How'd you find yourself writing a Python building platform?

02:13 - Awesome, yeah.

02:14 I went to school for engineering.

02:15 This was actually back in Canada.

02:17 I studied in Montreal at a little school called McGill University.

02:20 - Nice.

02:21 - We started then.

02:22 I used to intern, by the way, at this company called Research In Motion that used to make BlackBerries way back in the time.

02:27 - Oh, yeah, awesome.

02:30 In the heyday?

02:30 - In the heyday, yeah.

02:32 I remember when they said we had 50% of the US smartphone market share.

02:37 But the platform was actually built on Java, not Python.

02:39 Python was something afterwards.

02:42 Actually, my co-founder is the Python programmer, and I picked up Python after we started working together.

02:47 - Cool.

02:48 You got any fun stories from your time at BlackBerry?

02:50 Did you enjoy it?

02:51 How long were you there?

02:51 - I was there as an intern only.

02:53 I spent about 16 to 20 months of internships.

02:57 - Yeah.

02:57 - At the time, I was, I think, in my third year of school.

02:59 And we were just working on these little Java apps for the smartphones, and just making sure everything was working.

03:06 The cool thing is when you work at a company that's making devices, devices have a very long development cycle.

03:14 So imagine, for example, you worked at Apple today.

03:16 The iPhone, what, 15, whichever one's coming next, they've been working on it for at least a year,

03:22 probably longer.

03:23 So you get access to all these prototypes that you get to use, 'cause you're building for it, you're testing it.

03:29 That was a really nice, nice, nice day.

03:30 But you actually couldn't tell anybody about it.

03:32 But it was really cool to know that you're on the last day.

03:35 - And you couldn't lose it in a bar or anything like that, right?

03:38 - You remember those stories, right?

03:40 - Yes, exactly.

03:40 - It was all referenced a few times.

03:41 - Somebody got a hold of a lost phone, and it was sold, and there was all sorts of drama.

03:46 It was a big deal.

03:47 That was around iPhone 4, 3, 4, 5, sort of timeframe.

03:51 - Yeah, I remember that very clearly.

03:53 - Yeah, so you didn't wanna be that.

03:55 You wanted to make sure you hung on to it.

03:57 - Oh yeah, no.

03:58 (laughing)

03:59 - Yeah, I think working for a company like that would have been awesome, at least in the heyday.

04:03 It's cool to work for a tech company that's got a lot of wind that it's back,

04:07 and a lot of people using it.

04:09 It's kinda neat.

04:10 - I was very happy.

04:11 We had a lot of other interns that they hired at the time.

04:14 They used that up lots to work in there over the summer.

04:17 - Yeah, a lot of excited people to do stuff.

04:19 Excellent, cool.

04:20 And so then you picked up Python, I guess, when you started this project, is that right?

04:25 - Just a little bit before.

04:26 So when we started our startup, this was back in 2020.

04:30 My co-founder had been using Python.

04:33 He did a master's degree, computer science, focused on machine learning, actually.

04:38 In that field, Python is really the main language you use.

04:42 - Yeah, it is.

04:43 - And so he was very familiar with it, and so he set our stack, basically, to be a Python backend.

04:49 And then just through that process, just looking at things and designing features,

04:55 we just all got involved with Python.

04:56 So it kinda just became the same.

04:58 And this is actually the reason why we're working on a Python builder, is we're kinda building a product for ourselves.

05:04 It's something where it fits our own needs, that works with our mental models.

05:09 So that's pretty much it.

05:10 So today, I spend a lot of time building apps with Dropbase, so internal tools,

05:16 and that's most of the app building I do now.

05:19 So building demos, testing the products, making sure everything is working,

05:23 and then just finding other ways to make the developer experience more convenient.

05:27 - It seems like something you could really take care of a bunch of internal automation type of apps.

05:33 You don't have to create full-on web apps to secretize this data or to get that dashboard or whatever.

05:40 You just fire up your own platform and point at your data sources.

05:43 - That's right, yeah.

05:44 So the big difference with other frameworks is that you're gonna use these frameworks

05:49 to build your customer-facing applications.

05:51 And customers, they have expectations about what they need.

05:56 Interactions sometimes make a big difference for them.

06:00 UI components, the way models come up.

06:03 It's all part of the experience.

06:04 And so for that, you really need a lot of extra components complexity.

06:09 For internal tools, it's not to say that internal users don't have high expectations,

06:14 but the kinds of things that you do with those tools tend to be very, very similar.

06:19 You search for data, you get context about that.

06:24 So for example, you search for a transaction or for a user, you get some more context to make sure

06:28 that that's the user or the transaction that you want to act on.

06:31 And then you just act on it, right?

06:32 Like you trigger an action on that item or that resource or that person.

06:37 It helps you simplify the kind of things you need.

06:39 And so for that, having a framework, a builder to make this happen is super convenient.

06:44 The subtitle catchphrase of DropBase is build internal web apps with just Python, which is awesome.

06:51 And when I think of internal web apps, or even traditionally, if you look back a ways,

06:57 there was VB6 and Windows Forms and those types of things that were kind of playing the same role.

07:02 So same basic idea.

07:04 There was a lot of people who referred to that as forms over data.

07:09 It kind of the, not quite a negative term, but kind of like we're sort of doing

07:13 the same basic architecture over and over, but it's a different problem every time.

07:18 And so we kind of got to write code, create these projects from scratch every time,

07:22 but they're the kind of, same kind of thing.

07:25 And so, I think that's partly why VB6 with its kind of visual drag and dropy experience

07:30 became real popular, 'cause you could drag a table on there, drag a data source, bind it to that,

07:34 make a button click when somebody touches this thing.

07:37 And that didn't create something that would rival, say, airbnb.com, or where you have these really dynamic design sites,

07:45 but that's not what they need.

07:47 The company says, look, we need, this week, I need our salespeople to be able to answer this question

07:54 and make this change.

07:55 That's what we need you to build this week.

07:57 And if it's from scratch every time, that's a ton of rework.

08:01 - It's a lot of work.

08:02 It's funny you mentioned the forms over data.

08:04 It is true that a lot of the, well, if you take it at a very high level,

08:09 all apps are forms over data.

08:11 - In some sense, yeah.

08:12 - All SaaS apps are forms over a database in some sense.

08:17 And then you start hearing also about the similar things with you've heard about the GPT wrappers, right?

08:25 It's the same concept where it's like an oversimplification of what's happening,

08:30 but at the same time, it is kind of core to what's happening.

08:33 And for internal tooling, at least, is exactly what you need, forms over data, but very quickly,

08:38 so that developers don't have to spend a lot of time basically doing the same things over and over again.

08:44 You wanna make their lives easier to support their internal users.

08:48 So people in customer support, operations, and I think sometimes even supporting

08:53 other engineers as well.

08:54 - Yeah, and it's not that people in companies don't have expectations of nice apps and nice interactions.

09:01 It's just that it's more utilitarian.

09:03 Like so many of these big enterprises, when you kind of think of them, maybe the right way to think of them is

09:08 there's a massive Postgres or Microsoft SQL Server at the center.

09:12 And like, it almost connects the business divisions, like the sales team and the marketing team

09:18 and the product team and all that.

09:21 And if you can get into the database and answer questions, expose data, expose relationships,

09:27 put a UI to some aspect of that, you're really right at the heart of the company

09:32 in some sense, you know?

09:33 - Yeah, it's definitely about effectiveness.

09:36 One way we think about what these kinds of tools should do, you have to enable developers to very quickly

09:44 build apps that have maximal value, that lets you get the job done as effectively as possible,

09:51 but also that's easy to use for the end user.

09:54 So, you know, if it's like a business operator or someone in the operations team,

09:58 they also need to be able to learn quickly how to use it and trigger actions.

10:02 And so we call that sort of effectiveness of the apps, some sort of like effectiveness score.

10:08 It just combines these components.

10:10 And that's really the, like, if you can get to the essence of it and create a framework or a tool builder

10:16 that maximizes for that, I think you're in a really good place.

10:19 And this is something we're trying to do with DropBase.

10:22 The components are simple.

10:24 The kinds of apps that you can build look roughly the same, but they look really nice.

10:29 And they're also quite simple to understand.

10:31 They're modeled after, but it's in a way where you have data, a grid or table in the middle,

10:37 and then there's a sidebar from where you can trigger actions.

10:40 And this ties back to this concept of when you ask people in operations,

10:45 what they do, like sales, marketing, business operations, essentially ties back to the previous comments,

10:51 which was you search for something, you get context about it and you trigger action.

10:56 And so the way we translated that insight about what people just end up doing over and over again,

11:00 we said, well, then you really just need some sort of search bar, you need a grid and you need a sidebar

11:07 with some buttons or some other drop downs and other components.

11:11 And then you realize, okay, this is kind of what stretches I've been trying to do for a long time.

11:15 - Yeah, that's true.

11:16 - Except we like to trigger actions.

11:17 - Yeah, people do oddly connect Excel to like external data sources and all sorts of weird things as well.

11:23 Yeah, or write VBA that makes them change.

11:25 They probably should just not be doing that.

11:27 - Yeah, there's a lot of, it's actually a big use case.

11:29 One of our previous product, we actually did exactly that.

11:32 We let you connect any database source to your Google Sheets and just kind of run that on a schedule.

11:39 So you'd imagine in a business setting, you have sort of these like weekly, daily reports

11:46 that analysts end up working on, right?

11:48 And what you want is for the data to be fresh, up to date.

11:52 And so people just wanted a way to on at 7 a.m, 8 a.m on Monday morning,

11:58 basically automatically pull data from the database, load it up to your spreadsheet,

12:02 and then all your tables and calculations, which is sort of updated because they're referencing a tab, a sheet,

12:09 basically that has fresh data.

12:11 It is very interesting, the evolution of all these tools.

12:13 - It is really interesting.

12:14 Maybe one of the big differences is the interactivity here versus what you might do in that story, right?

12:21 - That's read-only really.

12:23 And then here, what we're doing is letting you trigger actions, perform actions,

12:27 basically outside the apps.

12:29 And you might call an API or you might trigger an internal endpoints or just some triggers matching in the UI.

12:36 - This portion of Talk Python to Me is brought to you by Mailtrap, an email delivery platform that developers love.

12:44 An email sending solution with industry best analytics, SMTP and email API SDKs for major programming languages

12:53 and 24/7 human support.

12:56 Try for free at mailtrap.io.

12:58 I think we'll get to this more later, but I wanna maybe touch on it since there's a good question.

13:04 Also, it might be a question a lot of people have.

13:07 So what's the pricing model for this?

13:09 And basically more broadly, what is the business model around here?

13:13 Luis says, "Already amazed by it.

13:16 "Would like to compare it." First thought, there's nothing like this available

13:20 in open source, so very neat.

13:22 - The business model is we're gonna sell the product on a per user per month basis.

13:29 So it's a B2B SaaS product.

13:31 Now, developers need to be able to play around with products before they can decide whether that's something they want.

13:38 And so we have a sort of a free version of the products that you can set up locally, like in your own machine,

13:46 or you can just put it up on an EC2 and you can just build apps for yourself.

13:50 Like if you wanna automate personal tasks, you can totally use this for it.

13:54 And then the way that we, in a way, layer the pricing is like if you need very complex permission systems,

14:02 so like you build an app and you want it accessible by this person, by person A, but not person B,

14:08 then you'll need very granular permission systems.

14:10 And so that's an indicator that you're probably like a corporate user, you're a business user.

14:15 And so we do the pricing based on that.

14:17 - The source is open, at least.

14:19 People can go and check it out, right?

14:21 Is that true?

14:22 - Let me clarify that.

14:23 So you can self-host it.

14:24 - Yes.

14:25 - You can look at the repo.

14:27 Behind the scenes, it's a Docker image that you set.

14:30 So the code for drawbase is not immediately, you can't just browse it through the file system,

14:37 but the code is basically sitting in your machine when you set this up locally.

14:41 Now, the difference here is if you look at the directory, where you have the workspace.

14:46 So the workspace directory is where all your apps files would be generated as you build the apps.

14:52 - Okay.

14:53 - That's really nice because you can essentially version control this from day one.

14:58 You can build apps, you can check it in GitHub, you can just keep your code, you can version it.

15:03 And so it's really, it's open source, let's clarify that, but you can self-host it.

15:08 - It's on GitHub, but the licensing is really not like just straight up GPL open source type of thing, right?

15:16 - That's correct, yes.

15:17 - Okay.

15:18 - And it's on GitHub because you do need to clone the repo and then you need to send it out and install it.

15:23 - The free tier doesn't allow self-hosting, but if you pay for one of the versions,

15:27 then it does have a self-hosting option.

15:30 So when you, just to wrap this up on the price, when you say it's $10 per user per month,

15:35 is that per person that makes the project, that builds the apps, or is that per person that interacts with the web app?

15:43 - This is currently per member of your workspace.

15:46 So we're not yet differentiating between someone who is building the app or using the app,

15:51 although that might be something that we'll have to add later on.

15:54 - Sure, so if you had say four salespeople and one "developer" in quotes maybe,

16:00 developer, that would be five users under this story.

16:03 - Correct, under the current pricing, yes.

16:05 - Okay, you know, even if it's not just pure open source, take it and run with it,

16:08 I do like the self-hosting aspect of it, because if you've got private data,

16:13 or maybe even more important than any of that, is I wanna connect it to data sources that are,

16:19 I don't wanna give your cloud access to my company database, for example.

16:22 - I can expand on that, actually.

16:23 So we built this specifically with that comment in mind.

16:30 So when you're using internal tools, it's very, well, let's say it's almost all the cases,

16:36 you are interacting with production, at least one production database, right?

16:41 Like if you're supporting customers and you're issuing them a refund, you don't do that in tests

16:46 and then take it to staging and then deploy it, right?

16:48 You basically, you act on it on your production data.

16:52 And so we thought, okay, people are probably going to be very hesitant to basically say, let me load up all my creds,

17:00 all my API keys into some new player, a new cloud, and then like hope for the best, right?

17:06 So when we designed Dropbase, we call it the worker or the worker server,

17:12 the way you connect to data sources is you basically go to your .env file

17:17 and you just add your database creds.

17:19 That env file sits in the same directory that that workspace directory sits,

17:25 the one that we saw on GitHub, and that's completely on your side and that's in your VPC or in your local machine.

17:33 And the same server is the one that triggers the task to query your database.

17:39 So, and that's also sitting on your side in your machine.

17:43 And so the entire part of the product that processes queries, touches your data,

17:49 your data sources, your credentials, that's completely on the user side.

17:54 And the only part that we manage is really just the permission system.

17:59 So that controlling the workspace and controlling the app permissions, that's the layer that we control.

18:06 And that's really like the part where we can do the pricing on, to begin with.

18:10 Like that's the feature set thing that helps us say, okay, this is gonna be paid customers

18:15 and these are gonna be developers who are just gonna learn how to code in Python,

18:19 just wanna build little apps for their own personal use.

18:22 - All right, that makes sense.

18:23 You know, let's maybe talk through an example.

18:27 If you go to dropbase.io, there's a, right at the top, there's a sort of tutorial

18:32 or a demo video of you using it.

18:35 Obviously, I don't wanna just play the video, but maybe just walk us through the steps

18:39 of what this app is and what are the steps to build it.

18:42 And just for people who are listening and haven't watched that video, maybe I think it's 12 minutes long

18:47 and you're like, let's create a new project.

18:49 And here it is published at the end, right?

18:52 Which is really nice.

18:53 So yeah, talk us through it.

18:53 - I'm gonna try to recreate the exact same one that you have on the screen, right?

18:58 So it looks like an app that has two tables and you can somehow perform an action on the sidebar.

19:05 Basically, it just notifies, either notifies a user or it performs some sort of permissions.

19:11 - I think what this one does is it has workspaces and then users are in a workspace

19:15 and you can make them admins or not admins of that workspace.

19:18 Is that what, does that help?

19:19 - Gotcha, perfect, okay.

19:21 Okay, so I'll describe how you build this app.

19:23 So you go to our app studio and it's gonna be a blank canvas.

19:26 In that canvas, you can add tables.

19:29 So the first thing you do is you add table one, you add the first table,

19:33 and then you would add table two, which is the second table.

19:36 And then you add a widget, so on the sidebar, you just click on add button

19:42 and then it just places a button on the screen for you.

19:44 So that will be sort of a shell of the application.

19:46 It'll be just the UI part.

19:49 At this point, it's just a few mouse clicks.

19:51 There's no Javascript code or Python code that you're writing.

19:54 The next step is to add the sort of the logic behind the scenes.

19:58 The first thing we need to do is to populate the first table with data about your workspaces.

20:04 And essentially what we do is you click on create new, you create a new function.

20:09 And in that function, it could be a SQL function or a Python function.

20:13 Because that's just a table, you can just create a new SQL function.

20:17 So you do create a new function, select everything from workspaces, let's say that's the table.

20:22 And then you can see a little preview of what that select statement will result in.

20:26 So you can verify that that's the data that you wanna show.

20:29 Once you've done that, you just save that file, that query, and you do something we call binding.

20:35 So in the UI, you can select table one, and it'll present you with the tables properties.

20:40 And one of the properties is which SQL file, which SQL script it's bound to.

20:46 So you just click bind to the SQL file that you just wrote, and then it just automatically populates it

20:52 with data for your workspace.

20:54 Now, the second table is a little bit more interesting because the second table will update

21:00 depending on what row you've selected in the first table.

21:02 When you click on a workspace in the first table, it should load all of the users

21:07 that are part of a particular workspace.

21:09 And so we do this, we have a feature called dependent tables, and that's exactly what it does.

21:14 So for the second table, you would still write a SQL query, and the query would just say,

21:19 select everything from users, where the workspace ID is the selected row

21:26 works as ID from the first table.

21:28 And we use that sort of a ginger, I'm not sure, maybe the audience will be familiar with ginger.

21:32 It's sort of like ginger templating style where you say select everything from users

21:37 where workspace ID is double curly brace.

21:42 And then we have something called state.

21:44 They basically gives you the state of the UI at any point in time when you've clicked something.

21:48 And it's really, we made it into a class so that you can say state.tables.table1.workspaceID.

21:56 And we resolve that into the value that's the workspace ID from the first table.

22:02 And so that's, and then you do the same thing.

22:03 You save that SQL query, you bind it to the second table, and then we automatically infer

22:09 that whenever you need, whenever you select a different row in the first table,

22:13 the second table will update the workspace ID value, rerun the query, and then show you the data for it.

22:19 - That's cool.

22:20 I was wondering how that happened.

22:21 I thought you must have to wire some on change event, clicks over here, then it triggers that,

22:26 but you just have that all automatic, right?

22:27 - The UI actually knows that which tables are related.

22:31 The UI sends a payload to the backend saying, this table was clicked, and this other table is related to it.

22:38 And so we kind of know that we need to process those again.

22:42 And so that's how we do this dependent table.

22:44 For the getting the value of the workspace ID in the first table, we basically, we resolve the sort of the variables

22:53 in the backend and then pass a value so that we can update the query.

22:58 So let's say that you stop at that point, right?

23:00 And then you say, preview the app.

23:02 The app would look like two tables where it's really just lets you see all the users

23:07 for each workspace that you have in your database.

23:11 And then a few more things to make that very useful is you might want to search for a workspace

23:17 before you know who to support.

23:18 So let's say each workspace is associated with one of your customers.

23:22 So let's say company A is your customer and company A gives you a call, a support call and says,

23:27 hey, can you make John in our company an admin?

23:31 So the first thing you want to do is you want to find, you search for company A and then find John.

23:36 So we have this nice feature that basically automatically creates searches for you.

23:40 So let's say in the first table, you can click on a button to convert it to a smart table.

23:46 And when you do that, we basically generate filters for you.

23:50 So you can then just say, I'd like to search by company name and you can select a filter

23:56 and you can pin the filter into the table and that automatically performs a search for you.

24:01 I say, it's pretty neat that way.

24:03 - It reminds me a little bit of Notion, Notion tables.

24:05 I don't know if you play with Notion any.

24:07 - Yes.

24:08 - You know, you have got those pin sorts and those pin filters and different things

24:11 you can kind of put at the top of the, I guess their databases are called in Notion.

24:15 A little like that.

24:16 - It's very similar to that in the sense that you're not writing any code

24:20 to be able to search through tables, but you can still modify what you let people search

24:25 by pinning certain filters.

24:27 The really interesting thing that we've done here is that we let you do joins

24:33 and still provides you that feature.

24:34 So in Notion, for example, you would just have one database and you can filter and sort that database.

24:40 With DropBase, what we have is, let's say you have a table called users and a table called roles,

24:46 and then they're related by an ID where let's say ID one is users, ID two is developers, ID three is admins.

24:54 You might have to join those two tables first.

24:57 And so that same smart feature, smart table feature, you can just write that SQL statement,

25:01 that join statement, and we can still generate sort of the right filters for you.

25:06 And we'll actually let you edit those tables as well.

25:09 What we do is we take your SQL statement and then we infer all the SQL required

25:14 to search or edit any column within the SQL statement.

25:19 - That sounds awesome.

25:19 - That's a really neat feature, especially for the people who are used to using

25:25 something like Django admin, in the sense that it helps you very quickly

25:29 build an admin panel with very little developer work.

25:33 You can just write a SQL statement and then we give you an admin panel.

25:37 So that's really neat.

25:38 But the final thing with the app here in the demo is the little button on the right side.

25:42 That is a Python function.

25:44 So you create a new Python function and you essentially say, you essentially write a database update

25:51 to update the role from whatever it was, let's say from developer to an admin.

25:56 It's just really a select statement, update table, that's column something on this particular ID.

26:04 And so that's just a Python function.

26:05 And the final thing is just to connect that button to run this Python function.

26:10 You click on the button, we run the function and then we perform a database update

26:14 to update the role to whichever role you want.

26:17 And that really is just the gist of the demo.

26:19 - So a couple of things about that Python function that's pretty interesting.

26:23 When you create it, you can say, I wanna create a function and it says, do you want SQL or do you want Python?

26:27 Which is pretty interesting.

26:29 The Python function has access to the UI widgets.

26:32 I get in the actual video, not the screenshot of the video.

26:35 I think you've got a dropdown select box.

26:38 And so the Python function go, well, what did the user select?

26:41 And then we'll make the change to the person in the workspace along those lines.

26:46 So that's pretty cool, right?

26:47 That you interact with this UI in kind of a object oriented way, I suppose.

26:52 - That's exactly how it works.

26:53 So behind the scenes, we have two classes.

26:56 One is called state and one is called a context.

27:00 So the state class just lets us access all of the UI state at any point in time.

27:06 Anything you enter in an input component or any row you select in the tables,

27:11 you can see the currently selected values of it.

27:15 And so whenever you click on a button or you perform an action, that state is passed to the backend,

27:23 just as a payload, just like a dictionary.

27:25 And the backend, we generate all the classes, all the objects related to state and context.

27:31 So we just have to pass the values in and then execute the function with those values as the input.

27:37 And so that's how we're able to do the state thing with Python.

27:41 If you've seen how you would do it in Python, it is very much a dot notation, right?

27:45 So you would say to get the value of column one in table one, you basically just say,

27:51 state dot tables, which gives you all the tables, dot table one, dot column one.

27:57 And that basically resolves into the value of the table, of the row in that table for that column.

28:05 - Yeah, that's cool.

28:05 I can imagine the implementation of that thing.

28:08 It's like dot dot get adder.

28:11 And if you ask for the thing, you look in the dictionary and you traverse the thing.

28:16 But with that in mind, what I thought was really nice about this is you had pretty decent autocomplete

28:21 in your little embedded Python editor.

28:23 How'd you pull that off?

28:24 - I did that you noticed, yeah.

28:25 We spent a lot of time on it.

28:27 - I bet you did.

28:28 - Yeah. - How's that work?

28:29 - When we were designing this, we were thinking, damn, VS Code is really nice.

28:33 You have all the plugins, all the autocomplete and everything, but we had two choices, right?

28:38 Either we build this whole UI builder into VS Code, or we kind of take some of the things

28:44 that make VS Code great and then bring it into the DropBase Studio.

28:48 We don't know sort of the final, eventually where this will be, but the current version of this is we thought,

28:53 you know what, I think we need to give users an editor, like a built-in editor,

28:58 so they can just quickly, they can have the best experience building the app

29:01 and the access to UI and context and state really quickly.

29:06 We just did it that way, where we added in LSP, so like a language server.

29:12 So anytime you type code in your Python function, it's basically over a WebSocket connection,

29:18 basically streaming the code changes and saving them in your file system.

29:23 That's the only way we can do this, this like object-oriented Python.notation access.

29:29 And so we need to have access to all the files.

29:32 And so we set this up so that not only you can do autocomplete, but also that we can actually do the state and context

29:39 approach to the web framework.

29:41 It was a bit complicated because we hadn't been really exposed to LSPs before.

29:46 And so we had to learn how to use LSPs and we had to sort of hijack sort of the WebSocket connection in a way.

29:53 So like we intercept the code and then we save it in your file system.

29:56 So we had to customize it a little bit to do this.

29:59 And it's really nice because now you can do autocomplete for your files.

30:03 It's just a neat, it's so hard to develop now.

30:05 We're so used to these tools.

30:07 And now with things like Copilot, like we're used to even more than just autocomplete, right?

30:12 It's like autocomplete the function, not just the variable, right?

30:16 - I feel like autocomplete is just table stakes, you know, especially in this kind of thing.

30:21 You know, if there's somebody who's just done Python forever and they're just, they'd rather get it out of the way

30:26 and it's fine.

30:28 It's not my way of working, but it's fine for people who want to do that.

30:31 But if you're working with somebody who might not be a full-time developer,

30:34 but they want to use your framework, your service to build some app, it seems like this could really empower them.

30:41 But if you give them something with zero autocomplete, zero highlighting,

30:44 they're going to be having a rough time, you know?

30:46 - Yeah, even for a more experienced developer, I think it's still a hard time.

30:50 - Even if you can do it, it's just less productive to go like, oh yeah.

30:53 - Way less productive.

30:54 - Yeah, way less productive.

30:56 I think AI gets added to apps a lot just to kind of check a box.

31:01 But the result of it is not that great to get on my email client that has AI integrated.

31:07 But it almost always seems like, well, that's not something I'd, yeah, that's something I want to read.

31:11 Like, I don't really want to read that.

31:12 And I don't need to summarize it.

31:14 That's emails, you know, just seems like a lot of energy goes into it when it's not that big of a value.

31:19 But maybe something like Copilot could be here.

31:22 - And this is something we've talked about, me and my co-founder.

31:25 So one of the things that we didn't get to cover because we're not going to go through all the demos,

31:30 but the way that we render data in these tables is we basically format it as a pandas data frame.

31:37 So what that means is that, let's say that you query data from Stripe, right?

31:43 Like you get all your customers from Stripe.

31:46 Stripe is not going to return a data frame for you.

31:48 It's going to return like an object, right?

31:50 A dictionary.

31:51 And then you basically have to take that dictionary and then basically convert it into a data frame.

31:56 And then we automatically know how to render everything else from there.

31:58 So we've thought about this and like, wouldn't it be cool if as soon as you get the response

32:04 from an endpoints, let's say as a JSON dictionary, that we suggest that we can just take it

32:10 that next step for you, which is just to like convert it into a data frame.

32:14 And then you wouldn't have to hustle with it.

32:15 We've done that before, but in theory that sounds very, very helpful.

32:19 If you're proficient in pandas and using data frames, it's actually not that hard.

32:24 It's a very quick thing for you.

32:25 But if you just know Python, but not exposed to the whole data frame ecosystem,

32:32 then maybe it would be really nice if you just said, okay, we just started to data frame for you

32:36 and then that's all you have to care about.

32:38 So we've thought about this.

32:39 We haven't added this yet.

32:40 - I think it's fine without, but it's kind of one of those things like you're in there

32:43 and you've got these data sources and maybe you're not super familiar with them.

32:47 Maybe you can pull them together somehow.

32:48 - One of the things that I find myself struggling with is, let's say I want to build a demo.

32:52 Let's say I haven't been exposed to like the SendGrid API or the HubSpot API.

32:57 Then I have to go to their documentation to figure out, how do I, what's the package name so I can install it?

33:05 How do I authenticate in?

33:06 How do I call a few endpoints to do what I need to do?

33:09 And I think in that case where it's like, it's not about your knowledge of Python.

33:13 It really is about your knowledge of this other thing that you're using.

33:17 In those cases, it seems that it could be extremely helpful for someone to build apps very quickly

33:22 if they somehow had access to either a quick documentation or it just suggested what you might want to do.

33:27 - Yeah, that's kind of what I was thinking as well.

33:30 If you're a regular listener of the podcast, you surely heard about Talk Python's online courses,

33:36 but have you had a chance to try them out?

33:39 No matter the level you're looking for, we have a course for you.

33:42 Our Python for Absolute Beginners is like an introduction to Python, plus that first year computer science course

33:47 that you never took.

33:48 Our data-driven web app courses build a full pypi.org clone along with you right on the screen.

33:55 And we even have a few courses to dip your toe in with.

33:58 See what we have to offer at training.talkpython.fm or just click the link in your podcast player.

34:03 - So speaking of that sort of external resources, you've got this Python function.

34:09 What can I put in there?

34:11 Can I use external packages?

34:13 Can I call out on the network to talk to some API endpoints?

34:18 Can I spin up threads?

34:19 What can I do?

34:21 How much Python can I do there?

34:23 - Pretty much all of the above.

34:24 So I'll elaborate what I mean by that.

34:26 So the standard way that you would connect to some of these services, these third-party services,

34:32 is you'll make like an HTTP request, like GET request, POST request.

34:36 So you can just like import requests, basically pip install requests, and then just do it over the standard Python,

34:43 basically Python package.

34:45 Now, it is way more convenient when you use an SDK provided by one of these third parties.

34:50 So if you wanna use Stripe, if you're able to just import Stripe, it'll make your life a lot easier,

34:55 you know, very nicely Pythonic, everything set up.

34:58 So in DropBase, you can install anything that you can install via PyPI.

35:03 We have a file called custom requirements.

35:07 And if you just list them out, when you set up DropBase, we'll basically install all those for you.

35:12 And then when you write a function, you can just basically import Stripe directly in the function

35:17 without, you know, pip installing it again, and then you just use it.

35:21 So that's really nice, basically anything.

35:23 I think you were doing a previous, UV, you were talking--

35:26 - Yeah, yeah, I was talking to Charlie Marsh about UV earlier today, yeah.

35:29 - We haven't looked into it yet, but anything you can pip install from, you know, from PyPI,

35:34 you can install in DropBase, which makes it really, really powerful.

35:37 - Yeah, nice.

35:38 - There's a database connections.

35:40 I mean, you could use SQL, or you can import whatever else you want, but we make those a bit more native

35:46 because we know that you're gonna connect to databases.

35:48 So we wanna make it a bit more a convenience.

35:51 So--

35:52 - And your tables need sort of direct access to it as well, right?

35:55 Not just the output of some access to the database, but you've got to figure out the columns

36:00 and all that kind of stuff, right?

36:01 - That's correct.

36:02 So for, we created a little library, like a utility slash helper that lets you perform database operations very quickly.

36:11 So if you've added your database credentials to the .env file, then you can quickly perform, you know,

36:18 like a select statement, or you can make an update to that database via functions,

36:22 but without, you know, the standard thing where you do, if you use SQLAlchemy, for example,

36:27 where you like start a session, start a connection, you know, like all those steps,

36:31 we kind of abstract that for you, but you can totally use SQLAlchemy in its full glory

36:35 if you, you know, if that's what you're used to.

36:37 - Nice.

36:38 Can I write Python files, like separate Python scripts and stuff, and then just import and call them from there?

36:43 Or does it have to be done through the UI?

36:45 - Totally. - Yeah?

36:46 - This is actually one of the biggest advantages of DropBase is that if you have like a,

36:50 like a Python script lying around and you want to sort of use it in DropBase,

36:54 you can add it to that file system somewhere in the workspace directory,

36:58 and you can just import it in via your function.

37:01 So you just like, - Okay.

37:02 - From your file, you can import a specific function in that file, for example.

37:06 And so, so the implication of this is that you can set up DropBase in a way

37:11 that it just lives in your existing Python code base.

37:14 So imagine you already, you know, you've set up your company, you've got product market fit, you know,

37:19 things are running, right?

37:20 And you have a Python backend, and now you're starting to scale and you need to build tools.

37:26 So your first option would be to do all custom, obviously.

37:30 The second option is to use some sort of tools builder, but every single action you take

37:36 is done over an HTTP request with authentication, with everything.

37:40 So just like a standard internet communication.

37:42 But if you wanted to just interact with an existing functions or internal endpoints,

37:48 then you'd have to either set up an RPC server, or you might want to use some other way

37:53 to get in there, right?

37:54 With DropBase, you basically just set up DropBase in the same directory as your app,

38:00 and you can then import selectively what functions you need.

38:03 It's sort of like a window into your code base that it's like a plug into that code base

38:09 where you can now expand and build a lot of internal tools that leverages everything that you've already built.

38:14 - Yeah. - That's the way, by the way.

38:15 - Yeah, when you've got, oh yeah, there's the requirements like custom, right?

38:18 So you've got your Docker compose file.

38:20 I mean, could you set it up just so as you build, it may be even better,

38:24 just set up a volume so that it can directly find, I mean, I guess that's what you're kind of showing

38:29 right here, right?

38:30 Is that you can sort of map, mount the volume just directly into say your Git repo

38:36 for your big project code, and then you can just start importing that and doing stuff with it, right?

38:40 - We still need to do some tweaks because of relative cats, but the idea is that you can do that

38:46 with a little bit of customization.

38:49 But yeah, our Workspace Server, basically you mount files or directories,

38:53 and then we can look into those to execute.

38:56 - Yeah, manage those files with Git or something like that.

38:58 - A good example of this is, are you familiar with Django and Django admin?

39:02 - Not super as I do every day, but I'm aware, sure.

39:05 - Django, it's a great web framework.

39:07 It's used by a lot of companies.

39:08 It's like, if you wanna build web apps, Django, it comes with a lot of stuff, right?

39:13 And there's this thing called Django admin that basically automatically generates admin panels for you

39:19 based on your Django models.

39:22 And so if you have a model for like a book, right?

39:26 In the book as authors, it basically exposes that to the Django admin.

39:30 And then now you can edit a book without really doing anything.

39:33 Like it all kind of comes for free.

39:35 Like it's pretty neat.

39:36 - I think that's like half the appeal of Django right there.

39:38 - It is, yeah.

39:39 I think a lot of people use it for that.

39:41 - Yeah, they're like, I don't wanna write that stuff.

39:42 I'm using Django.

39:43 Yeah, for real.

39:44 - And it's great.

39:45 Now, at some point when your company hits a certain milestone or a certain number of customers,

39:53 you will need to customize those admin panels.

39:58 You might need to create admin panels for things that maybe you don't have models for yet

40:04 or for things that combine data from your database with data from like Stripe or some other source.

40:11 And so what we see when we talk to these people is that they kind of struggle to like,

40:16 either do I like keep using this or do I like completely rebuild everything?

40:21 For those users, when we talk to them about DropBase, they get very excited because with DropBase,

40:26 you can install Django and it can sit in your file system.

40:30 And so essentially all the models that you've already built in Django, you can basically call them via DropBase

40:36 with DropBase function 'cause it's all Python, right?

40:38 And so it gives you this like, okay, Django admins are great up to a certain point.

40:43 And then after that, what happens, right?

40:45 Like you might not wanna rebuild everything just so you can have internal tooling.

40:48 And so I think that's quite of a nice spot for us to say, look, DropBase can live in your code base,

40:55 uses everything you already have, but it gives you some extra things if you want to build internal tools very quickly.

41:02 So that's something we're obviously very, very excited about.

41:04 - That's really cool.

41:05 I like that aspect of it.

41:06 So when we talk about this code, I guess there's two scenarios, the cloud version or the self-hosted version,

41:12 but where and how does this Python run?

41:15 Is it, it must be full CPython?

41:17 Is it running in isolated Docker containers or in your cloud, what happens?

41:22 Is it functions like AWS functions, Lambda?

41:25 - It just runs either on your local machine, if you've set it up as a developer,

41:30 it's all running there.

41:31 Obviously, if you could turn off your machine, you can use your apps.

41:34 And then if you set it up in a production instance, let's say you deploy this on an EC2,

41:40 your Python functions are running on that EC2, but it's running via Docker container inside.

41:46 - So it gets a little isolation, a little bit of protection, that kind of stuff.

41:49 - And we're assuming that, I mean, you're building these apps to run on your own infrastructure,

41:54 is that you would, that you know what you're doing.

41:56 So this is as opposed to us having a full cloud version where all customers run untrusted code

42:03 in the same sort of backend system, which would be obviously very dangerous

42:08 'cause I'm sure there's ways a customer can somehow, you know, go through the back

42:12 and then access other customers' untrusted code.

42:16 And that would be a nightmare.

42:17 And so if we have isolation, first layer is, well, it's in your infrastructure,

42:22 you're gonna do, it's just your company's code, but then further, you know,

42:26 we run Python in containers in that instance.

42:30 - That sounds more like a durability thing than anything.

42:33 I mean, it is also for isolation and protection, but first and foremost,

42:36 just don't let bad Python code take down the whole thing, you know?

42:40 - The way we recommend people using Dropbix or setting up their dev sort of process with Dropbix

42:47 is that they would clone, it's like basically fork the work Dropbix, and then they will develop locally.

42:54 They will test changes.

42:56 And once they're happy with the new code, you know, they'll push it back

43:00 and then they will have CI/CD into the production instance.

43:04 And then they can version control everything.

43:05 So that also gives you that extra layer of, okay, let's make sure that whatever we're pushing is tested.

43:11 You can always add test databases that you develop locally with before you push to production,

43:17 where it's gonna have to act on your production data.

43:19 - Yeah, that's pretty interesting.

43:20 I like the version control aspect of it.

43:22 That gives it a much nicer touch to connection to real software, rather than just it's a text input area in an app

43:30 that who knows what happens.

43:32 - As developers, it sometimes feels a bit scary, right?

43:34 Like you're building something and it's in this other framework, in this other cloud,

43:39 and it just feels like you can't kind of get, like if the thing goes away,

43:43 like you can't even see your previous code.

43:45 That was another key concept that we wanted to have is in this tool that it feels friendly for developers,

43:51 that it matches your mental models and your sort of like your development process,

43:57 let's call it, like how you're used to making apps or developing code, that we keep that feeling

44:02 when you're building apps with TrapFace.

44:04 - I wanna maybe have a PR to understand if we accept this change to it, right?

44:09 - That's right, yeah.

44:10 - Yeah, you don't normally hear that kind of stuff around these kinds of tools.

44:14 - And if you do, I think it tends to be like, yeah, okay, it's like a huge enterprise contract,

44:19 pay us $50,000 a year, and then you get version control, which to me, it sounds scary.

44:26 I mean, it just, it will make me a little bit less comfortable.

44:28 Now, obviously, if I'm a big company and I just really need the tool, sure, maybe I'll just pay for it and I get version control,

44:35 but getting version control, it just feels so like, like table stakes for developers, especially today,

44:42 that yeah, it just wouldn't make sense otherwise for us.

44:44 I mean, it's the way we're approaching this product.

44:46 - Yeah, well, the other aspect is, what are you version controlling?

44:50 Do you end up with something like effectively a Jupyter notebook, like big blob of something,

44:57 and then there's an older blob of something, and then you diff it, you're like, what is this?

45:01 But since you end up with just these, your workspace files that just live there, right?

45:05 It's a real optimized, like show me the changes, show me what's happened here.

45:09 - Yeah, it all lives there, including the component properties.

45:13 Like we don't store this in like a separate database or anything like that.

45:18 So like, you know, like for some of their tools, they will store all the components in their database.

45:24 And so what they do is, you know, when you load up their tools, like their tools builder,

45:29 it'll fetch all the components from the provider's database, combine it with maybe your custom code,

45:35 and then it'll do it.

45:36 And so even that feels like, okay, but where's like config for my components?

45:41 - Yeah, where'd this button come from?

45:42 Why is it gone?

45:43 - That's tough, yeah.

45:44 And then like, imagine if you wanted to like share apps, or, you know, it's just like version control

45:49 makes a bit less sense.

45:50 I mean, you're just version controlling, just like the individual functions,

45:53 maybe like some custom part of the code that you write, which is still useful,

45:57 but it still feels like you don't have the full picture of what's happening.

46:00 - Yeah, you don't have a full record.

46:02 It could easily get out of sync.

46:03 - Yeah. - Quite interesting.

46:04 I guess one thing we touched on a little bit before I press go here in the show,

46:09 you said that at one point you were considering using Jupyter and this whole mechanism.

46:15 Yeah, what's the story around that?

46:17 - We love Jupyter, we love notebooks, and we love the experience of them.

46:21 The sense that you can write some code and you can quickly test and execute the code

46:26 without, basically without needing to write anything else.

46:30 So for prototyping, for getting quick feedback, it's great.

46:33 And we wanted to give our developers something like that, because when you build these apps,

46:39 you're kind of iterating, right?

46:41 You're like, you're testing it.

46:42 A lot of the times you don't even know the documentation for Vibe or HubSpot or,

46:46 and so like there's a lot of experimentation.

46:48 And so we wanted a quick way to do that.

46:51 So we considered maybe having something like a Jupyter kernel within DropBase

46:57 that allowed people to do it.

46:58 There were some issues with it, is in the sense that the kernel actually stores results

47:04 from like previous blocks.

47:05 And sometimes that gets in the way of you triggering an action in a later block.

47:10 And so we were like, okay, maybe that's a little bit more than we need.

47:14 Now we still kind of eventually want something like that.

47:17 We hacked it in a way, like, so the way that we do it is, you can write a Python function.

47:22 You basically get one block.

47:24 You can write a Python function and you can click on a play button to basically run that function,

47:30 but it's not like a kernel.

47:32 So what we do is behind the scenes, we have like a main function.

47:36 And when you trigger that function, we take the state from the client.

47:41 So whatever you've selected or input it, we take the underlying file for your Python function,

47:46 and then we call it from me.

47:48 And so we kind of simulate that experience of like instantly testing code that you just wrote,

47:54 but there is no, like there's no Jupyter kernel behind the scenes.

47:58 And then you can only do one block at a time.

48:00 And so we said, okay, for now, as we're getting started with it, it's good enough that you can write your functions.

48:05 You can run and test them immediately, which is really nice.

48:08 You can do this with VS Code, by the way, like you would have to open up the terminal

48:12 and then basically run your function.

48:13 And so we still wanted this feature where you can click and just see your outputs

48:17 and basically debug and troubleshoot, but it'd be really nice if we get out multiple blocks

48:22 and you can just build functions that way.

48:23 So maybe for the future.

48:25 - Interesting.

48:26 - Did you say that you were a core developer for Jupyter?

48:29 - No, no, I just spoke to them.

48:32 It sounds fun, but I was just, I interviewed a whole bunch of them recently.

48:35 And what I thought was interesting is, Jupyter is such an empowering thing for Python developers,

48:41 but many of the core developers are so focused on writing JavaScript and TypeScript

48:46 to sort of make these interactions possible.

48:49 So the rest of us don't have to write JavaScript and that kind of stuff.

48:53 - So I think we're getting about to the end of our time here.

48:55 I'm sure that actually this is somewhat similar.

48:59 It's really a dynamic interactive web app.

49:02 And in that case, it probably has to have some interesting front-end JavaScript stuff going on.

49:06 What's the JavaScript story?

49:07 - Yeah.

49:08 - What framework are you using and stuff like that?

49:09 - We use React to build our components.

49:12 Obviously we abstract that away so that you as a Python developer, you're just writing Python,

49:18 well, you're writing SQL as well, but let's call that Python.

49:21 And then we deal with the components for you.

49:25 And so it's not the kind of framework where you're writing Python and we're generating HTMLX or something like that.

49:33 So obviously we understand React and we know we can build some beautiful components,

49:38 customize them with it.

49:39 We weren't about to create a completely new framework where we somehow just generate HTML from Python.

49:46 I think there's a few people working on that, actually.

49:49 We already know React, so let's just build those components or customize those components

49:54 and then just let people declare them and then sort of access and modify them

49:59 via the context objects in your Python functions.

50:03 So our stack, we use FastAPI for our backend, which is great.

50:08 - It's excellent, yeah.

50:08 - I'm not sure if you've had the creator here on.

50:11 - Yeah, I've had Sebastian on, I think at least three times, Sebastian Ramirez.

50:16 - Yeah, he's great.

50:17 - Yeah, he is really great, yeah.

50:18 FastAPI is a fantastic app.

50:20 And so, yeah, we use them.

50:22 We use React on our client side and we are a lot of our infrastructure is on AWS.

50:28 - Yeah, sounds really interesting.

50:29 Sounds like a fun app to work on.

50:31 - Yeah, you should play around with it.

50:33 I can help you build some apps to manage your podcast library.

50:37 - All right, well, Jimmy, I think we are pretty much out of time.

50:41 Final thought for people listening, maybe they're excited to try this out.

50:44 What are you telling them?

50:45 - Yeah, just go to dropbase.io and sign up for a free account.

50:49 It's free for developers.

50:50 You can set it up locally.

50:52 If you have any issues setting it up, just reach out.

50:54 I'll personally help you get it up and running.

50:57 Yeah, you can look at the documentation for everything else.

50:59 - Yeah. - Let's try it.

51:00 Give us some feedback.

51:01 We'd love to hear from you.

51:02 - Awesome.

51:03 Congrats on building a cool project for people and yeah, good luck with it.

51:07 - Thanks, Michael.

51:08 - This has been another episode of Talk Python to Me.

51:12 Thank you to our sponsors.

51:13 Be sure to check out what they're offering.

51:15 It really helps support the show.

51:17 Mailtrap, an email delivery platform that developers love.

51:21 Try for free at mailtrap.io.

51:24 Want to level up your Python?

51:27 We have one of the largest catalogs of Python video courses over at Talk Python.

51:31 Our content ranges from true beginners to deeply advanced topics like memory and async.

51:36 And best of all, there's not a subscription in sight.

51:39 Check it out for yourself at training.talkpython.fm.

51:42 Be sure to subscribe to the show, open your favorite podcast app and search for Python.

51:46 We should be right at the top.

51:48 You can also find the iTunes feed at /iTunes, the Google Play feed at /play

51:53 and the direct RSS feed at /rss on talkpython.fm.

51:57 We're live streaming most of our recordings these days.

52:00 If you want to be part of the show and have your comments featured on the air,

52:03 be sure to subscribe to our YouTube channel at talkpython.fm/youtube.

52:08 This is your host, Michael Kennedy.

52:10 Thanks so much for listening.

52:11 I really appreciate it.

52:12 Now get out there and write some Python code.

52:15 (upbeat music)

52:33 For more information , Plz visit the website of HealthWY.com

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon