Learn Python with Talk Python's 270 hours of courses

#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:06 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:18 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 12, 2024.

00:35 Are you ready for your host?

00:37 Please.

00:38 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:45 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 fosstodon.org.

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

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

01:11 Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.

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

01:25 Try for free at mailtrap.io.

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

01:32 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:42 Hey, Jimmy.

01:42 Hey, Michael.

01:43 How are you doing?

01:43 I'm doing well.

01:44 Welcome to Talk Python to Me.

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

01:47 Thank you.

01:48 I'm really excited.

01:48 Yeah, I am too.

01:49 I saw DropBase.

01:51 I saw what you all were building.

01:51 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.

02:13 Yeah, 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:20 We started then.

02:21 I used to intern, by the way, at this company called Research in Motion that used to make

02:26 BlackBerrys way back in the time.

02:27 Oh, yeah.

02:28 Awesome.

02:29 In the heyday?

02:30 In the heyday.

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

02:36 But the platform was actually built on Java.

02:39 No, Python.

02:39 Python was something afterwards.

02:41 Actually, my co-founder is the Python programmer.

02:44 And I picked up Python after we started working together.

02:47 Cool.

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

02:50 Did you enjoy it?

02:50 How long were you there?

02:51 I was there as an intern only.

02:52 Spent about 16 to 20 months of internships.

02:56 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

03:05 everything was working.

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

03:12 development cycle.

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

03:16 Like the iPhone, what, 15, whichever one's coming next.

03:20 Like they've been working on it for at least a year, probably longer.

03:23 Do you get access to all these prototypes that you get to use?

03:26 Because like you're building for it, you're testing it.

03:28 That was a really nice, nice, nice thing.

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 thing.

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

03:38 You remember those stories, right?

03:39 Yes, exactly.

03:40 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:46 That was around an iPhone 4, 3, 4, 5 sort of time frame.

03:51 Yeah, I remember that very clearly.

03:53 Yeah.

03:53 So you didn't want to be that.

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

03:57 Oh, yeah.

03:57 No.

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

04:02 It's cool to work for a tech company that's got a lot of wind that it's back and a lot of people using it.

04:09 It's kind of neat.

04:10 I was very happy.

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

04:14 So you just had a blast to work in there over the summer.

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

04:19 Excellent.

04:19 Cool.

04:20 And so then you picked up Python, I guess, when you started this project.

04:24 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:32 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:42 And so he was very familiar with it.

04:44 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, we just all got involved with Python.

04:56 So it kind of just became the same.

04:58 And this is actually the reason why we're working on a Python builder is we're kind of 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 spent 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:18 So building demos, testing the product, 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:32 You don't have to create full-on web apps to secretize this data or get that dashboard or whatever, right?

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

05:43 That's right, yeah.

05:44 So the big difference with other frameworks is that you're going to use these frameworks to build your customer-facing applications.

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

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

05:59 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.

06:21 You get context about that.

06:23 So for example, you search for a transaction or for a user.

06:26 You get some more context to make sure that that's the user or the transaction that you want to act on.

06:30 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:45 This is a little bit of a tool.

06:50 And when I think of internal web apps or even traditionally, if you look back a ways, 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:03 There was a lot of people who referred to that as forms over data.

07:08 It kind of the not quite a negative term, but kind of like we're sort of doing the same basic architecture over and over.

07:16 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, you know, I think that's probably why VB6 with its kind of visual drag and droppy experience became real popular because you could drag a table on there and drag a data source, bind it to that and make a button click when somebody touches this thing.

07:36 And that didn't create something that would rival, say, Airbnb.com or, you know, these really dynamic design sites.

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

07:47 The company says, look, we need this week.

07:50 I need our salespeople to be able to answer this question 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:00 It's a lot of work.

08:01 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, all apps are forms over data.

08:10 In some sense, yeah.

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

08:17 And then you start to hear 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:32 And for internal tooling, at least, is exactly what you need.

