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