#138: Anvil: All web, all Python Transcript
00:00 Have you noticed that web development's kind of hard?
00:02 If you've been doing it for a long time, this is actually easy to forget.
00:06 It probably sounds simple enough to pick a server-side framework, Pyramid or Django,
00:11 create a new project.
00:12 Oh, do I use pcreate?
00:14 Is that cookie cutter?
00:14 Is that manage.py?
00:15 Install some client-side dependencies with NPM.
00:18 Install some server-side dependencies with pip.
00:21 Create a database.
00:22 Well, first choose a database server, then create a database, maybe even set up and install the server,
00:28 the process and maybe even another machine to do this.
00:30 Connect the app to the database securely.
00:32 Pick a front-end framework.
00:34 Is that bootstrap or foundation?
00:36 Integrate the front-end framework into it.
00:38 Pick a theme.
00:39 Now, finally, you get to write some code.
00:40 Oh, now it's time to deploy.
00:42 Wait, that doesn't sound that easy.
00:44 Actually, even to me.
00:46 What if the web were as easy as old-school VV6?
00:49 You just open a UI, you drag and drop some widgets, you double-click on the things like buttons for events,
00:54 but with Python code, of course.
00:56 With Anvil, you'll see that it really is that quick and easy to get started.
01:00 Meet Meredith Loof, who's here to tell us about Anvil.
01:02 This is Talk Python to Me, episode 138, recorded November 6, 2017.
01:21 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem,
01:27 and the personalities.
01:28 This is your host, Michael Kennedy.
01:30 Follow me on Twitter, where I'm @mkennedy.
01:32 Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.
01:39 This episode is brought to you by Datadog and GoCD from ThoughtWorks.
01:43 Please check out what they're offering during their segments.
01:46 It really helps support the show.
01:47 Meredith, welcome to Talk Python.
01:49 Thank you very much.
01:50 Thank you very much for having me.
01:51 Yeah, you had some pretty interesting stuff going on at PyCon UK, and yeah, I'm super happy to bring it to a wider audience.
01:58 Cool, thanks.
01:59 Yeah, it was really great.
02:01 That's actually been our first time sponsoring that conference, and it was really quite fun being deluged in people.
02:08 Yeah, a whole bunch of stuff we weren't expecting.
02:10 We went through a lot of throat sweeps in the evening after the conference,
02:12 but it was really great to see the reaction out there, and I'm really pleased to be talking to you
02:17 and your listeners, too.
02:17 Yeah, that's awesome.
02:18 So I'm super excited to talk about your project called Anvil, which is kind of trying to democratize the web again
02:25 in like a really interesting and powerful way and using Python to do it,
02:28 but before we get to that, let's just hear your story.
02:30 How did you get into programming in Python?
02:32 So programming, I started, I was very privileged.
02:35 I started around the age of seven.
02:37 I was introduced to QBasic, and for me, it was just this piece of magic because here I was sitting at this blue screen,
02:45 and I could type something in, and it was nothing the seven-year-old's brain
02:50 couldn't comprehend, and here was this program.
02:53 It was drawing pictures on the screen.
02:55 It was interacting with me, and I could make it do what I wanted, and this was magic made real sitting in front of me,
03:02 and it was several years before that that I worked out that you could actually make a career
03:05 doing this amazing thing that I discovered was the best hobby in the world.
03:08 Actually, literally the reason we started Anvil was that that experience isn't there
03:16 in much of the web these days, and as far as I'm concerned, that's borderline criminal negligence
03:21 from our whole profession because that kind of magic that can capture a kid's eye
03:26 is what we should be delivering.
03:28 You're right.
03:29 It absolutely is missing, and so I think you guys are going to bring some of that back.
03:33 Yeah, that's awesome.
03:34 So that's how you got into programming.
03:35 How about Python?
03:36 So Python itself actually, I mean, I've like dabbled, dipped into it bits and pieces,
03:43 but honestly, like we started on Anvil first.
03:46 It was very much, you know, we want to bring back this sort of instant access magic.
03:52 We want to bring back what you had with like Visual Basic 6, these tools in the 1990s,
03:57 and we were like, okay, but it's got to be modern.
04:00 It's got to be an easy-to-use, accessible language.
04:05 It's got to, you know, it's got to feel that kind of easy workability in your hands,
04:10 and we like looked at it, and Python was so the obvious candidate.
04:13 And so like I was, you know, I spoke Python as like, you know, fourth language up till then,
04:18 and then I went, right, okay, this is clearly the right thing, and jumped into it, and I've been loving it.
04:23 Yeah, that's awesome.
04:23 And so you guys sponsored PyCon UK.
04:26 It sounds like Anvil is something that you're focused on pretty much day-to-day.
04:30 Is that right?
04:31 Absolutely.
04:32 So we originally started this a couple of years back now.
04:36 It was like an evening and weekends project.
04:39 It was, you know, we were on our way to a wedding, sitting there in the airport,
04:42 Departures Lounge going, you know, why don't we have Visual Basic 6 for the web anymore?
04:47 And that kind of turned into, you know, some evenings working on it, which eventually turned into like taking one day off a week
04:54 to work on it.
04:55 And then last summer, we just, honestly, we just stuck it on Reddit, and we saw the reaction, went,
05:00 oh, okay, this is really a thing now.
05:02 Okay, we could afford to go full-time on it.
05:03 And so we worked our way up to it, but now, yeah, this is our thing.
05:07 Yeah, that's a really great story, and I think a lot of people feel like the way
05:11 you get to somewhere where you have, like, your own business or your own sort of thing
05:15 that you can go do that's not part of your job, it's kind of like diving off a high diving board
05:20 with your eyes closed, whereas I think in practice, a lot of these things, like you described,
05:24 start as like, let's test the waters, let's do some proof of concept, let's slowly build up,
05:29 and then once you see that it's like gaining traction, like, all right, if I could go
05:32 and do eight or nine hours a day instead of one, think what would happen.
05:36 Yeah, absolutely.
05:36 It's very much sort of wading in from the shoreline rather than jumping up a diving board.
05:40 That's great.
05:41 All right, so we're definitely going to get into the details of what Anvil is,
05:46 but maybe just give us a really, really high-level picture of what you built,
05:51 and then let's talk about your thought that the web is not as accessible as it should be.
05:55 Well, what we built was a tool for building full-stack web apps with nothing but Python.
06:00 So you can design what your page is going to look like in a kind of drag-and-drop visual editor,
06:05 but everything you place, every button, every checkbox, every piece of text is actually a Python object.
06:12 And so even your client-side code that's running in the browser is actually just Python.
06:17 We compile this JavaScript.
06:19 We run it there.
06:20 Your server-side code is just Python.
06:22 We even have a built-in database that you can access with pure Python, no SQL,
06:26 although obviously if you want to, you know, go and pull in a MySQL database,
06:30 you know, we support everything that Python supports.
06:32 But the idea is really that you should be able to build a fully functional web application
06:37 and publish it knowing nothing but Python.
06:39 I think you could build a fully functional web application with hardly knowing any programming.
06:44 I mean, this could easily be built like a really functional web application
06:49 for your first computer science or programming course in high school or something, right?
06:54 We have people who've done that, right?
06:56 You know, we've had schools who've just taught their computing curriculum
06:59 with Anvil precisely because of that because, you know, for the kids, it comes back to what I was saying
07:05 at the beginning.
07:05 You know, you want that instant feedback.
07:07 You want to have this feeling that I just learned this abstract concept of the if statement
07:11 and now here it is in buttons of colors and images in front of me right away.
07:14 Yeah.
07:15 So let me see if I can just describe the experience of using this which, granted,
07:19 my experience is like I've only built like one little test app and played with it for an hour or something
07:24 but still, the idea is you go to your website, you create an account, you launch a cloud browser-based IDE
07:31 which is really focused on the sort of UI design layer of, UI and data layer of your app.
07:40 You have a design view and a code view.
07:42 In the design view, you have a bunch of components and widgets that you can drag over,
07:46 images, links, buttons, repeaters, columns, all sorts of stuff.
07:50 You can give them names and then you access them in Python in the code side of your page, right?
07:56 Yeah, that's exactly right.
07:57 But look, it's not just on the code side of a page because you can also then
08:02 pull up a server module and then you're writing, again, it's just a Python module
08:07 but now it's running on our servers and you can just make function calls
08:11 as just a decorator for, this is something that you should be able to call
08:15 from your client code and so you can make Python calls straight from the Python code
08:20 that runs when, say, when you click a button in that code view through to server module.
08:24 Right.
08:24 And I think one of the sort of making this more accessible aspects of it
08:28 is like, I've been doing a lot of JavaScript lately and JavaScript is like
08:31 an intense place these days, man.
08:34 And it didn't used to be.
08:37 even in the early days, though, like with things like Ajax and stuff, you still have this sort of callback
08:43 indirect seesaw type of programming.
08:46 So like with what you just described, like you write a function on the server
08:50 and then you write some literally Python code that runs in the browser and then you just say,
08:56 call that function on the server by saying something like anvil.server.name of thing you wrote,
09:01 pass the parameters, and it's even a synchronous call.
09:03 Like it blocks and then continues, right?
09:05 That's something we really wanted to do because, I don't know, I mean, I'm going to confess some bias here.
09:11 There's a talk I gave at PyCon US.
09:12 If you Google it, you can find it, anvil PyCon Portland talk, which I entitled like,
09:18 you want to make the world better, put a little bit less JavaScript in it,
09:21 which is, you know, it's like the inflammatory title, but fundamentally,
09:25 when you're doing stuff like that in JavaScript, even like the hello world,
09:29 you have to understand asynchronous callbacks, which means you have to understand
09:33 like closures and anonymous functions and even promises.
09:37 Well, that's just an abstraction on top of them and you've got to understand
09:39 that as well.
09:40 And like the minimal set of what you need to do for, hey, what's your name?
09:45 Let me stick that in a database and read it back to you is like a huge amount
09:50 of computer science.
09:50 And we really wanted to take that back to what you had, you know, what you get in a REPL
09:56 or what you had with QBasic or what you had with Visual Basic or Delphi,
10:00 where you could just go, well, okay, you click the button, what's the first thing I do?
10:03 Well, I call this function that puts it in a database, what's the second thing I do?
10:06 Well, I do something else with the value it's returned and you can reason about it
10:12 in a very straightforward manner.
10:13 And so we've put a lot of effort and a lot of like compiler hacking in the background
10:16 to make that happen so that the user model is as simple as it can get.
10:20 Yeah, and I think it's super, super approachable.
10:23 So, you know, I sort of touched on it, you did as well, like working with JavaScript,
10:27 working on the web these days, it's really tricky.
10:29 if you're not going to use JavaScript and you want something interesting,
10:31 you're probably talking Django, Flask, or something else, Ruby on Rails,
10:37 ASP.NET, but none of those are super like walk up and just, oh yeah, I just push the button
10:43 and go, right?
10:43 There's actually quite a bit of work to make those things all fit together.
10:46 and kind of the worst of it is you need to do all of the above, right?
10:50 Because if you're building a web application today, you're going to need
10:54 at least five different programming languages.
10:56 You need to write the HTML, you need to write the CSS to make it look how you want it,
11:00 you need to write the JavaScript for it to behave in the browser, you need a server-side language
11:05 like Python on, running on the server for the browser to talk to, you need to be talking SQL
11:11 to your database and then you need a framework for the JavaScript, a framework for your CSS
11:17 like Bootstrap, another framework for the JavaScript if you're doing this
11:20 React plus Redux thing, a framework for the server-side language like Django,
11:24 probably a framework for the database like SQLAlchemy.
11:27 I mean, I count these on my fingers, I've literally just run out and that is a completely
11:32 unfair bar to set for, you know, you must be this tall to ride this ride.
11:37 This ride is the web, it's the greatest application delivery platform that humanity has invented
11:42 and we make you learn all this stuff before you can basically do hello world
11:47 and it's kind of interesting how that happened as well because...
11:51 How do you think we got here?
11:52 The web as a platform is this kind of Frankensteinian creation.
11:56 It grew up in the 1990s and there were people who could see the, you know,
12:01 the potential for this.
12:03 You know, JavaScript itself was kind of dashed off extra famously constructed by Brendan Eich
12:08 in two weeks but as the web sort of grew and it could be seen as a platform,
12:13 Microsoft, who are then the dominant incumbent, put a lot of effort into kind of
12:18 corralling that power.
12:19 You know, you had the Internet Explorer Netscape, Monopoly Wars of the 1990s
12:24 and you had this kind of semi-deliberate crippling of the platform.
12:29 You know, how, if people remember, gosh, I mean, I realize that this makes me
12:33 old for some people.
12:34 if you remember the pain of trying to make something work at Internet Explorer 4
12:39 or 5 as a web application, it was really hard work and that was not accidental.
12:42 Yeah, and then they kind of fixed it in Internet Explorer 6 and then the web
12:46 kind of suffered from a couple years of stagnation.
12:48 It was years of stagnation.
12:50 I think that the couple of years of stagnation is, that was actually arguably
12:54 one of the periods of greatest innovation where it just became obvious how tight
12:58 the constraints and limits that had been put on it were.
13:01 because what actually happened is this wonderful, it's almost a Greek tragedy.
13:04 You get Microsoft trying desperately to hold back this tide of web innovation
13:10 so it doesn't become the platform of the future and then this, you know,
13:14 around the turn of the millennium and this is like famously product groups
13:18 in Microsoft not very well connected, the Outlook web access team, they go,
13:23 well, wouldn't it be great if you could have like Outlook, an email client
13:26 in a web browser and they kind of put enough pressure on to make the Internet Explorer
13:29 team implement this weird, janky interface for doing like real-time calls
13:35 to the server called XMLRPC request and then that gets released in like what,
13:41 2002, 2003 and within a year you've got Gmail and Google Maps.
13:44 Yeah, that just totally broke the dam free, right?
13:47 That was when the whole Web2O sort of thing kicked in, right?
13:50 Yeah.
13:51 Thing happened, yeah, and so the Internet Explorer stick-6 stagnation was a bunch of people
13:55 kind of, it was a belated putting on of the brakes when the dam had already broken.
14:00 but the fun thing about this is what it means is the whole Web platform,
14:04 the whole structure of the Web platform is built on the rubble of a platform war
14:10 of the early 2000s and so that's why the ground underneath your feet is so rough,
14:16 I would argue, because we're still trying to build a functional application
14:22 platform on top of a system that was originally documents and then evolved
14:27 against really like active opposition into an application platform and what's left
14:34 is this Frankensteinian monster of so many different languages and frameworks
14:39 having to work together to make something happen that you end up with this huge barrier
14:43 to entry.
14:44 Yeah, you do and I feel like a lot of the Web is like, well, we could probably
14:47 do this better but this is working everywhere and that's more important than anything
14:52 else.
14:53 It's the ultimate path dependence.
14:54 It's how we, you know, we got here this way and that's, so that determines
14:58 the way things are.
14:58 Well, so that probably means writing Python in the browser is not really
15:02 going to be a thing, right?
15:03 It's all JavaScript.
15:04 Absolutely.
15:04 Also, and this is, this is one of the things we set out to tackle.
15:08 We actually use an open source Python to JavaScript compiler called Sculpt
15:12 and so that's what enables us to take your Python code that you've written in this,
15:18 you know, design code, your view thing and run it right there in the browser.
15:22 that project already existed and there are a couple other kind of like it
15:25 but there was a lot that of work that needed doing to it.
15:29 I jumped in, I'm now one of the maintainers, I did the big change that enabled that
15:32 blocking code you were talking about earlier, that was, that was a big change.
15:36 But yeah, it's really quite fun because not often you get to do like deep compiler hacking
15:41 and then say, actually, this is, you know, you can draw a direct line from
15:45 this weird piece of object code transformation I'm doing to like I'm improving
15:51 usability for seven-year-olds.
15:52 And I mean, and indeed, I should say this, for developers of all strikes,
15:56 right, for your data scientist who knows how to draw a graph and needs to do
15:59 a web map.
16:00 what I think is really interesting there is like you open that statement with
16:03 we're improving sort of the accessibility of the web for seven-year-olds,
16:07 which I think, as you pointed out, kind of downplays the significance of it.
16:11 But when you get something that kids like that can start to use, what that really
16:16 means is non-programmer, you like crack open like a whole new aspect of the web
16:20 for non-programmers.
16:21 People who like, hey, I could totally program Excel and I could like set up these functions
16:27 and maybe an if statement that'll make like this Excel go, but I'm not a programmer,
16:30 right?
16:31 All of a sudden that person can become like they could build a web app totally with those skills.
16:35 So this is something that's quite interesting and it's a philosophical thing.
16:38 A lot of people are interested in making tools for non-programmers and actually,
16:42 if you want tools for building a web app for non-programmers, there's actually
16:46 quite a lot out there and it's probably better optimized for non-programmers
16:50 than Anvil is.
16:51 We actually take a different approach.
16:53 We say, programming's not actually that hard, right?
16:58 increasingly, people teach themselves to code from websites.
17:01 They get taught in school.
17:03 It is something that people think it's reasonable to teach middle schoolers
17:07 and a whole bunch of people have learned themselves and I would argue kind of one of the
17:14 big reasons we have this big mental block around, oh, programming's so hard,
17:19 we have to make it accessible to non-programmers is that when we think of programming,
17:23 we think of the modern 10-layer web application stack.
17:28 Whereas, actually, writing code is the best way to tell a computer how to do something
17:34 and Python is one of the best ways to get from I'm learning these concepts
17:39 to cool, I can write some code that gets some stuff done and that should
17:43 be all you need.
17:44 So, we're kind of not aiming at non-programmers, we're aiming at I can do a little
17:50 bit of code and that should be enough.
17:52 Yeah, I guess that's what I was thinking of as well.
17:54 It's like people who are like, I'll take a two-hour or five-hour course on Python
17:58 and put a little effort into learning to code, but I'm not going to take computer
18:02 science four-year program, right?
18:04 Like that kind of group.
18:05 And you shouldn't need it, right?
18:06 It's when people talk about coding as digital literacy, this is what they're talking
18:10 about.
18:10 You shouldn't actually need to be that kind of expert before you can at least participate
18:14 in this world.
18:15 So, funny story, I'm actually taking this interview from borrowed offices
18:20 of a customer who started with a single data scientist and, you know, she had the
18:29 stats knowledge, the marketing understanding for an ad tech product she wanted
18:33 to build.
18:34 As far as she was concerned, she was, you know, she was not a developer.
18:37 She couldn't build the web app that this so clearly needed and was, you know,
18:42 talking to agencies and so on.
18:44 And then she found Anvil and suddenly actually she realized she was a developer.
18:50 It's just that what she could do was, you know, the Python she'd learned in the
18:53 course of data science.
18:54 And that's kind of moving the goalposts that actually a lot more people can
19:00 and do know how to code.
19:01 They just don't think of themselves as being able to build stuff primarily because
19:05 of the quality of today's tools rather than because they actually don't know how to
19:10 program.
19:11 And the world's full of people like that, right?
19:13 People who can write a little bit of code, as you said, like people who'd in
19:17 previous decades would have graduated from Excel to Visual Basic are now like
19:24 they're the people who are writing Python analysis, you're doing a little bit of
19:28 Python notebooking and we're trying to graduate them onto, you know, you can take that
19:33 and you can build something real that in this case handles, you know, terrifying amounts
19:38 of advertising money.
19:39 That's awesome.
19:41 I do feel like that people are expected to start software as they're compared to
19:49 places like, well, this is how Instagram works with Django and this is how
19:53 they use microservices and this is how they've written it to be testable
19:56 and scalable.
19:57 People look at that and they go, well, I can't do that, so I can't start, right?
20:01 And I feel like sometimes the most important thing is just to get started.
20:05 like, I think Microsoft Access was like one of the most used small business
20:11 sort of things for basically forms over data, build something to work to make my
20:16 dentistry run or make my little business run.
20:19 I'm not a programmer but I can like drag this stuff around until I can get
20:22 what I need and that's kind of gone away, right?
20:24 I'm not a programmer but I can use Access to put this together.
20:27 I'm not a programmer but I can create a visual basic form to do this one
20:31 thing that's application specific.
20:33 I'm not a programmer but I've now created this line of business application that
20:38 runs my business and Microsoft have basically taken one look at this and
20:42 realized that they had to guarantee support for applications written in Visual Basic 6
20:45 out to like the 2030s or something because you give people this ability to like slide
20:51 into building code and you know you give people this power and amazing things
20:55 happen.
20:56 Although, yeah, something we've been working on quite a lot with Anvil is to
21:01 support that whole journey because I don't want to like pretend that good
21:06 architecture and testing and all these things aren't important and so a real, the big
21:13 design goal for us with Anvil is to have something you can get started with without this
21:20 huge barrier to entry but is not going to stop you achieving mastery and proper design
21:27 and scaling your app and scaling your code.
21:30 Right.
21:30 You don't want to set a really low ceiling.
21:32 Yes, exactly.
21:33 don't want to set a really high barrier to entry.
21:35 Yeah, and we're convinced that this is possible and we think that, you know, we are well
21:40 on the way if not already there for most people's use cases and I think that there's a bit
21:46 of a sense that the floor is so high on the traditional tools anything with a
21:51 lower floor must have a much lower ceiling and I just don't think that's
21:54 true.
21:54 I think that's awesome.
21:55 So maybe now is a good time to like start actually getting into the details of
21:59 Anvil.
21:59 People can check it out at Anvil.works, right?
22:01 You can go there.
22:02 There's some actually really nice videos and some really intriguing things but it
22:06 basically starts, you say, create a new project.
22:08 It happens on your web IDE and it drops you basically, well, why don't you
22:14 walk us through it?
22:14 So it doesn't just drop you into a blank page necessarily, right?
22:18 if you sign up at Anvil.works, it is free to sign up.
22:20 You end up in this IDE and you can choose some of our sample apps and see what
22:25 we've done before but if you just create a new app, you start with selecting a
22:29 visual theme and you create a new form which is like a page in your site.
22:35 You've then got this form.
22:37 It's not fully blank.
22:38 It's already got like the visual structure in there and for this point you have a
22:45 toolbox of stuff on the right that you can just drag on and visually create your
22:50 page and everything you drag on is a Python object and if you sort of scroll
22:56 down on the right you can have, you can see its properties like for example if you put some
23:00 text on there's, you know, the font size of the text, there's the string that's what the
23:04 text actually is, there is, you know, there's which font, there's which color, all that
23:09 kind of stuff and you may or may not realize it at this point but you're actually just
23:14 editing attributes of a Python object that is going to be created at runtime.
23:18 Hey everyone, this is Michael.
23:20 Let me tell you about Datadog.
23:21 They're sponsoring this episode.
23:22 Performance and bottlenecks don't exist just in your application code.
23:26 Modern applications are systems built upon systems and Datadog lets you view the
23:31 system as a whole.
23:32 Let's say you have a Python web app running Flask.
23:35 It's built upon MongoDB and hosted and scaled out on a set of Ubuntu servers running Nginx and
23:39 MicroWisgee.
23:40 Add Datadog and you can view and monitor and even get alerts across all of these systems.
23:45 Datadog has a great getting started tutorial that takes just a few moments and if you
23:49 complete it, they'll send you a sweet Datadog t-shirt for free.
23:52 Don't hesitate.
23:53 Visit talkpython.fm/Datadog and see what you've been missing.
23:58 That's talkpython.fm/Datadog.
24:01 Yeah, like you said, you may or may not know, but it has this very Visual
24:04 Basic 6 designer feel, right?
24:06 Like you see it, you drag the stuff on there, you have a properties pane, you
24:12 change the name, and then maybe if there's like a button, you have these
24:15 events, right?
24:15 So there's various things that might have events.
24:17 Like if you double click a button, it drops you into like this code behind type
24:22 thing, which is a Python.
24:24 Yeah, tell us about that back there.
24:26 If you double click a button, you're immediately dumped into a function that
24:29 runs and that button gets clicked, and it's actually a method of a class that
24:33 represents the whole page.
24:34 All of this is Python, right?
24:36 Absolutely, all Python.
24:37 And all those things you dragged onto the page are in fact accessible as
24:42 instance variables, so you know, self.label1 or whatever, in that Python
24:47 code.
24:47 So it's a very natural thing.
24:50 I mean, you said Visual Basic 6 and Delphi, and no two ways about it.
24:54 Anvil owes a huge debt to those rapid application tools of the 1990s, because
24:59 that was a really good way to work.
25:01 They were hugely successful in building quick little applications rather than
25:06 hiring like a big dev team, but they ran on Windows 95, not on the internet.
25:11 You'll spend most of your time, if you're editing an Anvil app, switching between
25:15 the visual design to put some visual component on and the code that runs when you
25:23 interact with these components.
25:24 everything there will be compiled to JavaScript and will run in the user's
25:29 browser.
25:29 You'll then, of course, if you're writing most non-trivial web apps are going to
25:34 require a server component, so you can add a server module to your app.
25:37 And that's a Python module that runs on our servers, original naming, right?
25:42 And you can put whatever you like into that module.
25:45 It's just a Python module.
25:46 But any functions that you annotate with at anvil.server.callable, just a decorator, those
25:52 functions you can then call from your client code.
25:56 Right.
25:56 Much like writing like a Pyramid or Flask web method.
26:00 You just put a decorator on it and then it's accessible.
26:03 But somehow there's a kind of a really nice link both through the autocomplete
26:08 IntelliSense side of things as well as the calling side with the Python that is the code
26:14 behind for your page that actually runs in the browser and the Python that you write
26:17 that actually lives in the server, right?
26:19 Not knocking Flask because Flask is excellent for building REST APIs, but
26:24 having to squeeze all of your app state through this choke point of it must be
26:30 representable as a REST API and as JSON is one of those things that makes the web
26:35 unnecessarily difficult and we explicitly avoid that.
26:38 So when you mark a function as callable in a server module in Anvil and then you call it from your
26:44 client code, as well as being autocompleted right through and, you know, if you get an
26:48 exception, there'll be a stack trace that shows the call going from the service
26:52 of the client exactly where it blew up, which is very hard to do over something
26:56 like REST.
26:56 You can also pass in or return much richer data structures.
27:01 I mean, you can pass in or return anything that could be JSONs, so, you know, lists,
27:05 dictionaries, strings, numbers, none, etc.
27:07 But you can also do things like returning a row from a database.
27:13 Actually, I'll just explain what that is.
27:15 So a lot of apps will require some app-specific storage.
27:19 And because it's just Python, if you already have a database, you can just, you
27:23 know, import PyMySQL, import Psycopegee, connect to a database and go on.
27:28 You know, many people do.
27:29 But a lot of the time you'll require something apps, some app-specific storage.
27:33 And Anvil has a built-in database we call the data tables for that.
27:37 That's based on Postgres, right?
27:39 Yes.
27:39 So it's backed by Postgres and the tables themselves have a directly Pythonic API.
27:44 So you don't actually write SQL to interact with them.
27:47 You can if you've got a dedicated instance and you have your own database and
27:51 we don't mind you writing Towers of Hanoi in SQL.
27:54 But this means that the data table itself is a Python object.
28:00 So if I create a data table to store all the visitors to my form, I entitle it
28:04 visitors.
28:05 I've then got app tables dot visitors accessible as an identifier in my code,
28:09 just like those components are accessible as Python objects in my code.
28:12 And I could return that.
28:15 I could search for a set of rows and those rows will become live objects.
28:20 You can access them like dictionaries to, you know, get the column values out
28:23 or you can update them by going, you know, row, bracket quote, name, bracket is Meredith.
28:28 Okay.
28:29 So I think there's some really interesting stuff happening here in that you
28:32 have Python that looks like it's just regular Python, but actually runs and
28:36 sculpt in the browser and you've got Python that runs on the server.
28:39 Where can I access this database?
28:41 Because it could be like, do I have to do it only on the server or can I put it
28:46 in my like button click?
28:47 Not necessarily should, but that I could.
28:49 Absolutely.
28:49 So the thing I was leading up to, we were talking about the client server
28:54 calls.
28:54 The reason that we benefit from not squeezing everything through this choke point of a REST API
28:59 is you can return a row from a database as a Python object.
29:05 from this server code and it will pop out of your, the call as a return value in the
29:10 client code.
29:11 And this means you can absolutely just directly access this in client code.
29:17 I mean, in fact, for any data table, you can set its permissions.
29:20 You can say, actually, this table should be completely readable from client code.
29:23 And then in your form code, in the stuff that gets compiled to JavaScript,
29:27 you can go iterate through all the rows of the table if it's readable from the
29:30 client.
29:31 Why shouldn't you be able to?
29:32 Yeah, that's cool.
29:32 And you also get like a visual designer type thing for the databases and the
29:36 relationships and stuff.
29:37 Yeah.
29:37 So yeah, if you're, you can say, oh, there's, here's a bunch of components.
29:41 I'm repeating it for every element of list.
29:45 And again, like this is something we gain from everything being Python because that list is just a
29:51 list of Python objects and you can give it a hint or the autocompleter can work out
29:56 what type the Python objects were.
29:58 And if, for example, it knows that you've given it a list of rows from such and
30:03 such a database, then when you, when you were in the visual designer and you pull
30:07 up the data bindings and you say, I want the text on this label to be the name column
30:13 from this row in the database, it could autocomplete that for you because it's all using the
30:18 same object model.
30:19 It's all using the same language and it knows, for example, what options are
30:23 available for column lookup on that row.
30:25 And that I think is a really powerful thing for making this stuff a lot faster.
30:29 I think also that that's a super important component for people who are getting
30:34 started.
30:34 They, they look at code and they're like, I don't know what to type.
30:37 Right.
30:38 But if you type dot and like, here's a list, like, oh, it says text.
30:40 Okay, cool.
30:41 That must mean like that's the value that's in the input box or I type dot customer
30:46 dot name.
30:46 Oh, that's the name of the customer, right?
30:48 That's super helpful.
30:49 So there's a talk that I, a lightning talk I just gave at Python UK.
30:53 So last Sunday, that will be going up on our website soon, possibly by the time this
30:57 podcast gets published, where I talk about the autocompleter and how we built it.
31:02 But actually I spent about half the talk talking about how no really autocomplete is
31:06 just terribly important.
31:08 And seriously, listeners out there, if you spend all your days in Vim or Emacs and you
31:14 don't use an autocompleter, I would just recommend just try for a week, install the Jedi
31:20 plugin for Vim or Emacs and experience what using autocomplete is like for your code creation
31:26 because you're faster, you know what you're doing, you can eliminate whole classes of bugs
31:31 without ever even hitting the run button.
31:33 And you get this, you know, you get to stay in flow rather than going out to check the document,
31:38 documentation every five seconds.
31:41 Yeah, I use PyCharm a lot and that's one of the main things that I find it super helpful
31:45 for.
31:45 You do the editor question at the end, but yes, absolutely.
31:48 And I have to say we spent a while thinking that we could do without autocompletion and
31:53 create a application development environment that was fun to use and we were just wrong.
31:57 You need it.
31:58 You need that reassurance.
32:00 Yeah, what I think is really interesting is you actually span like client server with
32:03 autocomplete and stuff as well.
32:05 Yeah, well, no, this is honestly the biggest thing.
32:07 It's when one of the reasons that a lot of people, again, when back in the 1990s, your
32:13 standard tools all had autocomplete, why people have kind of lost it now is because
32:18 the tools don't know about, oh, well, what's on the other end of this rest call I'm making?
32:24 What options will be available on the thing that comes back?
32:26 And actually, because it's all in the same system, it's all in the same language, the autocomplete
32:31 goes, well, you know, I passed the return statement that will give me this value five seconds ago.
32:35 I know exactly what it's returning and I'm going to autocomplete the columns available
32:39 on this database, right?
32:39 That's actually really, really nice.
32:41 And we preserve that.
32:43 And again, because we have this rich interface that's not squeezed over a rest connection,
32:48 we can do things like we have a built-in capability security model, which is a fancy word for
32:55 a thing that you most of the time just don't need to think about, which is if you've got
32:58 one of these rich objects and you return it from a server function, that was you giving the client
33:03 access to that object.
33:05 So if there's a data table that the server can access and the client can't, but there's some
33:09 server function that says, well, okay, I will give you the rows that belong to your user.
33:13 As it's returned to those, you've now got read access to those rows that belong to your user.
33:18 And so you can use them directly in client code.
33:20 That's cool.
33:21 How much ability do you have to structure things other than this like page code behind thing in
33:28 Python?
33:29 Like, can I create like classes and helper modules and stuff in Python that actually run and sculpt?
33:34 So we've got server side modules that run purely on the server and that's code that the client never
33:39 sees and is trustworthy.
33:40 And then we've also got like utility modules, which can be imported from client and server.
33:44 And again, they're just Python modules you can import.
33:47 So, you know, common code that'll be between lots of your pages.
33:51 We've also got a system where you can take your whole app and kind of package that up as well as a Python
33:58 package that other apps can depend on.
34:00 So you could say, you know, oh, I've built a form for, I don't know, for
34:05 displaying a progress bar.
34:06 This is something that actually one of our users did in the forum recently.
34:09 I built a progress bar form and I'm going to export this as a package that
34:15 somebody else can import.
34:17 So you can also structure your code in that kind of reusable libraries way.
34:20 Right.
34:20 That's a really cool bit.
34:21 Like, I can't remember the last time in the web that I had like a sort of a
34:26 drag and drop reusable visual component that had both a visual aspect and a
34:32 functional aspect.
34:32 But you guys have that, right?
34:34 You can create these like sub element controls and like drop them.
34:37 I mean, it's been probably 10 years since I've worked in a web framework
34:41 that had that.
34:41 Yes.
34:42 This is the thing, right?
34:43 People say, oh, it's been 10 years.
34:44 What happened to progress?
34:45 Why did we go backwards in those 10 years?
34:47 Yes, absolutely.
34:49 So when you import one of these, if you, when you import a dependency that's got some of this stuff in, as
34:55 well as being able to like import the utility modules, you know, just like
34:58 you'd import Python modules.
34:59 And of course they ought to complete and blah, blah, blah.
35:01 You've also got this server side code you can bring in.
35:04 So you can make, you've brought in the client side code, you've brought in the
35:07 server side behavior and you've brought in the visual design all at once.
35:12 So you can create these reusable components that will abstract away a lot of the fuss people.
35:19 people currently have to re-implement 10 times.
35:21 There could be actually almost a marketplace for people to create really powerful little controls.
35:28 Tell me about it.
35:29 That's definitely on our radar.
35:31 I don't have anything to talk about yet, but yes, you would not be the first person to ask for that.
35:35 Yeah.
35:36 I mean, definitely in like the Windows forums, VB space, there were companies
35:40 that like just, they built these components that you could buy.
35:43 Like I need a really cool graphing component or I need like a, I don't know, like a login component or
35:48 something and you just drop them in there.
35:50 Yeah.
35:50 And I feel like we've already kind of proved out that model with the components and services we already
35:56 provide within Anvil.
35:57 So as well as like forms and modules and server modules, in an Anvil app, you
36:02 just hit a plus button next to the word services and you get the option of
36:06 adding a bunch of pre-built interfaces to various external services.
36:13 So, I mean, the data tables is one I've already talked about, but you could, for
36:16 example, you know, add the Google API service and that's just a bunch of
36:19 packaged up functions for dealing with files in Google Drive, accessing Google
36:26 Sheets documents, authenticating people with their Google accounts.
36:30 So maybe some company that runs on Excel could take all of their Excel documents,
36:35 drop them into Google Docs, and then you could access them and convert them, access
36:40 them as Google Sheets and use them as companies that do that have done that
36:45 with Anvil.
36:45 Okay.
36:45 Yeah, for exactly that reason.
36:47 And that's enabled by the fact that there is this drop-in, you know, client and
36:51 server and UI service that provides the things you will need if you want to
36:58 interact with the Google API.
37:00 And similarly, you know, we have something equivalent for Facebook and a couple of
37:04 other things.
37:05 Yeah, you guys have Stripe, like a super simple integration with Stripe.
37:08 Oh, yes, absolutely.
37:09 So if you want to get money, again, just a Stripe integration just off the shelf.
37:14 Yeah, that's awesome.
37:15 You have email, you have user management.
37:17 Those are both pretty impressive.
37:18 Yes.
37:19 Well, user management was what I really wanted to talk about.
37:21 It's the perfect example.
37:22 The user management service is implemented.
37:24 I don't think there's any, no, there is no JavaScript in the entire thing.
37:29 It's all implemented using the standard API.
37:32 So user service is a perfect example of something that you could have written
37:35 yourself.
37:36 In fact, people, of course, people did.
37:37 People did before we had it implemented.
37:39 But it's just a data table with, you know, a column for email, a column for your
37:44 bcrypt hash password.
37:45 Oh, you guys are using bcrypt?
37:47 That's awesome.
37:47 You know, a server function that you pass in a username and password and it looks up
37:52 the user and says, does it match?
37:53 And if so, it stores something into the session.
37:56 And, you know, you can use the Google API service to say, oh, who's, you know, log this
38:00 user in with Google, who's logged in.
38:02 Right.
38:02 You got the OAuth 2 stuff.
38:03 It's all something you could build, but you don't want to have to every time you want to
38:07 build a web application.
38:08 I'm working on a project right now and I spent like literally a full day just working on
38:13 user management.
38:13 And I'm like, yep, this is just like the stuff I wrote six months ago.
38:16 And it's also going to be probably what I write six months from now.
38:19 So I feel like I'm always reinventing user management.
38:23 So that's cool that that's kind of a plug and play thing.
38:25 We've tried to pick off some like low hanging fruit, the things that people reinvent a lot.
38:29 And user management was, I mean, pretty much top of that list.
38:32 Yeah.
38:32 How many times have you written an email validation link processor thing?
38:38 Too many.
38:39 I want my life back.
38:40 Exactly.
38:40 But really, that's just the low hanging fruit because there's tons of stuff out there that
38:47 people implement every day and shouldn't have to, they should, they should be able to
38:52 create reusable libraries.
38:53 And we're really excited to have that kind of ease of use come to other domains in
39:00 that.
39:00 So if you're Esri and you're like a company that creates the company that creates ArcGIS,
39:05 you wanted people to access your stuff.
39:07 Maybe you could just drop in like, here's how you just plug into our web service and
39:11 just get to your like cloud GIS stuff.
39:13 Right.
39:13 Or things like this.
39:14 Yeah.
39:15 That's beautiful.
39:15 This portion of Talk Python to Me was brought to you by GoCD.
39:20 GoCD is an on-premise, open source, continuous delivery tool to help you get better visibility
39:26 into and control of your team's deployments.
39:29 With GoCD's comprehensive pipeline modeling, you can model complex workflows for multiple teams
39:34 with ease.
39:35 And GoCD's value stream map lets you track changes from commit to deploy at a glance.
39:41 Say goodbye to deployment panic and hello to consistent, predictable deliveries.
39:45 We all know that continuous integration is super important to the code quality of your applications.
39:49 Choose the open source local CI server, GoCD.
39:53 Learn more at talkpython.fm/gocd.
39:57 That's talkpython.fm/gocd.
40:00 And I mean, Anvil already, again, all of this stuff is stuff you could do yourself.
40:04 We have a bunch of really cool stuff for interacting with web services.
40:07 I mean, if you're a client of a web service, you probably just want the requests library
40:11 and then you're off.
40:12 But making that easy and simple and tab completing their whole API is a kind of thing that companies will want.
40:22 And it's something we've talked to with companies before.
40:25 And we're really excited about bringing that kind of, oh, OK, I want to do telephony.
40:29 Fine.
40:30 Yeah, that's one import and autocomplete.
40:32 Exactly.
40:32 Exactly.
40:33 Drop in the Twilio module or whatever, whoever it is, right?
40:35 So this is all super interesting.
40:38 And these component type things are super cool.
40:40 But one, I guess the thing that probably was most impressive to me that showed like,
40:45 OK, you have this thing that runs in your environment and is hosted.
40:49 And I want to talk about like what that means.
40:51 Before we talk about that, though, let's talk about Uplink, your final service.
40:55 Oh, yeah.
40:55 Well, so Uplink isn't really service.
40:57 The Uplink is yet another example of a pattern that we do right the way throughout Ambil.
41:04 Everything's built in abstractions, right?
41:06 You know, you can solve every problem in computer science with another layer of abstraction,
41:10 except the problem with too many layers.
41:11 Right.
41:12 If it doesn't work, you add one more, yeah.
41:13 Yeah.
41:14 And Ambil is an abstraction over the web.
41:15 And of course, every abstraction has its limits.
41:18 Every abstraction leaks, to quote that famous essay.
41:22 And the question is, how does your abstraction handle it when you hit the edge?
41:26 And I mean, JavaScript frameworks basically handle it by letting it all hang out.
41:30 But, you know, you can't use these JavaScript frameworks without understanding quite a lot
41:34 about how they work underneath anyway.
41:35 So you can just, you know, pull away bits of the foundation and edit it yourself if you need to.
41:39 Some abstractions, like if you're writing a Windows desktop application and you need it to run on the web,
41:45 you're kind of stuck.
41:47 You know, you're going to have to do some serious rewriting or interfacing.
41:50 But the pattern I most like is kind of, I should say, there's also this kind of ejection pattern.
41:57 There's a tool called Create React App, if you're familiar with it.
42:01 I forgive you if you're not.
42:02 But the idea is it simplifies a bunch of the creation of, you know, the front-end build process.
42:09 So I want to take my source code and compile it to another form of JavaScript,
42:12 compile it to another form of JavaScript, minify it and deliver it as one asset.
42:15 And it takes a lot of that kind of pain away from you.
42:17 But of course, it's going to be limited and it's going to be an abstraction that won't let you do absolutely everything your platform requires.
42:24 And if you hit this limit, there's a handle you can pull like eject.
42:28 And then it will say, well, you're done here.
42:30 I will dump out all like the high complexity stuff for you and say, well, right, you can edit it.
42:37 You know, you can edit a webpack configuration now.
42:39 Oh, goody.
42:40 And like if Anvil had something similar, it would be like, oh, this thing is now a horrendously complicated JavaScript app using this Python JavaScript compiler you have no familiarity with.
42:49 Have fun.
42:50 And that's actually slightly, I mean, it's more user-friendly than like making the user go down with a ship.
42:55 But it's still quite high complexity.
42:59 And what we try to do is instead of an ejector seat, we've got escape hatches.
43:03 So you want to do some specific visual design on your web page.
43:08 Well, that's fine.
43:09 If you want to, you can drop down and edit the HTML and CSS that makes up the template into which these Anvil components are dropped.
43:16 And you can create your own house style and, you know, bring in assets from a professional designer and use that.
43:22 If you have some, you know, you want to build something like WebRTC was a request I got recently.
43:27 You know, we don't support that yet.
43:29 We will one day.
43:29 We don't yet.
43:30 I want to use this advanced feature of the browser platform.
43:33 Well, that's okay.
43:34 I can write some JavaScript.
43:36 Some JavaScript.
43:37 And then I can call it from Python.
43:39 It can call into my Python.
43:40 And then I can package all of that up as one of these custom components.
43:43 Make a library so other people can just say import my code.
43:46 And now you have WebRTC support.
43:47 It's all auto-completed.
43:49 It's all nice.
43:49 It's all in Python.
43:50 You don't have to worry about it.
43:52 And the server-side version of this is the uplink.
43:54 So the uplink, it's a library you can pip install from anywhere in the world.
44:00 And when you enable it for your app, you get an authentication key.
44:03 And you do anvil.server.connect and you give it this authentication key.
44:08 And now your Python code, wherever it's running in the world, is connected to your Anvil app.
44:12 It makes a secure WebSocket connection in.
44:14 It's really quite impressive.
44:16 I think maybe give us the example that you have on your website with the Raspberry Pi.
44:20 Because I think that really highlights how flexible this is.
44:22 So if you've got a Python code, if you've got Python code running somewhere in the world,
44:26 and you Anvil server-connect in, all those things you can do on the server module,
44:29 you can do from your Python code, wherever it is.
44:32 And there's an example tutorial video on our site of me doing this with a Raspberry Pi.
44:38 So I take a Raspberry Pi.
44:39 I write, like, with two lines of code.
44:42 If you've ever used a Raspberry Pi, you can get something called a SenseHat for it,
44:45 which is an LED array.
44:46 And it's, like, really super simple to display some text scrolling across that LED array.
44:51 It's very nice.
44:52 And I write a function that takes a piece of text, displays it on that.
44:57 Because I've got the uplink, all I do is I mark that at Anvil.server.callable,
45:01 just like I would in a server module.
45:02 And all of a sudden, I can call it from my web app.
45:05 Just to be clear, this is a function running on the Raspberry Pi.
45:08 It's being called by your Anvil app.
45:11 Absolutely.
45:12 There's a function running on the Raspberry Pi.
45:13 It's crazy.
45:13 Called from a web browser.
45:16 Why shouldn't you be able to do that, right?
45:17 Yeah, it's beautiful.
45:18 It's one call.
45:19 We don't even use a server module.
45:20 We call it straight from the browser.
45:22 Yeah, that's really incredible.
45:23 And it even goes straight through firewalls and stuff.
45:26 You don't even have to open a port because it's an outbound connection to establish that socket, right?
45:30 And so you can drive code.
45:32 I mean, obviously, the Raspberry Pi is a slightly educational, possibly slightly facetious example.
45:37 But, you know, we've got people driving big, like, machine learning jobs that need to run on some dedicated server somewhere with, like, 20 GPUs in.
45:46 And, like, you know, if they tried to do that inside our server modules, they'd hit their CPU quota pretty quickly.
45:51 And that would be the end of that.
45:52 But because there's a route to plug your code into Android wherever it is, they just import the uplink module, you know, mark some control functions callable.
46:02 And they can drive this big GPU rig from our hosted web stuff just as easily as you could drive this Raspberry Pi on your desk to display something just as easily as you could be driving a server function.
46:15 This is a really cool feature.
46:16 I really like it.
46:17 So maybe this is a good time to talk about, like, what it means to publish your code, where is it hosted, things like that.
46:23 So tell me about where I can put this code.
46:25 When I hit publish on your site, what does that mean?
46:28 It's hosted on our infrastructure.
46:29 We were talking earlier about this hugely deep web stack you need to understand all of.
46:33 And you need to understand all of before you can do, like, even Hello World on the web.
46:38 And we didn't talk about the layers lower on the stack, right?
46:41 Also, if I want to deploy a Hello World on the web, I'm going to need to understand, like, you know, AWS, spin up a server.
46:46 I'm going to have to understand how to administer a Linux computer usually.
46:50 I'm going to have to publish that.
46:52 I'm going to have to keep it up to date with security updates because I don't want to be the next Equifax being popped by, you know, months old known vulnerability.
46:59 And that, too, is a barrier to entry.
47:02 And tools like Heroku can help.
47:04 But what Anvil does is we do the whole package.
47:07 So you write your code in Anvil, and it's hosted on our platform as well.
47:10 So you hit the publish button from the Anvil editor, even if you, you know, just signed up 30 seconds ago.
47:16 You hit the publish button, and you've got a URL that is your app on the web already.
47:21 By default, obviously, it's a private URL.
47:24 It's like one of those Google Apps sharing links.
47:26 So, you know, Google Docs, if I send you this link, you can open it.
47:30 But if you don't have it, you can't get it.
47:32 And this is really powerful because it means that your turnaround time is really low.
47:38 You can get something onto the web very quickly.
47:40 And you're not worrying about all that ongoing maintenance burden of, ooh, have I updated the server this week?
47:45 Yeah, I think that's really cool.
47:47 And where's your infrastructure actually running?
47:48 Is it AWS or somewhere else?
47:50 We run in AWS.
47:51 Okay.
47:51 But, I mean, we also run on-site stuff.
47:53 Go on.
47:53 Sure.
47:54 And you guys have an option to let it, to basically have an on-prem version, right?
47:57 Absolutely, yeah.
47:58 And, of course, that is just, you know, a few Docker containers, one Docker-compose command,
48:02 and you've got a local version of Anvil running on your own machine.
48:05 Yeah, that's cool.
48:06 So our code runs in Docker on some Linux machine in AWS, basically, when we run it, the server code?
48:11 Absolutely, yes.
48:12 Okay.
48:12 It's a little bit more tightly locked down than that, but yes.
48:15 Yeah, sure.
48:15 And do I get to pick the data center?
48:19 Not at the moment.
48:20 You will want one of, there's a business-dedicated hosting plan that says, essentially, we will put the VM wherever you like, and you can have it to yourselves.
48:27 Okay.
48:27 Yeah, that's pretty cool.
48:28 So I think what you guys have built really is quite interesting, and definitely for proof-of-concept apps, for people who don't really consider themselves web developers, but they feel like they can learn enough to solve their problem.
48:41 Like, this is awesome.
48:42 Yeah, I think it's not just for those people.
48:45 I mean, it is for those people.
48:46 It's not just for those people.
48:49 Something that we do observe quite a bit, for example, is people going, oh, well, I'll just use this to throw together like a visual mock-up.
48:56 Oh, wait.
48:56 Well, I can add a little bit of behavior to it.
48:58 Oh, well, I can add a bit more behavior to it.
49:00 Oh, okay.
49:01 Well, I've got this first version of my app.
49:03 I might as well launch it as a prototype, right?
49:04 Oh, well, it's in production.
49:06 It's scaling.
49:07 Okay, then.
49:08 Yeah, exactly.
49:09 So the point is that we should be able to grow with you from that proof-of-concept prototype up to a deployed application, and we have many people who've done that with us.
49:17 It sounds definitely doable looking at what you guys have built there.
49:20 So one thing I do want to sort of touch on with you is what about the escape patches?
49:25 Like, so if I want to use a different editor that's external, if I want to do, like, unit testing, if I decide I actually want to take that code and put it somewhere else, is there a way to, like, move out?
49:37 I've talked to you before about, like, the server hosting environment and some of the really quite critical usability stuff we can do because we're not squeezing everything through this REST API checkpoint.
49:49 A corollary of that is it kind of needs to be hosted on our platform to work because standardized platforms that let you just return a database row from the server to the client and have that give you implicit permissions are kind of thin on the ground.
50:01 So if you want to run an Anvil app on-premises on your own hardware, you are going to need an on-premises license.
50:08 If you do want to migrate out, obviously, you know, we'd be sad to see you go.
50:13 But because of these escape patches I talked about earlier, it's actually a fairly straightforward process, right?
50:18 You could change your server modules into REST endpoints.
50:21 So, I mean, even if you're not moving out, right, you have, for example, a native iOS app that wants to talk to the same backend as the web app you've already created.
50:28 Well, that's fine because although by default we don't go through this REST API layer, you can decorate functions in your server modules to make them REST endpoints.
50:40 And say, this is very Flask-like.
50:42 Oh, well, this function is available at this URL.
50:44 And that lets you expand outside the Anvil hosted web client.
50:50 And equally, you can use different backends from an Anvil hosted client.
50:55 So, yeah, we don't think that you're kind of stuck there.
50:58 But there are tools of our platform that you kind of need the whole thing to use.
51:03 Yeah, that makes sense.
51:04 I do understand.
51:05 Like, you guys are doing a lot of magic to wire this stuff together.
51:08 And without the sort of orchestration behind the scenes, then I can see how that's not so easy to do.
51:15 I have a love-hate relationship with the word magic.
51:17 I mean, obviously, magic is a word that people use when they see, you know, something like Anvil working.
51:22 Oh, my goodness, that's magic.
51:23 And it's the word I used earlier to describe my first experiences with something like QBasic.
51:28 Oh, my goodness, this is magic.
51:29 But there's good magic and bad magic, right?
51:32 There is bad magic as in this is an Angular app and I'm not really sure what it does underneath to make this lever I pull over here connect to that thing over there that just wiggled.
51:41 And then there's kind of good magic which is comprehensible.
51:45 You could see exactly how it worked.
51:48 It just saved you some work.
51:50 Like, for example, the client server calls in Anvil.
51:53 There are an example of what I would argue good magic.
51:56 You can see, you know, it's just a function call.
51:58 You can see how it worked.
52:00 You see how you could implement it with REST endpoints if you wanted to.
52:03 But you're kind of glad you don't have to.
52:05 I mostly meant that in the positive sense, the magic you guys are doing.
52:08 But just that it's hard to replicate outside the environment, right?
52:13 So you have a business model for this that is more or less like a freemium.
52:19 Like there's a basic version.
52:21 But if you want your own domain, then you've got to pay some amount.
52:25 It seems pretty reasonable to me.
52:27 But one of the things that came up is like, what if I'm working on an open source project and I'd like to have like some kind of open web app hosted with you guys that a bunch of people can come and contribute to?
52:37 Like, what would that look like?
52:39 Or is that possible?
52:39 It totally would.
52:40 I mean, even if you have an open source web app, you know, somebody's usually paying for hosting somewhere.
52:45 But the good news about, the good thing about Anvil is that all of your apps are in fact Git repositories.
52:52 So it is totally a thing you can do to pull your apps Git repository out of Anvil.
52:58 You could stick it on GitHub.
52:58 You could collaborate.
53:00 If you asked earlier about, oh, I want to use my own editor.
53:03 Oh, I'm an Emacs fiend.
53:04 I absolutely must edit this module in Emacs.
53:05 That's fine.
53:06 Get checkout.
53:07 Get pulled.
53:07 Have fun.
53:08 Get pushed when you're done.
53:10 But also that means that you're open to collaboration tools like GitHub.
53:14 So you could totally run an open source app that's based on Anvil.
53:17 You could have multiple instances that people pay to host or host on our free version.
53:23 Yeah, that sounds good.
53:24 The Git integration is pretty nice.
53:26 And I guess you can create multiple upstreams in Git and make one of those be your GitHub repo, right?
53:32 That's something that we do all the time.
53:35 I mean, you can even do like a continuous integration, continuous deployment, because everything you can do in the Anvil editor is reflected in this Git repository, obviously.
53:44 So you could do things like, oh, well, this is my staging deployment and it's got access to some staging data.
53:51 And then I pull that Git commit and I push it up to somewhere else.
53:55 And that's my deployed app.
53:57 Indeed, we actually have a miniature version of this within Anvil itself.
54:00 So you can choose a version of your app.
54:02 If you go into view history, you can see like the full Git history of your app.
54:05 And you can select a version that's the published version.
54:10 And so if somebody comes to your shared URL externally, that's what they get.
54:15 And so you can carry on hacking and you've got this dev versus production thing already kind of built in.
54:20 But the thing about Git is that, of course, you can extend that.
54:22 I think that's really nice.
54:23 And so basically of this UI that says, here's your Git history.
54:26 That means like you went and pressed save, like save a state here.
54:29 But you can actually mark like this one right here right now is production and continue working on it and then push production on down the line once you have it sort of tested.
54:38 Also kind of in production.
54:39 And I think that's pretty powerful.
54:40 Yeah.
54:41 And actually, if you use that Git interface, you'll discover that's just a branching Git.
54:45 And this is kind of what I mean about good magic versus bad magic.
54:48 That's kind of magical.
54:49 But how we do it is very much open and you can play with it, too, if you want to do something more advanced.
54:55 But yeah, the normal user experience is like one click.
54:57 Okay, that's production now.
54:58 Done.
54:58 All right.
54:59 So we don't have much time left.
55:00 This is so much cool stuff to talk about.
55:02 I guess one last question is like you have your data tables as a service there.
55:07 How do I back up my data?
55:08 So if you're using the data tables within Anvil, the first thing to say is we do take regular and properly encrypted and stored backups of those.
55:18 So you should not have to worry about the data loss.
55:21 But if you want to copy on your own system, then there's a ton of ways to get it out.
55:25 I mean, every data table in the editor, there's like a download a CSV button, which is the very straightforward way of getting this stuff out.
55:33 But earlier we talked about the uplink.
55:35 And, of course, from the uplink, you can do anything you could do in those server modules.
55:40 It's not just a matter of saying, oh, well, here's a function that displays some text on my Raspberry Pi and it's callable from the web.
55:46 That script can also reach in and say, oh, I would like to iterate over all the rows in this table.
55:52 And that's totally legit from an uplink.
55:54 Sync that with some local DB, something like that.
55:57 Yes.
55:57 So if you had your own representation of data you wanted to synchronize with or import, export, that is really straightforward to do.
56:05 And again, if what you actually want is something in Amazon Redshift, if that's where you want to sync your data to and that's where you want all your data to live,
56:13 you could just access it there from Anvil as well because we've got all those Python modules ready for you to use.
56:20 There's nothing forcing you to use the data table service.
56:22 It's just something that makes your life more convenient in a lot of cases.
56:25 Right.
56:26 Knowing the Docker containers are running AWS, you can basically crack out and get to most of the other AWS stuff, right?
56:32 That would be accessible.
56:33 That would be possible even if we weren't running in AWS, right?
56:36 Right.
56:36 Lower latency inside AWS.
56:38 Yeah.
56:38 Does run quite well.
56:39 Nice.
56:39 All right.
56:40 Well, I think, you know, there's a bunch of other stuff we could dig into.
56:42 I think we should probably leave it here just for time's sake.
56:45 So let me ask you the two questions.
56:47 We talked a lot about editors, actually.
56:49 So let's start with your favorite editor.
56:52 Favorite because it's my baby and also I spend a lot of time in it is, of course, the Anvil editor.
56:57 It's got a full autocomplete.
57:00 It can do full stack development and it's plugged into full version control on the backend.
57:04 So I spend a lot of my time obviously working in that.
57:06 For building the Anvil backend itself, I actually use IntelliJ and I really love the JetBrains tools.
57:13 IntelliJ, PyCharm are fantastic.
57:15 Again, the autocompletion is top notch.
57:18 Cool.
57:19 All right.
57:19 That sounds awesome.
57:20 Yeah.
57:20 The editor you built is really, really nice.
57:22 I definitely like it.
57:23 Yeah.
57:23 Check out our PyCon UK lightning talk.
57:25 Yeah.
57:25 You send me the link.
57:26 I'll put it in the show notes.
57:27 And notable PyPI package.
57:29 The selfish answer here is the Anvil uplink because it is on PyPI and it is remarkably cool
57:35 in its ability to plug your own code into the cloud.
57:37 If I weren't counting that, then it's got to be Pandas.
57:40 The things you can do in like three lines of code that I recall using janky libraries to
57:47 pull that data out of Excel files and process it or worse using R.
57:51 Yeah.
57:52 Incredible.
57:52 So yeah, Pandas wins.
57:53 Cool.
57:54 Yeah, that's definitely a big one.
57:55 All right.
57:56 Final call to action.
57:57 People want to check out Anvil.
57:59 What do they do?
58:00 Oh, they go to anvil.works and they sign up for a free account.
58:04 We've got tons of walkthrough videos and tutorials.
58:07 There's a user forum that's really quite active and friendly.
58:10 And you can sign up for an account for free and start building.
58:13 And I would really encourage you to do so.
58:15 And I would look forward to seeing you there.
58:16 Awesome.
58:17 Well, congrats on building this.
58:18 It's definitely pushing Python in a direction that I haven't really seen it pushed successfully
58:24 in quite a while.
58:26 So it's awesome.
58:27 Nice work.
58:27 Thank you very much.
58:28 It's been great talking to you.
58:30 This has been another episode of Talk Python to Me.
58:33 Today's guest was Meredith Loof.
58:36 And this episode has been brought to you by Datadog and ThoughtWorks.
58:39 Datadog gives you visibility into the whole system running your code.
58:43 Visit talkpython.fm/datadog and see what you've been missing.
58:47 Don't even throw in a free t-shirt for doing the tutorial.
58:50 GoCD is the on-premise, open-source, continuous delivery server.
58:54 Want to improve your deployment workflow but keep your code and builds in-house?
58:58 Check out GoCD at talkpython.fm/gocd and take control over your process.
59:05 Are you or a colleague trying to learn Python?
59:08 Have you tried books and videos that just left you bored by covering topics point by point?
59:12 Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm/course
59:18 to experience a more engaging way to learn Python.
59:21 And if you're looking for something a little more advanced, try my Write Pythonic Code course at talkpython.fm/pythonic.
59:28 Be sure to subscribe to the show.
59:31 Open your favorite podcatcher and search for Python.
59:33 We should be right at the top.
59:34 You can also find the iTunes feed at /itunes, Google Play feed at /play,
59:40 and direct RSS feed at /rss.
59:42 on talkpython.fm.
59:44 This is your host, Michael Kennedy.
59:45 Thanks so much for listening.
59:47 I really appreciate it.
59:48 Now get out there and write some Python code.
59:50 I'll see you next time.
59:50 Bye.
59:51 Bye.
59:51 Bye.
59:51 Bye.
59:51 Bye.
59:52 Bye.
59:52 Bye.
59:52 Bye.
59:52 Bye.
59:52 Bye.
59:52 Bye.
59:53 Bye.
59:53 Bye.
59:53 Bye.
59:53 Bye.
59:53 Bye.
59:53 Bye.
59:53 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:54 Bye.
59:55 Bye.
59:55 Bye.
59:55 Bye.
59:55 Bye.
59:55 Bye.
59:56 Bye.
59:56 Bye.
59:56 Bye.
59:57 Bye.
59:58 Bye.
59:59 Bye.
59:59 Bye.
01:00:00 Bye.
01:00:01 Bye.
01:00:02 Bye.
01:00:03 Bye.
01:00:04 Bye.
01:00:04 Bye.
01:00:05 Bye.
01:00:06 Bye.
01:00:07 you you you Thank you.
01:00:09 Thank you.