08:36 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 want to make their lives easier to support their internal users.

08:48 So people in customer support, operations.

08:51 And I think sometimes even supporting other engineers as well.

08:54 Yeah.

08:54 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:02 Like so many of these big enterprises, when you kind of think of them, maybe the right way to think of them is there's a massive Postgres or Microsoft SQL server at the center.

09:11 And like it almost connects the business divisions, like the sales team and the marketing team and the product team and all that.

09:20 And if you can get into the database and answer questions, expose data, expose relationships, put a UI to some aspect of that, you're really right at the heart of the company 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 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 users.

09:54 So, you know, if it's like a business operator or someone in the operations team, they also need to be able to learn quickly how to use it and trigger actions.

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

10:07 Yeah.

10:08 It just combines these components.

10:09 And that's really the, like, if you can get to the essence of it and create a framework or a tool builder 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 greater table in the middle, 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 what they do, like sales, marketing, business operations, essentially it ties back to the previous comments, which was you search for something, you get context about it, and you trigger action.

10:55 And so the way we translated that insight about what people just end up doing over and over again, we said, well, then you really just need some sort of search bar.

11:03 You need a grid and you need a sidebar with some buttons or some other drop downs and other components.

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

11:15 Yeah, that's true.

11:15 Except we like to trigger actions.

11:17 Yeah.

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

11:22 Yeah.

11:23 Or write VBA that makes some change.

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

11:27 Yeah.

11:27 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 Okay.

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 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, basically automatically pull data from a 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, basically, that has fresh data.

12:11 It's 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:22 And then here, what we're doing is letting you trigger actions, perform actions, basically outside the app.

12:29 So you might call an API or you might trigger an internal endpoint or just trigger some action in the UI.

12:37 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 and 24-7 human support.

12:55 Try for free at mailtrap.io.

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

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

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

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

13:13 Luis says, already amazed by it, would like to compare it.

13:18 First thought, there's nothing like this available in open source.

13:20 So very neat.

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

13:29 So it's a B2B SaaS app 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 free version of the products that you can set up locally, like in your own machine, or you can just put it up on EC2.

13:48 And you can just build apps for yourself.

13:50 If you want to automate personal tasks, you can totally use this for it.

13:55 And then the way that we, in a way, layer the pricing is like, if you need very complex permission systems, so like you build an app and you want it accessible by this person, by person A, but not person B, 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:21 Let me clarify that.

14:22 So you can self-host it.

14:24 Yes.

14:24 You know, you can look at the repo.

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

14:30 So the code for draw base is not immediately, you know, you can't just browse it through the file system, 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:45 So the workspace directory is where all your apps files would be generated as you build the apps.

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

14:58 You can build apps.

14:59 You can check it in GitHub.

15:01 You can just keep your code.

15:02 You can version it.

15:03 And so it's really, it's not open source.

15:05 It's clarified 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.

15:16 Yes.

15:17 Okay.

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

15:22 The free tier doesn't allow self-hosting, but if you pay for one of the versions, then it does have a self-hosting option.

15:29 So when you, just to wrap this up on the price, when you say it's $10 per user per month, is that per person that makes the project, that builds the apps?

15:40 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.

15:54 So if you had say four salespeople and one developer in quotes, maybe developer, that would be five users under this story.

16:03 Correct.

16:03 Under the current pricing, yes.

16:04 Okay.

16:05 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 or maybe even more important than any of that is I want to connect it to data sources that are, I don't want to 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:29 So when you're using internal tools, it's very, well, let's say it's almost all the cases 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 and then take it to staging and then deploy it, right?

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

16:51 And so we thought, okay, people are probably going to be very hesitant to basically say, let me load up all my creds, all my API keys into some new player, 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's server.

17:11 The way you connect to data sources is you basically go to your .env file and you just add your database creds.

17:20 And that .env file sits in the same directory that that workspace directory sits, the one that we saw on GitHub.

17:27 And that's completely on your side.

