#23: 3D Printing with Python at Authentise Transcript
00:00 I'm sure you've heard of a full stack developer and full stack Python, but this week Authentize
00:05 is taking it to a whole new level with Python all the way from the cloud to the client to
00:10 the printer.
00:10 It's all about 3D printing with Python on show number 23 with Eli Ribble, recorded Wednesday,
00:16 August 5th, 2015.
00:18 Hello and welcome to Talk Python to Me, a weekly podcast on Python, the language,
00:48 the libraries, the ecosystem, and the personalities.
00:50 This is your host, Michael Kennedy.
00:53 Follow me on Twitter where I'm @mkennedy.
00:55 Keep up with the show and listen to past episodes at talkpython.fm and follow the show on Twitter
01:01 via at talkpython.
01:02 This episode is brought to you by Hired and Codeship.
01:06 Thank them on Twitter for supporting the show where they're at hired underscore HQ and at
01:11 Codeship.
01:11 I don't have any particular news this week, so let's get right to the show with Eli.
01:16 Eli Ribble has been hacking since he was little and discovered BASIC, NetHack, and
01:21 Debuggers.
01:21 He's enchanted by magic, is implemented via technology, and holds a master's degree in
01:26 computer science from the University of Utah.
01:28 He's developed driving simulator engines, mobile device management on Windows CE, websites, and
01:34 various cloud streaming applications.
01:36 Recently, he's been building 3D printing technology in the cloud to help start the digital manufacturing
01:40 age as the CTO of Authentize.
01:43 He's been doing professional Python development for the past seven years.
01:47 Eli, welcome to the show.
01:49 Thanks.
01:51 It's great to be here.
01:51 Yeah.
01:52 I'm really excited to talk to you guys about 3D printing and Python.
01:56 It sounds like you're doing some amazing stuff over there.
01:59 Yeah.
02:00 Thanks.
02:00 We're actually really enjoying it.
02:02 I feel like 3D printing is poised to really change a lot of things in the world about how
02:08 manufacturing is done.
02:09 And it's a lot of fun to get to be a part of that.
02:11 Yeah.
02:12 I'm sure it is.
02:13 It's definitely cutting edge.
02:14 All right.
02:15 So you work at a place called Authentize.
02:16 And you're using Python there.
02:19 What's the story with that place?
02:21 I actually long ago started the company with mostly contractors doing a lot of development
02:27 work.
02:27 And they basically brought whatever tooling they wanted to the table.
02:30 We had a little bit of Perl, some C, bits and pieces of Python, and a bunch of other languages
02:36 I won't go into.
02:36 And part of my job here was to bring all of that together, tighten it up, build an engineering
02:42 team around, ideally, some reasonable common decisions.
02:47 I tend to agree with Netflix's attitude about allowing developers to have some freedom.
02:53 But in our space, in 3D printing, Python is extremely common.
02:58 And it's also very good for building web APIs and that sort of thing.
03:00 And so we use Python all up and down the stack.
03:03 We have a desktop client that it's also sort of an agent that manages the printer, sends
03:11 commands to it, gets responses back.
03:12 That then streams data up to a streaming server that lives in the cloud in a data center.
03:17 That's written in Python as well.
03:18 We have various APIs where people can send commands to printers, control prints, do slicing, things
03:24 like that.
03:24 All of those APIs are all written in Python.
03:26 They interface with databases using Python.
03:29 We manage our deployments even, all with Python.
03:33 We are essentially a full Python shop.
03:36 Everything here.
03:36 Our whole cloud, everything.
03:38 That's awesome.
03:39 You know, there's the term full stack Python and things like that, which is awesome.
03:43 But this is like taking it to a whole nother level.
03:45 Like physical objects come out of your full stack Python system.
03:48 It's great.
03:49 So before we get into that, maybe we could just sort of start at the beginning and talk
03:55 about how you got into programming and kind of tell your story.
03:58 And then we'll talk about how you guys are using Python.
04:00 Gosh, as far as how I got into programming, it was forever ago.
04:04 My parents bought an old 486.
04:09 My older brother.
04:12 SX or DX?
04:13 Oh gosh, I couldn't even tell you.
04:14 I was not old enough to really care.
04:17 It was just magic to me.
04:18 That was good enough.
04:19 I watched my older brother use it a little bit and got kind of curious.
04:23 And here in Utah, we have year-round school.
04:26 So you're on again, off again every nine weeks or so.
04:29 And during the off times, it was basically me and the computer.
04:32 So I started learning basic, doing that sort of thing.
04:36 When I got into middle school, they had a class where you would learn the 12-key calculator.
04:41 You'd learn basic typing skills, Microsoft Word, that sort of thing.
04:44 And if you finished everything in time, there was a little programming module at the end based
04:48 on whatever time was left over.
04:49 And I sped through everything like you wouldn't believe so I could get to that programming module.
04:53 And then I would actually stay late at school just so that I could do more.
04:57 It was really ridiculous.
04:58 That's awesome.
05:00 It's an old, old thing for me.
05:03 I was back at 12 years old doing this stuff.
05:05 That's cool.
05:06 So it really resonated with you when you figured it out and learned it, right?
05:09 Yeah.
05:10 Yeah, absolutely.
05:11 Okay.
05:12 So let's talk about what you guys are doing with 3D printing and Python.
05:17 There's all sorts of moving parts.
05:20 It sounds to me like looking over your website and looking through some of the notes you'd sent
05:26 me about what you guys are up to, that there's just all sorts of various hooks and stuff that
05:31 you're putting together, like what, web APIs or JSON, HTTP APIs that you're connecting together
05:38 with Python.
05:38 Is that right?
05:39 Yeah.
05:39 So 3D printing's kind of complicated.
05:43 It's funny in that regard because it's very much in the maker community now.
05:46 So there's all these people tinkering in their spare time doing it.
05:49 But even still, usually that simplifies things.
05:52 But even still, it is quite complicated.
05:54 And there's a lot involved to actually produce a physical object with it.
05:58 So we started out and created a system where somebody who owns a website and runs a marketplace
06:04 and just wants to sell designs can have this website, sell the designs, and our technology
06:11 is embedded in the website and allows someone to directly from the website stream a print
06:16 to their printer.
06:16 Now, obviously, I have to install a little piece of software on their local computer that talks
06:20 over the serial interface to the printer.
06:23 But the idea was to try to simplify a lot of this.
06:26 There's intellectual property controls that come into play as well.
06:30 Obviously, if you're running a website, you don't want someone to buy a design, then steal it
06:35 and turn around and sell it as their own.
06:37 And so part of our technology is to sort of separate out the model, which is the intellectual property,
06:45 from the instructions to the printer, which is what the end user is really buying so that they can end up
06:50 with a physical object that looks like the model.
06:54 So we built a system to simplify printing and realized, well, we've built all these parts and pieces
06:58 that are interesting just to makers and people who do 3D printing as a whole.
07:01 Let's separate each of them out so that people could then build applications against them.
07:05 So we ended up building a suite of web APIs that do the various parts involved in 3D printing
07:09 so that people can mix and match and use them as they want.
07:11 Yeah, that's cool.
07:12 On your website, you had a really cool, I don't know if it was a slogan or just a statement somewhere,
07:18 that you guys are building the middleware for 3D printing.
07:21 Yeah.
07:22 Yeah.
07:22 I mean, again, it kind of goes back to this whole maker movement of people just cobbling stuff together.
07:28 And it's funny when you start looking at, say, putting firmware on your printer,
07:32 there's a couple of fairly well-supported firmwares.
07:35 But for many years, a lot of it was, oh, download this from this forum post because some guy was tinkering with it last weekend
07:43 and he fixed these bugs and it's got some really great updates.
07:45 And someone would basically branch that.
07:47 And this was like, I mean, this was not ancient history, right?
07:50 Like this is three, four years ago.
07:51 GitHub existed, but it was still this sort of ethos of like just, you know, rip, modify, push, like stick it places, email it to your friends, which isn't bad.
08:04 It's really cool.
08:04 And I like that feel that the community has.
08:08 But at the same time, it makes it very hard for somebody new to come in and to kind of get their bearings and get going.
08:14 Yeah.
08:14 Grabbing firmware from some random user off of the internet is kind of different than, you know, actually installing trusted software, I guess.
08:24 Right.
08:24 Right.
08:24 Interesting.
08:26 So at a high level, you guys are using, you said, Flask and MicroWisgi and Python 3 to sort of put all this together.
08:37 Do you want to talk a little bit about why you chose that?
08:39 Sure.
08:40 So I've been doing Python for quite a while now, and it's really hard for anyone to do Python and to not run into sort of Django, MySQL kind of environment, especially if you were doing this six years ago, which I was.
08:59 And so I've used Django before, and it's great.
09:01 It's a really great piece of software.
09:03 But for this particular company, I felt like we had a real opportunity to start fresh.
09:08 The company's relatively young.
09:09 And I kind of looked around and looked at the tooling and thought, you know, I'd love to go with something that is really modern and a little more a la carte pieced together.
09:17 Flask was very simple and direct, and I really enjoyed it.
09:21 At the time, it was kind of best in breed, and so far I haven't found anything in Python that's necessarily better, but there's constantly new things popping up in that space in Python.
09:29 MicroWisgi I've used before at companies.
09:32 I really trust it.
09:32 It does a really good job.
09:33 Same thing with Nginx.
09:35 I mean, several years ago, it was a little bit more of a bleeding-edge choice, but now it's just like, yeah, you go Apache and, I don't know, something else.
09:44 I haven't used Apache in forever.
09:45 Or you go Nginx and MicroWisgi if you're in Python.
09:47 There's a couple alternatives, but it's just very reliable.
09:51 And I feel like you only get so many sort of innovation points that you can spend at a new company.
09:57 I really wanted to spend them on Python 3, and I tried to make everything else really just stable.
10:02 Right, yeah, I've been using MicroWisgi and Nginx to deliver all the episodes of my podcast, actually the download server and stuff, and it's been super amazing.
10:12 So, yeah, I really like it.
10:14 You said that you chose Python 3, and was that just because there was this opportunity to pick the latest and sort of reset everything as you came into this company,
10:25 or was there more to it than that?
10:27 That was certainly there, and that was definitely a component.
10:33 Part of it is that I feel like Python 3 has finally come into its own.
10:37 You know, I've been watching Python 3 for, goodness, it feels like forever, but from the initial drafts,
10:42 I was looking at some of the changes they want to make, and it's like, oh, this is really exciting.
10:45 This is really great.
10:45 It's going to be really hard to deal with this whole break in the community.
10:48 You know, I think everybody just sort of needs to do their share, and it's kind of like that pigeon.
10:53 We'll all work together, and we'll make Python 3 a reality.
10:55 So some of that is just the sense of wanting to be a part of moving things forward, right?
11:01 Like you have to reach this critical mass with Python 3 in order to get it drawing new projects to it,
11:07 and I wanted to do my part.
11:09 Part of it is also that it's finally got some features that just cannot be reasonably backported.
11:15 You know, for a while, some stuff was backported.
11:17 There was ways you could work around it, but now, like, especially async.io.
11:20 And in our company, we do a fair amount of actual streaming, and async.io is beautiful, and I really like it.
11:28 And looking through it and looking at it over, I was like, okay, we're going to do this streaming server.
11:33 Let's use something that we want to stick with that we'll be really happy with.
11:36 And I've used G-Event before, and it's fine, and some things like Tornado and stuff like that way back when.
11:42 But I just really like async.io, and I want to help build it up, and it fits our need really well.
11:48 And so we went with it.
11:49 And we were able to put something together based off of async.io really fast.
11:54 We threw together a streaming server prototype within, like, two days, and then we started flushing it out with more of the features we needed.
12:01 And after a couple weeks, it was essentially stable.
12:03 Yeah, that's really cool.
12:05 I think async.io is definitely one of those major features that, like you said, is a legitimate reason to say,
12:12 look, we're going to choose Python 3 over Python 2 because if that's relevant to you, it really does do more in some great ways.
12:19 So what are you guys doing for deployment?
12:22 Deployment.
12:24 Yeah, that's always the question, right?
12:27 So we use Salt.
12:30 It's not just because we're based in Utah and Salt Stack is a Utah company, though we do send some love down south to our neighbors down there.
12:40 But, yeah, Salt is fantastic.
12:42 It's written in Python, which means when it comes down to debugging what's going on with deployment, we can bring all the same knowledge to bear.
12:49 We run essentially a DevOps shop.
12:52 I'm a little hesitant to throw that out there because we don't really have a choice.
12:58 My team is small and all my developers have to be able to handle everything.
13:02 And so everyone figures out how stuff gets deployed and they debug it.
13:06 So being in the same kind of stack that way helps a whole heck of a lot.
13:10 Beyond Salt for like our sort of coordination of commands and our configuration management, we actually use PIP.
13:20 So when we push a new update to some service, and we have a lot of services, we try to run essentially a microservice architecture.
13:29 We push the update into Git.
13:31 Jenkins grabs that, builds it, runs the test, ensures that it's good, all that stuff.
13:36 If it's accepted and we need to deploy it, the developer will put it in the dev environment, test it, make sure it's fine and functions as specified.
13:46 And then they tag the build, send it to Jenkins again.
13:48 It will then package it up just using setup tools, right?
13:51 Like any package you would stick in the cheese shop.
13:54 And zips that up and sticks it into an archiver.
13:59 And the archiver just is a pretend pip mirror, I guess you could say.
14:04 It's really simple.
14:06 We have this little tiny app that basically responds the way pip expects things to respond.
14:10 And then on all of our machines, we put a special config for pip saying, hey, also hit this other mirror if you're looking for anything.
14:18 And it's our internal mirror.
14:19 It's on our internal network and protecting all that stuff.
14:21 It's where all of our code lives.
14:22 And we just say pip install whatever it was.
14:26 And we have some projects that depend on one another.
14:29 And they just go through setup tools.
14:31 They're just part of the dependencies.
14:32 And our deployment system just says, hey, I want you to pip install, upgrade, you know, this system for, say, managing 3D models.
14:42 And it will look, find the newest update, install that update, download any dependencies, internal or external, get them all installed via PIP.
14:49 And then it just tells MicroWSGI to bounce the process if need be so that it updates all of its logic.
14:54 And off we go.
14:56 Like, we're PIP.
14:58 That's a really interesting way to do it.
15:11 This episode is brought to you by Hired.
15:14 Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.
15:20 Each offer you receive has salary and equity presented right up front.
15:24 And you can view the offers to accept or reject them before you even talk to the company.
15:29 Typically, candidates receive five or more offers in just the first week.
15:34 And there are no obligations ever.
15:36 Sounds pretty awesome, doesn't it?
15:38 Well, did I mention there's a signing bonus?
15:40 Everyone who accepts a job from Hired gets a $2,000 signing bonus.
15:44 And as Talk Python listeners, it gets way sweeter.
15:48 Use the link Hired.com slash Talk Python to me.
15:52 And Hired will double the signing bonus to $4,000.
15:56 Opportunity's knocking.
15:57 Visit Hired.com slash Talk Python to me and answer the call.
16:01 You know, it's a little crazy, but it's really cool, actually.
16:13 Especially the dependency part.
16:16 Yeah, that one was actually kind of tricky.
16:18 And it's funny because I first developed a system like this at a previous company.
16:22 And at the time, it was kind of painful because we were going through some of the growing pains of setup tools and distribute and the different packaging methods.
16:31 pip was relatively new, but it was growing fast.
16:34 And we just decided, well, what if we try this?
16:37 Like, what if we try doing our own internal dependencies in setup tools and just let pip figure it out?
16:44 Some of our deployment people at the time were like, heretics and all that stuff.
16:48 We gave it a shot and it worked out.
16:50 And it's actually gotten much better.
16:51 Like, pip has been growing a lot recently, especially if you're in the Python 3 world.
16:55 And it's quite powerful.
16:58 I mean, there's a few things that are a little bit difficult.
17:01 We struggled with version numbers, actually, since our version numbers in Git, our version numbers went all the way through from Git, tags, all that stuff, all the way through Jenkins.
17:12 And Python 3, PIP, the latest stuff, is all very exacting about how it treats your version numbers.
17:19 And so we'll occasionally get internal conflicts or we accidentally push something to production that's not a production build because, oh, it turns out that the way our Git tag translated into a pip version ended up making it more recent than our last one on accident.
17:33 But overall, like, the system's really good.
17:35 And I kind of encourage other small businesses that are doing this, like, check this out because I've used it now at two different companies.
17:42 And it's pretty seamless.
17:44 And we're pretty happy with it.
17:45 Yeah, it actually sounds really pretty effective.
17:48 I think that's cool.
17:49 Is Docker in this world anywhere?
17:51 Are you considering Docker?
17:52 Like most modern companies, we're always considering Docker.
17:57 We're not actually using it at this point.
18:00 Right now, the feeling is that it won't buy us any advantages.
18:06 Part of that is because of the position that we're in.
18:08 We have credits with some cloud providers.
18:11 And so it's essentially free for us to spin up enormous servers and really over-provision.
18:17 And so, like, Docker can be kind of effective at eking out more bang for your buck on your resources.
18:23 We don't really need that.
18:24 And it adds a layer of complexity on top of the rest of our config management that we don't really need right now.
18:29 But we keep an eye on it because it is interesting and it's an exciting project.
18:32 And we expect that someday we probably will need it.
18:34 But first, we have to get through the growth phase.
18:36 Yeah, I kind of feel the same way.
18:38 You know, some of the stuff I was doing recently, I'm like, oh, I should probably do this with Docker and it'd be really great.
18:43 But in the end, I realized, you know, it's really a dedicated VM and it's doing one thing.
18:49 And I could just configure the VM or I could configure the Docker image and have that be the only Docker thing running, the only Docker container running.
18:57 So in the end, I just put it in and just, you know, changed it directly.
19:01 But I think you're right.
19:02 In the future, it's definitely going to make a huge difference in what we do.
19:06 I think Docker is going to be a major part of what the world has for deployment, but maybe not today for everyone.
19:13 Yeah, I had a very trusted sort of IT systems management fellow that I've worked with who's done this for many, many years.
19:21 And I talked to him about Docker once and he said the key insight you have to have at Docker is it does not get rid of the fact you have to manage a server.
19:29 Like whatever it does, it will be on top of having a server.
19:33 Now, that's not strictly true.
19:34 There's some services out there now for different cloud providers that gets rid of that constraint.
19:38 But if you keep that in mind, it kind of reminds you, oh, it's not like magic sauce that solves all of my configuration management server management needs.
19:45 Right.
19:45 It's an additional tool.
19:46 I'm very useful for what it does.
19:48 Yeah, exactly.
19:49 It doesn't it doesn't save you from everything, but it is a very cool tool.
19:53 At PyCon 2014 and to a lesser degree this year at Europython, Guido Van Rossum got up and during the keynote and basically said, I know you guys are still many of you are still on Python 2.
20:09 And some guys are moving to Python 3 like your project, but there will be no Python 2.8.
20:15 There's a great giant slide that had like two Python 2.8 and a huge like cross through it or something.
20:21 What are your thoughts on that?
20:23 That's really hard.
20:26 I agree with him.
20:27 I think you have to make the hard break.
20:30 And the irony here is if anyone was going to be pushing for Python 2.8, they should have been doing this five years ago.
20:37 Right.
20:37 And I get that a lot of people like, well, it's been five years.
20:40 That's how long they expected it to take.
20:43 And not everybody has moved over.
20:44 So obviously something was wrong.
20:47 We should have a Python 2.8.
20:48 I see it kind of the other way, which is we should have been arguing about this five years ago.
20:52 And since that's not the argument that was made, like, OK, it's either Python 3 is dead or it's not dead.
20:59 And to me, it's very much not dead.
21:00 If it were dead, OK, let's jettison it.
21:02 Let's go back to maintaining Python 2.
21:04 But it doesn't make a lot of sense to me to continue the bifurcation longer, which is all you would do.
21:10 Like the more major revisions you release of Python 2, all you're doing is extending that timeline before there's this critical mass that pulls people into Python 3.
21:18 And so, like, my attitude now is, OK, if we're talking about, you know, Python 2.8, like, what you really need to be doing is let's enumerate the constraints you have about needing to be on Python 2 and figure out how to solve those constraints for you.
21:37 Because there's so much compelling about Python 3 and so many things have moved over and support it that, to me, you really have to give me strong reasons why not to switch over rather than trying to give good reasons to backport stuff.
21:50 Yeah, I tend to agree with you on that.
21:52 I think there's a lot of interesting technical debates and conversations.
21:57 You know, I've got a million lines of Python 2 code and we just moved to 2.6 or who knows whatever.
22:02 You know, some strange thing like that, right?
22:04 And there's totally merits to that conversation.
22:07 But on a larger level, on a more philosophical level, it seems wrong to me to have this great community, some of which is focused doing their best work on Python 3, on the interpreter and these new features like AsyncIO, and then a whole other big chunk of people working professionally on this older version that's kind of disconnected in some sense.
22:29 Like, it just seems, it just seems not like a good use of the community's energy and stuff to have these two things where people are focused.
22:37 And I think you're right.
22:39 Going forward, it'd be great if it was Python 3.
22:42 Yeah, I think Guido's making the right decision by basically saying, we're just going to keep adding great things to Python 3 to make you want to be here.
22:50 It's like, rather than having two separate parties and being like, well, we should try to split food between them and music and all that stuff.
22:57 Just be like, we picked a party, let's make that party the best party it can possibly be.
23:01 And whatever happens to this other party will happen.
23:03 We're not going to worry too much about it.
23:05 I think that's kind of where Python 3 is right now.
23:07 It's like, let's put the focus on the new stuff and people will trickle over because they're going to see how awesome it is.
23:12 That's right.
23:13 And they just keep adding stuff like you say, like, hey, now our party has a hot tub.
23:16 Hey, now our party has a ski jump.
23:18 Hey, it has a cool water slide.
23:19 And eventually, like, all right, we have to go there, right?
23:21 Someday, that's probably how it's going to play out, isn't it?
23:24 Awesome.
23:26 So let's go back to your overall architecture because it sounds like you're doing a ton of stuff with Python.
23:33 Could you maybe walk us through kind of like the flow through your whole environment and all the stuff that happens there and how Python fits into that story?
23:42 Okay.
23:43 So first off, our baseline is essentially Amazon services.
23:47 We do have some other cloud providers that play in, but we're very Amazon-centric, AWS-centric as far as, like, kind of our main line goes.
23:55 So you're running Linux servers and EC2 and things like that?
24:00 Yeah.
24:00 Yeah, exactly.
24:01 Ubuntu, to be specific, for the most part.
24:05 So, yeah, we've got all these servers.
24:06 So let's say you want to print a model.
24:08 So you've got, I don't know, a new iPhone case that you want to print out maybe that has your initials on it.
24:15 Pretty exciting.
24:16 So first, you need to get that into our system.
24:18 We have a system that will take in models from partners that have marketplaces from individuals.
24:24 Anybody, essentially, you can build an account.
24:26 You send us a model.
24:28 That's going to come in through a Python API, Flask, you know, really standard, MicroWisgee, Nginx, Flask, and then SQLAlchemy, of course, talking to Postgres.
24:38 And it's going to store that record in there, and we're going to stick your model.
24:43 Basically, we're actually going to hand you back a URL that says, hey, upload your model to this URL, and it's assigned us through URL, so you don't have to go through Python.
24:49 You just send the model up there.
24:50 That way we're not having to broker all of this data that's coming in.
24:53 Amazon will do that for us.
24:55 So that then initiates a job on the back of the queue that says, hey, process this model.
24:59 There's a Python application that's pulling messages off of a queue.
25:03 It pulls down your model, analyzes it, checks to see if it's printable, gets some essential statistics about it, things like that, and then eventually we'll update a resource in the database so that you can see, okay, my model's been uploaded.
25:12 It's been ingested.
25:13 It's been analyzed.
25:15 It's good to go.
25:15 It's good to print.
25:16 All of that stuff.
25:17 We then have a couple different APIs you could use to modify the model.
25:20 Say you want to put your initials on it, change the scale, things like that.
25:25 There's different operations you might want to do to improve the print quality, that sort of thing, and that will actually cascade through the same system, reanalyze after operations and that sort of thing.
25:34 That's all done.
25:35 You can actually just stop there if you wanted.
25:36 But let's say we want to go on to actual printing.
25:38 There's another service that you would say, okay, hey, I have this printer.
25:43 It's a, I don't know, MakerBot.
25:46 No, let's not do MakerBot.
25:47 Let's say it's an Ultimaker.
25:49 You say, I have this Ultimaker printer I bought.
25:52 It's lovely.
25:52 I've got some PLA.
25:55 That's a type of plastic I want to print this with.
25:57 Here's the model that I want to use.
25:59 It's already in your service.
26:00 Here's a bunch of parameters about the print, like the wall thickness, the layer height, that sort of thing, the temperature of the nozzle so that you know what temperature the plastic's going to come out, all that stuff.
26:10 And there's a bunch of essentially like mechanical engineering, material science stuff that goes into those parameters.
26:15 And the nice thing is you could also pick very high level parameters and just say, I want quality over speed.
26:21 Figure it out.
26:22 And we'll figure it out based off of your printer and the model and things like that.
26:25 So then that also goes through, again, a Python API to handle all that, sticks it in another Postgres database.
26:31 There's another job that will go on another queue.
26:34 There's a Python process on the back end, pulls the job off the queue, pulls the model down.
26:38 It's going to load up software from different slicing engines, depending on exactly the approach and that sort of thing.
26:45 Run those processes, monitor them, push updates into a database that you could pull constantly for information about your slice.
26:51 Because slices can take a while, you know, very complex geometry with really difficult settings.
26:56 We could be talking about tens of minutes.
26:58 What's a standard time?
27:00 Most people for most prints will be on the order of like a couple minutes, really.
27:07 It's really just like the big or the really complicated stuff that will get in the tens of minutes.
27:11 So we'll finish the slicing job.
27:14 We actually have a callback API so you can tell us, hey, hit this URL endpoint when it's done so that you can integrate a service with us.
27:20 We'll tell you, hey, slicing's done.
27:22 We have instructions for your printer.
27:24 That will then get handed over to a streaming service.
27:26 Again, Python 3 using asyncio that is handling, you know, hundreds of thousands of connections at any given time for a particular server.
27:34 You will, assuming you're working on like a web page.
27:38 You could do all this with a command line, but most people do it on some sort of web page, often with one of our partners.
27:44 You'll be seeing, you know, JavaScript that's interacting with these APIs, pulling down updates and displaying the status as you go along.
27:51 You know, get to this point where it's like, okay, let's print.
27:53 You're going to, you need to download our software on your printer.
27:56 Some printers have our software built in.
28:00 Anybody who has like a laptop or desktop with the printer plugged in could download the application and run it.
28:05 That application is mostly written in Python.
28:08 There are, of course, some platform specifics as well as some encryption and stuff like that that isn't for various reasons.
28:14 Yeah.
28:15 So for the client side stuff, I was wondering, so you send them an application and a decent amount that's Python.
28:21 Are you like compiling that or composing that into an application like a .app or .exe file with something like CX Freeze?
28:31 Or how does that work?
28:33 For Windows, we're actually sending them an MSI.
28:36 For Mac, we're sending, oh goodness, what is their installer type?
28:41 I can't remember what it is for Mac, but either.
28:44 A PKG or whatever?
28:45 Yeah, yeah.
28:46 PKG.
28:46 Thank you.
28:47 Anyway, for any given platform, it's a real installer.
28:51 So it'll be properly signed and all that sort of thing, and it will walk you through a wizard and install.
28:56 The thing that it installs will end up being a binary, and that binary actually has a bootstrapping process where it unpacks itself as a bunch of PYC files and then can execute, can use those files with an interpreter that's baked in.
29:11 That interpreter has all of our dependencies.
29:12 It's got a version of Python that we know what it is so that we don't end up using whatever their installed version of Python is.
29:19 And it basically comes with everything.
29:21 So you run it, it unpacks itself, executes Python.
29:24 It's got, again, some other languages bound up in there, but mostly Python, to even do all the UI stuff.
29:30 Because we've got a little, like, sys tray icon that shows you the status of your print, that sort of thing.
29:48 This episode is brought to you by CodeShip.
29:51 CodeShip has launched organizations.
29:53 CodeShip has launched organizations.
29:53 Create teams, set permissions for specific team members, and improve collaboration in your continuous delivery workflow.
30:00 Maintain centralized control over your organization's projects and teams with CodeShip's new organizations plan.
30:05 And as Talk Python listeners, you can save 20% off any premium plan for the next three months.
30:11 Just use the code TALKPYTHON, all caps, no spaces.
30:15 Check them out at CodeShip.com and tell them thanks for supporting the show on Twitter where they're at CodeShip.
30:20 That's awesome.
30:26 What UI frameworks are you using?
30:28 So for Mac, sorry, I laughed because I think for Mac it's called something like Rumps something.
30:35 It's this tiny little thing that we found.
30:39 And it's a great piece of software.
30:42 But it basically gives you – you define a class and it figures out all of the Coco bindings and stuff so that it can do a message pumping loop for you.
30:52 And it will just like – the class defines some menu items, some callbacks when those menu items get fired.
30:58 And that's it.
30:59 It's very small, very simple.
31:00 But it does exactly what we need, which is fantastic.
31:03 On Windows, goodness, I think we have something similar.
31:07 But, yeah, ultimately we're using just a couple of very, very small little toolkits that are designed only to do like a system tray icon kind of application.
31:17 There's no Windows in our application aside from a little like help blurb, like tell me about the version of this software.
31:25 But that's all.
31:25 It's just very, very minimal.
31:27 So we kept the framework very, very light.
31:30 Yeah, that's really cool.
31:31 I think that's one of the somewhat untouched frontiers of Python is proper native feeling applications.
31:39 Yeah, and it's been a bit difficult, to be honest.
31:42 It took us a while to sort out exactly how to do Mac just because we needed the Coco bindings.
31:48 And those are built into the latest versions.
31:50 But they're kind of different across different versions.
31:52 And you can't really properly virtually environment one when you're doing development.
31:56 Not easily anyways.
31:57 There's all these little complexities.
31:58 But I agree.
31:59 It's somewhat of an untouched area.
32:01 And it's really interesting because there's no reason you can't use Python much as you would, say, like C# on Windows as a high level language to just tie your UI logic together.
32:10 Yeah, definitely.
32:12 By the way, I found at least one of the rumps repositories on GitHub at JaredKS slash rumps.
32:23 Ridiculously uncomplicated OS X Python status bar apps.
32:27 Perfect, right?
32:27 Yep.
32:28 Yeah, that's exactly why we used it.
32:30 And it does exactly what we need, which is, I mean, that's the Python way, right?
32:33 That's right.
32:34 Very cool.
32:34 Okay.
32:36 I kind of short-circuited you talking about this architecture thing.
32:39 Were we getting to the end of what we got to the client side?
32:42 Or what's the story there?
32:43 Yeah, yeah.
32:44 Okay.
32:44 So the client side.
32:46 Yeah, you download this application.
32:47 All it does is mediate between the streaming server and the connection to your printer.
32:53 However we're making that connection, there's various ways it could be made.
32:56 But it does some of this UI stuff.
32:58 It does some of the streaming stuff.
33:00 And the Python is all kind of the high-level application logic, which is really nice.
33:04 We were able to take some C code that did all of this that was probably close to five to seven times as many lines of code
33:12 and compress it down into much smaller, much more easily debugged Python, which is awesome.
33:16 One of the other fun things that the client does is it will stream logging events up to our server
33:21 so that if you were trying to do a print right now, I could actually log in.
33:24 You could give me essentially a little token that would correspond to your installation.
33:28 I could watch the information coming from your printer over the wire into our data centers
33:33 so that I could actively debug with you stuff that's going on.
33:36 That's necessary because printing is just hard.
33:38 And 3D printing is a whole other level, right?
33:42 Yeah, it's a whole other dimension.
33:44 Of course, of course.
33:45 Yuck, yuck.
33:46 So anyways, that's the client application.
33:50 The last component I think that's interesting as far as Python goes is that while your print is going on,
33:55 people can opt in to a computer vision component, which is they'll mount a camera on their printer
34:00 and the camera will watch the printer as it's printing.
34:03 And we're using OpenCV on both the front end and the back end, so on both the client-side application as well as the back end server.
34:09 And awesomely, thank you OpenCV Project for supporting Python 3 relatively recently
34:16 because we actually started on the OpenCV 3 beta when we first did this product,
34:21 trusting it would come out of beta in time for us to run it in production.
34:24 Yeah, not too long ago it did, right?
34:26 Yeah, yeah.
34:27 It was a matter of months.
34:29 It was this year.
34:30 So it was really great.
34:32 But it's a really cool piece of technology.
34:33 Anyways, we use that so that we can capture these images of the printer.
34:37 We send some data about those images up to the cloud, and we use machine learning and computer vision on it to assess whether or not your print is going well
34:46 so that you can have these 10 and 20-hour long prints, and it will actually text you if it looks to us like, I don't know,
34:53 so your cat jumped on the platform to get warm next to the hot plastic, and we're trying to print on your cat.
34:59 That's not good, so we text you and let you know if your cat's there.
35:02 There's got to be a Law Cat reference in there somewhere.
35:04 I'm sure there is, but I always miss it.
35:08 Ah, that sounds really, really cool.
35:10 What's the craziest thing you've seen printed?
35:13 Sorry, I'm trying to filter through all the things that are actually okay to talk about.
35:22 Probably the craziest thing, we've gotten a surprise number of nude models.
35:28 So for whatever reason, naked people.
35:33 Interesting.
35:34 People print naked people.
35:36 Are these like little toy-sized ones?
35:38 Yeah, most of the printers that we work with can't build much more outside of,
35:44 oh, I'd say maybe 20 centimeters cubed.
35:47 So you're not doing any life-size prints.
35:50 That's probably good.
35:51 Oh, boy.
35:53 What else?
35:54 One of my favorites is people who print stuff with actual joins.
35:59 And this isn't, say, crazy, but I think it's really interesting to people who aren't into 3D printing.
36:04 One of the first prints that I did when I joined the company was I printed out a bracelet for my wife.
36:08 And this is, of course, printed in plastic.
36:10 And it's all one object, right?
36:12 So you literally print this object, and it's rigid and hard.
36:16 And you take it off of the build platform, and then you bend it.
36:19 And you hear all of this breaking all along.
36:21 Like you just completely snapped it apart.
36:22 But all you've done is broken these really tiny bonds to keep the print as one object.
36:27 And then there are these ball and socket joints and various other sorts of joints, and they work.
36:32 And so you have this completely flexible fluid thing made out of rigid plastic that you print it all at once,
36:37 all in one object that cannot come apart unless you break it.
36:40 But it works like jewelry.
36:41 And every time I see those, I think they're amazing.
36:44 I just love them.
36:45 Yeah, that's really cool.
36:46 I have seen certain things that have been printed where you couldn't ever put it together because the way,
36:52 you know, it could be 3D printed, but it couldn't be assembled from parts, basically,
36:55 which I think is a really cool idea.
36:57 Yeah, and that actually has a lot of application into some modern industrial stuff that we've been doing lately.
37:03 Like aerospace, they have need for parts that you literally cannot machine or manufacture right now.
37:08 But 3D printing can produce these things with extremely complex internal geometry that's used for like jet engine injection type stuff
37:15 where you'll get improvements of, say, 20% in fuel economy or something like that.
37:20 Just because you have this highly advanced structure that you can analyze really in depth and get some really neat economies out of.
37:26 That's really cool.
37:27 I mean, you could make a big dent in sort of the gas consumption of the world, which, you know, could make a big difference.
37:33 That's awesome.
37:33 Where do you think 3D printing is going?
37:36 I mean, these are early days.
37:38 Yeah, my expectation is that 3D printing will follow a trajectory somewhat similar to personal computing, say, 30 years ago,
37:48 where right now we're at the very beginning.
37:51 It feels like we've essentially invented the transistor, right?
37:54 And it's going to be a little bit of time.
37:56 There's a lot of big industries getting in.
37:58 Department of Defense, aerospace, also very big because it enables them to do things they've never done before.
38:02 Kind of similar to personal computing, obviously.
38:05 And I think what will happen is a lot of these technologies will get cheaper and cheaper
38:09 and they become more and more ubiquitous.
38:10 But there will be kind of this inflection point where people realize that you don't have to manufacture things in giant warehouses
38:17 and then distribute them all over the globe via a massive logistics network.
38:21 Instead, what you'll do is you will create the objects you need at the point of use.
38:27 Now, I don't necessarily follow some people in thinking that every person will have their own personal 3D printer to make them everything they ever dreamed.
38:33 That would be pretty far out.
38:34 But I think it's very reasonable to have sort of the Kinko's model where every neighborhood has a 3D printing bureau nearby
38:40 where, you know, every couple, several weeks or what have you, when you have a need to produce something that's personalized
38:46 or that comes through the sort of digital manufacturing environment, you'll send them a command, they'll print it, they'll say,
38:54 hey, your thingamabob is ready, come pick it up, and you'll go pick it up.
38:57 And I think we'll see that by and large all over the world because it's so much cheaper to just acquire the raw materials in place that you need
39:04 and then assemble them intelligently rather than to drag raw materials all across the planet to a few focused manufacturing centers,
39:12 build the object, and then redistribute them back out the opposite direction.
39:15 Yeah, that's a really cool vision.
39:17 And I think you're right.
39:19 That sounds pretty amazing.
39:21 You know, I've been reading some books lately, and I was talking to the authors of some, like, early, you know, not quite yet released books.
39:28 And I'm like, do you have an electronic version that I could get?
39:32 And, of course, you know, they sent me something I could put on my Kindle or whatever.
39:35 And it was just really nice that a tree didn't have to be cut down, turned into paper, printed somewhere, and put on a truck and driven to my house.
39:43 It was just like, poof, here it is, and now it's on my Kindle.
39:46 But this is like that for everything, right?
39:49 It's amazing.
39:49 It seems realistic, though.
39:52 Yeah.
39:52 One of the other things that's kind of curious about this is most of us are familiar with mass-produced objects,
39:59 because right now that's one of the most efficient things that we have is this mass production,
40:03 which we've had for 100 years.
40:04 You know, everybody has exactly the same, you know, parts to their car, because there's only so many manufactured these parts,
40:11 and they're just mixed and matched in slightly different ways.
40:13 But with this whole digital manufacturing thing, like, we have a print shop that we maintain here so that we can test our software for various reasons.
40:20 But, you know, one of my interns will be looking at the printer and go, oh, you know, we're having somewhat inefficient cooling on this printer because of these various reasons.
40:30 And could we fix the ducting on this?
40:33 And we'll pull the ducting off, kind of look at it, bring up the model in a 3D modeler,
40:36 manipulate some parameters, you know, open a gap a little bit, shorten some of the length, something like that,
40:41 print it, and in, like, three or four hours, we've mounted a completely new piece of duct work that's more efficient at cooling or whatever.
40:48 And, like, we just naturally want to highly customize everything we have to deal with the particular environment that we're in.
40:55 And I think we'll see this interesting inversion where instead of having everything is mass produced,
41:00 and we try to make everything the same so that it can deal with all of these mass produced items,
41:04 we'll instead go to the opposite end where we have very intelligent tooling that can hyper-customize everything that we have.
41:11 Yeah, that's really cool.
41:13 And I think there's going to be a whole new set of sort of craftsmen that can do that customization for people rather than giant factories, right?
41:21 Exactly.
41:22 Awesome.
41:23 So people want to get started with working with you guys for 3D printing.
41:27 Maybe they want to set up a website, sell some models, and work with sort of B2C that way.
41:32 Like, what do they do?
41:33 Actually, they just reach out to us.
41:35 We keep an email address, info at authentize.com.
41:38 Reach out.
41:40 We've had all kinds of people from graduate students who are just doing studies in 3D printing that need some data to help them in their studies,
41:47 to businesses, Fortune 100 companies that want information on how they can use 3D printing to, you know, essentially mom and pop shops.
41:55 We actually have a few shops that specialize, like highly specialized, like 3D printing sex toys, say.
42:02 And they will reach out to us and say, can you help us out?
42:05 And that's what we do is we help people get 3D printing working for them.
42:09 Yeah, that's cool.
42:09 I saw you just recently had done some kind of partnership with Autodesk.
42:14 And those guys are obviously natural counterparts to what you guys are doing.
42:18 Yeah.
42:18 Yeah.
42:19 We're working with Autodesk to, part of the difficulty in 3D printing is the tooling, right?
42:24 You talked about new professionals that will do this design work.
42:27 Ideally, we need to, you know, push all of this interesting, professional-grade tooling out to as many people as possible, make it smarter, make it easier.
42:35 And Autodesk has some great tooling.
42:36 And so we're working together with them to try to bring more of those tools to the masses so people can do better designs and make better stuff for everyone to print.
42:43 Excellent.
42:43 Yeah, the Autodesk guys are great.
42:45 I've been out to their place.
42:46 Very cool.
42:48 How about your favorite editor?
42:50 So if you're writing code, what do you write it in?
42:52 I'm writing it in Vim.
42:54 Vim.
42:54 Okay.
42:55 Right on.
42:55 There's a ton of packages out on Python Package Index.
42:59 What one do you think maybe people don't know about that you'd like to say, hey, be sure you check out this cool thing that's out there?
43:04 Oh, this is going to sound so boring.
43:07 There's a tool for sorting your Python imports.
43:11 I'm really super weird in that long, long ago, I was involved in lots of flame wars about coding style.
43:20 And I think they scarred me in some way.
43:22 And so I actually harp on coding style a lot in my organization because in my mind, you read the thing 10 times more than you're going to write it.
43:29 Maybe even more than that if your company survives.
43:31 And so you should optimize for readability in your code.
43:35 And so I actually like all of the imports to be sorted.
43:38 I like parameters to be sorted.
43:39 I like to build little tables out of white space and code.
43:42 Anything that will make it more readable, more approachable is a good thing to me.
43:46 So like little tools like that that will sort your imports so that they're alphabetical.
43:50 Awesome.
43:50 Awesome.
43:51 So what's the tool?
43:52 Oh, gosh.
43:54 I pi sort something like that.
43:56 I pi sort.
43:57 I don't know.
43:57 It's one of those things that it's like you install it and you stick it in your git hook and then you never think about it.
44:01 Yeah, of course.
44:02 Very nice.
44:04 Okay.
44:04 That's awesome.
44:05 Anything else that we haven't talked about you want to let people know about or some sort of call to action?
44:12 If you have not given Python 3 a try, try it.
44:16 Like I keep going back to a lot of us will remember our original experience with Python and it feels a lot like that XKCD comic where it's like import anti-gravity and you're just like, come join us up here.
44:29 It's amazing.
44:30 My feeling for Python 3 now is that it has that same sort of gap of joy to program to Python 2 as Python 2 did to everything else back then.
44:40 So like if you have not tried it, try it.
44:42 Especially like say asyncio or, you know, any of some of the newer language developments like 3.3, 3.4, that sort of area.
44:51 Look it over.
44:52 Try it out.
44:53 It will be very hard for you to let go.
44:54 And that's part of my point.
44:56 That's awesome.
44:57 Yeah.
44:58 And then the whole type annotation thing is coming.
45:00 That's going to be a pretty interesting conversation in the community, I think.
45:03 Oh, yeah.
45:05 Yeah, I agree.
45:05 I'm watching that whole thing and I'm really excited for what it will mean.
45:09 I don't even know, which is part of what makes it so exciting.
45:12 Yeah, that's awesome.
45:13 And just, you know, to follow up on your XKCD, if anybody's not familiar with this cartoon, open up a Python REPL and type import antigravity.
45:23 It's awesome.
45:25 Eli, thanks for being on the show.
45:27 It's been really interesting.
45:28 Yeah, thanks for having me.
45:29 Yeah, you bet.
45:30 Talk to you later.
45:31 This has been another episode of Talk Python to Me.
45:34 Today's guest was Eli Ribble, and this episode has been sponsored by Hired and CodeChip.
45:39 Thank you guys for supporting the show.
45:42 Hired wants to help you find your next big thing.
45:44 Visit Hired.com slash Talk Python to me and get five or more offers with salary and equity presented right up front and a special listener signing bonus of $4,000.
45:53 Check out CodeChip at CodeChip.com and thank them via Twitter where they're at CodeChip.
45:59 Don't forget the discount code for listeners.
46:01 It's easy.
46:02 Talk Python, all caps, no spaces.
46:04 You can find the links from today's show at talkpython.fm/episodes slash show slash 23.
46:11 Be sure to subscribe to the show.
46:13 Open your favorite podcatcher and search for Python.
46:16 We should be right at the top.
46:17 You can also find the iTunes and direct RSS feeds in the footer on the website.
46:21 Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
46:27 You can hear the entire song on our website.
46:29 This is your host, Michael Kennedy.
46:31 Thanks for listening.
46:32 Smix, take us out of here.
46:34 Stating with my voice.
46:36 There's no norm that I can feel within.
46:38 Having been sleeping.
46:39 I've been using lots of rest.
46:41 I'll pass the mic back to who rocked it best.
46:44 I'll pass the mic back to who rocked it best.
46:56 you