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