17:30 And that's in your VPC or in your local machine.

17:32 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, 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 like the app permissions.

18:04 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, that's the feature set thing that helps us say, okay, this is going to be paid customers.

18:15 And these are going to be developers who are just going to learn how to code in Python.

18:18 They just want to build little apps for their own personal use.

18:22 All right.

18:22 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 or a demo video of you using it.

18:35 Obviously, I don't want to just play the video, but maybe just talk us through the steps of what this app is and what are the steps to build it.

18:42 And just for people who are listening, haven't watched that video, maybe I think it's 12 minutes long 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:52 So yeah, talk us through.

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

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

19:04 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 a workspaces and then users are in a workspace and you can make them admins or not admins of that workspace.

19:18 Gotcha.

19:19 Perfect.

19:19 Okay.

19:20 Okay.

19:21 So I'll describe how you build this app.

19:22 So you go to our app studio and it's going to 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, and then you add table two, which is the second table.

19:36 And then you add a widget on the sidebar.

19:39 You just click on add button and then it just places a button on the screen for you.

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

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

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

19:50 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:57 The first thing we need to do is to populate the first table with data about your workspaces.

20:03 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:12 Because that's just a table, you can just create a new SQL function.

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

20:21 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 want to show.

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

20:34 So in the UI, you can select table one, and it'll present you with the table's 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

20:51 populates it with data for your workspace.

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

20:59 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 that

21:07 are part of a particular workspace.

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

21:14 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 workspace ID from the

21:27 first table.

21:28 And we used to sort of a Jinja, I'm not sure, maybe the audience will be familiar with Jinja,

21:32 it's sort of like Jinja templating style where you say, select everything from users where

21:37 workspace ID is double curly brace.

21:41 And then we have something called state.

21:43 State 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.

21:50 So you can say state.tables.table1.workspaceID.

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

22:01 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.

22:07 And then we automatically infer that whenever you need, whenever you select a different row

22:12 in the first table, the second table will update the workspace ID value, rerun the query,

22:17 and then show you the data for it.

22:19 That's cool.

22:19 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

22:37 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 for the getting the value of the workspace ID in the

22:49 first table.

22:49 We basically, we resolve the sort of the variables in the backend and then pass the value so that

22:56 we can update the query.

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

23:00 And then you say preview the app.

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

23:07 workspace that you have in your database.

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

23:16 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

23:27 says, 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

23:35 then find John.

23:35 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 the filter

23:56 and you can pin the filter into the table.

23:58 And that automatically performs the search for you.

24:01 So it's just 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:07 You know, you have got those pinned swords and those pinned 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:14 A little like that.

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

24:21 through tables, but you can still modify what you let people search by pinning certain filters.

24:26 The really interesting thing that we've done here is that we let you do joins and still provide

24:34 you that feature.

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

24:39 that database.

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

24:45 roles.

24:46 And then they're related by an ID where, let's say, ID 1 is users, ID 2 is developers, ID 3 is

24:53 admins.

24:54 Yeah.

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

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

25:02 statements, 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:08 What we do is we take your SQL statement and then we infer all the SQL required to search

25:15 or edit any column within the SQL statement.

25:18 That sounds awesome.

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

25:25 like Django admin in the sense that it helps you very quickly build an admin panel with very

25:31 little developer work.

25:33 Yeah.

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

25:36 Yeah.

25:36 So that's really neat.

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

25:42 Yeah.

25:42 That is a Python function.

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

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

25:56 So it's just really a select statement, update, table, set, column, something on this particular

26:03 ID.

26:03 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 to update

26:14 the role to whichever role you want.

26:16 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:22 When you create it, you can say, I want to create a function and it says, do you want SQL

26:25 or do you want Python, which is pretty interesting.

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

26:32 Like in the actual video, not the screenshot of the video, I think you've got a dropdown select

26:37 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:45 So that's pretty cool, right?

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

26:51 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 context.

26:59 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, you can see

