Latest / Talk Python To Me / #32: PyPy.js - PyPy Python in Your Browser
Transcript
- 0:00Imagine a future where you're building a rich client-side web app.
- 0:03You start by creating some backend services, maybe in Flask or Node,
- 0:07create an HTML page, you throw in a few divs and ULs,
- 0:10and then you type script source equals main.py language equals Python.
- 0:15That future might just be possible for the right type of applications
- 0:20with Ryan Kelly's PyPy.js project.
- 0:22This is Talk Python To Me with guest Ryan Kelly.
- 0:27Show number 32 recorded Wednesday, September 30th, 2015.
- 0:54I have many interests, sometimes conflates my creativity.
- 0:57Welcome to Talk Python To Me, a weekly podcast on Python,
- 1:01the language, the libraries, the ecosystem, and the personalities.
- 1:04This is your host, Michael Kennedy.
- 1:06Follow me on Twitter where I'm @mkennedy.
- 1:08Keep up with the show and listen to past episodes at talkpython.fm
- 1:12and follow the show on Twitter via at Talk Python.
- 1:16This episode is brought to you by Hired and Codeship.
- 1:19Thank them for supporting the show on Twitter via at Hired underscore HQ
- 1:23and at Codeship.
- 1:24Hey, everyone.
- 1:26Thanks so much for listening in.
- 1:28No news today, so let me introduce Ryan and we'll get right to the interview.
- 1:31Ryan is a software developer based in Melbourne, Australia.
- 1:36Most of his days are spent coding in Python and JavaScript,
- 1:39commercially as an engineer at Mozilla,
- 1:41as well as for a variety of open source projects.
- 1:44He also maintains a strong interest in logic programming,
- 1:47mainly as a result of his doctoral thesis.
- 1:49Ryan, welcome to the show.
- 1:52Thanks for having me.
- 1:53I'm super excited that you're here today.
- 1:55We're going to talk about Python,
- 1:57but in a place that you typically don't find it,
- 1:59in the browser, right?
- 2:00Yep.
- 2:02Yeah, there's a lot of cool projects out there,
- 2:04and I'm a huge fan of the one that you've been working on.
- 2:07Before we get to that, though,
- 2:08let's talk about how you got into programming.
- 2:11What's your story?
- 2:11Sure.
- 2:12So I think it was quite a while ago now,
- 2:16and I actually started programming in JavaScript in high school way back in the day
- 2:19for a class, right?
- 2:21I was never the kid that sort of always grew up with computers.
- 2:24I very much just got into it for a school assignment
- 2:27and pretty much fell in love straight away.
- 2:30You know, I just fell in love with the ability to have a thought
- 2:33and kind of capture that in some concrete form
- 2:37and have it executed and have effects on the world.
- 2:39It's pretty amazing.
- 2:40And actually, that kind of subject changed my entire career path.
- 2:44I'd always planned to go into the sciences,
- 2:45and I had sort of a half a semester of computer programming in high school
- 2:51and changed my whole career trajectory into engineering and computer science.
- 2:54I think a lot of us who are in programming had that experience
- 2:57where maybe we didn't think that we were programmers per se, right?
- 3:02But then you get some experience where then you're like,
- 3:04wow, this is really amazing.
- 3:06This is really way more rewarding than a lot of other stuff.
- 3:08I had that experience in math.
- 3:10I studied lots of math, and I'm like, but we don't build anything here.
- 3:13Programming is so much more concrete but creative.
- 3:17I love it.
- 3:18Yeah, it's that beautiful combination of kind of creativity in the mix, right?
- 3:24The discovering and creating is pretty cool.
- 3:27Yeah, sure.
- 3:28So how did you get to Python?
- 3:29I was handed Python as a requirement for an internship I was doing in university.
- 3:37I went to work for a company that was doing engineering simulations.
- 3:40So I think like a lot of people, I sort of come to Python because it has really strong tools for doing data analysis and visualizations.
- 3:46So that was in a kind of typical intern project kind of way.
- 3:52It's kind of like, here is a relatively well-scoped project, and you're using this language, and off you go.
- 3:57But I just found that it really fit my head in a way that a lot of other languages that I've been dabbling around with didn't.
- 4:04It was just kind of super easy to get up and running and dive in, and I found that the more time I spent with it,
- 4:11and the more I came to understand the language and find all of these more and more interesting corners of it,
- 4:16it just kind of grew from there.
- 4:17And sort of since from that point, it's always been my kind of go-to language for side projects or projects where I'm not kind of locked into a language for other reasons.
- 4:29Yeah, I think Python has this rare combination of being very capable and yet very simple.
- 4:36There's a lot of capable languages, and there's a lot of simple languages, but they don't often intersect.
- 4:41So that's great.
- 4:43I've worked in some interesting languages like Prologue, and there's a language called Mozart, which is like a logic programming language.
- 4:49And they're incredibly powerful, but yeah, they don't have that just clarity that Python has.
- 4:55So before we get to talk about your project, you work at Mozilla, right?
- 5:00That's right.
- 5:01I'm a huge fan of Mozilla.
- 5:03Firefox is definitely my browser.
- 5:06Cool. Good to hear.
- 5:07Yeah, I try to spread the word.
- 5:09What do you do there?
- 5:09I used to work with the cloud services team.
- 5:12We're not an independent team anymore.
- 5:13So when I first started out, I was working on the web servers behind Firefox Sync.
- 5:18So doing sort of data storage and RESTful JSON APIs.
- 5:23They're all Python-based servers.
- 5:27So it's pretty standard kind of Python backend web gig.
- 5:32Through a series of kind of mergers and reorgs and so forth, I actually wound up on a project that's operating in Node.js.
- 5:40So my time these days is spent on Firefox accounts, which is the login system for Sync and for all of the new kind of cloud-based services that Mozilla is doing.
- 5:49And it's a 100% JavaScript shop, that team.
- 5:53So it's an interesting change of pace.
- 5:56But it does leave me kind of itching to get more involved in Python stuff on the side.
- 6:00Yeah, that's really interesting.
- 6:02I think that's a good lead into your topic because it's like Python and JavaScript, those two worlds colliding, right?
- 6:10Right.
- 6:12So maybe at a really high level, we could just talk about your project, PyPyJS, and then we could talk a little more specifically about it.
- 6:20Sure.
- 6:22So at a super high level, I like to describe it as an experiment in building a fast and compliant Python environment for the web.
- 6:31So concretely, it means like I want a Python interpreter that will run on top of JavaScript.
- 6:37So anywhere you would go that you would want to do something in JavaScript, you should be able to take Python to that platform as a first-class citizen.
- 6:45And obviously, a big place where JavaScript shows up is in the browser.
- 6:49And the browser is just dominated by JavaScript.
- 6:52There's really not a lot of other games in town if you want to do scripting in the browser.
- 6:56But I'm also kind of interested in how it might fit on the server side in Node.js or other JavaScript frameworks as well.
- 7:02But basically, being able to take other languages such as Python and put them anywhere where JavaScript is currently claiming as its home turf.
- 7:10Yeah, that's great.
- 7:11I mean, there's definitely been people talking how JavaScript is becoming the new assembly language of the web.
- 7:16And we'll get into that.
- 7:17So the way that I heard about your project was you gave a really excellent presentation at PyCon 2015.
- 7:24Oh, thank you.
- 7:26Yeah, yeah, definitely.
- 7:27What was the title of it?
- 7:28I forgot.
- 7:29PyPy.js.
- 7:31What, how, why?
- 7:32I think from memory.
- 7:33Yeah, that's perfect.
- 7:35Yeah, I think you're right.
- 7:35And it's on the YouTube channel for PyCon US 2015.
- 7:39So I'll be sure to link to that in the show notes.
- 7:42One of the ways you opened your talk was you talked about how Mozilla loves the web.
- 7:47And not just the technology of it, but sort of the whole idea and the culture of it.
- 7:51Can you maybe talk about that a bit?
- 7:53Sure.
- 7:54Sure.
- 7:54So we have this saying at Mozilla.
- 7:57And this was sort of one of the things that really inspired me to get started on this project.
- 8:00We like to say like the web is the platform.
- 8:03Well, this is kind of the world we want to live in is where the web is the platform.
- 8:08And so the web, not necessarily from a technology standpoint, but from a kind of computing platform standpoint, is pretty unique and pretty amazing.
- 8:17It's a platform that doesn't have any kind of all-powerful gatekeepers.
- 8:23It's a platform where anyone can kind of show up and start participating.
- 8:28You can publish stuff on the web without having to be locked into a particular hardware platform or a particular set of tools.
- 8:34You can show up and start consuming stuff from the web without any of the similar sets of restrictions or requirements.
- 8:43And so at Mozilla, we kind of see the web as a really powerful tool for empowerment and participation in the global kind of information economy.
- 8:55Of course, the web, you know, from a social standpoint, that's all very well.
- 9:01But when you get right down to the technology of the web, it doesn't necessarily tick all of those boxes, right?
- 9:07In a sense, the technology stack of the web is a little bit kind of restrictive.
- 9:11It's all kind of JavaScript and HTML in the browser.
- 9:13There's kind of a lot of nice sociological aspects of the web that are really unique and really valuable.
- 9:21And there are some technical aspects of the web that are not always to everyone's liking.
- 9:25So that's an interesting platform in that respect.
- 9:27It really is.
- 9:29You know, you could have sold me on this idea with that statement in 2005, no problem.
- 9:37But I think it's even more relevant now because we all have these app platforms and these proprietary APIs, you know, iOS, Android, OS X.
- 9:48There's just more and more walled gardens and proprietary stuff.
- 9:53Walled gardens and app stores.
- 9:55Yes, absolutely.
- 9:56And there's, you know, good financial reasons for that, right?
- 9:58Absolutely.
- 9:59And not just financial reasons.
- 10:01Like curated content has a lot of user value and security value and stuff like that.
- 10:06So the web has not completely undeserved reputation as a little bit of a security badlands because you don't know whose code you're running half the time.
- 10:14You just could have got to trust that the browser is going to do the right thing for you.
- 10:17That's right.
- 10:18And that's, I think, partly why the JavaScript component of the web is so crucial because if it involves Flash or ActiveX or some other, you know, high privileged C-based plugin, it's not the web.
- 10:33Not really.
- 10:34Absolutely.
- 10:34And you can't really trust it, right?
- 10:35Absolutely.
- 10:35And so your mission to bring things like Python to the web have to involve JavaScript somehow, right?
- 10:41Right.
- 10:43And I think there's been a long history and pretty much since the web has been a thing of trying to bring more kind of native platform functionality to the web.
- 10:53You know, you mentioned Flash.
- 10:54They've had, you know, ActiveX or Java applets, you know, way back in the day.
- 10:59And the web has a really long history of trying to compete with native platforms by bringing native platform technologies kind of into the web by expanding the scope of the technology stack of the web.
- 11:14As, you know, one after another have been kind of failures.
- 11:18They fail to stick for any significant length of time.
- 11:23And a lot of the time it's because of aspects like that security, right?
- 11:25You're just kind of opening up too many holes, too many opportunities for things to go wrong.
- 11:29Whereas if you take kind of JavaScript as your base level, then you can build on this sandbox that's had 20-odd years of, you know, figuring out how to get that right and build that model correctly.
- 11:42So if you take that as your foundation, you kind of get a lot of the good security stuff and the lessons learned from the web for free.
- 11:48Yeah, I totally agree.
- 11:50And it's also worth noting the birthplace of JavaScript is Mozilla, right?
- 11:54Well, it wasn't Mozilla back then.
- 11:56But yeah, sort of the heritage of JavaScript sort of comes from the same place as Mozilla.
- 12:02Yeah, absolutely.
- 12:03Yeah, absolutely.
- 12:03So when I think about JavaScript frameworks, there's the kind of more lightweight ones where it's, I'm writing, I'm taking some JavaScript API and I'm writing some more JavaScript code to write maybe a single page application.
- 12:20So I'm thinking of like Angular, you know, those types of things, jQuery, so on.
- 12:26And then at the other end, there's an idea of bringing more stuff into the JavaScript world using the concept of something called asm.js.
- 12:38Can you speak to that a little bit?
- 12:40So asm.js is a funny beast.
- 12:45It's sort of this tiny little subset of JavaScript, which if you look at it in the right light and you kind of suspend disbelief for long enough,
- 13:00inside of JavaScript are the semantics of a 32-bit CPU, essentially.
- 13:09So JavaScript has, for what is a high-level language, JavaScript has a surprising number of kind of really low-level features.
- 13:17Like it's got 32-bit bitwise integer operators and things like this.
- 13:24Asm.js basically came out of an attempt by a very smart fellow named Alonza Kai to compile C code to the web.
- 13:33And through a series of kind of experimenting with different ways of doing that,
- 13:38came to realize that there was this subset of JavaScript that you could target that implemented the semantics of the machine more or less directly,
- 13:46that you could then take C code and transliterate into this subset called asm.js.
- 13:52And because of the kind of browser wars and the JavaScript performance wars that had been going on up to that time,
- 13:59it also happened that that stuff would run pretty fast.
- 14:02So he likes to describe it as discovering a kind of low-level 32-bit assembly language hidden inside JavaScript,
- 14:10and I think that's pretty apt.
- 14:11Very cool.
- 14:12Have you seen the video or the PyCon presentation, Birth and Death of JavaScript by Gary Bernhardt?
- 14:19I was present in the audience for that talk, and I loved it.
- 14:22That was an amazing talk.
- 14:24Those of you guys out there listening who haven't seen this, I'll put it in the links.
- 14:28And I've referenced it before on the show.
- 14:30But he did a really good job of showing off Asm.js and basically bringing anything that can be written in C to the web.
- 14:39And one of those was like a pretty high-end video game like Quake or something like this, right?
- 14:46They're doing sort of more – within half the speed of Native, I think they usually get these things running.
- 14:53It's pretty amazing.
- 14:54Yeah, very, very amazing.
- 14:56And if you say high-end game like Quake, but I sort of sense that presentation has gone past,
- 15:01I think they actually have been launching with even more kind of –
- 15:05the very latest and greatest gaming frameworks are starting to ship support for generating Asm.js JavaScript natively.
- 15:12That's really amazing.
- 15:14Okay, so there's this idea of we can take C code and we can compile it not to machine instructions,
- 15:19but we can compile it to a special subset of JavaScript that then can be translated by the browsers to execute very fast.
- 15:28Correct.
- 15:28So how does this relate to your project, PyPy.js?
- 15:31The PyPy.js is sort of a coming together of what to me are two amazing feats of engineering, right?
- 15:38And one of them was Asm.js and Emscripten and this whole idea that you can treat the web more or less like a compile target,
- 15:46as if it were a native CPU.
- 15:48The other half of that, of course, is the PyPy Python interpreter,
- 15:52which I think you had an episode on not too long ago.
- 15:55That's right.
- 15:56That was show 21.
- 15:58And PyPy, the interpreter, does some really amazing stuff.
- 16:01It's incredible.
- 16:02So one of the things that I think actually was talked about a little bit in that episode,
- 16:08but one of the things I really like about PyPy is they weren't just focused on writing a really fast Python interpreter.
- 16:15They were focused on creating a platform for experimenting with interpreters.
- 16:21So it seemed to me the perfect kind of opportunity to learn more about both of these projects.
- 16:29I'll learn more about PyPy.
- 16:30I'll learn more about Emscripten and Asm.js.
- 16:33Because PyPy is structured in such a way to make it really easy to dive in and kind of change bits in and out and play around with it,
- 16:40I had this idea that I could get in there and like, well, I'll just find the just-in-time compiler backend inside PyPy,
- 16:48and we'll just change it to emit Asm.js instead of, you know, x86 or ARM assembly,
- 16:54which in a lot of projects would be kind of a terrifying proposition.
- 16:58But because of the amount of kind of just good abstractions and so forth that are inside PyPy,
- 17:04it actually was quite approachable as a problem.
- 17:08So the coming together basically looks like the PyPy interpreter toolchain run through the Emscripten compiler toolchain
- 17:18so that you get a version of it that is compiled to JavaScript.
- 17:22And then at runtime, it uses the PyPy just-in-time compiler infrastructure
- 17:28to take your Python code that you're running and spit out Asm.js at runtime,
- 17:34in the same way that a native PyPy interpreter would spit out kind of specialized native code for your application.
- 17:39So very much treating Asm.js as if it were just another dialect of some assembly language for a machine.
- 17:46That's so amazing.
- 17:46How long did it take you to get a proof of concept that was actually doing something?
- 17:51I think my very first proof of concept without the just-in-time compiler part came together pretty quickly.
- 17:58I lost maybe two weeks trying to figure out that Emscripten was actually assigning file descriptors
- 18:07at different numbers than they usually are in Unix.
- 18:09So like standard in is usually file descriptor zero, standard out is usually file descriptor one.
- 18:16And it was giving them different numbers because it had never mattered before.
- 18:18But PyPy really didn't like it.
- 18:20So there are a few kind of just like toolchain compatibility problems like that.
- 18:24But sort of once I got that figured out, right, is sort of just compile it as if you were running it through a cross compiler
- 18:32and you get it up and running pretty quickly.
- 18:34The JIT backend, I probably worked on, on and off for the better part of a year.
- 18:39I conceived this scheme at the end of PyCon Australia probably three years ago.
- 18:45And then I presented the kind of final first version of it at the following PyCon Australia the next year.
- 18:52In your presentation, you said your goal was really to bring support to the web for Python.
- 18:58And in your mind, that had to sort of meet three criteria, compatibility, performance, and webbishness.
- 19:04Can you talk about that?
- 19:06I wish I'd found a better word for that.
- 19:07I think that's the official word, yeah.
- 19:10Yeah.
- 19:12So this is not the first time people have tried to do Python-y stuff on the web.
- 19:17I think I even said in the talk it probably won't be the last.
- 19:21But it's one of those classic cases that you get in software a lot of a triangle where the three goals are kind of more or less opposed to each other.
- 19:31So you've had languages that compile to JavaScript.
- 19:35That's a thing that we know how to do.
- 19:36And we know how to do that relatively fast.
- 19:40As long as your language semantically maps to JavaScript pretty well.
- 19:46Python doesn't.
- 19:47So in Python, you have big ints by default.
- 19:51You have a variety of checks built into your arithmetic operators and a few things like that.
- 19:58So the semantics of Python are actually quite different to the semantics of JavaScript, even though they look very similar.
- 20:05On the one hand, it's easy to make something go fast in JavaScript.
- 20:08If you're not too far from the semantics of JavaScript.
- 20:11On the other hand, we know how to compile languages from one to the other, right?
- 20:16It's sort of a Turing completeness argument.
- 20:18So if we wanted to get a really compliant Python interpreter, you know, one that implements all of the edge cases of CPython up and running on a different platform, you know, it's not implausible that we can get that up and running.
- 20:34So it's interesting to see how fast we can do it.
- 20:36So there's kind of two relatively opposed goals there, right?
- 20:41Being fast and being – I like to say being Python, right?
- 20:46But doing all of the things that Python does, not kind of looking a bit like Python, but having JavaScript's number model and things like that.
- 20:53Right.
- 20:53Exactly.
- 20:53There's all these – you know, when you talk to people about JavaScript, they're like, oh, there's all these JavaScript gotchas you have to be on the lookout for.
- 21:01I don't typically hear people go, look out for all the Python gotchas because they're lurking everywhere, right?
- 21:06Right.
- 21:06Python's usually got your back.
- 21:19This episode is brought to you by Hired.
- 21:22Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.
- 21:28Each offer you receive has salary and equity presented right up front, and you can view the offers to accept or reject them before you even talk to the company.
- 21:37Typically, candidates receive five or more offers in just the first week, and there are no obligations ever.
- 21:44Sounds pretty awesome, doesn't it?
- 21:46Well, did I mention there's a signing bonus?
- 21:48Everyone who accepts a job from Hired gets a $2,000 signing bonus, and as Talk Python listeners, it gets way sweeter.
- 21:56Use the link Hired.com slash Talk Python To Me, and Hired will double the signing bonus to $4,000.
- 22:04Opportunity's knocking.
- 22:06Visit Hired.com slash Talk Python To Me and answer the call.
- 22:09It's usually got your back.
- 22:20That's right.
- 22:20And so you can't just, for example, translate floats in Python directly over necessarily to just run as JavaScript or numbers, especially integers, like you say, over to JavaScript numbers.
- 22:33So there's all that.
- 22:34That's the compatibility bit, right?
- 22:36Right.
- 22:37So, yeah, that's the compatibility aspect.
- 22:39And things like parts of the standard library as well.
- 22:42You know, do you have all of a full implementation of the sys module, including get frame and kind of the debugger and all of these things?
- 22:52And it's interesting.
- 22:54It's sort of like, well, I don't really use those things that often.
- 22:57You know, I don't really depend on integer overflows escalating to big ints by default that often.
- 23:05Or, you know, I don't use sys get frame that often.
- 23:07But it's interesting.
- 23:08But it's interesting.
- 23:09As soon as you start trying to run, like, whole programs on Python, like, you'll find that, oh, you use some library somewhere that uses some library that happens to use one of those things, you know, in some corner of its API.
- 23:23So even though they seem like edge cases, they're often not at a whole program level.
- 23:28Right.
- 23:29They're not necessarily edge cases for small, simple things.
- 23:32But if you're going to really write major apps there, then all of a sudden those become things you have to worry about, right?
- 23:37Right.
- 23:38And something I'm very interested in is less about kind of writing Greenfield's Python code for the web.
- 23:43Because, you know, personally, I am not that unhappy writing JavaScript.
- 23:47I'm interested in taking Python code that you've written and putting it on the web without having to do a whole lot of work.
- 23:54And the compatibility aspect really is really important for things like that.
- 23:57Right.
- 23:59Like script source equals some file dot py.
- 24:02Something like this, right?
- 24:03Right.
- 24:04Well, so, something like that.
- 24:08Yeah.
- 24:09But it would be, you know, taking something that you've already written and being able to put it on the web and make use of all of the fun distribution aspects of the web without having to do a whole bunch of busy work to make it run in JavaScript.
- 24:20Right.
- 24:21Absolutely.
- 24:21So it sounds to me like pypy.js completely nails the compatibility part because it's effectively PyPy.
- 24:29Is that right?
- 24:30Correct.
- 24:31So the fun thing about basing this on PyPy is we essentially get the compatibility part for free because they put an amazing amount of work into being a really, really compatible with the Python language reference, cPython.
- 24:43And then you get to the performance.
- 24:44And performance has multiple aspects.
- 24:47All right.
- 24:48One is I've got my code loaded up.
- 24:50And now I can run this and it's doing XYZ iterations per second with such and such amount of latency.
- 24:57The other part of it is I visit the web page and then it responds.
- 25:04Right.
- 25:05Yes.
- 25:05Maybe we could talk about those a bit.
- 25:08Absolutely.
- 25:09PyPy being interpreted with a just-in-time compiler generally targets kind of steady state performance of your application.
- 25:19So, you know, you load some code and you run it for a while and the JIT has a chance to kick in and generate a specialized code and you get very nice kind of steady state performance for the code that you're running.
- 25:29And I think, again, the combination of PyPy and Asm.js means we can kind of get a lot of that more or less, I don't want to say for free, but, you know, easily in a JavaScript environment.
- 25:43What we really don't get and what is actually really important on the web, as you say, is that kind of initial startup experience.
- 25:51Like the time between hitting a web page and being able to interact with it is even more critical on the web than it is in sort of places where you'd normally find Python.
- 26:05And PyPy.js, realistically, right now does a pretty terrible job of it.
- 26:10It's only so fast you can start interacting with the page and you've got to load sort of megabytes worth of JavaScript to even start running your code.
- 26:17Right.
- 26:18And so right now, if you look, I think, you know, you have a really great page, arewepythonyet.com, that talks about a lot of cool stuff.
- 26:25We can get to that.
- 26:26But on there you have the download size, both, you know, off of disk and sort of maybe on the wire, the GZIP representation on the wire.
- 26:35And on disk, it's like it was a little higher, but you guys have gotten down to 15 megabytes, right?
- 26:41Yep.
- 26:41And what is that, like five on the wire?
- 26:44Yeah, I guess down to comfortably on a single digits on the wire.
- 26:47I think five is probably about right.
- 26:50Which for a native application is not terrible.
- 26:55Like that's kind of in the ballpark.
- 26:57But for stuff that you have to load up in order to interact with a web page, it's not great.
- 27:01Yeah.
- 27:02Typically, we talk about minification of our JavaScript and it's smaller, usually smaller than five megs.
- 27:08Yes.
- 27:09Usually not measured in megabytes, let's be quite frank about it.
- 27:13That's right.
- 27:14That's huge.
- 27:16What is that, 100K?
- 27:17No, no, that's 20 megs.
- 27:18But, you know, there are potential solutions, right?
- 27:24I mean, there are CDNs, extreme caching.
- 27:28Right.
- 27:29Could alleviate this somewhat, right?
- 27:32The core runtime parts could somehow be sort of shared across sites.
- 27:37Indeed.
- 27:38I think there's actually still a lot of low-hanging fruit in that size, right?
- 27:43So that size includes, for example, an entire Unicode character database, which is built into the interpreter in PyPy.
- 27:52It includes all of the standard library modules that are built into the interpreter, whether you're going to use them or not, and things like that.
- 27:59So there is definitely some scope for making that smaller.
- 28:02And I've made more minimal builds of it that are several megabytes smaller.
- 28:09But I don't think it's ever going to get down to, you know, tens of kilobytes in size.
- 28:14This is pretty unrealistic.
- 28:15If you go and download CPython from python.org, compressed, that's like 22, 23 megabytes, right?
- 28:25And so, you know, if you're going to ship the whole runtime, the implementation, the PyPy implementation, that's kind of a lower bound in some way.
- 28:32Exactly.
- 28:34But that's not always a problem.
- 28:38You know, if you look at this as a way to write all of your kind of interactive website scripting in Python instead of JavaScript,
- 28:46like you were saying, kind of script lang equals text Python,
- 28:50that's a tremendous amount of overhead to pay before you can do any of the interactivity on your site.
- 28:56But if you're doing something like shipping a kind of more appy experience that you've built in Python,
- 29:03kind of bootstrapping into, in the same way that you might if you're loading up a game on the web
- 29:08or like some sort of more heavyweight application, it's less of a big deal.
- 29:12So, and, you know, the games that are compiled for the web within script and have this problem as well, right?
- 29:18You want to get into the game and start playing it.
- 29:20You've got to download many more megabytes of like image assets and compiled code and all this sort of stuff.
- 29:26But it's okay for that use case.
- 29:29And I think that's sort of the point where we're at with the project now where the people that are sort of really showing an interest in starting to use it
- 29:36are cases where that's going to be less and less of a concern,
- 29:39where you're okay to kind of wait for a few seconds while you're bootstrapping into a fairly elaborate experience.
- 29:47Right.
- 29:47And like I said, once you get that loaded up the first time, you can cache it.
- 29:51So if you're able to wait five seconds or whatever it takes to download that, then, you know, maybe it's possible.
- 29:58So games are obviously one concept here.
- 30:02Maybe if you're doing some, like I said, single page app thing where you kind of load it up and then you just stay there for a long time.
- 30:09Right.
- 30:11So I had some preliminary kind of interactions with the Jupyter and IPython people trying to get this plugged in.
- 30:27And in a sense, it actually went really well.
- 30:30They've got a really excellent infrastructure for plugging in different language backends and different, you know,
- 30:35they can do Ruby or whatever plugged into their infrastructure.
- 30:40So that, in a sense, kind of works.
- 30:42Like, hey, you can plug in, plug Pypy.js and run this completely client side.
- 30:46Of course, then, what that's missing is all of the fun libraries that you might want to use with that.
- 30:51So if you want to do scientific Python on the web, scientific kind of programming on the web in Python,
- 30:56you're going to want things like NumPy and sort of all of the analysis libraries that typically go along with that.
- 31:03So I'm still interested in kind of pushing ahead and seeing where we can go with that.
- 31:09But I think it becomes more of a library problem at that point, making sure you can actually ship that,
- 31:15all of the details of that experience that people would expect and not just the Python interpreter itself.
- 31:20The Python interpreter itself is actually probably the easiest of the bits, right?
- 31:25Because then you've got to get NumPy and SciPy and scikit-learn, and a lot of those have C extensions,
- 31:31which then you've got to get into Asm.js again.
- 31:34Right.
- 31:34There's a lot of nuances that people building those libraries have never thought of, right?
- 31:39Exactly.
- 31:40And so in theory, that's all possible, right?
- 31:44It's all the same principle of we've got code for a native platform where we can retarget it for the web.
- 31:49But it's never quite that straightforward in practice.
- 31:52Do you want to talk about arewepythonyet.com a bit?
- 31:57Sure.
- 31:57Yeah.
- 31:59So what was the idea?
- 32:01You said that was inspired by some sort of performance metrics at Mozilla historically.
- 32:07The domain name in particular is a little kind of inside joke at Mozilla, right?
- 32:13When the browser performance wars were really heating up, folks that were working on JavaScript performance at Mozilla needed a place to put their public JavaScript benchmarks.
- 32:24And so they created this site called arewepastyet.com, which you could go to and just kind of look at all of the different JavaScript benchmarks that were running in the different engines.
- 32:33And it kind of became a little bit of a thing at Mozilla.
- 32:35So when people were talking about, oh, Firefox is a real memory hog and we need to do something about the memory usage of Firefox, you know, they started up a metrics tracking site called areweslimyet.com.
- 32:46We were starting to really measure our community contributions and figure out, you know, how many contributors we're getting from different parts of the world and how big the community is growing.
- 32:55Like they set up a metrics tracking website called arewemillionyet.com.
- 33:00And sort of this ongoing habit of just trying to picking things that we really want to make a big difference to and measuring them and putting it up somewhere for everyone to see.
- 33:09The other folks that are really keen on, you know, doing public performance measurements are the PyPy team.
- 33:15So the benchmarks that are on arewepythonyet.com are all taken from the PyPy Speed Center, which I haven't managed to get all of their benchmarks running, but I've got a good subset of them.
- 33:26But yeah, sort of both places, I guess, have a really strong history of being really upfront and public about all of their performance metrics tracking.
- 33:37I think it's a wonderful philosophy to try and follow in the footsteps of.
- 33:40Yeah, that's great.
- 33:42And you go there and you can really quickly see where the performance is really good and where it might lag behind.
- 33:48And one of the things I thought was really interesting is there are plenty of places where PyPy.js is literally faster than CPython.
- 33:58Yep.
- 33:59All of that magic, of course, is due to the PyPy JIT.
- 34:04And if you change the comparison to compare it to a native PyPy, of course, it's going to be uniformly slower.
- 34:09But yeah, I was pretty amazed.
- 34:12That's sort of one of the challenges I set myself when I was starting out on this little experiment was to say, look, you know, is the combination of Asm.js, you know, being almost as fast as a native platform and PyPy being kind of consistently faster than CPython.
- 34:29Can that in combination mean we can actually run Python benchmarks in the web faster than your standard Python interpreter?
- 34:36And it's pretty astonishing to find out that that is, in fact, the case.
- 34:44This episode is brought to you by CodeShip.
- 34:57CodeShip has launched organizations, create teams, set permissions for specific team members, and improve collaboration in your continuous delivery workflow.
- 35:07Maintain centralized control over your organization's projects and teams with CodeShip's new organizations plan.
- 35:12And as Talk Python listeners, you can save 20% off any premium plan for the next three months.
- 35:18Just use the code TALKPYTHON, all caps, no spaces.
- 35:21Check them out at CodeShip.com and tell them thanks for supporting the show on Twitter where they're at CodeShip.
- 35:33Yeah, I was, when I pulled this up, I was like, all right, let's see how many times slower it is.
- 35:39Is it like something we could live with because it's going to run in the browser?
- 35:42And I was like, wow, okay, that's really cool.
- 35:44It's also fun to click off the D8 interpreter in those comparisons and get just the SpiderMonkey engine.
- 35:53It'd get a little bit more times faster than CPython as well.
- 35:56That's awesome.
- 35:57And of course, D8 is Chrome and SpiderMonkey is Firefox, right?
- 36:02V8 JavaScript engine, yes.
- 36:03Same one that runs Node.js, right?
- 36:06So very interesting.
- 36:07So the performance story is really, really good on the execution side.
- 36:13But then you also have the stuff about sort of the startup and the download size and so on.
- 36:18Right.
- 36:19So there's no point, you know, trying to hide any of that stuff.
- 36:22There's a whole tab there about startup overhead.
- 36:24And it does indeed measure the download size in megabytes.
- 36:27And you can, you know, it's even got a little feature there.
- 36:30You can actually click to just test how long it'd take to load up on your machine.
- 36:34What's interesting here actually is the download size is one thing.
- 36:40Like that's kind of understood and easy to grasp.
- 36:43But there's also a graph of the time it takes.
- 36:45Like once you've downloaded that, how long does it take for the JavaScript engine to actually kind of initialize this interpreter?
- 36:52And that actually is on the order of a second or two just by itself, right?
- 36:56Kind of taking all of that JavaScript code and parsing it and loading it up into the browser is actually, you know, makes the browser work really hard.
- 37:04Yeah, it's a large quantity of JavaScript that you can understand, right?
- 37:09So, you know, you work at Mozilla.
- 37:12Maybe you can pull some strings.
- 37:13Is it, would it be possible to take projects like this, like Asm.js and PyPy.js and have them sort of certain versions shipped with browsers?
- 37:26So like when I load up Firefox and I hit a page and it says, give me PyPy.js, it goes, we already have that downloaded.
- 37:34Let's go.
- 37:34I'd love to think I could pull those strings.
- 37:37I don't know if I really have that power.
- 37:39But I mean, the thing about the web, and this has been a general principle of the web for a long time, right, is no one browser vendor really has the power to do that by themselves.
- 37:57So, you know, we could kind of put this in the browser and say, yeah, like, you know, we want to treat Python as a first class language and we're going to special case it in the browser and get a really good experience for Firefox users.
- 38:10But the individual market share of us or any other browser who tried to do that is probably not sufficient to, for people writing websites to be able to depend on it, right?
- 38:21Yeah, absolutely.
- 38:22And the most important use case of that would be on mobile.
- 38:26And then that's an even harder sell.
- 38:28Absolutely.
- 38:28Absolutely.
- 38:30What's really interesting and sort of segueing out of that a little bit, what you really need in order for something like this to kind of take the next step and to get over some of these kind of fundamental problems of code size or load time or whatever is, you know, if you can't find a way to hack around that in JavaScript, which for some of these things we really can't.
- 38:51You kind of need all of the browser vendors to agree on a way forward and sort of everyone's got to ship something better together.
- 39:00And one of the amazing things that's happened coming out of Asm.js and experiments like the Games initiative that have kind of proven that that's a really powerful thing is you're actually seeing all of the browser vendors sort of getting together and talking about, well, like, what's next after Asm.js?
- 39:19Like, how can we make this better?
- 39:21How can we really commit to this as the web rather than any particular browser platform?
- 39:27That's really, I mean, that's the way the web works, right?
- 39:29That's the way the web is successful anyway.
- 39:31Like you said, people have tried to jam their way through, you know, like, IE6 type stuff that happened back in those days, but that's not really what sticks.
- 39:41You've got to have a good story for getting from where the web is to where you want the web to be.
- 39:46And Asm.js kind of really came in and provided that.
- 39:50It's like, all right, we want to treat the web as a compilation target.
- 39:53And here's a pretty okay way of doing it.
- 39:56All right.
- 39:56You know, we can get to that point.
- 39:58So now you've got impetus to actually make that better.
- 40:04Yeah, a foundational idea to start from that everybody can start to come from.
- 40:08Right, exactly.
- 40:09You know, people had traditionally talked about JavaScript as the assembly language of the web, sort of conceptually, but Asm.js is kind of making that concrete in a very real way.
- 40:20The name of the kind of project that's spinning up out of that discussion is called WebAssembly.
- 40:26And it's very much targeted at being like, here's an actual assembly language for the web, right?
- 40:31It's kind of like, take that idea that Asm.js proved is plausible, you know, doing this assembly language on top of the semantics of JavaScript, but outside of the limitations of necessarily, you know, 100% backwards compatibility with JavaScript.
- 40:47So it's gone from kind of like, yeah, this should be the assembly language of the web and kind of like, this is what it looks like, to suddenly taking that idea really seriously.
- 40:56Yeah, the future is going to be super interesting when that sort of takes hold.
- 41:01Absolutely.
- 41:02And I think, you know, a lot of these problems, like the load time of the JavaScript and the download size, like they'll get better for free when that technology starts to kick in.
- 41:12They won't go away, but they'll get better.
- 41:14Right.
- 41:15And a lot of the stuff that you sort of shipped from your site that would have been JS files or whatever are now binary, right?
- 41:21In that spec?
- 41:22Right.
- 41:23Right, exactly.
- 41:23So Python 2 or Python 3?
- 41:27Currently Python 2.
- 41:29Mostly by default.
- 41:31But that describes me as well as this project.
- 41:35I'm one of the laggards.
- 41:37I'm sort of slowly coming to the realization that I'm falling behind and that I still use Python 2 by default everywhere.
- 41:45That said, one of the neat things about this, right, is the PyPy team are working really hard on their Python 3 compatibility.
- 41:52And so it's a pretty straightforward prospect to kind of ride along the coattails of that work and ship Python 3 in the browser just as easily as you can ship Python 2 on top of this technology stack.
- 42:03Yeah.
- 42:03That's great because you're just taking literally the PyPy interpreter as it is and sending it through this tool chain.
- 42:12Whatever support PyPy has for Python 3 more or less is the support you have for it, right?
- 42:17Right, exactly.
- 42:18It sort of just comes out the other end.
- 42:20And that goes for all of the other languages that people are experimenting with on top of the PyPy tool chain as well.
- 42:26Yeah.
- 42:27I read an interesting article just this week talking about Python 2 versus Python 3.
- 42:31And, you know, there's a lot of practical reasons that a lot of people are still doing Python 2.
- 42:35And this article was called Planning an Early Death for Python 2.
- 42:39And it had some really interesting ideas.
- 42:41I'll be sure to link to it.
- 42:42But a lot about the way, like, people culturally think and talk about Python.
- 42:47They were attempting to change that there.
- 42:49And I thought it was an interesting idea.
- 42:50Anyway, I'll link to that for everyone.
- 42:51Yeah, cool.
- 42:52For what it's worth, I've really noticed a change in the community in the last year or two where it's kind of Python 3 is – it seems to have kind of broken through in a sense.
- 43:02Like, people might look at you a little bit odd if you're not taking Python 3 seriously.
- 43:07Or at least it's something I've noticed anyway.
- 43:10Yeah, I've definitely noticed the same thing.
- 43:12So are there notable deployments or places that we could go find that PyPyJS is being used yet?
- 43:20Or is it too early for that?
- 43:22What's the story around there?
- 43:23I think it's broadly too early for that.
- 43:26I mean, you can go to the PyPyJS website and muck around with it.
- 43:29It's sort of an interesting project for me.
- 43:32I was sort of in the position of doing a project that I don't really want to build anything with.
- 43:36Like, the project itself is the point of it for me.
- 43:39So I've been talking to a couple of different people who are interested in trying it out as part of an actual product.
- 43:46In places where you might use something like IPython or sort of one of the other in-browser Python environments currently.
- 43:54But I don't think any of those are live yet.
- 43:57They've certainly – I've got people showing up and chipping into the project and trying it out and experimenting with using it in their stuff.
- 44:05But I don't think anyone's quite put it into production just yet.
- 44:08Right.
- 44:08And if you want to check out the code, it's at github.com/PyPyJS.
- 44:12So pretty easy to find, right?
- 44:16Do you see maybe a use case in some of the more, like, offline app-ish HTML5 apps?
- 44:25So I'm thinking, like, Firefox OS, like, PhoneGap-type platforms?
- 44:30Absolutely.
- 44:31So that's one of the places where the startup overhead of this whole infrastructure will be less of a problem.
- 44:38Because you can list, you know, the files to be downloaded as, like, your app manifest.
- 44:42And you kind of get better control over the caching and things like that.
- 44:46So it probably makes more sense in that sort of contained experience of an app than it does as, you know, a bit of scripting on the open web somewhere.
- 44:55Sure.
- 44:57Yeah, that definitely seems like it.
- 44:58What about Chrome OS?
- 44:59To be honest, I haven't thought about it.
- 45:03I'm not sure you're allowed to promote them, but, you know, those do have sort of prepackaged offline manifest type stuff, right?
- 45:09So it seems potentially would be good.
- 45:12And particularly as the web kind of comes to terms with that packaging of applications and more standards sort of start to emerge around it, then, you know, ideally, you don't have to make that distinction like, oh, PhoneGap or Firefox OS or Chrome OS.
- 45:28It's kind of like, oh, this is how we do packaged apps for the web.
- 45:30And Python has a place in that ecosystem.
- 45:33That would be a really great outcome.
- 45:34That would be absolutely a great outcome.
- 45:36There are other sort of Python in a browser type frameworks or attempts or projects.
- 45:44And you listed something like at least nine in your talk.
- 45:47You know, two that are pretty popular come to mind.
- 45:50One is Sculpt.js.
- 45:51I had Brad Miller on one of the earlier shows to talk about that.
- 45:55And another was Brython.
- 45:56And those seem more like, you know, script lang equals Python sort of type of frameworks.
- 46:04But they make tradeoffs to make that possible.
- 46:06Can you compare those a bit?
- 46:08Exactly.
- 46:09I'm not super familiar with Sculpt.
- 46:11But I had a look at Brython in some detail.
- 46:14And I'm actually quite a fan of the stuff they're doing.
- 46:17I think they've selected an excellent set of tradeoffs.
- 46:20It's a different set of tradeoffs to the ones that PyPy.js is interested in.
- 46:26And the big tradeoff that they make in Brython to get good performance is the number model.
- 46:33So if you do like a for loop, like, you know, for X in range one to 100, right, that will get turned more or less directly into a JavaScript loop over JavaScript numbers.
- 46:45And for that use case, it's absolutely fine.
- 46:48Like, JavaScript numbers will behave correctly.
- 46:51But if you ever happen to get yourself, get your code into a situation where, you know, you're counting up a little too high or you're dividing by a number that you're accidentally dividing by zero or something like that, then you're not quite getting the semantics of Python's number model on top of Brython.
- 47:08For the script kind of text equals Python use case, we're actually, like, writing new code.
- 47:17You can write that code for Brython, and it's a really excellent set of tradeoffs.
- 47:21Because you know to watch out for those things.
- 47:23But if you were to take a, just, you know, get some Python code off the shelf and try and run it through, then, you know, you've got more chance of it's going to trip you up.
- 47:31So, of course, what you get in return for making that tradeoff is you get a much better kind of startup experience, much lighter weight integration into the browser, a lot less JavaScript to load.
- 47:42And in some cases, sort of a tighter integration with the browser and with the native DOM and stuff like that.
- 47:51Right, because they can lean more heavily on JavaScript itself.
- 47:54Correct.
- 47:55So, from Brython's perspective, it's targeting JavaScript.
- 48:00So, it can interact with JavaScript objects and this sort of thing.
- 48:04From PyPyJS's perspective, it's kind of targeting this weird C-like platform that happens to run on JavaScript, but you can't really see.
- 48:15It's difficult for it to see the native JavaScript objects and so forth in a sensible way.
- 48:19You did show a way that you could interact with libraries such as jQuery and the DOM and so on.
- 48:25Absolutely.
- 48:26From PyPy.js, right?
- 48:27Yes.
- 48:28That works.
- 48:29That actually works surprisingly well for what it is.
- 48:32And the way to think about that is a lot more like C-types or CFFI.
- 48:39Like, it's more like you're doing a C-binding to the objects in your JavaScript world than interacting with them directly.
- 48:47And on top of that, you can build a nice little API that exposes them as Python objects.
- 48:51But when you go to use that bridge between PyPyJS and the native JavaScript environment, you're going through basically indirecting through a C-API.
- 49:05That makes it something of a challenge to do fast and to do things like cross-language reference cycles, for example.
- 49:14You know, if you've got a Python object that refers to a JavaScript object that refers back to a Python object, it can get a bit weird.
- 49:21But for a lot of stuff, it works surprisingly well.
- 49:25Oh, yeah.
- 49:26Because, you know, maybe you don't need super complicated interaction.
- 49:29But, like, I'd like to grab something out of this text box and then display it over here in this, you know, select or whatever.
- 49:35Yeah.
- 49:36Yeah.
- 49:36For things that are, you know, strings and things that are immutable or things that don't really have references back into Python, it's fine.
- 49:44No dramas at all.
- 49:45One thing that I was thinking about as I was thinking about your project was, you know, you're talking about taking Asm.js and focusing on that.
- 49:55And compiling down to this subset.
- 49:56And there are other projects that both describe Python sort of more fully and JavaScript more fully.
- 50:06So, for example, TypeScript on the JavaScript side, which is like an optionally typed JavaScript type thing that AngularJS has adopted, right?
- 50:15And then the type hints that are coming in Python 3.5.
- 50:19Do any of those types of things help here or does it just not really matter?
- 50:23I think the way this particular kind of collection of technologies operates is at far too low a level for those to make a difference.
- 50:32I think it would be really interesting to try and do higher level correspondence between those two things.
- 50:40But I think it would be a very different size and shape project.
- 50:44Yeah, it's not something you could shoehorn in, is it?
- 50:46Right.
- 50:47No, not at all.
- 50:48Yeah, for all of the fun of kind of having it eventually run on JavaScript, actually, the experience of building it feels a lot more like building something in C.
- 51:01And the JavaScript kind of just appears as a platform underneath it.
- 51:04Because you're using the same tool set that they use for C, like LLVM compilers and things like that, right?
- 51:10Right, so classic compiler tool chain that just happens to spit out JavaScript at the other end.
- 51:15Yeah, it's like saying, well, when I'm doing C++, how does stuff happening in machine language and assembly, you don't even think about it, right?
- 51:25Right.
- 51:25Same thing here, more or less?
- 51:26Right.
- 51:26Exactly.
- 51:28Well, Ryan, we're kind of coming up near the end of the show.
- 51:30Do you have maybe some call to actions for people out there?
- 51:34I'm really interested in connecting with people who want to put this to concrete use.
- 51:40I think what the project really needs now is kind of be driven by concrete use cases.
- 51:47So it's past the point of like, oh, experiment with these fun technologies and see what's possible, right?
- 51:54See how fast we can make it or things like that.
- 51:58There's still ground to cover, but that's kind of the real experimental phase of that is more or less done.
- 52:07And in order to go from experiment to actual product and for me to like go into the website and remove the word experiment from the description of the project,
- 52:17it really needs to make that jump into something that people actually would be happy to deploy and practice.
- 52:24I need to talk to a couple of people who are doing like Python shells in the web for a variety of reasons who are interested in trying it out.
- 52:33But I'd love to hear if people had a Python application that they thought would be really interesting to port to the web in the same way that you might like take a game that you've got written in Python and package it up with Py2.exe and ship it to your Windows users, right?
- 52:49If you've got something that you think, that'd be really great if I could just take this Python kind of application and port it to the web.
- 52:56I'd love to just kind of talk through the possibilities.
- 52:59I think that's, as much as anything, that's what the project needs right now.
- 53:03People to come and try and put it to use and see what works and what doesn't and we'll fix the bits that don't.
- 53:09A great call to action and that is what makes projects real, right?
- 53:12When people use them and they have to hit all the little edge cases and sort of smooth it out.
- 53:18So it's a real product, right?
- 53:20Exactly right.
- 53:21You sort of can't get away from the fact that you've got to download 10 mega JavaScript.
- 53:25You can wave your hands and pretend that's not an issue when you're doing an experiment but not when you're doing a product.
- 53:31Right, absolutely.
- 53:33So another thing that I thought you had as kind of a final call to action in your talk was the concept of filing bugs against the web.
- 53:41Do you want to maybe talk to that really quick because that's a cool Mozilla idea, I think.
- 53:45I guess the driving force for this project for me is really that philosophy.
- 53:50It's the idea that the web should be a first class computing platform.
- 53:54And a lot of people kind of in the habit of thinking like, oh, the web can't do this.
- 54:00Or I really want to do this on the web but it's not going to work because X, Y, and Z.
- 54:05And it wasn't until I actually started working at Mozilla that it kind of occurred to me that actually, you know, the web is a really fluid medium.
- 54:14There are a lot of people who really care deeply about the web being a really powerful platform.
- 54:20And sort of invested in the web.
- 54:22Not necessarily winning but competing with native platforms.
- 54:28And it's a change in perspective, right?
- 54:30So if you can realize, I actually like the fact that the web can't do this, I should consider that a bug in the web.
- 54:37That's, there's one thing to say that another thing to put it into practice, right?
- 54:41If you come into bugzilla.mizilla.org and you're like, bug, I can't run Python on the web.
- 54:46Like we may not close it as invalid straight away.
- 54:50But it's probably, you know, it would be Intel projects like this.
- 54:55A big chunk of work.
- 54:57I don't know.
- 54:59I encourage people to expect more from the web.
- 55:01It's actually getting more and more powerful as an application platform.
- 55:05And if it's something that you feel like you should be able to do but can't quite make it work on the web, like find someone at Mozilla or in the Google Chrome team or like people who will take that really seriously.
- 55:18There are a lot of people working in the web who want it to be just every bit as powerful as a native platform.
- 55:24So don't just assume that it can't.
- 55:27Yeah, I totally agree.
- 55:29That's, you know, that whole way of thinking about the web is why I brought it up because I think it's really cool.
- 55:33All right, two more questions before I let you go, Ryan.
- 55:36If you're going to write some Python code, what editor do you open up?
- 55:40I'm very much a Vim user.
- 55:46Specifically Vim in an 80 by 24 terminal window.
- 55:50Sort of, you've got to work pretty hard to encourage me to make it any wider than that.
- 55:54I don't know if that's actually a productive way to get code written or if I'm just so used to it that I can't cope with anything else.
- 56:00But Vim all the way.
- 56:02Perfect.
- 56:03And then there's, you know, 60 plus thousand excellent packages out on PyPI.
- 56:10What are some that you think people should know about that maybe they don't?
- 56:14Interesting.
- 56:16So a friend of mine from the local Australian Python community, Russell Keith-Magee, who's a kind of does a lot of stuff in Django.
- 56:24He has an interesting new project out called Toga, which is a kind of GUI library, right?
- 56:31He's working on native applications.
- 56:33But it's a GUI library with kind of all of the last however many years of experience writing Python under its belt.
- 56:43So you can do fun things like pip install Toga, and it works on whatever platform you happen to be on.
- 56:48And you can get up and running with your GUI library.
- 56:52It's got things like support for iOS and Android UIs and stuff like that.
- 56:57So I think it's pretty neat.
- 56:58I haven't had a lot of excuse to play around with it, but I've kind of checked it out out of interest.
- 57:04So if you're working in native GUI applications in Python, I think it's really worth checking out.
- 57:10All right.
- 57:11Excellent.
- 57:11I hadn't heard about the one, so I'll check it out myself.
- 57:15Ryan, this is really excellent.
- 57:16Congratulations on this project.
- 57:18I think the fact that you brought Python to the web in a way that executes faster than CPython in a lot of ways is really an accomplishment.
- 57:27And maybe we'll solve this download speed thing, and it'll really take off.
- 57:31That'd be great.
- 57:32We'll see how we go.
- 57:33It's been a lot of fun in any case, so that counts for a lot.
- 57:36Yeah, it sure does.
- 57:38Thanks for being on the show.
- 57:39Talk to you later.
- 57:40Thanks so much, Michael.
- 57:41Bye.
- 57:45This has been another episode of Talk Python To Me.
- 57:47Today's guest was Ryan Kelly, and this episode has been sponsored by Hired and CodeShip.
- 57:51Thank you guys for supporting the show.
- 57:53Hired wants to help you find your next big thing.
- 57:56Visit Hired.com slash Talk Python To Me to get five or more offers with salary and equity presented right up front,
- 58:03and a special listener signing bonus of $4,000.
- 58:05CodeShip wants you to always keep shipping.
- 58:08Check them out at CodeShip.com and thank them on Twitter via at CodeShip.
- 58:13Don't forget the discount code for listeners.
- 58:14It's easy.
- 58:15Talk Python.
- 58:16All caps.
- 58:17No spaces.
- 58:17You can find the links from today's show at talkpython.fm/episodes slash show slash 32.
- 58:24Be sure to subscribe to the show.
- 58:27Open your favorite podcatcher and search for Python.
- 58:29We should be right at the top.
- 58:31You can also find the iTunes and direct RSS feeds in the footer of the website.
- 58:35Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
- 58:40You can hear the entire song on talkpython.fm.
- 58:43This is your host, Michael Kennedy.
- 58:45Thank you for listening.
- 58:46Smix, take us out of here.
- 58:48I'm first developers.
- 59:04I'm first developers.
- 59:06I'm first developers.
- 59:07I'm first developers.
- 59:09First of all, first of all, first of all, first of all.