Latest / Talk Python To Me / #342: Python in Architecture (as in actual buildings)
Transcript
- 0:00At PyCon 2017, Jake VanderPlas gave a great keynote where he said Python is a mosaic.
- 0:05He described how Python is stronger and growing because it's being adopted and used by people
- 0:10with diverse technical backgrounds.
- 0:12In this episode, we're adding to that mosaic by diving into how Python is being used in
- 0:18the architecture, engineering, and construction industry.
- 0:20Our guest, Gui Talrico, has worked as an architect who helped automate that world by bringing
- 0:25Python to solve problems where others were just using point-and-click tooling.
- 0:30I think you'll enjoy this look into that world.
- 0:32We also touch on his project, PyAirtable, near the end as well.
- 0:35This is Talk Python To Me, episode 342, recorded November 7th, 2021.
- 0:42Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:59This is your host, Michael Kennedy.
- 1:00Follow me on Twitter, where I'm @mkennedy, and keep up with the show and listen to past
- 1:04episodes at talkpython.fm.
- 1:06And follow the show on Twitter via at Talk Python.
- 1:09We've started streaming most of our episodes live on YouTube.
- 1:13Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming
- 1:19shows and be part of that episode.
- 1:21This episode is brought to you by Shortcut and Linode, and the transcripts are sponsored
- 1:26by Assembly AI.
- 1:28Dee, welcome to Talk Python.
- 1:31Thanks.
- 1:31Happy to be here.
- 1:32Yeah, it's fantastic to have you here.
- 1:34I'm really excited to talk about buildings and architecture and that kind of stuff just
- 1:40permeates our lives, right?
- 1:41That's, you walk around, you go to cities, you marvel at the large buildings, go to someone's
- 1:46house, and it's this beautiful place.
- 1:48Really nice to see.
- 1:49All that starts with good architecture and design, right?
- 1:52Yeah, that's right.
- 1:53Where we live, where we work, pretty much most of our lives we spend inside some sort of structure.
- 2:01Exactly.
- 2:01Exactly.
- 2:02Cool.
- 2:02Well, we're going to talk about that.
- 2:03Before we get into that, though, let's just start with your story.
- 2:06How'd you get into programming in Python?
- 2:07Yeah, it was a bit of a long journey to Python.
- 2:09I think my first experience with programming was actually with Lego Mindstorm.
- 2:15I don't know if you're familiar with it.
- 2:16Yeah.
- 2:16A little robot thing, right?
- 2:18Yeah.
- 2:18You can program those with Python, can't you?
- 2:20Yeah.
- 2:20I don't know what it looks like these days.
- 2:22I guess when I got it, I was maybe, yeah, in my early teenage years or something.
- 2:26And at the time, they had something that was similar to MIT's Scratch kind of block, plug and play.
- 2:32So I did a little bit of that.
- 2:33And then later, I tried to learn Visual Basic 6, I think also in my early teenage years.
- 2:40And that was fun.
- 2:42I built a couple little personal projects.
- 2:44I feel like we still don't have something to take the place of Visual Basic 6.
- 2:49Yeah.
- 2:49Yeah.
- 2:50Do you think so?
- 2:51I mean, I look around at all the different UI platforms, whether that's the stuff we have
- 2:56in Python or whether that's Swift or whether that's .NET with WPF or whatever else you want
- 3:03to talk about.
- 3:04Nothing is as easy as, I want these buttons here in a text box and a list and I double click
- 3:09it and I write three lines of code and that happens, right?
- 3:12Yeah.
- 3:12The environment has changed, right?
- 3:14Because before they were just desktop apps, right?
- 3:16You would build it and that's it.
- 3:18And now you have to think about, even if.
- 3:21React has made it as easy to build front end app, you still have to deal with something
- 3:25else for styling and then you have to figure out how you're going to serve the data or are
- 3:29going to deploy it to you.
- 3:30Yeah.
- 3:31I think you're right.
- 3:32I mean, I'm not saying VV6 is the pinnacle of what we could design, right?
- 3:36It's not going to win massive design awards, but wow.
- 3:39Could people get stuff done quickly with that framework?
- 3:42Yeah.
- 3:42So you did a little bit there, huh?
- 3:44Yeah.
- 3:44I never got too deep, but it was an extension of a robotics course that I was taking.
- 3:47So we were building these little UIs and then clicking around and having the robot move or
- 3:52something.
- 3:53So it was very basic UI.
- 3:55But what was interesting is at the time I grew up in Brazil and at the time it was still there
- 4:00and I wanted to get really deep, but there was this, there was a bit of a language barrier,
- 4:03I think.
- 4:04This was also, you know, pre-Google.
- 4:05So trying to learn how to program while also not knowing how to speak English, I actually
- 4:11feel like it slowed me down a bit.
- 4:13Yeah.
- 4:14I can imagine.
- 4:15I've always had a lot of both respect and I guess a little bit of sympathy for people
- 4:20who are non-native English speakers, especially people who didn't particularly speak English
- 4:26super well, but then had to program with for loops and while loops and true and false and
- 4:32ints.
- 4:33And it's just like, if, you know, maybe if you're with a language that's not that different,
- 4:38it's not that hard, but you know, if you're like Chinese or even Portuguese, it's, you know,
- 4:43why do you have to program all these foreign words?
- 4:45It just seems crazy to me that that's how it has been, right?
- 4:49Yeah.
- 4:49And also the resources even today with post-Google era or during the Google era, you can, if you
- 4:56search for some sort of engineer problem in English or in Portuguese, I can guarantee you're
- 5:01going to get a much bigger pool of answers and resources in English.
- 5:05So yeah.
- 5:06Yeah.
- 5:06Yeah.
- 5:07That was a little bit of a barrier.
- 5:08In fact, what actually happened is I never really progressed and I just went on to other
- 5:12things.
- 5:12All right.
- 5:13Maybe this program and things not for me.
- 5:14Yeah.
- 5:15I don't know.
- 5:16I guess, yeah, I just kind of didn't really get it.
- 5:18Never really clicked.
- 5:19And then I moved on to other things and ended up pursuing a degree in architecture to talk
- 5:25a little bit about it, but it was a little bit of kind of a gap.
- 5:28And then I think it was just during my college years, I tried getting into a little bit of
- 5:33web development, played around with action script, flash, or I think that's what it's called.
- 5:38Right.
- 5:38It was like JavaScript, like inside flash.
- 5:41And then within architecture, I got a little bit into like visual programming, which
- 5:46it's, I guess, a more sophisticated version of, you know, scratch, but similar to what
- 5:503ds Max uses to compose material.
- 5:52You know, this idea that you can kind of connect flows into each other visually.
- 5:57And that's used pretty extensively in architecture still.
- 6:00And that was kind of like my gateway back into programming in some ways.
- 6:04And then a couple of years later, I actually practiced architecture for, I think about five
- 6:08or six years.
- 6:10And at the time I was trying to figure out how I could change careers.
- 6:13And I was just, I had this kind of itch.
- 6:16I just really wanted to write code and I couldn't figure out how to kind of break it.
- 6:19And I ended up doing this process of changing careers.
- 6:22I actually took a year off and spent every kind of brief minute I had trying to learn how
- 6:28to code.
- 6:28Was that on your own or did you go to university?
- 6:31Yeah, it was just on my own.
- 6:32Yeah.
- 6:33Literally like Google, what language should I learn first?
- 6:36And this was like 2014, I think 15.
- 6:40And I actually picked Ruby first.
- 6:42This was Ruby on Rails.
- 6:44Yeah.
- 6:44Golden years, I guess.
- 6:45And I started with Ruby and after a couple of weeks, I just didn't enjoy it that much.
- 6:51I was getting confused with some of the basic kind of built-in blocks and I decided to try
- 6:56Python and it was just kind of smooth sailing.
- 6:59I mean, I guess as smooth as it can be learning by yourself.
- 7:02Yeah, yeah, sure.
- 7:03But, you know, I felt like even the basic grammar, it was just kind of stick.
- 7:07I didn't have to keep going back and say, oh, how do you do a for loop again?
- 7:11I found it was always a bit stickier with me, not having to think about where semicolons
- 7:16would go, you know.
- 7:17Yeah.
- 7:18It was just easier and smoother and more enjoyable for me in general.
- 7:21For sure.
- 7:22Well, I gave VB a lot of positive praise a little bit ago.
- 7:27I think also that language is a really interesting example of how to try to be like,
- 7:33Python, but not do it well.
- 7:34So, with JavaScript or C# or a lot of these languages, you have all these symbols
- 7:40on the screen, especially the static languages.
- 7:42C#, Java, C++, right?
- 7:44Semicolons, angle brackets, you know, parentheses, all sorts of stuff all over the place.
- 7:49And then there's languages like Python that say, you know, you don't need that.
- 7:52You don't need all these symbols.
- 7:53Let's just go and write it.
- 7:55And, you know, VB is like that, right?
- 7:56There's no semicolons.
- 7:57There's not that many symbols.
- 7:58But it's like everything is begin for, end for.
- 8:03Like, it's just, it's the worst possible.
- 8:05It's like they still need the closing curly braces and stuff like that, but they don't want to
- 8:09put a curly brace.
- 8:10So, they make you type like a huge long word, which is crazy.
- 8:13And somehow Python struck that like smooth balance of not having all that stuff, but not giving
- 8:19up too much as well.
- 8:20Yeah, and also the boilerplate that's required.
- 8:23I think I had tried doing some C# as well.
- 8:26And when you open up the simplest example you can find, and it's class, void, public.
- 8:32And you're like, wait, what is public?
- 8:34You haven't gone to understand classes or access and things like that.
- 8:40And it's really overwhelming.
- 8:41And in Python, it's like, even the class takes a little bit when you're learning, but you can
- 8:46just, here's a function that's inside of this object.
- 8:49And it's much easier to understand, I think, as a beginner.
- 8:52It's kind of ramp up.
- 8:53I think it's a big testament that you can be really effective with Python with a super, like
- 8:59a very partial understanding of what Python is or how it works, right?
- 9:02You can not even be aware that half of the stuff exists and you can still get along just
- 9:06fine.
- 9:06So, that's pretty awesome.
- 9:08So, let's dive into the main topic, buildings, architecture.
- 9:12So, I've seen some of the presentations you've given, and it sounds to me like this is an industry
- 9:18that's ripe for more programming, automation, empowerment.
- 9:23You know, I always say that programming is a superpower for people who are not programmers,
- 9:28right?
- 9:28If you're an architect versus an architect who programs, the programming architect can do way
- 9:33more, right?
- 9:34And it sounds to me like this area is kind of open for more of that.
- 9:38Yeah, absolutely.
- 9:39Give us the background.
- 9:40So, it starts with pictures and drawings and blueprints type things, right?
- 9:44Yeah, yeah, exactly.
- 9:45So, I mean, I guess I should just preface this with the fact that I've been outside the industry
- 9:49for about four years now.
- 9:52I'm just doing more traditional software development.
- 9:55So, I may be a little bit out of the loop on some changes, but in general, the time I spend
- 10:00in the industry, what you would see is that it's still a pretty kind of analog industry.
- 10:05And there are parts that are improving.
- 10:07There are parts that are very advanced.
- 10:08I mean, we do still manage to build incredible buildings.
- 10:12But there's this weird kind of tension where people are coming up with these design concepts
- 10:16and figuring out what the building is going to look like, what spaces you're going to need.
- 10:20And then kind of at the other end, you have people standing on their literally cutting material
- 10:27and assembling things.
- 10:29And then there's this big kind of gap in the middle of how you go from one thing to another.
- 10:33And that's kind of the meat of architecture.
- 10:36So, my experience was primarily medium and large buildings.
- 10:40And it's actually just very labor-intensive labor as far as software, not the hands-on labor
- 10:47for architects.
- 10:48But there's just a lot of work that goes into designing a big building.
- 10:52So, if you have a, I don't know, one of the office buildings I worked on, 150,000 square
- 10:58feet, six-story or something.
- 10:59And someone had come up with a design, okay, it's going to look like this.
- 11:04And it was very conceptual design, kind of massive.
- 11:06And then you have to turn into a real project with faucets that work and lights and sprinklers.
- 11:13Exactly.
- 11:14When you think, well, let me rephrase that.
- 11:16When I think of architecture, I think of the overall feel of it, right?
- 11:21Is it flowing?
- 11:22Does it have sharp edges?
- 11:24Does it feel modern, right?
- 11:26And so on.
- 11:27I have a picture here on the screen for us to look at that's this, you know, sort of
- 11:32wood structure.
- 11:32It's light and airy.
- 11:34And sure, that's architecture.
- 11:36But it sounds like, and so are the support beams.
- 11:39So is the plumbing.
- 11:40So is the light switch and where they go.
- 11:44And just way more detail than just the general skeleton or structure.
- 11:49Yeah, and like which part of the plywood is going to go in which direction, like on your
- 11:54kitchen counter or something, like that level of detail.
- 11:57But what you're showing here, it's kind of what you see in school and what you get really
- 12:01excited about in school.
- 12:02And then when you start working, you realize that there's only a few people that get to
- 12:06do this type of work.
- 12:07And the majority of the people are just kind of doing coordination and working on lots of
- 12:13drawings and coordination between different trades.
- 12:16But, you know, of course that does happen, but big chunk of the work is just figuring
- 12:20out how to coordinate and assemble drawings.
- 12:22So if you imagine a lot of this work is done on kind of traditional desktop applications.
- 12:28So if you're familiar with Autodesk, the biggest ones in the US are AutoCAD, Revit.
- 12:34Those are more, Revit is very like architecture kind of building focused.
- 12:38AutoCAD is more kind of generic, I know, drawing and drafting.
- 12:42And then you have other players like MacNeil, they do kind of 3D modeling and it's used all
- 12:48the way from small jewelry design and boats all the way to buildings, but more at the conceptual
- 12:53stage and Revit is kind of the big dog as far as like building documentation.
- 12:58And there's this interesting process because at the same time you are coming up with the
- 13:01building at large scale, right?
- 13:03Like what do you see there?
- 13:04That's kind of mass in.
- 13:05You have to zoom in all the way to what is it going to look like?
- 13:09Like cove in a bathroom, for example, and you might have to.
- 13:12Cut a section through that in detail.
- 13:14And there's this weird process we are still in where buildings are designed half in 3D
- 13:19and half in 2D.
- 13:19So you do some 3D and then you get sort of these views, but then you might zoom in and
- 13:25actually.
- 13:26Then you do a projection.
- 13:27You're like, oh, we need to see just this wall.
- 13:29Yeah.
- 13:29Yes.
- 13:30Or just the floor.
- 13:31How it's going to look.
- 13:32You can assemble the sketch work needs a drawing of like, what does it look like if I cut
- 13:35through here?
- 13:35And you literally draw in 2D and you have to assemble these big drawing sets that are references
- 13:40that show the 3D and say, okay, if you were to cut through this, here's what you would see.
- 13:44And oftentimes they're not even like the same model.
- 13:47You're just trying to make this thing look coordinated.
- 13:50How often does it go wrong?
- 13:52Oh, pretty often.
- 13:53Yeah.
- 13:53Pretty often.
- 13:54So one of the things that's done, usually there's a tool called Navisworks is one of the ones
- 13:58that's used that's for clash detection.
- 14:00So, cause not only have the architects, but you also have these trades coming together, right?
- 14:05So you have separate models for the architecture, like walls and floors and things like that.
- 14:11And then you have the structural engineer as a separate model with all the steel or concrete
- 14:17structure.
- 14:17And maybe the MEP, mechanical, electrical employment folks have a separate model and then they all
- 14:24get linked.
- 14:25And in the end you may have like a duck going through a life fixture or things kind of through
- 14:30all.
- 14:31And you actually have to do clash detections and trying to figure out places where the model
- 14:35may not have a kind of a valid condition.
- 14:37Yeah.
- 14:37I can imagine.
- 14:38So this Revit app is largely a .NET C# desktop application.
- 14:45Is that right?
- 14:45Yeah, correct.
- 14:46Yeah.
- 14:47And so if you want a programmer to work with it, what do you do?
- 14:50Do you do that in C#?
- 14:51Yeah.
- 14:52So Revit's been around for a while and I'm not sure when it started.
- 14:56I don't think it was from the very beginning, but at some point they released an API and without
- 15:01this API, you can do everything through the UI, right?
- 15:04So you can click around and you can basically achieve everything you need to.
- 15:08And through the API, you can sort of automate everything that's visible and sometimes a
- 15:13little bit more.
- 15:14But the idea is that, for example, one of the first tasks I automated in Revit was I was working
- 15:20in a really large office buildings and each room would get tagged with like the name of
- 15:24the room.
- 15:25Right.
- 15:25And I would have to literally drag the stag on.
- 15:27Right.
- 15:27And then sometimes as the building moved, things would get kind of out of place and you
- 15:31wanted the tags to be kind of centered nicely and you would literally have to go around and
- 15:35move around these tags.
- 15:36And one of the first.
- 15:37For hundreds of rooms, right?
- 15:39That sounds like not a fun, good use of your time.
- 15:42Oh, no, definitely not at all.
- 15:43Yeah.
- 15:44And yeah, one of the first automations I built was this tool that would just go
- 15:48automatically room by room and make sure the tag was in the center.
- 15:51So I'm just going to figure out the delta between the center of the room and where the tag was and
- 15:55like slide it.
- 15:56Yeah.
- 15:56And I actually had at the company that I worked at a time, I had a system that would measure the
- 16:01use of tools and that tool would just get used like hundreds of times a day.
- 16:05So imagine every time someone clicked that button, the amount of time you would see these architects
- 16:10like going around and moving these packs to get them center and just little things like that.
- 16:15Very kind of monotonous, boring, not very impressive automations, but actually a lot of time in the day
- 16:21to day.
- 16:22Yeah.
- 16:22But you can easily apply code to those and really make people's lives better.
- 16:27And it sounds like hundreds of people's lives better by, you know, not making them fiddle with
- 16:32stupid labels all the time.
- 16:33Oh yeah.
- 16:33Push a button.
- 16:34Right.
- 16:35So while these can be programmed in C#, there's a Python angle, right?
- 16:40Yeah.
- 16:40There's a couple of different ways that Python comes in.
- 16:42I think Revit itself does support some sort of Python automation, but it's again, it's a bit
- 16:48bulky, difficult to use, difficult to debug.
- 16:50So one of the main ways that it's used these days, there's this project and I've actually
- 16:55become really good friends with the maintainer, but there's this project called PyRevit.
- 16:59And the idea is that when you write Python, you get used to things being sort of Pythonic or more
- 17:05elegant and it's easy to do, right?
- 17:08So what he was trying to do is how can we have this kind of experience building automations within
- 17:13Revit?
- 17:14So instead of having to compile my C# add in, how can I kind of just pop up the script, click
- 17:21a button and have it run my Python code.
- 17:24And that's essentially, you know, what he built.
- 17:26So initially it was using only Iron Python because that's the way it integrates within the Revit
- 17:32environment.
- 17:32Since it's .NET, you would essentially use an Iron Python.
- 17:36You could interact directly with Revit through the common language runtime.
- 17:39Right.
- 17:39So tell us a bit about Iron Python.
- 17:41I suspect many people do know about it.
- 17:43This came originally out of a project at Microsoft.
- 17:48I think, was this Dino Veland?
- 17:50I can't remember.
- 17:51Yeah, that's what I've heard.
- 17:52I've interacted with the maintainers a couple of times over the last few years.
- 17:55And the impression I've had is that there was one or two people kind of trying to get this
- 18:00going, but it's not very active.
- 18:02And I think the three release wasn't too late.
- 18:06So it shows there it's still in alpha actually.
- 18:08At the time when I was using it, it was still in 2.7.
- 18:11It's been stuck there for a long time.
- 18:12At least it's making progress.
- 18:14I mean, here's a release in 2021 on it.
- 18:16So that's good.
- 18:17Yeah.
- 18:17One of the things I'm not too familiar with it, but I remember hearing from the PyRevit
- 18:21maintainer that they actually ended up using this other project called Python.net.
- 18:26Yes.
- 18:27And Iron Python is essentially a Python interpreter that was written in C#.
- 18:33And Python.net does something kind of different.
- 18:35It actually allows you to use CPython, but interact with the .NET side.
- 18:40And I don't quite remember how he worked, but I know he got it to work and he was able
- 18:43to get CPython applications running inside of Revit as well.
- 18:46Right.
- 18:47So Iron Python is a Python interpreter, but instead of having the interpreter implemented
- 18:54in C the way that the one that we're all mostly familiar with is, it's implemented on top of .NET.
- 19:00And yeah, that was Dino Vila in that double check.
- 19:03So nice job on that, Dino.
- 19:05And it's implemented on top of the .NET CLR runtime and it's kind of its own little thing in this thing called the dynamic language runtime,
- 19:11which means integration with .NET is super easy because it's already running in .NET.
- 19:18It's equivalent to saying integration with C is easy on CPython because it's already effectively running in C, right?
- 19:23And I guess that's probably a pretty natural way to go because if you're trying to integrate with a C# .NET library,
- 19:30you got to somehow get that thing in and do something with it, right?
- 19:34Right.
- 19:34So I could see why they would go with Iron Python first.
- 19:37But yeah, I've sort of heard that Python.NET is, it seems a little bit more CPython friendly, I guess.
- 19:44Yeah, I think one of the issues with the Iron Python project is that it's kind of impossible to maintain.
- 19:50Like how do you keep up with all the changes and releases of CPython and like rebuild them from scratch in C#?
- 19:58I would imagine it would take a huge amount of time and resources to keep that project like going in the same pace.
- 20:04Yeah. So here looking at Python.NET, we've got, it supports 27, but also 35, 36, 37, and 38, which is not 39 and 310.
- 20:12Yeah.
- 20:12But it sure is better than alpha support for 3.4.
- 20:15Yeah. Do you know how it actually, like what it actually does? How does it get to?
- 20:19I have no, I have not learned enough about Python.NET to know how it works, but it's, yeah, it looks pretty neat though, doesn't it?
- 20:27Yeah. But I think it's just, it's, you're able to operate in CPython, but kind of import common-legged
- 20:33during time and talk to your .NET DLLs in the same way you would from Iron Python. So it's pretty interesting.
- 20:40Yeah. You get very foreign looking code. Import CLR from system.winds.forms, import form,
- 20:46which is something you would expect to see in a .NET project, not in a Python project.
- 20:50Yeah. But there's actually, that's one interesting thing that I've seen happen quite a bit because
- 20:55people within this industry ended up using Iron Python quite a bit. I know there's a few projects
- 21:01out there for building UIs in Python, but I've actually seen quite a few projects with like desktop UIs
- 21:08basically built using, you know, .NET because it has...
- 21:12Oh, interesting.
- 21:12What is it? Windforms? I forgot what the other one was.
- 21:15Yeah. Windforms is the one that's like the modern-ish VB. I say modern-ish because I think they kind of
- 21:21stopped advancing that in something like 2008, I think is when they stopped advancing it. So it's
- 21:28not like super modern, but it's way more modern than VB6 was. So yeah, there's that and there's WPF.
- 21:34And then some weird variants.
- 21:34Oh yeah. WPF is the more current one, right?
- 21:37Yeah. Also way harder to use, but yeah, more modern one.
- 21:41This portion of Talk Python To Me is brought to you by Shortcut, formerly known as clubhouse.io.
- 21:49Happy with your project management tool? Most tools are either too simple for a growing
- 21:53engineering team to manage everything or way too complex for anyone to want to use them without
- 21:58constant prodding. Shortcut is different though, because it's worse. Wait, no, I mean, it's better.
- 22:03Shortcut is project management built specifically for software teams.
- 22:07It's fast, intuitive, flexible, powerful, and many other nice positive adjectives.
- 22:12Key features include team-based workflows. Individual teams can use default workflows or
- 22:17customize them to match the way they work. Org-wide goals and roadmaps. The work in these workflows
- 22:23is automatically tied into larger company goals. It takes one click to move from a roadmap to a team's
- 22:29work to individual updates and back. Type version control integration. Whether you use GitHub,
- 22:34GitLab, or Bitbucket, clubhouse ties directly into them so you can update progress from the command line.
- 22:40Keyboard-friendly interface. The rest of Shortcut is just as friendly as their power bar, allowing you to
- 22:46do virtually anything without touching your mouse. Throw that thing in the trash.
- 22:50Iteration planning. Set weekly priorities and let Shortcut run the schedule for you with accompanying
- 22:56burndown charts and other reporting. Give it a try over at talkpython.fm/shortcut. Again, that's talkpython.fm/shortcut.
- 23:02Choose Shortcut because you shouldn't have to project manage your project management.
- 23:10So what you're saying is you've seen some people write Python code that then will do stuff like this
- 23:17to put that kind of UI on the screen, right? Right.
- 23:21Yeah. And even PyRevit itself had quite a few kind of UI components and they were all just using standard
- 23:26.NET stuff, but writing in Python. And what's interesting too is in addition to PyRevit, there's
- 23:33a few other projects. And one of them I had worked on that's called, it was called Revit Python Wrapper.
- 23:38And there's another one called Revitron, which all have kind of similar idea, which is like,
- 23:44I want to have the Python experience, but, you know, using this other kind of stack. So the idea
- 23:50for Revit Python Wrapper is that the Revit API, it's this very bulky C# API. Yeah.
- 23:57It's enormous. There's...
- 23:58You can make it do its thing in Python, but you work with the type names and the function
- 24:04names and stuff straight out of the .NET world, right? Which is clearly not Pythonic. They're
- 24:09very different in the way of doing things. Yeah. So your code doesn't look or feel like Python. And
- 24:13then the interfaces and kind of the APIs for the libraries are weird. So like, if I want to just
- 24:18query, you know, this model for a wall, I would have to like build this object and this kind of like
- 24:23builder pattern. And, you know, it's, it's very strange. Like it doesn't feel like Python. So when I
- 24:29started writing that, I would build these little functions that would take the C# code and
- 24:34give me like a Python-like column that I could make. And that's what this project came out from,
- 24:39was this idea that I wanted to wrap everything that didn't feel Pythonic to make it like feel like I
- 24:44was using it. So you wrote your own, like your PyRevit wrapper a little bit that would then make it
- 24:50easier, right? And make it feel more natural. And then eventually you just decided... Yeah. So at the
- 24:55time I was writing, I was writing Python code and the PyRevit, it was sort of, it was kind of the
- 25:00environment. So the idea for PyRevit is you would, you could literally just save this .NET
- 25:04file in a folder and put a PNG icon and it would sort of load it up that file and add it to the
- 25:10Revit ribbon. So someone could click on it. And when he clicked, it would load your source code and feed
- 25:15it into the Python engine. So it would just help you kind of establish this environment and you didn't
- 25:21have to compile and add in, restart Revit. And then Revit Python wrapper was that every script that I had,
- 25:28I would just import Revit Python wrapper and then just say collector type equals wall and it would
- 25:34query for every wall of the model. And I stopped working on this project for a while. Then I recently
- 25:39ran into this Revitron, which is a much more kind of sophisticated version, but essentially the same
- 25:44idea. People wanted to write a very clean Python, but operate kind of on top of the Revit API without
- 25:51having to deal with the non kind of Python look and feel. Interesting. Okay. Yeah. And even has its own
- 25:57CLI. Oh yeah. Yeah. I guess it integrates with the PyRevit CLI, right? Yeah. So one of the things that's
- 26:04interesting about this high Revit, which if I go further enough back, I'll find it, is that you can use
- 26:11Python to build these little toolbar buttons or widgets, right? Yeah. And the way you do it is,
- 26:17as you sort of described, there's this super convention of all of these directory, this directory
- 26:23structure, right? Like if you put this file there and then the Python file in like some location that can,
- 26:29it'll trigger the discovery that'll then create like a, some kind of icon and action in there, right? Maybe
- 26:36tell us about that a bit. Yeah. And under the hood, if you were to write this in C#, there would be a
- 26:40whole bunch of boilerplate that you would have to add for how those buttons get instantiated and loaded
- 26:45into the UI. And one thing that I've sort of witnessed, like seeing PyRevit project grow, I was one of the
- 26:52kind of early users, adopters. And it was this huge barrier for people who wanted to automate Revit because
- 26:59you had to learn C# and the add-ins were difficult to build. And it was just this big time.
- 27:07You probably had to learn interfaces and how to implement them and all that kind of stuff.
- 27:11Yeah. And like you had to, you had to go around like the little, you know, the compile settings and
- 27:16think around with it to get it to work. And you had to compile for different versions of Revit. And it was
- 27:20really difficult, at least for me, maybe it's easier for some people, but with PyRevit, you could literally just
- 27:26duplicate this folder and open a new Python file, start messing with it. And every time you click,
- 27:31it would rerun. You wouldn't even have to reload anything because you would just read the source
- 27:35code and feed it to the RnPython interpreter. So for the first time, I felt like I had this ability to
- 27:40iterate quickly and explore and test things out. So it was a totally different experience.
- 27:46Yeah, that's great. I'm looking at the code sample here for PyRevit, the create your first command
- 27:52example. And I see exactly what you're talking about with this sort of C# abstractions leaking into the
- 27:58Python world.
- 27:59Yeah, there's definitely a little vision there.
- 28:01Yeah, because it says, oh, look how easy it is to build this. You just drop this in this here and you put your
- 28:05Python file in the folder that is like your button where it contains your icons. And then you write capital
- 28:12db, capital F filtered, capital E element, capital collector. So filtered element collector of
- 28:19da da da da, right? It's real similar to what you would expect from that language. That language's idioms
- 28:26and not Python's idioms.
- 28:27Yeah.
- 28:28In the Revit Python wrapper, I started wrapping these classes. So for example, the filtered
- 28:32element collector, I mean, that's a pretty long that I wouldn't give it to a Python class usually. So
- 28:38I just called it the collector and I created a class that wrapped the filtered element collector. So
- 28:43instead of writing something like this, you would say collector type equals wall. And you could write,
- 28:49you know, wall as an enum and you would sort of basically output this code that you're seeing there.
- 28:54But the problem is you can't really avoid it because even though you wrapped collector,
- 28:58there are like 8,000 other like C# classes that I'm not going to wrap them individually.
- 29:04So like eventually just kind of leaks. You just can't, you can't do the whole thing.
- 29:08Yeah. Somewhere there's some function you can't get in front of and it returns one of these things.
- 29:13And then, then there it is. Right. Exactly.
- 29:15I tried at some point, I had these wrappers that would take the return and wrap those into some sort
- 29:20of generic wrapper. And you would get so complicated and people that they couldn't
- 29:24figure out what it was doing. So that's why that Revit Python project ended up
- 29:28just kind of being abandoned at some point. And I wasn't as involved with it anymore.
- 29:32So I just kind of sat there, but that was the idea. If you look at an example for that one,
- 29:36you see that it looks a lot more, more Python-like.
- 29:39Yeah, absolutely. I'm clearly seeing stuff that looks more like Python.
- 29:43And that's fantastic. Right. Like, you know, variable names. Another thing that you spoke about that,
- 29:47I don't even know what you were doing to solve this, but you said that you had to somehow adapt to things like
- 29:53out parameters and ref parameters, which is a certain way to have a, instead of doing pass by value,
- 30:00so you can actually modify the reference itself and the parameter. It's a little bit like
- 30:05passing a pointer to a pointer in C or something like that, where you can change the pointer itself
- 30:11inside the function. What did they do in Python to deal with that? That seems, I don't know how to
- 30:16do that in Python.
- 30:17Iron Python has a special, I don't remember because it's been a while, but Iron Python has a special construct.
- 30:22Oh, okay. So in Iron Python, there's like an out or something. Okay.
- 30:25Yeah. So you import some special Iron Python object, and that becomes your reference and pass that.
- 30:32So, you know, Iron Python is this, is this weird kind of ways of handling those differences. What's
- 30:38difficult is that it's a very niche thing. So when you run into a problem with, with those,
- 30:42there's not a whole lot of people like trying to solve this. So it was always a little bit difficult
- 30:47too.
- 30:48I've had that sort of scenario before. And it's, it's not very often fun. And I remember
- 30:54specifically one time there was something I was trying to do with this code and it just
- 30:59was not responding in any way that I expected. And I was, I was at my wits and I'm like, I'm just going
- 31:06to Google this. I'm just going to just find whatever I can. And the only answer I could find was a blog
- 31:10post I wrote about it six months ago. I'm like, well, that's it. We're done. There's,
- 31:15there's no hope for me now. Cause I'm sure I've tried. I can't do it. And I, the only thing I can
- 31:19find is some dumb blog posts that didn't really answer the question I wrote about it. So here we go.
- 31:23On Iron Python, a couple of times I had issues. My only resource was to go into the GitHub project
- 31:29and actually post an issue. And I said, there's a stack over full question, no responses. I'm
- 31:34completely at lost here.
- 31:36Yeah. Well, that's such one of those, such a big challenge of using one of the
- 31:40these sort of niche interpreters or runtimes, because when you need help, there's no one to
- 31:46help you. And if it comes down to some little weird internal behavior, right, that behavior might be
- 31:51different. And just because people, they'll tell you, well, that's how it works in CPython. You're
- 31:54like, well, I know, but that's not how it works for me right now. Right. Can you help me? Like,
- 31:58no, I don't know anything about that. Right. It's, it's a challenge.
- 32:01Yeah. And if you're trying to post a reproducible example in Stack Overflow, and you have to have
- 32:06Revit open, for example, to execute this, if you're trying to deal with some like,
- 32:10lots of iron Python within this environment, it's really difficult.
- 32:14Yeah. Oh my gosh. I can see why you would want to get away from it. I'm guessing that
- 32:17Python.net makes this easier. Maybe it's still the same. I'm not entirely sure. I would like to learn
- 32:22more about that one, but yeah.
- 32:23Same here.
- 32:24Yeah. Let's see. On the live stream, I just want to say, hey,
- 32:27Bhavani, that finally could catch up on the live stream here. Big fan of Python. And just,
- 32:33you know, people listening, if you get the chance to be grateful to drop by the live stream we do on
- 32:37YouTube, just go to talk python.fm/youtube. YouTube can be part of it. It's always fun to get
- 32:42input from everyone out there. All right. Give us some examples of the types of things that you were
- 32:47able to do with Python and automating Revit. There's a talk, I'll go ahead and link to the talk that you
- 32:52gave at a meetup in San Francisco at Pine Silla. I'm saying that correctly. Yeah. And you talked about,
- 33:00there's a lot of nice graphics and you talked a lot about what you've done at various projects and stuff.
- 33:05Give us some concrete examples. Like it's all great in practice to say you could automate stuff,
- 33:09but like, what did you actually do?
- 33:10Yeah. So there was a lot of those kind of very boring, automating, moving tags type of thing.
- 33:16Some of the other bigger projects I worked on at the time I was working at WeWork.
- 33:21This is the fast growth time at WeWork as well, right?
- 33:23Yeah, that's right. So when I joined WeWork, it was a relatively small team. I think the
- 33:29built-in information, you know, modeling team, which is the team that I had joined, had just a handful,
- 33:34like four, five people. And I think the company as a whole was maybe 800. And when I left four years
- 33:41later, they were at around 10,000 employees. Oh my gosh. And then the building department,
- 33:46or the design building and design department initially was open in one or two buildings a
- 33:51month. And by the time I left, they were open in like 25 or 30. So all other kind of WeWork drama
- 33:58side of what happened within the company, within the kind of design and architecture department,
- 34:03it was just, it was really interesting to see. Yeah. Because traditionally,
- 34:07companies build in buildings, they're doing that as a service. So they're an architecture office
- 34:11that you hire. And WeWork was one of those examples where you had this kind of vertical integration.
- 34:16They were the owners, they were the operators, they were the designers, they were the builders,
- 34:21they even bought, they acquired a general contractor. So you had this huge opportunity to optimize and to
- 34:28integrate. So some of the things that we did, like one of the projects I worked there was related to
- 34:33integrating data from the earlier design process into everything that would happen kind of downstream.
- 34:39So for example, as designers were working on buildings and trying to get them through the
- 34:44approval process, as soon as this project was sort of starting to materialize, we wanted to get those
- 34:50spaces fed into the kind of sales pipeline. So we would actually build Revit integrations that would extract
- 34:57data from these models and feed them to other parts of the company. So one of them was related to
- 35:03Oh, interesting.
- 35:04Yeah. To figuring out how many offices are going to be in this building, how big are they,
- 35:08how many desks are in each one, and essentially integrate that, for example, with Salesforce,
- 35:12so that the sales team could start selling them. We did things with supply chain as well. So we have
- 35:20logistics company that would be trying to orchestrate shipment of, for example, these chairs and couches
- 35:26that you see in the photo, they would need to be placed at warehouses and then delivered to buildings
- 35:31before opening. And they turned these buildings around really quickly. So it was really important
- 35:36that they had kind of insight. So as people were designing these buildings, we could actually start
- 35:42quantifying what was being used, what was going to be assigned, and then get the data sort of out of the
- 35:48model, which is not very, it's essentially a file that sits there. And we would use Python, for example,
- 35:54to quantify these things, pull the data out, and then send them on to other platforms. So it's a
- 35:59little bit of kind of data wrangling.
- 36:00Yeah. It's like JIT interior design, just in time, right? Like, we're going to need this here by
- 36:06Tuesday. So we're going to automate it. So one of the things you have to do is you have to figure out
- 36:11how, you know, maybe describe for, I'm sure not everyone's been inside of what we work before. Give
- 36:15us a quick sense of like, what is the inside of what we work look like? Or any, a lot of these co-working
- 36:19spaces, but we work is probably one of the bigger ones.
- 36:22Yeah. So we work, it would take empty floor spaces and they would use sort of storefronts,
- 36:29kind of glass their storefronts and subdivide them into small offices, as small as a single desk or
- 36:35kind of cuticle. And they could be as big as a 15 or 20 person office. And they were really efficient
- 36:41in how they kind of packed these desks. And they would do it in a way that it was very efficient for them.
- 36:46They would pack these offices really close, but then they would create these really nice,
- 36:50beautiful shared common spaces. So when you would walk into WeWork, you would often see these very
- 36:57kind of slick hip spaces, well-designed music playing. So it was this kind of nice experience,
- 37:03this cool kitchen and coffee area. And I think they were really good at it. I got to work out of WeWork
- 37:09for many years and it was a really nice change for my previous kind of office environments. And even as a
- 37:15a product, I actually really enjoyed what they were building.
- 37:18Nice. Yeah. So one of the things you spoke about is setting up some automation to figure out, well,
- 37:22how should we lay out these tables, either this open space, like just hangout area tables or
- 37:28like the co-working desks, or there's some parts that have like glass, clear glass separators. So you
- 37:34have some sort of quiet, but it's still, they've all got to be laid out, right? And you can say,
- 37:38okay, if we adjust the walls like this or do that, then here's the arrangement, right?
- 37:42Yeah. A couple of my coworkers were trying to figure out how to automate this so that
- 37:47as architects are taking this kind of big floor plate and they're slicing it, they're generally
- 37:52trying to figure out how the circulation is going to work. And then we build these kind of long blocks,
- 37:56and then you're going to start subdividing them to offices. And then as you start subdividing them,
- 38:00then you've got to figure out how the desks are going to work. And then you have columns. So actually
- 38:04like laying them out and getting kind of an efficient algorithm can be kind of time consuming. So some folks from
- 38:11the data and research team, they were writing algorithms. And the first one that I saw was actually written in Python.
- 38:17And I think it was served like using a Flask API, but the idea is that you could pass it a polygon
- 38:23and you would apply these rules about how you can lay out desks within this kind of polygon.
- 38:28And you would say, the door is here, do your best to lay out desks. And you would, you would try to do that. It was
- 38:35fairly straightforward math. It wasn't artificial intelligence or some sort of machine learning. It
- 38:40was actually pretty straightforward kind of brute force, which I found laying these out along the
- 38:44edges. But they were really interesting. They did some really interesting research on that.
- 38:48Yeah. Cool. A lot of nice examples of what you can do with a little bit of Python, a little bit of
- 38:53automation, even if you've got to somehow mash that together with a .NET or, you know, I guess if it
- 38:58was a Java API, you could use Jython or some other thing like that, right?
- 39:02Yeah. And this one specifically, the way we got around it is by actually building it as an API and
- 39:07have a C# add in called API to do the calculation. So that way we're going to have to deal with it.
- 39:13Nice. Yeah, that's perfect.
- 39:15This portion of Talk Python To Me is sponsored by Linode. Cut your cloud bills in half with Linode's
- 39:23Linux virtual machines. Develop, deploy, and scale your modern applications faster and easier. Whether
- 39:29you're developing a personal project or managing larger workloads, you deserve simple, affordable,
- 39:34and accessible cloud computing solutions. Get started on Linode today with $100 in free credit
- 39:40for listeners of Talk Python. You can find all the details over at talkpython.fm/linode.
- 39:46Linode has data centers around the world with the same simple and consistent pricing, regardless of
- 39:52location. Choose the data center that's nearest to you. You also receive 24/7/365.
- 39:59human support with no tiers or handoffs, regardless of your plan size. Imagine that,
- 40:04real human support for everyone. You can choose shared or dedicated compute instances,
- 40:09or you can use your $100 in credit on S3 compatible object storage, managed Kubernetes clusters, and more.
- 40:16If it runs on Linux, it runs on Linode. Visit talkpython.fm and click the create free account button
- 40:22to get started. You can also find the link right in your podcast player show notes. Thank you to Linode for
- 40:28supporting Talk Python. Let's talk about this other thing that you've been working on,
- 40:35AEC.works, which is architectural engineering and construction works. And tell us a bit about this
- 40:41project. This is a website you built for raising the visibility of cool companies in the space.
- 40:47Yeah. This actually started when I was an engineer at WeWork and I was seeing a lot of really interesting
- 40:55companies start to show up and try to build either software products or try to take a technology and
- 41:04build new companies within AEC that were trying to use technology in some interesting way. And I started
- 41:10keeping a list of it, Google sheet or your table form or something. And this list started growing.
- 41:16And so it started with four and five and eventually I had 20 or 30 of them. And I would often share them
- 41:21in different kind of community forums. And then I thought it would be interesting if I could somehow make
- 41:26that available and maybe even so that people could contribute and edit them. So basically build this out.
- 41:33It's a Django, a traditional, somewhat traditional Django app, except that on the front end, instead of
- 41:40using templates, I just use Vue.js. So it's a front end, back end separation type project. And yeah,
- 41:47the idea is that you can create these entries that represent these different companies or products.
- 41:52And then it just, you know, it's kind of displays them. It's pretty simple, nothing really crazy.
- 41:56Nice. Yeah. I will highlight a couple just to give people a sense, but there's a way to come here and say,
- 42:01suggest a company that's doing like innovative work here, right? So if people are out there like,
- 42:05why is my company out here? Well, there's a button, right?
- 42:07Yeah, exactly.
- 42:08All right. So I just briefly, let's talk about two of them that are maybe noteworthy.
- 42:13This one right at the top of the moment that says it's called Speckle. And let's see, it says,
- 42:20engineers, designers, and hackers, and the entire organization rely on us for interoperability
- 42:25automation. So it's like source control collaboration, versioning notification for
- 42:30architectural construction folks.
- 42:33Yeah. It's a little bit like AC architecture, geoconstruction data wrangling on steroids, right?
- 42:40So when you're in, and if you're working with software, you can pretty much always just like
- 42:45make a JSON and pass it around. Right. And you can, as long as you can get, you know, at least some basic
- 42:50data types. Now, if you have to pass around a wall, it's much more difficult than just passing around a
- 42:56string. And what type of wall is it? Where is it located? How big it is? It's complicated. So you have
- 43:02all these different desktop applications. And I've highlighted some that are used primarily within
- 43:06architecture, like Revit, for example. But there's all these other applications for other disciplines
- 43:11within the construction, you know, engineering industry.
- 43:13Right. Some of the ones they highlight are like Unity, Civil, 3D, E-Tabs, Blender, Unreal,
- 43:19that kind of stuff. Yeah.
- 43:21Yeah.
- 43:21There's Revit, yeah.
- 43:22So yeah, the first time Speckle came around, I believe it was like an academic project came out of
- 43:28Europe. And what they would do is they would build, like, for example, you know, an add-in for one of
- 43:32these platforms. And they would output some sort of serialization of these objects. And then they would
- 43:39build an add-in for another of these, you know, desktop apps that could read that JSON object.
- 43:44And DC realized it back into this architectural or, you know, engineer whatever structural beam or
- 43:50something. So it was about building all these connectors and would plug into these environments
- 43:54that weren't very easy to interrupt data in and out. Right.
- 43:58And on top of it, you would have a web platform. I think they call it like streams or something.
- 44:03And that way you could take data from one thing and plug it into another, see them all online
- 44:08together and share them, for example. So there's some, you know, really interesting ideas about
- 44:12collaborating, tracking them. And that's only possible because you take them out of these desktop
- 44:17apps, because a lot of them are not really built for this type of collaboration or this type of data
- 44:23sharing. Yeah. That's a really interesting idea. Like these things do not support
- 44:26any sort of interoperability, but if we can just get stuff in and out of any one of them,
- 44:31we could be that middle ground. Right. Yeah. So I don't know a ton about this. I really basically
- 44:36just skim the website and watch their explainer video, but it seems like some pretty cool open
- 44:41source stuff for people in this space. So they could check that out. Right.
- 44:44Yeah. And what I think what it's exciting about them is that they're actually open source too. So
- 44:48a lot of software in AC is they're big companies and they're paid and there's not a lot of example of
- 44:55successful open source companies essentially. They've actually been able to become a real company with
- 45:02employees and raise money and they're open source. So it's really interesting to see them trying to
- 45:06build a successful open source model within the industry. Yeah, absolutely.
- 45:10Prad Vaughan out in the live stream says two double high fives for Django for your app at
- 45:18AEC.works. All right. So that's Speckle, which is cool. And then also Ladybug, Ladybug tools.
- 45:23Yeah. Ladybug is incredible too. Ladybug's been around for a while. I don't know how long,
- 45:28but it was actually one of my first experiences, one of the first times I got exposed to open source
- 45:33within AC industry as well. But it's essentially, it started, it was a bunch of Python tools that would help you
- 45:40do kind of environmental analysis and they would basically use like weather data and some
- 45:46existing products. I forgot that it's been a while since I used this, but they would essentially wrap
- 45:51around these heavier duty programs that could actually do like daylight simulation or like solar analysis.
- 45:58But they would, they would build an interface in Python that you could use within, or Revit wasn't too much
- 46:04later, but right now when some of these other AC applications and the outcome within was that you
- 46:09would basically would allow any kind of architect, you know, students to essentially take any type of
- 46:15building that they were designing and actually run and see what does this building look like throughout
- 46:20the year? What does sun hit or what does light look like inside and actually render these analytical
- 46:25kind of drawings from it? So it was really interesting. It made all of that kind of accessible to a lot of
- 46:31people that wouldn't have been able to otherwise. And I think it was entirely written in Python for a long time.
- 46:35Yeah. It has a cross platform, Ladybug tools. It's written in Python, which can be run almost anywhere
- 46:41and plugged into any geometry engine, which is great. And then it talks about having some visual aspects of
- 46:47harnessing the capabilities of CAD to produce a variety of interactive 3D graphics, which producing cool interactive graphics in
- 46:54Python is always fun. But yeah, this one's also free and open source.
- 46:56Yep. That's right. I think they've received some grants from the public of energy or something like
- 47:01that. They're pretty well supported.
- 47:03Yeah. And it's 99.8% Python. That's still a lot of Python and 0.2% other.
- 47:09It's probably marked down.
- 47:10It's probably. I'm guessing it's the one shell script and the requirements.txt here.
- 47:15Yeah, that's right.
- 47:16Awesome. All right. So all that stuff is super neat. The work that you're doing here to shine a light on,
- 47:22the different ways we can automate stuff. In architecture, we've got Revit and then the
- 47:26PyRevit and the Python Revit wrapper and then Revtron, you said. And then also these open source
- 47:35like connectors and interoperability platforms are all super neat. I do want to talk to you about
- 47:40one other thing that doesn't have a super clear connection, but it's also, it sounds like it came
- 47:44out of your time at WeWork, this stuff you did with Airtable. Is that right?
- 47:48Yeah. Yeah, that's right.
- 47:49Yeah. So Airtable is something that I've seen and I've had people tell me that, oh, you definitely have
- 47:54to work with Airtable. It's amazing. It's like Sheets or Excel, but way nicer or things like that.
- 48:00Tell us, you know, a couple people out there, Airtable is this commercial product, right? Tell us about
- 48:04this and then we'll get to some Python side of things in a moment.
- 48:08Yeah. I'm a huge fan of Airtable. Pretty much since the first time I sort of run into it,
- 48:13I've been an user and I use it for everything personal projects work, but I define it as this
- 48:19kind of Google Sheets meet relational database. And I think there are other products like it,
- 48:25but I find Airtable just really kind of a joy to use.
- 48:28Yeah. I also feel like there's a Trello Kanban board aspect of it as well, right?
- 48:34Yeah. They've been adding, you know, quite a few kind of like views
- 48:37and tooling on top of the underlying data. So there's some interesting things you can do.
- 48:42It's not as sort of pure of a kind of tracker as Trello is, but you can basically build a Trello-like
- 48:49interface and there's a Kanban mode. So you can, whatever your roles are, if you have certain fields.
- 48:56So for example, you could maybe have a table with like apartments you're enlisted, for example, and maybe
- 49:01you have a column that is the status, whether you've visited them or not. And in Google Sheet, you would maybe
- 49:07type it or do like a data validation. In Airtable, you can actually see this is a field that links to
- 49:12this other table and you have the options that I want. And you can kind of create truly kind of relational
- 49:19data and have these views be linked to each other and in some really interesting ways.
- 49:24Yeah. Cool. Yeah. So it's, it's a little bit like spreadsheet meets relational database
- 49:30that has relationships rather than just random stuff you type in Excel, right?
- 49:34Yeah, that's right. Cool. All right. So that's Airtable. The Python side of things is you created
- 49:39this thing called a PI Airtable, which is a Python client for the Airtable API, right? Tell people about
- 49:45this. The initial version of this was through my time at WeWork as well, but we had all these Airtables
- 49:51that would store, I think one of them was like a furniture database. So everywhere was a piece of
- 49:56furniture and you had all this detail about these objects, maybe some data. And now you were to use
- 50:02that in other places or you wanted to feed additional data in that, in that table. So Airtable
- 50:08expose an API, but API, it's somewhat simple and minimal, but you know, it works as effective.
- 50:14So this was originally called Airtable Python Wrapper and was recently renamed to PI Airtable, but it's just
- 50:21a kind of a lightweight Python client around. It just, it adds a lot of the kind of nuances about the API
- 50:29itself, some of the data types and just kind of a high level interface. So then you can just kind of
- 50:34import it and you don't have to go spend too much time in the documentation, figuring out what all
- 50:39the HTTP requests are. And it just wraps them up and handles a lot of the, a lot of the things and add
- 50:44some, you know, nice high level abstractions to make it really easy to use. I've been working on this
- 50:49project for probably maybe three years now. And it was really interesting because in the beginning it was
- 50:54just me and I thought it was useful to have this and I just kind of put it out there. And it was really
- 51:00fun to see like people coming into the repo and actually asking questions or opening bug tickets.
- 51:06And in some cases, like I've had people just do lots of contributions. Like this one, this one person
- 51:13came out of nowhere, would they, and just like rewrote a test suite for it. I had these, the initial
- 51:18test suite, I guess I didn't know any better, would actually make calls to the API. And it was hard because
- 51:24the state wasn't predictable. Tests were a bit slow. So I guess when I did that, I didn't know you should
- 51:30sort of mock your requests and run your tests that way. And they literally came and like rewrote all
- 51:35my test suites. And so it was really fun. And it's been kind of one of the longer running open source
- 51:41projects that I've had. And over time I've just gotten better at kind of maintaining and added features.
- 51:46And then more recently, I just kind of rebranded Aspire table, build new documentation. And it's been
- 51:52really fun to see the project grow and it's got a decent user base. So I often see people coming up in
- 51:58there and I searched GitHub every once in a while and I see it used in a lot of different places.
- 52:02So it's really cool to see.
- 52:04Yeah, that's fantastic. So you said it has 200,000 downloads a month and it's listed as the
- 52:10official Python air table library, right? And the air table docs.
- 52:14Yeah. I assume those 200,000, a lot of them are CI. I don't know how many are actual direct installs,
- 52:22but you know, it does get used. Yeah. And then the air table documentation.
- 52:26That's not nothing, right? So that's a lot, right? Even if it's a quarter,
- 52:29Yeah. Yeah.
- 52:29That's still a ton of people using the library.
- 52:31Yeah. It's pretty exciting. And then recently, I think it was about a month ago or so,
- 52:35they added to the official documentation as the community driven kind of Python client. And
- 52:41they didn't have any others listed before that. So I think that's bringing more people.
- 52:46Nice. And so you said it also has some ORM capabilities.
- 52:49Yeah. So this was really fun. I would always use this library or whatever I needed to work with
- 52:54their table, but I would oftentimes want to build classes for the models that I had. I was always,
- 53:00I love using Django and these different types of ORMs. I think it's a really fun way of kind of working
- 53:05with persistence. And I wanted to do something like that with air table. So I, in this recent release,
- 53:12I basically kind of tried to build my little ORM and the idea is that I would define, for example,
- 53:18if I had an air table that it was contact, name, first name, email or something, I could essentially,
- 53:24you know, define a class called contact and then inherit from this air table base model and then
- 53:30define the fields. And then I could just instantiate that class and say, not save. And you would fire the
- 53:37request to basically save it. I could update an attribute and then just hit save and you would
- 53:42update it or call it delete method. So it was really fun. I don't know how much that's used. It's kind of
- 53:47a new feature, but I had tons of fun building it. And I got into descriptors, which I had never used
- 53:53before. Yeah. Descriptors are wild. Yeah. They were really crazy. So you had to define, these are the
- 53:59attributes this model should have, but when you actually instantiate, they behave very differently.
- 54:04You want to get the actual value, but not the kind of the field type. So descriptors were
- 54:10the natural answer, everything to it, but it was really fun building it.
- 54:13Right. And you've got like text fields and email fields and even checkbox fields, which I don't
- 54:18typically recall from the Django ORM or SQL. Yeah. That's an air table, a kind of native type.
- 54:24Yeah. Yeah. Cool. Yeah. You even have links from one air table to another. Cool. Yeah. I didn't
- 54:30realize it had this ORM aspect to it. This is very neat. Yeah. So when you fetch a record from air table,
- 54:36if it's a link, you actually just get the ID. It doesn't actually like transverse the link. So
- 54:41if you define it as a, as a link field, it actually takes that ID and fetches the next one. And then
- 54:47actually gives you the object instead of the ID. Yeah. Perfect. Like a foreign key type of relationship
- 54:53thing. Awesome. All right. Anything else you want to throw out there about higher table before we
- 54:57wrap this thing up? No, that's it. Yeah. So if people are out there using air table and they want to
- 55:01treat it like an ORM, I just want to talk to it. Yeah. Sounds like you should check this out.
- 55:06Yeah. I actually have a blog post I wrote when I, maybe about a year ago, that was called using air
- 55:11table as a backend on the medium. And it was an initial version of AC that works instead of having
- 55:18a Django backend. I actually tried to build it with just an air table serving it. And it was interesting.
- 55:24It's not, you won't have all the guarantees you have from a, from a proper database, but it's a really
- 55:29easy way if you just want to put data somewhere and be able to fetch it. And you also get a free kind of
- 55:34UI that you can see the data and change it. So yeah, it's kind of like the admin backend of Django,
- 55:40but it's like this super rich thing in the form of air table, right? Yeah, exactly. Yeah. Very nice.
- 55:45I mean, maybe it's not a full ACID transactional database, but at the same time, if that's where
- 55:51people are putting the data, you don't want to put it into Postgres and then try to keep the thing in
- 55:55sync or something like that. Doesn't sound fun either. Right. So use the one place that holds the data.
- 56:00That's what you're doing. Yeah, exactly. You won't get, I mean, I think if you're doing this,
- 56:03you're probably not, you won't be replacing Postgres, but it would maybe be replacing just
- 56:08like a local file or something. Yeah. But yeah, you do get, you get some form of like revision.
- 56:13It keeps track of every change. And so you get a lot for free. Yeah. Very nice. Yeah. People should
- 56:19definitely check that out. All right. Well, we're about out of our time. So let me ask you the final
- 56:23two questions here. If you're going to write some Python code, what editor do you use? I think these days
- 56:29it's probably always VS Code, right? Or a big percentage of it.
- 56:33Yeah. There's definitely a big chunk. Yeah. I had a little, like my first one was notepad
- 56:39plus. Then I think I used add a sublime for a while and then add them and then end up in VS Code. And
- 56:45these days I just, I love the Python integrations that the team that there has built. So I couldn't
- 56:51really see myself moving away from it anytime soon. Yeah. That's cool.
- 56:55Very invested in it.
- 56:55Oh, there's a lot of action going around on with VS Code in general. And then also in the Python
- 57:02aspect of it. Right. I do feel like this sublime to Adam to almost everyone who is on that path.
- 57:09VS Code is the destination.
- 57:11Yeah.
- 57:11I agree.
- 57:12Yeah.
- 57:12It just kept getting easier.
- 57:14Cool. All right. And notable IPI package. I mean, you've already given us
- 57:18many different packages and things for people to check out, but something that, you know,
- 57:22you ran across like, oh, this is cool. I really got to tell people about this one.
- 57:25Yeah. This is not a secret package. I think it's a pretty well-known, but I, I've just
- 57:30really come to enjoy using a Pydantic. It's one of those that I think I added on pretty much every
- 57:35project I have. I think it's such a blast just to be able to define my classes and set the types.
- 57:41I really enjoyed the way the project came together and it's sort of one of the standard ones that I
- 57:46added everywhere now.
- 57:47Yeah. If you have to parse data into your model or turn your model into something like JSON,
- 57:52it really helps a lot, especially if you have a hierarchical model, right? I've got this thing
- 57:56that contains a list of other Pydantic models, and then you've got to do type conversions to date
- 58:01times or to numbers or stuff like that. Yeah. It's fantastic.
- 58:04Yeah. And even on projects, you're collaborating with other people, you have a sort of my PY first
- 58:10kind of approach, right? Where from the very beginning, your objects are kind of typed and
- 58:15that just makes it a lot easier to collaborate with other people that will jump into your project. And
- 58:19it's very clear what that object is and all the types. Yeah.
- 58:22So that kind of helps make sure that you stick with it.
- 58:25Absolutely. Good recommendation. I suspect people probably have heard of it as well, but it's
- 58:29definitely a good one. Yeah. I've had Samuel on the show to talk about it. All right. Final call to
- 58:34action. People, especially those out in architecture, engineering, construction, are excited about Python
- 58:40and some of the tools. What do you tell them?
- 58:41I think it's a, it's an exciting time for the construction industry. It's kind of really good
- 58:46place to innovate. There's a lot of exciting technology products and companies being built.
- 58:52So I think there's a lot of opportunities to do something in kind of a different space. And I think
- 58:57they can really benefit from experience people that have been, you know, doing more traditional
- 59:02software development to help them scale and build things. So yeah, it's interesting to see how
- 59:07that those kinds of streams cross and to see architects go to build software and also seeing
- 59:12engineers come to help make the architecture and construction industry better. Yeah. Fantastic.
- 59:18All right. Well, thank you so much for being here. It's been great to have you on the show. And I'd love
- 59:24to get these views into the different areas and communities where Python is making a difference.
- 59:29So thanks for sharing it in the architecture space.
- 59:32Nice. My pleasure.
- 59:33Yeah, you bet. See you later.
- 59:34Thanks, man.
- 59:35This has been another episode of Talk Python To Me. Thank you to our sponsors. Be sure to check
- 59:42out what they're offering. It really helps support the show. Choose Shortcut, formerly Clubhouse.io,
- 59:47for tracking all of your projects work because you shouldn't have to project manage your project
- 59:51management. Visit talkpython.fm/shortcut. Simplify your infrastructure and cut your cloud bills in
- 59:58half with Linode's Linux virtual machines. Develop, deploy, and scale your modern applications faster and
- 1:00:03easier. Visit talkpython.fm/linode and click the Create Free Account button to get started.
- 1:00:08Do you need a great automatic speech-to-text API? Get human-level accuracy in just a few lines of code.
- 1:00:14Visit talkpython.fm/assemblyai.
- 1:00:17Want to level up your Python? We have one of the largest catalogs of Python video courses over at Talk Python. Our content ranges from
- 1:00:24true beginners to deeply advanced topics like memory and async. And best of all, there's not a subscription in sight. Check it out for yourself at training.talkpython.fm.
- 1:00:32Be sure to subscribe to the show, open your favorite podcast app, and search for Python. We should be right at the top. You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
- 1:00:49We're live streaming most of our recordings these days. If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:01:01This is your host, Michael Kennedy. Thanks so much for listening. I really appreciate it. Now get out there and write some Python code.
- 1:01:07I'll see you next time. I'll see you next time.
- 1:01:27Thank you.