27:12 the currently selected values of it.

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

27:22 backend 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

27:36 input.

27:36 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 state dot

27:52 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, dot, dot, get adder.

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

28:15 But with that in mind, what I thought was really nice about this is you had pretty decent autocomplete in your little embedded Python editor.

28:23 How did you pull that off?

28:24 I did that you noticed.

28:24 Yeah.

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

28:26 I bet you did.

28:28 Yeah.

28:28 How's that work?

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

28:32 You have all the plugins, all the autocomplete and everything.

28:36 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 that make VS Code great and then bring it into the DropAce Studio.

28:47 We don't know sort of the final eventually where this will be.

28:51 But the current version of this is we thought, you know what, I think we need to give users an editor, like a built-in editor, so they can just quickly, they can have the best experience building the app and the access to UI and context and state really quickly.

29:05 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, 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 dot notation access.

29:28 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 approach to the web framework.

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

29:45 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 need.

30:04 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 There's somebody who's just done Python forever, and they'd rather get it out of the way, 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, 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, you'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:55 I think AI gets added to apps a lot just to kind of check a box, but the result of it is not that great.

31:03 To get on my email client that has AI integrated, but it almost always seems like, well, that's not something I'd, yeah, something I want to read.

31:11 Like, I don't really want to read that, and I don't need to summarize it.

31:14 It's not emails, you know?

31:15 It 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 This is something we've talked about, me and my co-founder.

31:24 So one of the things that we didn't get to cover, because we're not going to go through all the demos, but the way that we render data in these tables is we basically format it as a pandas data frame.

31:37 Okay.

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.

31:59 And like, wouldn't it be cool if as soon as you get the response from an endpoint, let's say as a JSON dictionary, that we suggest that we can just take it at next step for you, which is just to like convert it into a data frame.

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

32:15 Yeah.

32:15 We've done that with it.

32:16 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, OK, 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 MARK MANDEL: I think it's fine without.

32:41 But it's kind of one of those things, like you're in there, and you've got these data sources,

32:45 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 the SendGrid API or the HubSpot API.

32:57 Then I have to go to their documentation to figure out 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 not about your knowledge of Python, it really is about your knowledge of this other thing

33:16 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:21 if they somehow had access to either quick documentation or you just suggested what you might want to do.

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

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

33:35 But have you had a chance to try them out?

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

33:41 Our Python for Absolute Beginners is like an introduction to Python plus that first year computer science course 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:54 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 MARK MANDEL: So speaking of that sort of external resources, you've got this Python function.

34:09 And what can I put in there?

34:10 Can I use external packages?

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

34:18 Can I spin up threads?

34:19 Like what can I do?

34:21 How much Python can I do there?

34:23 MARK MANDEL: Pretty much all of the above.

34:24 MARK MANDEL: 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, is you'll make like an HTTP request.

34:34 Like get requests, post requests.

34:36 So you can just like import requests, basically.

34:39 pip install requests and then just do it over the standard Python, basically Python package.

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

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

34:54 a lot easier, 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:06 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 pip installing it again, and then you just use it.

35:20 So that's really nice.

35:22 But basically anything.

35:23 I think you were doing a previous UV.

35:25 You were talking.

35:26 Yeah, yeah.

35:27 I was talking to Charlie Marsh about UV earlier today.

35:29 Yeah.

35:29 We haven't looked into it yet.

35:30 But anything you can pip install from PyPI, you can install in DropBase, which makes it really,

35:36 really powerful.

35:37 Yeah, nice.

35:38 There's a database connections.

35:39 I mean, you could use SQLAlchemy or you can import whatever else you want.

35:42 But we make those a bit more native because we know that you're going to connect to databases.

35:48 So we want to make it a bit more convenient.

35:50 So.

35:51 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 and all that kind of stuff, right?

36:01 That's correct.

36:01 So 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, like a select statement or, you know, 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, where you like start a session, start a connection, you know, like all those steps, we kind of abstract that for you.

36:32 But you can totally use SQLAlchemy in its full glory if you, you know, if that's what you're used to.

36:37 Nice. 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.

36:45 Yeah.

36:45 There's actually one of the biggest advantages of DropBase is that if you have like a Python script lying around and you want to sort of use it in DropBase, you can add it to that file system somewhere in the workspace directory.

36:57 And you can just import it in via your function.

37:01 So you just like from your file, you can import a specific function in that file, for example.

37:06 And so the implication of this is that you can set up DropBase in a way that it just lives in your existing Python code base.

37:14 So imagine you're already, you know, you've set up your company, you've got product market fit, you know, things are running, right?

37:20 And you have a Python backend.

37:22 And now you're starting to scale and you need to build tools.

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

37:29 The second option is to use some sort of tools builder.

37:33 But every single action you take 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, then you'd have to either set up an RPC server or you might want to use some other way to get in there.

37:55 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 where you can now expand and build a lot of internal tools that leverages everything that you've already built.

38:14 Yeah.

38:14 That's it, by the way.

38:15 Yeah.

38:15 When you've got, yeah, there's the requirements at custom, right?

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

38:20 I mean, could you set it up just so as you build, maybe even better, just set up a volume so that it can directly find.

38:28 I mean, I guess that's what you're kind of showing right here, right?

38:30 Is that you can sort of map, mount a volume just directly into, say, your Git repo for your big project code.

38:38 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 the relative paths.

38:44 But the idea is that you can do that with a little bit of customization.

38:48 But yeah, our workspace server, basically, you mount files or directories, 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:04 Django, it's a great web framework.

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

39:08 It's like, if you want to build web apps, you have Django.

39:11 It comes with a lot of stuff, right?

39:12 And there's this thing called Django Admin that basically automatically generates admin panels for you based on your Django models.

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

39:25 And the book has authors.

39:27 It basically exposes that to the Django admin.

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

39:33 It all kind of comes for free.

39:35 It's pretty neat.

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

39:38 It is.

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

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

39:42 I'm using Django.

39:43 Yeah, for real.

39:44 And it's great.

39:44 Now, at some point, when your company hits a certain milestone or a certain number of customers, 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:03 Or for things that combine data from your database with data from like Stripe or some other source.

40:10 And so what we see when we talk to these people is that they kind of struggle to like either do I like keep using this or do I like completely rebuild everything?

40:20 For those users, when we talk to them about DropBase, they get very excited because with DropBase, you can install Django and it can sit in your file system.

40:29 And so essentially all the models that you've already built in Django, you can basically call them via DropBase, with DropBase function because 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 want to 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, uses everything you already have, but it gives you some extra things if you want to build internal tools very quickly.

41:01 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?

41:20 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 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, your Python functions are running on that EC2.

41:42 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 It's 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 in the same sort of backend system, which would be obviously very dangerous because I'm sure there's ways a customer can somehow, you know, go through the backend and access other customers' untrusted code.

42:15 And that would be a nightmare.

42:17 And so if, you know, we have isolation, first layer is, well, it's in your infrastructure you're going to do.

42:22 It's just your company's code.

42:24 But then further, you know, we run Python in containers in that instance.

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

42:33 I mean, it is also for isolation protection.

42:35 But first and foremost, just don't let bad Python code take down the whole thing, you know?

42:40 The way we recommend people using DropBase or setting up their dev sort of process with DropBase is that they would clone, basically fork the for DropBase.

42:52 And then they will develop locally.

42:54 They will test changes.

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

43:00 And then they will have CICD into the production instance.

43:03 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 the production, where it's going to 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:23 That gives it a much nicer touch to connection to real software rather than just it's a text input area in an app that who knows what happens.

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

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

43:39 And it just feels like you can't kind of get, like if the thing goes away, 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, that it matches your mental models and your sort of like your development process, let's call it.

43:57 Like how you're used to making apps or developing code, that we keep that feeling when you're building apps for a trial phase.

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

44:09 That's right.

44:10 Yeah.

44:10 Yeah.

44:10 You don't normally hear that kind of stuff around these kind of tools, you know?

44:14 And if you do, I think it tends to be like, yeah, okay, it's like a huge enterprise contract, you know, 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, you know, getting version control, it just feels so like, like table stakes for developers, especially today.

44:42 But 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.

44:46 Well, the other aspect is, you know, what are you version controlling?

44:49 You know, do you end up with, you know, something like effectively a Jupyter Notebook, like big blob of something.

44:56 And then there's an older blob of something and then you diff it.

45:00 You're like, what is this?

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

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

45:08 Show me what's happened here.

45:09 Yeah.

45:09 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, it'll fetch all the components from the provider's database, combine it with maybe your custom code, and then it'll do it.

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

45:40 Yeah.

45:41 Where'd this button come from?

45:42 Why is it gone?

45:43 That's tough.

45:43 Yeah.

45:44 That's tough.

45:44 And then like, imagine if you wanted to like share their apps or, you know, it's just like version control makes a bit less sense.

45:50 I mean, you're just version controlling, just like the individual functions, maybe like the custom part of the code that you write, which is still useful, but it still feels like you don't have the full picture of what's happening.

46:00 Yeah.

46:00 You don't have a full record.

46:01 It could easily get out of sync.

46:03 Yeah.

46:03 Quite interesting.

46:04 I guess one thing we touched on a little bit before I press go here in the show, you said that at one point you were considering using Jupyter in this whole mechanism.

46:15 Yeah.

46:15 What's the story around that?

46:17 We love Jupyter.

46:18 We love notebooks.

46:19 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 without, basically without, 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, you're kind of iterating, right?

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

46:42 A lot of times you don't even know the documentation for Drive or HubSpot or, and so like there's a lot of experimentation.

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

46:50 So we considered maybe having something like a Jupyter kernel within DropBase that allowed people to do it.

46:58 There were some issues with it in the sense that the kernel actually stores results 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.

47:18 Like, so the way that we do it is you can write a Python function.

47:22 You basically get one block.

47:23 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 Jupyter kernel behind the scenes.

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

47:59 And so we said, okay, for now, as we're getting started with it, it's good enough.

48:04 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.

48:10 Like you would have to open up the terminal and then basically run your function.

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

48:19 But it would be really nice if you could get out multiple blocks and you can just build functions that way.

48:23 So maybe for the future.

48:25 Interesting.

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

48:29 No, no.

48:29 I just spoke to them.

48:31 It sounds fun.

48:32 I interviewed a whole bunch of them recently.

48:34 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 to sort of make these interactions possible so that 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:56 I'm sure that actually this is somewhat similar.

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

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

49:05 What's the JavaScript story?

49:07 Yeah.

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

49:09 We just 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.

49:19 But let's call that Python.

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

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

49:32 So obviously, we understand React.

49:35 And we know we can build some beautiful components, 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:45 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 and then just let people declare them and then sort of access and modify them via the context objects in your Python functions.

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

50:07 It's excellent, yeah.

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

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 or our client side.

50:24 And we are a lot of our infras on AWS.

50:27 Yeah, sounds really interesting.

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

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

50:32 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:40 Final thought for people listening.

50:43 Maybe they're excited to try this out.

50:44 What are you telling them?

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

50:49 It's free for developers.

50:50 You can set it up locally.

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

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

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

50:59 Yeah.

50:59 Let's find it.

51:00 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.

51:06 And yeah, good luck with it.

51:07 Thanks, Michael.

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

51:11 Thank you to our sponsors.

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

51:14 It really helps support the show.

51:16 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:26 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:38 Check it out for yourself at training.talkpython.fm.

51:41 Be sure to subscribe to the show.

51:43 Open your favorite podcast app and search for Python.

51:46 We should be right at the top.

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

51:52 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:07 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:14 We'll see you next time.

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