Latest / Talk Python To Me / #79: Beeware Python Tools
Transcript
- 0:00Can you write me a Python app for all the major platforms out there?
- 0:02Oh wait, I also want them to be native GUI applications.
- 0:07And I want them to work on mobile, so Android, iOS, tvOS, and watchOS, as well as the major desktops.
- 0:13Also, I need them to appear indistinguishable from the native apps in terms of the way you deploy them.
- 0:19So a .app on macOS and a .exe on Windows and so on.
- 0:24What technology would you use for this if you were going to build it in Python?
- 0:28This week, I'll introduce you to a wide set of small, focused, and powerful tools that make all of this and more possible.
- 0:35We're speaking with Russell Keith-Magee, the founder of the Beware Project.
- 0:39This is Talk Python To Me, episode 76, recorded October 4th, 2016.
- 0:56Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 1:18This is your host, Michael Kennedy.
- 1:20Follow me on Twitter, where I'm @mkennedy.
- 1:22Keep up with the show and listen to past episodes at talkpython.fm.
- 1:25And follow the show on Twitter via at Talk Python.
- 1:29This episode is brought to you by Rollbar and Hired.
- 1:32Thank them both for supporting the show.
- 1:34Check them out at Rollbar and at Hired underscore HQ on Twitter and tell them thank you.
- 1:42Hi, everyone.
- 1:43I want to take a moment and give you a quick update about my online courses.
- 1:46I just opened Access for my Python for Entrepreneurs course for pre-order.
- 1:52If you're thinking about taking this course, you should act soon.
- 1:54Right now, while we're still finishing the content, you can buy it for just $59.
- 1:58That's $30 off the retail price.
- 2:00And you'll get early access to the content while it's being developed.
- 2:04Currently, there's about 3.5 hours of content, and there's more coming every day.
- 2:08Check it out at talkpython.fm/launch.
- 2:11The early reviews have been great, so I'm sure you'll love it too.
- 2:16Now, let's hear about the Beware Project with Russell.
- 2:18Russell, welcome to the show.
- 2:20Thanks for having me.
- 2:21It's my honor.
- 2:22We're going to talk about so many things in the Beware Project.
- 2:25Several of my guests have actually recommended the Beware Project as something that's really
- 2:29standing out in the Python space, and I kind of have to agree with them.
- 2:33You guys are doing some cool stuff, and so I'm looking forward to talking about it.
- 2:36Oh, fantastic.
- 2:38It's been a fantastic ride the last couple of years, and it's over the last sort of 12 months
- 2:43who sort of just started to get a lot more momentum and starting to – partially because
- 2:47we're actually getting to the point where we've got something we can really show that's
- 2:50interesting, not just sort of theoretical.
- 2:52So, yeah, really enthused to talk about it.
- 2:55Yeah, great.
- 2:55Now, before we get to it, let's start with you.
- 2:59What's your story?
- 3:00How did you get into Python and programming?
- 3:01The programming story for me started a long, long time ago.
- 3:05My father is a mechanical engineer who kind of saw these computer things at the point when
- 3:12home computing was just starting to become a thing, and he got one of the first Commodore
- 3:1764s that was available for sale in Australia.
- 3:20Not with any specific plan of what he was going to do with it, just could see that these computers
- 3:25were going to be a thing and kind of maybe we should play with them a little bit, which
- 3:29is something he's always done with technology.
- 3:30He bought a hideously expensive 3D printer when they were still hideously expensive, just
- 3:36so he could play with it.
- 3:36So, yeah, I got introduced to the Commodore 64 when I was 8 or 10, somewhere around that
- 3:42sort of territory, and I've kind of been just tinkering with them ever since.
- 3:47It's kind of gone from, hey, I can write this really, really dumb, my sister is ugly, my sister
- 3:52is ugly, my sister is ugly, go to 10 loop, through to doing a PhD in computer science over
- 3:59time.
- 3:59So, my undergrad degree actually wasn't in computer science, it's in physics, but I picked
- 4:04up all the computing degrees and computing courses I could along the way, and they kind
- 4:07of encouraged me to come over to the computer science department for my postgrad studies.
- 4:12So, I did my honours in computer science and a PhD in computer science, and then progressed
- 4:16from there into working in industry.
- 4:18My PhD supervisor and I had a very, very frank conversation at one point about halfway through
- 4:24my PhD, even when we decided mutually that my future did not lie in academia.
- 4:28And so, yes, from that point, she was happy to try and get me out of academia and into industry,
- 4:32and I started working professionally as a computer scientist since then.
- 4:36I was in a PhD program, and I know you feel like you're on the path to just keep going
- 4:41into academics.
- 4:42But I feel personally very lucky that I had a broader exposure around that time to see what
- 4:49was possible in industry, because for every opportunity in academics, I feel like there's
- 4:54100 opportunities that are just so amazing out there, you know, outside of the confines of
- 4:59a university and a grant.
- 5:01I think it's great.
- 5:02Yeah.
- 5:03I mean, for me, it was, I don't know, a slightly more practical thing is that I actually like
- 5:07doing things, not just kind of the theoretical aspects of it.
- 5:10And I was getting, during my PhD, I was getting very, very tied up in playing around with interesting
- 5:16pieces of technology with a view to actually doing something, but wasn't actually furthering
- 5:19my research at all.
- 5:20So, and it's kind of a precursor to a lot of the stuff that I'm now doing in Bware in some
- 5:24regards.
- 5:25Excellent.
- 5:25Okay.
- 5:26So where along the path did you come across Python?
- 5:28I first used Python back in the 1.5 days.
- 5:31So a long time ago, I was talking like early, late 90s, at which point it was mostly a system
- 5:38config language, mostly because Red Hat was using it in their setup tools and what have you.
- 5:43At that point, it was kind of, well, this is an odd language with odd syntax.
- 5:47I don't want to use odd syntax, so let's not use it.
- 5:50What's up with this white space thing, huh?
- 5:52Yeah, well, and that's the thing.
- 5:53It was, it's the thing that everybody gets caught on.
- 5:56But as I sort of grew as a software developer, that interesting property became more and more
- 6:03the thing that I actually value in Python.
- 6:05So it's one of these things where once you've read enough incredibly badly formatted Java
- 6:11code, you realize how valuable it is having a language that literally cannot run unless
- 6:15you get the white space indentation, right?
- 6:17Yeah.
- 6:18And so, yeah, it's sort of, over time, it grew from being just the systems language I
- 6:22kind of have to use to something that I vaguely tinkered around with.
- 6:25Over that whole period of the sort of mid-90s through to about 2005, when I got involved with
- 6:32Django, I've had this series of little background projects that I've tinkered around with.
- 6:38And whenever I wanted to learn a new language or a new framework or a new whatever, it's sort
- 6:41of the first project is, let's render that in this new language.
- 6:44And at some point, I got to the point where, yeah, well, hang on, I can do this in Python,
- 6:48can't I?
- 6:48Let's build this in Python.
- 6:49And yeah, this is actually working really.
- 6:50I like the way this is coming out.
- 6:52I then got kind of distracted by, hang on, maybe this web thing is actually a thing too.
- 6:57Oh, I can use this Python for the web.
- 6:59Oh, look, here's this Django thing, which is brand new.
- 7:01And 10 years later, I'm still working on the Django project.
- 7:06So you actually became and have been for a while a core developer on the Django project.
- 7:11That's correct.
- 7:11Yeah.
- 7:11So I was introduced, like I discovered Django because I was poking around.
- 7:18I had this vague idea that the web was a thing that maybe I should know more about, and maybe
- 7:22I could use it to solve some of these technical problems that I had.
- 7:25And I found Django just before they did like the 0.91 release or around that sort of timeframe.
- 7:32So very, very early days, November of 2005, effectively.
- 7:36And it was sort of two things really happened.
- 7:40One, because it was a really early stage project, the sort of the barrier to getting involved was a lot lower than it is today
- 7:46because there's not as much sort of momentum and inertia around what's going on.
- 7:50But also because it was written in Python, I come from a physics background.
- 7:54I have done theoretical computer science.
- 7:56But like all theory, it's utterly useless for actually doing things.
- 7:59I never actually formally studied networking or anything like that.
- 8:03So when I tried to work out how to build a web page with PHP, the PHP website didn't actually help me at all.
- 8:10I didn't understand what it was trying to do.
- 8:12But the Django tutorial got me from I don't know how the web really works to, oh, yeah, okay, I can build a website.
- 8:22And this makes sense now relatively quickly.
- 8:25And when I hit the limits of what Django could do, because it was written in Python, I could dive into it and I could modify it relatively easily.
- 8:33I understood what was going on pretty quickly.
- 8:35So within a month or two of picking up Django for the first time, I was submitting patches that would – if you've got a many-to-many relationship between two tables,
- 8:47back in the day, you could only go from the model that defined it to the model that it was pointing to.
- 8:51I needed to be able to go the other way.
- 8:53So I added that modification into the query language.
- 8:56And when you start making changes like that, the core team, Adrian and Jacob, offered me the commit bit.
- 9:01And sort of the rest is history from there.
- 9:04Yeah, that's really great.
- 9:05Do you feel like getting started and contributing to Django was easier 10 years ago because it was a newer, less mature, less sort of solidified project?
- 9:15Absolutely.
- 9:16I mean, when things are – like 10 years ago, Django didn't have a backwards compatibility guarantee.
- 9:22There was certainly a preference to not just move things around because, but changing backwards compatible things was at least an option.
- 9:30There wasn't as much – the community was smaller, so it was easier to get consensus with a bunch of people.
- 9:36There wasn't the consideration of a million – if we deploy this change, Instagram is going to break because we all of a sudden have changed this API.
- 9:45So, yeah, 10 years ago, it was absolutely easier to get involved.
- 9:48There's no doubt about that at all.
- 9:50Yeah, that's really interesting.
- 9:52I think that's a big tradeoff, right?
- 9:53I mean, the value of Django is probably higher now.
- 9:56But it's just – it's all sorts of projects that have been around for so long.
- 10:01So, let's talk about a project that's not been around for quite that long, and that's your project, Beware.
- 10:05Yes.
- 10:07So, Beware is interesting because it's kind of many things that work together sort of synergetically.
- 10:15And you said that your project follows the Unix philosophy for tools.
- 10:19Yes.
- 10:20Give us a quick overview of what Beware is and then maybe touch on that.
- 10:24Sure.
- 10:24Okay.
- 10:25So, the place where I started with that sort of Unix philosophy is a talk that I gave at PyCon Australia.
- 10:29I think it was four years ago, but I have to check the exact date.
- 10:32But essentially, the theory that I was positing at that point was that the Unix philosophy as a process is quite strong.
- 10:38Now, the Unix philosophy is the idea that you don't build one tool that does everything.
- 10:42You build a large number of small tools, each of which has a well-defined interface.
- 10:47So, that – and then the power comes from the small tools being able to plug together really easily or having a natural way of plugging together.
- 10:55Now, the unfortunate corollary of the Unix philosophy has become that in order for something to be Unix, it must be text-based.
- 11:03So, yes, you can run LS, and LS you can pipe into sort, and sort you can pipe into unique.
- 11:09And these are really, really powerful things to do.
- 11:12But at the end of the day, it's all text.
- 11:16And there are many, many areas where text is not the natural interface.
- 11:20And the example that I gave at the time was testing.
- 11:22If you run a unit test suite or a pytest suite or whatever, what you get coming up on the screen as the user interface is dot, dot, dot, dot, dot, dot, F, dot, dot, dot, dot, dot, dot, dot, dot, dot.
- 11:33Which is completely correct and completely accurate, but not helpful from a user interface perspective.
- 11:40What you want to know is which dot is running?
- 11:42Why did it turn up an F?
- 11:44When something writes to standard output at the wrong time, which test did that?
- 11:49How long has my test suite got left to run?
- 11:52Now, these are all questions that you're entirely in a position to answer or at least provide good guesses for in the case of something like runtime.
- 11:57But when your only user interface is writing something to console, you have – you are deliberate or you have – you have just hobbled yourself in terms of what it is you can actually display.
- 12:09So what I was originally positing with the Beware project was that what we can do is build tools that are still Unix related.
- 12:15Now, they do one thing.
- 12:17They do one thing well.
- 12:18But one of those one things can be let's display a GUI that enables me to see all these useful things.
- 12:24So here is – where we started was with Cricut.
- 12:27Cricut is a user interface for running test suites.
- 12:30It shows a tree, which is your test suite.
- 12:32You press go and it works through your test suite, highlighting the lines of the tree that are currently running as individual tests.
- 12:39As the test suite is running, you can click on other pieces of the tree and see what tests have run and how long they took to run and what output they generated and whether they passed and failed.
- 12:47And because you know, well, this is how long the test suite is, this is how many tests there are.
- 12:53Each test takes an average of X milliseconds or seconds.
- 12:56Therefore, we can estimate this entire suite is going to take 20 seconds to run.
- 13:00That's really nice.
- 13:01I think the visual component of it is just – I am with you.
- 13:04I don't mind working the command line.
- 13:07But we have such powerful and beautiful OSs these days.
- 13:12Like, I feel like we're using one-tenth of what we can in terms of interactability, right?
- 13:18Yeah.
- 13:18I've bought a $4,000 laptop with a retina display that's able to render things at a resolution that my eye can't discern.
- 13:25And I'm using it to show 80 by 25.
- 13:27It just doesn't make any sense.
- 13:29Yeah, it totally doesn't make any sense.
- 13:31But I think that taking this idea of the Unix philosophy applied to like a modern GUI-based set of tooling, that's really powerful.
- 13:40And that's one of the things that I find really appealing about your project.
- 13:44Yeah, and that's sort of – like I said, we started – I started initially with Cricket as a proof of concept because, you know, unit testing is a thing that I do a lot of and I enjoy.
- 13:52And the unit test suite is difficult to get into when all you've got is dot, dot, dot, dot, dot.
- 13:57So here is a user interface that lets you use, interrogate, manipulate a test suite as it runs.
- 14:02The other – like I also have – there's another tool called Duvet, which is a coverage tool.
- 14:06It takes the code results partially from a test suite but also from anywhere else that it's running and shows you graphically which lines of code have been operated rather than giving you, you know, line 17 to 25 were not covered.
- 14:18Well, what's line 17 to 25?
- 14:19Oh, it's that for loop.
- 14:21Yeah, exactly.
- 14:22Yeah, 94% coverage is not the same as scrolling through your code and seeing, oh, there's a red spot.
- 14:28Hmm, why is that red?
- 14:29Yeah, exactly.
- 14:30But in order to get that capability, you don't have to swallow the whole of an IDE.
- 14:36You just have to have a mechanism for displaying that isn't 80 by 25 console.
- 14:43And so one of the things when I was poking around your projects that seemed to be a theme was they seem to be supported on all the major OSs, at least the desktop ones for the most part.
- 14:54Yeah, so that's the intention anyway.
- 14:55So originally I use a Mac as my daily developer box.
- 15:00I do also do work on Linux mostly as a server capacity.
- 15:04I know I have many, many friends who are using Linux as a desktop.
- 15:08And, you know, if I write a tool that is useful, I don't want to lock them out.
- 15:11You know, I don't – my passion for Mac is not because I particularly like Macs.
- 15:16It's because I like the hardware.
- 15:17I think it is a usable operating system.
- 15:20It is a usable platform where I don't have to mess around.
- 15:23If someone wants to use a different platform, they should be able to.
- 15:26And my choice of tools shouldn't be affecting their productivity.
- 15:29I've been from the beginning very actively trying to do this as a cross-platform thing.
- 15:34Plus also from my perspective, you know, one of these days I'm anticipating that I probably will end up leaving Mac and going somewhere else.
- 15:40And I want all my tools to keep working, please.
- 15:41Yeah.
- 15:42That would definitely lock you in if you spent five years building an amazing set of tools.
- 15:47But you had to stay on your – whatever OS you happen to have been on at the time, right?
- 15:50Yeah.
- 15:51You couldn't possibly leave.
- 15:52And the thing is, you know, at the end of the day, so much of what these platforms are doing is not platform-specific.
- 15:57You know, it's show me a menu, show me a button, show me a pull-down.
- 16:00You know, these are generic concepts.
- 16:02Originally, it started – like, Cricket is still and was originally built using TK Inter, mostly because it is available cross-platform.
- 16:10And you can install it saying pip install, you know, pip install whatever, and it just works.
- 16:15And a lot of where Beware has been sort of hunting for the last sort of three and a half years has been TK Inter.
- 16:20The major limitation I hit is that TK doesn't have a web widget.
- 16:24You can't display a web page in TK.
- 16:27And over time, TK's theming on OS X has gotten worse and worse, but that's kind of secondary to just you can't display a web page.
- 16:35And trying to write a new widget in TK is just pathologically bad.
- 16:39So it turned out for me the easy solution was to write a new widget toolkit, ironically.
- 16:43Yeah, I think there's a lot of cross-platform tool or tool chains, but not too many of them seem to really focus on the truly native component.
- 16:54And that makes a big difference to me.
- 16:56I remember running some Java apps and just looking at, like, the file open dialog.
- 17:00Oh, this just so does not belong here.
- 17:02What is this thing?
- 17:03It kind of resembles a file open dialog, but I know it's not.
- 17:07Like, the hotkeys don't work.
- 17:08All the various things that you would expect, right?
- 17:10Yeah, exactly.
- 17:12And so there are cross-platform widget toolkits that work to various degrees of work.
- 17:17There are things like Swing in Java, which sometimes looks like native and sometimes doesn't quite.
- 17:22And then you've got things like GTK, which, yeah, sure, works on Mac,
- 17:26as long as you're running an X server.
- 17:27And then you get the loving user interface of an X server running on your Mac.
- 17:31And then there are things like QT and WX, which are relatively mature and been used for a while and have Python bindings.
- 17:38But the Python bindings are kind of a secondary thought.
- 17:41In the case of QT, there's a whole licensing thing that's going on that's just a complete mess.
- 17:46And they're not as simple as pip install widget set because there's compiled components and libraries.
- 17:52And you've got to install this 150 meg library.
- 17:54And you've got to know which one you've got to have.
- 17:56And it just becomes such a nightmare that the basic thing of, I just want this damn thing to run, gets in the way of getting stuff done.
- 18:03Absolutely.
- 18:04The UIs in your apps look really nice.
- 18:06And they're cross-platform.
- 18:07What did you do?
- 18:08I accidentally stumbled upon a couple of things that I didn't realize were actually possible.
- 18:13So I was looking a long time ago at Pygame and realized that Pygame actually manages to do this native thing without actually having a compiled component.
- 18:25And the way it does it is because Objective-C, whether you know it or not, is actually a raw C API with some pretty syntax around the outside of it.
- 18:35And Python gives you this thing called C types, which lets you call any C API without having to compile something.
- 18:42So with a little bit of Python class magic and Meta class and descriptors and what have you, you can write a class in Python that is a pure Python class that looks and feels and behaves in the Objective-C environment like an Objective-C class.
- 19:00And then when you go, you look at the next option, you look at GTK.
- 19:03GTK provides native Python bindings that are actually native Python bindings.
- 19:06So there you've got two major platforms where you can write native applications using the native APIs with pure Python without having a binary component involved.
- 19:18And then so from there, it was kind of a, well, okay, that means I've got Coco and GTK, which are the two that I'm sort of covering my bets on.
- 19:27Can I do this on Windows?
- 19:28Well, yeah, because there's a Win32 and that's a C API.
- 19:31Okay, so that works.
- 19:31What about, well, but why is anyone going to use this new platform?
- 19:36You know, it's nice that it doesn't have this extra compiled component, but that's not sort of compelling.
- 19:40What's going to be compelling?
- 19:42And this is, again, sort of three years ago.
- 19:44It was like, well, what if I could use these widget sets on mobile as well?
- 19:48A lot of what I've been doing for the last couple of years is trying to get Python to run on mobile, both on Android and on iOS, so that you can actually then say, well, okay, yeah, I can run this, this similar API or identical API on macOS.
- 20:02I can run it on GTK on Linux.
- 20:04I can run it on iOS and I can run it on an Android.
- 20:07And that's sort of, you know, that's what's been keeping me busy for the last couple of years at this point.
- 20:11Yeah.
- 20:12And that's quite the achievement, especially the mobile part.
- 20:16But I think even, you kind of went through it quick, but I feel like native on the three major desktops is actually a bigger deal than, you know, maybe it sounds at first.
- 20:26I think if you're going to build an app and if it can look and behave literally like a macOS app or a Windows app or a Linux app, that is a really big deal.
- 20:37And if you can use Python for that, that's even better.
- 20:40Now, one of the projects, and I'm sorry, I don't remember the name of the project, but one of the projects you're working on is bundling that up so you can distribute.
- 20:48You can actually ship sort of a bundled up version of Python with everything it needs to run your app, right?
- 20:54Correct.
- 20:55Yeah, that's briefcase.
- 20:56So, yeah, the idea of briefcase, yeah, is to say, well, okay, a macOS application is basically a directory with some metadata in very specific places.
- 21:05And historically, giving someone a tool that is written in Python is kind of a, well, you need to install Python, but you need to install it from here and you need to give it your system password.
- 21:16And then you've got to hope that someone hasn't buggered up the site packages directory and, and, and, and, and, and.
- 21:22Here's the dependencies.
- 21:23Install those too.
- 21:24Yeah, and then you sacrifice the chicken and wave the blood this way and hopefully it works.
- 21:29Unless you're on Windows, then you better find out where VCVAR is about.
- 21:32Oh, exactly.
- 21:34And, you know, because every Windows user knows how to set their path variable.
- 21:37But at the end of the day, we're now at the point where a 100 megabyte application is absolutely nothing.
- 21:42You know, okay, 10 years ago, that was a major drama, but now that's just getting up in the morning.
- 21:46So why not ship the version of Python you actually need with the dependencies you actually need?
- 21:51And when you run it, it runs it locally.
- 21:53And so, okay, with macOS, well, yeah, I can do that.
- 21:57I can template.
- 21:57I can use cookie cutter, which is a fantastic project from Audrey Roy Greenfield and Danny Greenfield Roy, to like template out what this application needs to look like.
- 22:06And then your Python script goes here and your dependencies go there and we can pip install into that directory, zip it up, ship it to someone, and it just runs because it's pure Python.
- 22:15You're giving them the Python interpreter it has to use with the dependencies that they need and it's running natively.
- 22:20And then from there, you can do similar sorts of things.
- 22:23I haven't done as much work with Linux because installing apps on Linux doesn't quite work as well.
- 22:28I've done some exploratory work with Windows and it should absolutely be possible on Windows, possibly to the point of like actually generating an MSI installer that looks like it's a completely native installer.
- 22:38It just happens to spit out something that starts a Python interpreter, but you never know that.
- 22:42I think the irony is we in the Python community will be successful on these desktop systems and mobile systems if people don't know that they're running a Python application.
- 22:55Oh, absolutely.
- 22:56I completely agree.
- 22:57So as soon as you know or you can tell what tool someone used to build something, I think you've lost the game.
- 23:04Like you need to be able to run a piece of software and just be able to give it to anybody and it will just start, it will just run, it will behave the way they expect it to and they don't get any surprises.
- 23:14Anything less than that and yeah, okay, yeah, it may be very useful in various areas or demographics or whatever, but you're not going to get the mass market adoption if you've got to hold your breath and lift your leg in a funny way on a Tuesday when the moon's full in order for it to work.
- 23:29Yep, it might work for developers, it might work inside your company, but it's not going to be something you can broadly distribute if that's the story, right?
- 23:36Yeah, exactly.
- 23:37But even beyond that, I mean, looking at the developers themselves, this is part of the great lamentation about why I got involved with Beware in the first place.
- 23:44You shouldn't be in a situation where you have to be this tall to get onto this development project.
- 23:49If you can't just pick up a tool and use it and pick up a tool and develop it, then you've just set a barrier to entry to anybody helping to make your project better.
- 23:58So the dream of open source is that anyone can get involved, anyone can make their project better, anyone can contribute a patch.
- 24:04But if I can't even get a development environment going without 10 years of a computer science experience, then what the hell chance has the random person who has no computer science background got of fixing the tool?
- 24:15They don't.
- 24:16It's the being able to contribute open source dream is at best a dream.
- 24:21Yeah, yeah.
- 24:22And then you end up with people running to things like JavaScript because, hey, we can all start a browser or something like that, right?
- 24:29Yeah, exactly.
- 24:42This portion of TalkPyPundemy has been brought to you by Rollbar.
- 24:47One of the frustrating things about being a developer is dealing with errors, relying on users to report errors, digging through log files, trying to debug issues, or a million alerts just flooding your inbox and ruining your day.
- 24:59With Rollbar's full stack error monitoring, you'll get the context, insights, and control that you need to find and fix bugs faster.
- 25:06It's easy to install.
- 25:07You can start tracking production errors and deployments in eight minutes or even less.
- 25:12Rollbar works with all the major languages and frameworks, including the Python ones such as Django, Flask, Pyramid, as well as Ruby, JavaScript, Node, iOS, and Android.
- 25:21You can integrate Rollbar into your existing workflow, send error alerts to Slack or HipChat, or even automatically create issues in Jira, Pivotal Tracker, and a whole bunch more.
- 25:30Rollbar has put together a special offer for Talk Python To Me listeners.
- 25:34Visit Rollbar.com slash Talk Python To Me, sign up, and get the bootstrap plan free for 90 days.
- 25:39That's 300,000 errors tracked all for free.
- 25:42But hey, just between you and me, I really hope you don't encounter that many errors.
- 25:46Loved by developers at awesome companies like Heroku, Twilio, Kayak, Instacart, Zendesk, Twitch, and more.
- 25:52Give Rollbar a try today.
- 25:54Go to Rollbar.com slash Talk Python To Me.
- 25:56Yeah, so you said, well, your website, which I'm presuming you had a say in what it said,
- 26:10says that the end goal of the Beware project is to be able to do for mobile and desktop facing software the same thing that Django has done for web software.
- 26:18I think that touches on the point you just made that like Django, the Django community, Django girls, all these different groups seem to have found a way to make it really easy to onboard into dynamic server-based web development,
- 26:33which is not really a simple thing to do, to be honest.
- 26:36There's a lot of moving parts and things you've got to know.
- 26:38Yeah, and I suppose that's the Django girls analogy is really the one that's really is my yardstick for when this is successful,
- 26:46because what the Ola Sotaska, Ola Sendecker have done and the rest of the team with Django girls as it's grown has been absolutely amazing,
- 26:53because it proves that you don't need to have a computer science degree to be able to do things on the web and to do really meaningful things on the web too.
- 27:04You can take people who are intelligent and engaged with no computer science background and in a day's training course,
- 27:11get them to the point where they have a database-backed website that is under their control, publicly visible somewhere on the internet.
- 27:18Now, there's that, yeah, at some level, that's an absolutely huge achievement, you know, because this is incredibly empowering for those people.
- 27:26But it also, having APIs, part of the reason it's possible is because we've got an API, we've got Django,
- 27:31we've got a language like Python that is readable and gives reasonably good error messages and enforces reasonably good practices.
- 27:38But we haven't done it by taking something and dumbing it down.
- 27:43We've taken the live tool and just pointed them in the direction of things they have to do.
- 27:48That's powerful.
- 27:49That's super powerful.
- 27:50I think that's also one of the powers of Python is there are simple languages out there, Visual Basic, for example,
- 27:58that is super easy to get started with, but they don't go very far.
- 28:01And then there's really powerful languages like C++, Java, C#, whatever.
- 28:07But there's, you know, that first step is like a really big jump.
- 28:11And Python, I think, is just really well designed in that it actually spans both of those.
- 28:17And so we're kind of lucky to be in this space as well.
- 28:20Yeah, no, I agree.
- 28:21I mean, it's Python is a language that is easy enough to teach to beginners and simple enough and conceivable enough that you can –
- 28:29hello world is one line of code.
- 28:30You don't have to teach a whole lot of computer science concepts to get going.
- 28:34But that doesn't mean the computer science concepts aren't there.
- 28:37You can do asynchronous decorators and, you know, all this kind of really, really hardcore computer science stuff without –
- 28:44but you can opt into it as you need to over time.
- 28:47And you can get basic stuff done.
- 28:49And Django, you know, something like Django, you can provide an API that lets you get stuff done with most of the important –
- 28:56sort of the difficult questions answered for you, but with an option in the future that if it ever starts to become a problem,
- 29:02you can dig in and replace that decision with something that's going to scale better or perform better or whatever the problem happens to be.
- 29:09Yeah, absolutely.
- 29:10And we have a lot of good examples like, hey, you can build Dropbox or Instagram or whatever.
- 29:14Yeah, exactly.
- 29:15I mean like, okay, well, whatever you're trying to do is probably not that complicated.
- 29:18So perfect.
- 29:19This will work for you.
- 29:20You can scale from Django Girls to Dropbox without – or to Instagram without – you know, okay, yes, you've got to level up along the way.
- 29:27And there's – you know, the Django that's being used in Instagram is not the same Django that's being used in Django Girls in some regards because so many parts have been swapped out.
- 29:35There was a quote from Cal Henderson at the very, very first DjangoCon where he sort of points out that the frameworks – the companies that are at the top of that performance tree,
- 29:45the top 1% of websites have very, very unique requirements because they've got very specific traffic patterns and very specific queries that need to be issued.
- 29:53And there are some things they have to do a lot of that other people don't have to do a lot of.
- 29:57The good news is that 99% of websites are not in the top 1% of websites.
- 30:02So for most of those websites, you can just take a common entry point, give them something generic, and as long as they've got the power to move over time,
- 30:09then it doesn't matter that you're hiding the detail from them initially.
- 30:12Yeah.
- 30:12Yeah, that's really great.
- 30:13One of the things that I thought would be fun to do for the audience would be to look at all the different projects that you have going on
- 30:20because I looked at it here and I was just blown away at how many different things, you know, following the Unix philosophy that you pointed out,
- 30:27cool little tools that fit together that you guys have here.
- 30:31So maybe we could do like a quick survey of those.
- 30:33Sure.
- 30:34Okay.
- 30:34And it's interesting that this is actually, no, reactions are probably the wrong way to putting it.
- 30:39It's sort of, it's lessons learned from being involved in Django.
- 30:43The Unix philosophy here is not just about a single tool that does something well and therefore makes it easy to use and powerful to plug into something else.
- 30:50It's also a contribution aid because if you've got a tool that you know only does one thing and only does one thing well,
- 30:57the code base is inherently smaller.
- 30:59Now, overall, the amount of lines of code that are ultimately going to end up in everything that's Bware is probably going to be as big, if not bigger than Django, I imagine.
- 31:06But if you want to just contribute to the coverage tool, you can look at just the code for the coverage tool.
- 31:13You don't have to carry the entire baggage of all of Bware to be able to understand that one piece.
- 31:18Yeah, that's a great point.
- 31:19It makes it easier to consume piece and which makes it easier to get involved.
- 31:23But yes, so a survey of what we have.
- 31:26Sure.
- 31:27Well, also, I think that also is helpful from a project management and scope perspective.
- 31:32Like somebody proposes a feature for Cricket, the test runner.
- 31:36Well, like it really had better be about running tests, right?
- 31:39And not like an editor feature or something, right?
- 31:41Like if this was some giant project that did all these things, well, maybe it makes sense to add this funky drag and drop editor thing that somebody's proposing or whatever their idea was, right?
- 31:50Yeah, yeah, exactly.
- 31:51And, you know, you can say, well, okay, yes, this should absolutely be a tool.
- 31:54It's just not Cricket because Cricket is a test runner.
- 31:56Yeah.
- 31:57Excellent.
- 31:57Perfect.
- 31:58So just for people listening, you can find all this stuff at pybee.org.
- 32:02So P-Y-B-E-E dot O-R-G.
- 32:04And so let's talk about some of the tools.
- 32:07Like you had built some tools for actually performing checks when people do pull requests.
- 32:12And you call that B4 with two E's.
- 32:14Nice.
- 32:15Yes.
- 32:15We're big on puns as well.
- 32:17So there's almost always an inside story or a background gag.
- 32:23The person who suggested B4 to me suggested at the same time a different name that I really am kicking myself I didn't pick, which was Apis Praiore, which, yeah, sort of is the Latin for B.
- 32:34But, you know, Apriori, Apis Praiore.
- 32:36But, yeah, so B4 is – we haven't actually got that one live yet.
- 32:39It's basically we're looking for a way to actually run that and integrate.
- 32:43But it's essentially – all it does is listens for a pull request trigger, runs in the same way that you don't – you know, pysetup.py –
- 32:49pysetup.py test runs your test suite.
- 32:52Pythonsetup.py B4 will go through and run linters.
- 32:56It'll go through and run spell checkers.
- 32:57It'll go through and run any of the pre-commit checks that you might have, which is also not something that's particularly uncommon.
- 33:03But the thing that's different is that it integrates with GitHub so that when you – if you look at, like, your GitHub pull request, if anyone's integrated with something like Travis, it will run your pull requests – sorry, run your pull requests through Travis, run the test suite, and then if it passes the tests, give it a little green tick.
- 33:18B4 will also put a little green tick to say, and the linting is fine, and the spell checking is fine, and this, and this, and this.
- 33:25So just as a sanity checker, before anyone even reviews a pull request, we can go through 15 different checks if we need to about what this code needs to look like and provide the automated feedback to say, oh, yeah, no, hang on.
- 33:38You've got an indentation problem here on line 17 and a spell check – a spelling problem in your documentation over here and so on and so on.
- 33:46That's actually taking a suggestion from the Rust community that they've sort of discovered – I don't know if it was accidentally or intentional or if there's something behind it – but that if you've got feedback that needs to be given, it's – that is sort of mechanical in nature.
- 34:01It is better for that feedback to come from a robot because people understand that robots don't have emotions and aren't being – they're not picking on this because you're a human.
- 34:09They're picking on this because it's not fitting a rule, and so they will work with it.
- 34:13It also means it can be automated, which is one more thing that you don't have to do as a developer who is reviewing this code.
- 34:21If I look at a B4 approved patch, I know that it passes all the tests, and it has been linted, and it doesn't have any spelling mistakes, and so on and so on.
- 34:29Yeah, it's great, and so you save your energy for reviewing things like algorithms and the checks that should be there and whatnot, right?
- 34:36Yeah.
- 34:37Cool.
- 34:37So the next one that's on the list is Duvet, which is your coverage visualization tool.
- 34:42We talked about that.
- 34:43And then there's Briefcase.
- 34:45That's the one that lets you package your Python app into a standalone application, and I just can't get over the possibility of how cool that is.
- 34:53I know there's been like Py2exe and CX Freeze and Py2app, and they all seem to like almost work, and they just drive me crazy.
- 35:02Yeah, and that was kind of my – like I'm aware these projects exist, and a lot of them work really well for Windows but don't work on any other platform.
- 35:11So in some cases, I will admit I haven't actually done a whole lot of packaging work here on Windows, and I haven't done any on Linux at this point.
- 35:18But the approach that I'm sort of taking there with the way Briefcase is working is basically, well, here is a template for what an app needs to look like if only I knew the one script I need to run.
- 35:28Put my one script here, and the rest goes.
- 35:30It's also a helper sort of thing for iOS and Android because in order to get an iOS project running, you can't just drop a Python script somewhere.
- 35:39You actually need to have this great big iOS Xcode project, and most of that can be automated.
- 35:45Yeah, and it actually creates an Xcode project file, right?
- 35:49Yes, exactly, and the intention is in the not-too-distant future, hopefully, that it will create the Xcode project, compile the Xcode project, push the Xcode project to the device, and start it.
- 35:59Yeah, that's fantastic.
- 36:01Yeah.
- 36:01Like I said, I'm very thrilled about this, and this is going to require lots of attention because that looks cool.
- 36:07The other one that we talked about that's next in the list is Cricket, so that's your GUI test runner.
- 36:12That was your first foyer in this whole beware plan, right?
- 36:16Correct, yeah.
- 36:17Yeah, that's where I started as a proof of concept that, yes, you could build a cross-platform GUI tool that was useful for development purposes that you could pip install into your development environment and just use.
- 36:29I mean, the thing that's interesting there, that sort of pip install thing, if you've got – like test runners aren't unusual in IDEs, but in order to get them to work, like you need to know where PyCharm puts its path setting.
- 36:39You need to know where the environment variables go for the test environment to start up.
- 36:45So like in Django's context, it's, you know, you need to set Django settings.
- 36:48You need to know where the Django settings file is so that the application can start.
- 36:53Working out where to put that in your IDE is a complex thing.
- 36:57Whereas with – one of the interesting side effects of Cricket is because you pip install it into your environment, when it starts, it forks from inside your running Python environment.
- 37:05So you inherit all the environment that it needs to run in.
- 37:09So as long as you can run a test suite, as long as your environment is set up the way that, you know, your command line environment should be set up, Cricket just works.
- 37:18You don't have to – there is no configuration dialogue for Cricket.
- 37:20Yeah, that's awesome.
- 37:21I really like it.
- 37:23And, you know, the playful icons and the fun names really make it, like, enticing to go explore these.
- 37:30So the next one, speaking of that, is called Bug Jar.
- 37:33Yeah, and I'm actually mildly surprised that that name hadn't been taken anywhere because it seems like an absolute gimme for a debugger.
- 37:39That's actually, like, if you dig back into the archives behind – before Cricket, Bug Jar is actually where I really started because what I really wanted – PDB is an incredibly powerful tool.
- 37:50PDB is – the API, the way it all works is fantastic.
- 37:54The PDB interface, to my mind, is toxic.
- 37:58And I know that there is IPDB and there's PDB++ and there's a bunch of other tools out there, but they're all console-driven.
- 38:04And I know there is WinPDB, but I've never been able to get it to actually, you know, work.
- 38:09What I really, really wanted was the debugger that was like the one that I had in 1988 when I first got my copy of Ball and C, but for Python.
- 38:19And I got a little distracted along the way.
- 38:22Eventually, I'm going to get back there, I swear.
- 38:23That's a great idea, and I really appreciate a visual interactive debugger myself as well.
- 38:29I know you can do it with – in the command line, but it's not the same when you're working on a large project, in my opinion.
- 38:36Yeah, I mean, the visual scope and context you get by having an arrow pointing at a line of code with a window on the side that says the value of X is 3 versus a command line interface where you have to type 15 commands to get the same amount of information.
- 38:50It just – it seems like a no-brainer to me.
- 38:52Yeah, absolutely.
- 38:53So the last one is kind of a quick documentation one called Galley.
- 38:57Yeah, the name on that may actually need to change because we've lost the namespace on PyPI.
- 39:02That's the one that finally pushed me over the edge with TK because TK doesn't have a web widget.
- 39:08I write documentation.
- 39:10I like – I don't like writing documentation, but I appreciate the documentation is important and I need to write it.
- 39:15But Sphinx, as much as markdown and restructured text try to look like markup, they don't.
- 39:25So you end up writing a bunch of code, compiling it.
- 39:28Oh, I missed – I didn't put – there's one less underscore that I needed on that particular thing or I forgot the colon after this bit.
- 39:37So the idea behind Galley was to provide you a text window on one side where you edit your text and then actually render it so you can see what it looks like as you modify it.
- 39:45But in order to do that, you need to have a web browser to actually display the content of the code or the content of what has been generated and you can't do that in TK.
- 39:54Actually, the other interesting thing about Galley is that it actually takes me a little bit closer to the thing that got me involved in Django in the first place, which is an editing tool.
- 40:02There's a whole other podcast in the tool that in my dream of dreams I'm eventually one day going to write.
- 40:08That's sort of an editor that is context-sensitive or syntax-sensitive.
- 40:12But, yeah, that's a talk for another time.
- 40:14All right.
- 40:15Awesome.
- 40:15Sounds great.
- 40:17All right.
- 40:18So that wraps it up for the tools.
- 40:21Let's talk about some of the libraries.
- 40:22And these libraries are – each one of them is really ambitious.
- 40:25And it's just one more library.
- 40:27So that's pretty cool.
- 40:28So the first one is Coliseum.
- 40:31This has to do with the layout and putting stuff basically on a screen.
- 40:36Is this for the web or is this for your Python desktop app?
- 40:40No.
- 40:41So this is actually targeting – like the reason I started that project is specifically because of Toga.
- 40:45When I started Toga, the original plan was to use something called Cassowary, which is if you've ever programmed for iOS,
- 40:52it's the constraints algorithm that underpins Cassowary.
- 40:56So that underpins iOS.
- 40:57So effectively, it's a linear algebra approach to describing how widgets appear on a page.
- 41:03If you've ever written any GUI code for a native application, you effectively have to say,
- 41:09I've got a button and a button, and there's a split pane, and the split pane is this, and so on and so on.
- 41:14And there's usually some box model that's involved, which here is a stack of vertical boxes,
- 41:18or here is a grid of some description.
- 41:20The Cassowary is trying to do an algorithmic approach, which says, I'm going to specify how my desktop lays out as a series of linear programming constraints.
- 41:30So the left side of this button must be 10 pixels from the left side of the screen,
- 41:35but the right side of the button must be no more than 10 pixels from the right side of the screen, and so on.
- 41:41And then you run Cassowary to solve the linear programming constraints, and then your widgets appear on the screen.
- 41:47Now, that's incredibly powerful, but it's also an absolute pain in the butt if when it goes wrong,
- 41:54because all of a sudden you're trying to solve-
- 41:55Yeah, it's super hard to debug that iOS stuff, and you're just like, what is going wrong with this?
- 41:59Why does this not work?
- 41:59When it works, it's great.
- 42:01When it doesn't, you are screwed.
- 42:03So prompted mostly by React, they sort of, or React Native rather, they sort of pointed out that you could lay out,
- 42:11like the CSS box model, yes, it's intended for the web, but there's actually nothing web-specific about it per se.
- 42:18It's basically just a set of algorithms for how you put boxes of content and relate boxes of content in a tree-like structure.
- 42:25So what I said originally ported just the version of Flexbox that React has developed,
- 42:31and the intention is to connect that into a full CSS2 plus Flexbox plus any of the other interesting pieces of the CSS spec
- 42:40that you can use for any boxes.
- 42:42Now, obviously, that immediately translates to buttons, widgets on a page,
- 42:46but you could also do things like, okay, I need a HTML to PDF translator.
- 42:52Well, okay, I can take the DOM tree that I've got and use that to turn out a set of drawing instructions.
- 42:57So the intention is that ultimately Colosseum is going to be powerful, or it will be powerful enough
- 43:03that you can throw an arbitrary piece of CSS and some tree of content and be able to render it.
- 43:10The interesting side effect of that, of course, is that when you actually want to take Toga and deploy it to the web,
- 43:15which is something I've spoken about at DjangoCon Europe this year, it means that you've actually got CSS.
- 43:21So you've got the same layout mechanism on the web that you're using in your native GUI toolkits.
- 43:27So you don't actually have to have a separate layout scheme working out there.
- 43:30Yeah, that's cool.
- 43:31I really like it.
- 43:32That's quite ambitious.
- 43:34I definitely think CSS is a fabulous way to layout things.
- 43:39I've used a lot of Windows, rich GUI type of layouts, and I've always gone, gee, if I just had CSS, this thing would be maintainable, you know?
- 43:48I will admit I do have a bit of a love-hate relationship with CSS more generally, but it's sort of – in terms of a general – it is something that is well-known.
- 43:56It is something that is well-understood.
- 43:57It is something that is well-documented.
- 43:58It is something that is open.
- 44:00And that sort of combination of stuff, but the only – it makes it really powerful, but the only thing we don't have is an open implementation that isn't tied to a browser.
- 44:09Yeah.
- 44:10So, yeah, at some point I'd need to sit down and spend a whole lot of time just working on Coliseum.
- 44:15At the moment it's fairly limited in what it can do.
- 44:17It's useful enough but not completely CSS or the complete CSS.
- 44:20Sure, sure.
- 44:21Yeah.
- 44:22Cool.
- 44:22And, you know, I think part of that frustration, at least projected my own frustrations I've had with CSS and things like that and the design is,
- 44:30more about when the implementation varies.
- 44:33It's like, why does IE have a line here, a border, and why does Firefox have a space and Chrome has neither of these, like – that's not really a frustration with CSS.
- 44:41That's just, like, with the browsers.
- 44:43Yeah.
- 44:44Yeah, for sure.
- 45:00IE platform for top Python developer jobs.
- 45:02Create your profile and instantly get access to 3,500 companies who will work to compete with you.
- 45:07Take it from one of Hired's users who recently got a job and said,
- 45:10I had my first offer on Thursday after going live on Monday and I ended up getting eight offers in total.
- 45:15I've worked with recruiters in the past, but they've always been pretty hit and miss.
- 45:18I tried LinkedIn, but I found Hired to be the best.
- 45:21I really like knowing the salary up front.
- 45:23Privacy was also a huge seller for me.
- 45:26Sounds awesome, doesn't it?
- 45:28Well, wait until you hear about the sign-in bonus.
- 45:29Everyone who accepts a job from Hired gets $1,000 sign-in bonus.
- 45:33And as Talk Python listeners, it gets way sweeter.
- 45:35Use the link Hired.com slash Talk Python To Me and Hired will double the sign-in bonus to $2,000.
- 45:41Opportunity's knocking.
- 45:42Visit Hired.com slash Talk Python To Me and answer the door.
- 45:48Yeah, so you mentioned Toga a couple times and Toga is a Python native, OS native GUI toolkit.
- 45:59Yes.
- 46:00Tell us about that.
- 46:02Okay.
- 46:02So this is essentially the bit that comes before the actual application.
- 46:06So the philosophy we've kind of taken is that native is good.
- 46:10Native is what you're looking for.
- 46:11You want something that looks native, feels native.
- 46:13It's not pretending to be agnostic.
- 46:16It's not pretending to be the platform that it's not.
- 46:18It gives you – if you want a button, it's a button the way that a button looks on that platform.
- 46:23And it sort of does that by being Python first, Python native, which means that you're not looking at an API that is very obviously C wrapped in Python.
- 46:32It enables you to do things like – the classic example is whenever you've got a long-running task in most widget toolkits, they are C or some variant thereof.
- 46:43And so you come up with some small quantum of work that can be evaluated and you push that quantum of work into some form of timer in a separate thread that gets evaluated at some regular interval.
- 46:56In Toga, you use the same – just a function that's a callback except you make it a generator.
- 47:01You make it yield regularly.
- 47:03And when it yields, what it does is it yields to the event loop and then it resumes inside where it was previously.
- 47:09So you can exploit the fact that Toga gives you – or so Python gives you this mechanism to resume where you were inside a method, which isn't a capability you have inside Java and C and C++ and so on, to produce an API that is rich and flexible.
- 47:24You know, when you want to specify a list of something, you just give it a list of something.
- 47:28When you want it in a string, you just give it a string.
- 47:30And it works out how to make that render in a native fashion, in a native appropriate fashion.
- 47:35Yeah, that's really amazing.
- 47:37And if you want to try it out, anyone listening can just pip it, soltoga, T-O-G-A, and then toga-demo, right?
- 47:44And then boom, you have a running GUI right there.
- 47:47It looks totally native to me.
- 47:49Yeah.
- 47:49And it is completely native because it is – you know, when Toga demo runs, it is firing up on Mac.
- 47:54It's an NS window with an NS split pane with an NS list or NS table and so on and so on.
- 48:01And when you click on the button that's a dialog, it's an NS alert box or whatever it happens to be.
- 48:05And then if you do exactly the same on the GTK, it's a GTK window with a GTK split pane with a GTK button in it and so on and so on.
- 48:12So if you look behind this, it sounds like it's incredibly complicated, but the actual code behind Toga is relatively simple once you've got the bridging to the native layer done.
- 48:20On GTK, you get that for free because there is a native Python API.
- 48:24And Rubicon, which is the library that lets us get to Objective-C, is complex but almost completely transparent because you just sort of name the classes and name the methods in a slightly funny way and you can access them.
- 48:35So the native Toga implementation of a button on macOS, for example, is about 30 lines of code and it's 30 fairly straightforward lines of code at that.
- 48:46So adding new widgets is relatively simple.
- 48:48And at the end of the day, if you do actually want to get into a widget that is very macOS specific, you can just drop into that level.
- 48:54Okay.
- 48:55Yeah, that's really great.
- 48:56Toga looks really amazing.
- 48:58And like I said, I think building out these truly OS native things in Python, mix that with a briefcase.
- 49:06Very lovely, right?
- 49:07So the next one, I'm sure I'm going to mispronounce.
- 49:10So can you hit it for me?
- 49:12Okay.
- 49:12So that's Oroboros.
- 49:13Oroboros.
- 49:14Okay.
- 49:14Yeah.
- 49:15Yeah.
- 49:15So Oroboros, for those who don't know the Greek mythology or the old Latin mythology, it's the image of a snake eating its own tail.
- 49:24So the idea here is that if we're going to – part of being – of Toga is trying to be cross-platform.
- 49:30So we've got it on macOS.
- 49:31We've got it on GTK.
- 49:32We've got it on – we've got some parts of it on Windows.
- 49:35But they're all just sort of standard Python running in standard Python-y kind of ways.
- 49:39We've got Python running on iOS, and that's actually just CPython compiled for iOS because iOS is, as much as they try to hide it, C under the hood and Clang under the hood.
- 49:49But on Android, they really, really, really want you to be using Java.
- 49:53So I've kind of had to do a bit of an interesting shim to get there, which I'm sure we'll come to.
- 49:56And for deploying to the web, if you want Python on the web, well, you've got to have it written in JavaScript.
- 50:03In order to do that, you need an implementation of the Python standard library written in – written so it works on that platform.
- 50:10Now, a lot of the Python standard library is written in Python, but there are some parts that aren't.
- 50:13So things like the underlying core of date time, mk time, and time structure T and things like that are native concepts.
- 50:21So you've got to have a native implementation of those concepts that the rest of the standard library can then build on.
- 50:26And so Oroboros is attempting to build as much of the standard library in Python as we can possibly build, cribbing from CPython when we can, and then filling out the rest with the interface, the API that you need to implement in order to have date time working inside a web browser or working on an Android phone.
- 50:48That's really amazing.
- 50:49Have you combined that with PyPy?
- 50:52I think we have actually taken some pieces with PyPy, and I think there probably is some crossover there in terms of what we're doing and what they're doing in that PyPy benefits from having a pure Python version of any module because they can then optimize the entire VM rather than just optimizing parts of it.
- 51:07So at some point, I don't know if we'll merge with PyPy, PyPy merges with Oroboros or whatever, but there is a piece there that I think that can be shared at the very least.
- 51:16Yeah, absolutely.
- 51:17That definitely seems like that would be great because if you have it in pure Python and you feed it to PyPy, it should go nice and fast.
- 51:23Theoretically.
- 51:24That's the intention, yeah.
- 51:25And that is ultimately what PyPy is doing a lot of the time.
- 51:28It is just they have re-implemented parts of what is written in C in Python so that it will run fast because they can pass the full bytecode optimizer over everything it's doing rather than just parts of what it's doing.
- 51:40Right, absolutely.
- 51:41So that brings us pretty naturally to the next major category, which you call bridges.
- 51:46Yes.
- 51:48I love the subtitle, boldly going where new Python has gone before.
- 51:51Sorry, the question from before might be like, well, all right, great.
- 51:55It's a pure Python standard library.
- 51:57Like, what can you do that?
- 51:58But then you have Batavia, which would work really well with that, right?
- 52:03Yeah, so the idea here is that Batavia specifically started as a bit of a joke at PyCon Australia Sprints last year.
- 52:10I don't particularly like JavaScript.
- 52:12I accept it that it exists and it is the lingua franca that is on the web and it's not going anywhere.
- 52:16And I don't want to language shame anybody for having knowing JavaScript.
- 52:19It is an important language to learn, to know, and there are some very valuable things in there.
- 52:23But I would be a very happy man if I never had to write another line of JavaScript in my life.
- 52:27So part of that is that if I'm going to write web software and I want responsive front-end web software, I need to have Python running in the browser.
- 52:36Or alternatively, I need to rewrite everything I'm doing on the server in JavaScript, which given that I don't want to do that, I need to get Python into the browser somehow.
- 52:45So what Batavia does is take a look at the fact that when you compile CPython, now Python as a whole is a, you know, if you wanted to have a complete Python compiler and interpreter and everything, yeah, that's a big thing to build.
- 52:59And there are people who are doing that.
- 53:01You know, Brython and Sculpt both do that.
- 53:03PyPy.js takes a slightly different approach.
- 53:05I had Ryan from PyPy.js on and there's a bunch of cool stuff that's happening to him.
- 53:09But a lot of those projects are really large or they make big trade-offs in terms of support.
- 53:13Yeah, so like, you know, PyPy.js, I don't know exactly where it's at in terms of size now.
- 53:17But like the first time I looked at it, it was like 20 megabytes as a compressed download.
- 53:21And that's fine if you've got that already cached.
- 53:24But if you want to build your next Instagram, downloading a 20 meg bootstrap is just not a candidate.
- 53:30So Batavia treats it at a slightly different angle.
- 53:33So in saying instead of we don't actually need the full Python interpreter or the full Python compiling tool chain with a REPL and everything else,
- 53:40what we need is the ability to run Python code.
- 53:43CPython compiles to bytecode.
- 53:46Bytecode is a simple virtual machine with 150 odd instructions, most of which are push, pop, add value, subtract value, this kind of thing.
- 53:54Can we implement that virtual machine in JavaScript and then just give it Python bytecode?
- 54:00And the answer is yes.
- 54:01And it turns out to be a relatively small amount of bytecode as well.
- 54:04You can get Batavia, like a fully functioning Batavia instance running in something like 10 kilobyte of compressed JavaScript.
- 54:11And I'm sure there's all sorts of opportunities to optimize there as well.
- 54:15That's amazing.
- 54:16And that's totally acceptable for downloading 10, 15K in JavaScript.
- 54:19Yeah, yeah, yeah.
- 54:20So that's less than your logo image in most cases.
- 54:23You know, it's easily an achievable goal.
- 54:25And all you're really losing is really performance at that point because it is CPython that is running.
- 54:32It's just running in the browser using JavaScript to emulate the pieces that can't be done natively.
- 54:38Now, the other thing I have to shout out here is part of the reason that I know this or I thought this joke actually might be plausible is a blog article slash book chapter written by Ned Batchelder and Alison Captur called Architecture Open Source Volume 4, which looks at sort of a bunch of complex problems and says, okay, let's solve this problem in 500 lines or 500 lines of Python.
- 55:04And Alison's chapter in that book.
- 55:07Yeah, that's a cool book.
- 55:08Yeah, it's a very cool book.
- 55:09Yeah, it's an amazing book.
- 55:10And one of the chapters in there is here is a Python interpreter written in 500 lines of Python.
- 55:14And that blew my mind when I read it.
- 55:18It's amazing stuff.
- 55:19But it also means, hang on, 500 lines of Python, that means I should be able to do it in about 500 lines of JavaScript as well.
- 55:25And that's about dead on.
- 55:26It's not that far from it.
- 55:27You need a little bit more bootstrapping to say like JavaScript's only got numbers.
- 55:31You need a concept of integers and floats and they need to behave the right way.
- 55:34There's a little bit of bootstrapping you need to do around the outside.
- 55:37But it's achievable is the point.
- 55:39And you can do it in sub 100k of code or some 100k of deliverable artifacts, which means that when you – if you've got like a – say you've got a Django server that has a form and the form has a validation function at some point.
- 55:53That validation function is Python code.
- 55:56It can be compiled as a code object.
- 55:58That code object has bytecode.
- 56:00That bytecode can be turned into a string.
- 56:02The string can be sent to the browser.
- 56:03The browser can then run that JavaScript – or say run that bytecode in the JavaScript version of the virtual machine.
- 56:10And then you've got not just similar or transpiled or whatever, exactly the same code running on the client and the server.
- 56:17And you've written it all in Python.
- 56:19Yeah, that's great.
- 56:21So it takes the load off your server because most of the stuff would happen client-side.
- 56:26And it means you write it once.
- 56:27Yeah, it's not just the load.
- 56:28I mean the load is obviously a benefit.
- 56:29But it's also – if you want a rich user interface, you want to say you want to validate credit card numbers as they're being typed in.
- 56:35You can't do that server-side because this is something I get acutely aware of because I'm in Australia.
- 56:39You can't change the laws of physics.
- 56:41Ping time from me to the east coast of the U.S. is 300 milliseconds.
- 56:45You cannot change that unless you are willing to accept a 300 millisecond or longer delay in every user interface action.
- 56:54It has to be running locally.
- 56:55And if you can run it in Python, then all the better.
- 56:58Yeah, very cool.
- 57:00Those two go together.
- 57:01Great.
- 57:01That's awesome.
- 57:02So that's Python in JavaScript.
- 57:06Yes.
- 57:07What if I want to run Python bytecode on, say, the JPM?
- 57:11Well, I'm glad you asked.
- 57:13So, yeah, the next project on the list is VOC, VOC.
- 57:17That is a – takes a very similar approach to what Batavia has done.
- 57:21But instead of saying let's target JavaScript, let's rewrite a CPython interpreter in JavaScript, it says, okay, CPython, when it runs, is a stack-based virtual machine.
- 57:32Java, when it runs, is a stack-based virtual machine.
- 57:37Now, okay, to be sure, they are different stack-based virtual machines.
- 57:40They have different requirements.
- 57:41They have different needs.
- 57:42They have different operational characteristics.
- 57:44But they're close enough that if you squint, you can turn one into the other.
- 57:49And so that's what VOC does.
- 57:51VOC says, okay, let's take this Python code, CPython code, and compile it into directly the equivalent Java class files.
- 58:00Not turning it into Java code that gets compiled.
- 58:03Turning it into the class file directly.
- 58:05So the output isn't a PYC file.
- 58:07The output is a .class file.
- 58:09That then runs as if it was Java because it is Java.
- 58:14So, and the sort of interesting little side effects of things like that is that when, you know, you write your Python code and it throws an exception, for example, the exception can point at the line of Python code that generated it.
- 58:26Now, this sort of general approach isn't that unusual.
- 58:28If you look at something like Scala, Scala is just a compiler that produces Java class files.
- 58:33It happens to be a different functional language.
- 58:35So all we're doing here is effectively a compiler that takes Python input and spits out Java class files.
- 58:41Now, that's critically different to something like Jython, which is a full implementation of a Java virtual machine and Java compiler and all the rest.
- 58:50So when you run your Python code through Jython, it is Python code being interpreted in Java at runtime.
- 58:58Right.
- 58:58Which is also not to be, not to dis Jython.
- 59:01Jython is a great project as well, but it's a different approach.
- 59:04Right.
- 59:04It's almost like instead of using C to implement the virtual machine, they're using Java versus actually compiling, compiling the steps.
- 59:13Yeah.
- 59:14And ultimately, the reason that I've kind of started VOC is that you say it's written in Java rather than written in C star, except for the parts that aren't.
- 59:23Because there are parts of the compiler tool chain, Xerces and what have you, that are written using the Java native interface.
- 59:33And so you can't actually, at least not at the moment anyway, you can't compile Jython for Android because there are parts that will not run on Android.
- 59:43So I needed a different approach to get things working on Android.
- 59:45And so, you know, VOC was born.
- 59:47Cool.
- 59:47And VOC works on Android.
- 59:48And yeah, the intention was originally to target it for Android.
- 59:51But by a side effect, because Java is actually a cross-platform runtime environment, I've, you know, I knocked out a demo swing application.
- 59:58You can write a native swing application that gets native swing APIs in Python and it will run through Java.
- 1:00:05And you can't tell that it's not Java.
- 1:00:06That's really cool.
- 1:00:07It turns out a Java API, a Java user interface that looks awful because it's not native.
- 1:00:12But, you know, it is using Swing's native components.
- 1:00:14You could entirely plausibly write a, you can't do it yet, but conceptually, you could take Django, compile it to Java class files, run it in a J2EE container, and satisfy your, you know, your enterprise deployment requirement that everything's written in Java.
- 1:00:31Because it is.
- 1:00:32It's just written in Python in Java.
- 1:00:34Yeah.
- 1:00:34They just care how it executes, right?
- 1:00:36Interesting.
- 1:00:37Yeah, exactly.
- 1:00:37So I'm always, you know, I've done a lot of, like, scientific parallel computation type stuff previously.
- 1:00:44And I'm always on the lookout for things that let me dodge the GIL.
- 1:00:48Does this let you dodge the gill?
- 1:00:51Well, effectively, yeah, because, you know, it is on, when it's compiling, it's compiling for the Java virtual machine.
- 1:00:56So it is producing thing, you know, the variables are all locked the same way they would be in a piece of Java code.
- 1:01:02So it is a GIL-less version of Python.
- 1:01:05With all the language, well, not all yet, because I'm still working on bits of it.
- 1:01:08But, you know, you can do anything you can do in Python, you can do in Vox.
- 1:01:13You know, you can, for example, you can do yield statements in Vox.
- 1:01:16There is no equivalent of a yield statement in Java.
- 1:01:19But I can, you can generate the Java bytecode that does the functionality of yield, because it's essentially just assembly language at that point.
- 1:01:26It's just Java assembly language.
- 1:01:28Okay, very interesting.
- 1:01:29All right, final one on your bridge.
- 1:01:32Is Rubicon.
- 1:01:32Yeah, so Rubicon was, there was originally a Rubicon Java as well, which I was looking at using for Android, but turned out to not be quite plausible for various reasons.
- 1:01:41But it's mostly there for the Objective-C portion.
- 1:01:43So I touched on this earlier, that Objective-C, for all of the funny syntax, is ultimately just a series of C APIs.
- 1:01:51And C types, which is part of the Python standard library, lets you call any native C function as long as you know it's prototype.
- 1:01:58So you can invoke any Objective-C API directly from Python without having to compile anything.
- 1:02:03And then Rubicon then sort of wraps that up in a bunch of meta classes and whatnot, using the Python 3 type annotation syntax to say, well, this argument is an integer and this one is a Boolean and it returns an object.
- 1:02:15Map that to the underlying call in Objective-C.
- 1:02:19You end up with, you know, you can instantiate an NS button the same way that you would in Python normally.
- 1:02:25The only difference is that the message passing syntax replace colons with underscores and the method names get really long.
- 1:02:31But that's kind of, you know, you don't have to pre-compile, pre-declare, pre-anything about what is in your Objective-C environment.
- 1:02:39You've just got to call the things you need.
- 1:02:41Wow, that's fantastic.
- 1:02:42So you brought up Python 3.
- 1:02:45What's the story with Python 3 across Beware in general?
- 1:02:48Okay.
- 1:02:48So I have taken the wonderfully controversial stance of saying Python 2 is dead.
- 1:02:53I am developing a set of tools.
- 1:02:56I started developing a set of tools four years ago.
- 1:02:58Four years ago, I was developing stuff in Python 2 primarily.
- 1:03:02I am now at the point where I'm developing new runtimes.
- 1:03:06I'm developing new languages or new runtime environments, new language interpreters, new libraries for cross-platform.
- 1:03:12I have made the decision that I am Python 3 and for the most part, I don't care about Python 2.
- 1:03:17Now, if someone else wants to come in and care about Python 2, power to them.
- 1:03:20I won't turn down the patch.
- 1:03:22But I am aggressively targeting Python 3 and hoping that that will be enough of an incentive.
- 1:03:27Like by the time that Toga is mature enough that you can seriously do stuff with it, that that will be enough of a reason for people to consider building new code in Python.
- 1:03:35And part of that is also that it is also new projects.
- 1:03:38And this is a new library.
- 1:03:39No one is coming to this with existing code base.
- 1:03:42So I can start with the new APIs.
- 1:03:44And so I am.
- 1:03:45Yeah, that's brilliant.
- 1:03:46And on behalf of everyone, thank you for moving us all one step closer.
- 1:03:50That's great.
- 1:03:51Or how many projects do you have?
- 1:03:5215?
- 1:03:53Maybe move just 15 steps closer.
- 1:03:54I don't know.
- 1:03:55But you definitely move just closer.
- 1:03:56So thanks.
- 1:03:56All right.
- 1:03:58So that kind of more or less rounds up beware.
- 1:04:00There's a few more things on here.
- 1:04:01One of them is Python Apple support, which let me just read the description because I think it really brings home some of the power of what you have here.
- 1:04:08A meta package for building a version of Python that can be embedded into macOS, iOS, tvOS, or a watchOS project.
- 1:04:16Of course, for Python, written in Python, right?
- 1:04:19That's just so cool that all those OSes are involved in this, right?
- 1:04:23Yeah.
- 1:04:24So I mean this is kind of one of these accidents that happens because Apple is trying to make a consistent development environment for themselves.
- 1:04:31We just happen to be able to, you know, horseshoe, crowbar into place.
- 1:04:35As Apple tries to put or is pushing Swift, they have historically pushed Objective-C.
- 1:04:39Both of those are built on top of Clang.
- 1:04:41Clang is a GCC advanced in various ways.
- 1:04:46So it is, under the hood, a C compiler.
- 1:04:48The good news is that CPython is written in C.
- 1:04:51And so with the application of a few patches, you can compile the default CPython sources for any of those platforms.
- 1:05:02Now, the catch is that, and this is sort of a process of long negotiation with the CPython team,
- 1:05:07is that it's not just a matter of a patch that says, hey, look, you can build for macOS.
- 1:05:12MacOS these days only compiles for one platform.
- 1:05:15It compiles for x86.
- 1:05:16When you compile for iOS, you actually need to compile for, depending upon where exactly you're targeting,
- 1:05:23possibly as many as five or six different platforms.
- 1:05:27You need ARMv6, ARMv7, ARMv7S, i386, x86-64, ARM64.
- 1:05:33And you need to have all of those compiled and turned into what's called a fat binary.
- 1:05:39So it's like one library file that has all of those pieces.
- 1:05:42And there's a whole bunch of tooling that you need to, like, you need to build all the libraries separately
- 1:05:46and then mash them together with this thing, this tool called LiPo, to make them into one library.
- 1:05:52Now, that doesn't fit well into the CPython build chain at the moment.
- 1:05:56I've submitted a proposal for a patch that would enable you to manage that,
- 1:06:01but I don't know if that's likely to ever get merged.
- 1:06:04There's a whole bunch of sort of technical and political things that go on there.
- 1:06:06So Python Apple support is essentially just an external project that says, okay,
- 1:06:10take the CPython source code, download it for you, apply the patch that I know needs to be applied,
- 1:06:15build it, build all the dependencies, build OpenSSL, and build libbz2 and all the other pieces that need to be built.
- 1:06:22And spit out a Python.framework that works on iOS.
- 1:06:26That's great.
- 1:06:27And then the interesting thing is then, okay, well, doing that for iOS, well, you can do it for macOS as well,
- 1:06:32because that's basically just, you know, you only have to compile it for x86.
- 1:06:34tvOS is exactly the same thing, except you've only got to compile it for ARM64.
- 1:06:39And watchOS is exactly the same thing, except you've got to compile it for ARM7K.
- 1:06:43So it's the same basic infrastructure.
- 1:06:45You've just got to change the key that you're calling into.
- 1:06:47I see.
- 1:06:48Just make it a little more Apple-friendly, bundle that all together.
- 1:06:50Yeah.
- 1:06:50Yeah.
- 1:06:51Yeah, exactly.
- 1:06:52Awesome.
- 1:06:52And so one of your main goals was to build a Python toolchain that lets you write these UI apps in Android
- 1:07:00and the various Apple OSes as well as Windows.
- 1:07:03And so you have a bunch of templates as well to help people get started, right?
- 1:07:07These are cookie-cutter templates, which I haven't talked a lot about cookie-cutter, but it's a really great project.
- 1:07:11And I'm sure we'll have Audrey on the show sometime to talk about it.
- 1:07:14Yeah.
- 1:07:15Yeah, so tell us really quickly about your templates before we're out of time.
- 1:07:18Sure.
- 1:07:19So the templates are effectively saying, well, you know, okay, a Python project is, at the end of the day,
- 1:07:24a entry.py that contains print hello world.
- 1:07:27You know, it can be more than that, but that's all you have to have.
- 1:07:30But in order for them to run on iOS, you have to have a whole lot more.
- 1:07:35You have to have your Xcode project and your dependencies and your icons and your configurations and all this other stuff.
- 1:07:39But most of that information is relatively constrained.
- 1:07:43Like we know we need the name of the package, and the name of the package needs to appear here, here, here, here, and here.
- 1:07:47So the templates are basically just saying, okay, well, I know what format it needs to come out as.
- 1:07:52All I don't know is the name of the package I want to generate.
- 1:07:55So let's just leave that as a blank, generate it from template, and then you've got something you can use.
- 1:08:00And then Briefcase takes those templates and takes the support libraries and things like that, pre-compiled versions of the support libraries, and spits them out.
- 1:08:08You run Briefcase over your project.
- 1:08:10If you've got a project that has your hello world.py file, and it has a setup.py that says that's where the file is and these are the dependencies,
- 1:08:19it takes all that information, uses that to generate the template so that you can then just say, run this Xcode project, and off goes your iOS project.
- 1:08:27Or run this, generate the GTK application or generate the watchOS application.
- 1:08:31Yeah.
- 1:08:32That's excellent.
- 1:08:33Yeah.
- 1:08:34So I think your project is great.
- 1:08:36I definitely want to encourage people to check it out.
- 1:08:38We'll probably have to kind of leave it there for that one.
- 1:08:41So one thing I did notice is that you have a couple of upcoming events that you're going to be at.
- 1:08:46Were you just in Portland?
- 1:08:46I was not in Portland for PyDX, no.
- 1:08:49I was in Portland for PyCon this year, and I'll probably be back there next year at this point.
- 1:08:54All right.
- 1:08:54Yeah.
- 1:08:54I was thinking, maybe I just missed you like three days ago in PyDX.
- 1:08:57Anyway.
- 1:08:57No, no.
- 1:08:58Unfortunately not.
- 1:08:59Yeah.
- 1:08:59Okay.
- 1:09:00But so, yeah, maybe tell people about some of the upcoming events that you have that you're going to be at in case they want to meet you or some of the team members or something like that.
- 1:09:07Sure.
- 1:09:07Absolutely.
- 1:09:08So I myself will be – I'm keynoting Python Brazil on the 15th of October this year, and I'll be around for the sprints there as well.
- 1:09:16So if you're in Florianopolis, please come and see me.
- 1:09:19We're very keen to have new people involved.
- 1:09:21About two weeks after that, I'll be in Amsterdam for Django Under the Hood.
- 1:09:25So that's the Django deep dive conference that happens once a year in Amsterdam, and I'll be there for the full sprints of that as well.
- 1:09:33Probably working on Batavia and some of the more webby parts of the framework at that point.
- 1:09:38I'm also speaking at LinuxConf Australia 2016 in January next year down in Hobart.
- 1:09:45If you haven't ever been to Australia, I can highly recommend Hobart as a venue to go to and LCA as a conference.
- 1:09:52It's a great little community.
- 1:09:54It's sort of the Australian equivalent.
- 1:09:56It's like the peak open source conference.
- 1:09:58Despite the name LinuxConf AU, it is a multi-language – there are people there talking about FreeBSD.
- 1:10:03It's kind of an odd name that's kind of stuck around for historical reasons rather than being actually just about Linux.
- 1:10:08So they're the ones immediately.
- 1:10:10There are a couple of other conferences that I'm speaking at in the future, some of which I can't talk about.
- 1:10:15But what's your directories?
- 1:10:18I'm coming to a city near you.
- 1:10:21Awesome.
- 1:10:21Yeah, spreading the good word.
- 1:10:23Excellent.
- 1:10:24Indeed.
- 1:10:25I also noticed that if people need help, they want to set this up and they've got a big team and they really want to get going, that you also offer training.
- 1:10:32So people want to get a jump start, they can contact you, right?
- 1:10:35Yes.
- 1:10:35Then just maybe give a quick shout out to all the people on it if you want to just pull up the list.
- 1:10:39Yeah.
- 1:10:40So I haven't specifically got – it's not like you can come to me and say, here's my rate card for Python training or Choga training.
- 1:10:45It's more an aspirational thing about being able to fund the development of Beware and Python development on a more sustainable basis.
- 1:10:55I have been working on this as sort of a part-time volunteer capacity for the last couple of years.
- 1:11:00I've had some amazing help from Katie McLaughlin and Philip James and Chris Swenson who have done amazing work as well.
- 1:11:07But they definitely have volunteer capacity.
- 1:11:09I have recently been – started to be paid on a part-time capacity from a company called Jambon Software to do bits of Beware development.
- 1:11:18But I would like to ultimately turn this into a full-time gig for myself and a small team of crack Python developers.
- 1:11:25And also to use that as an opportunity to reach out, to get new people involved, to reach out, do diversity, to do diversity and outreach, to bring interns in, pay them for their time and actually introduce them to open source development.
- 1:11:39And once you get to give them an internship with a crack team of people at the top of their open source contribution game, let them loose on the world and see what else they can do.
- 1:11:48So, yes, training is one axis where I'm definitely – I am notionally available for hire if someone wants to do that.
- 1:11:56But I'm also open to all sorts of other options, including if you go to pyb.org, there are some options there for corporate sponsorship if you want to become a member of the project and drop some money in the tin regularly so that we can continue to do what we're doing.
- 1:12:08Because ultimately, the reason I'm doing this is because I like Python.
- 1:12:12I want to keep using Python.
- 1:12:13But I don't think we can continue to sustain large-scale Python development the way that it sort of has been on a wish and a prayer for the last 10, 15 years.
- 1:12:24Django development has not been anywhere near as fast or as motivated as it could have been if we only had a little bit more money or if the Django project had a little bit more money.
- 1:12:35And given the amount of money that is available in the Django community, the number of people who are making millions of dollars with Django, I think it's telling that we haven't been able to find a way to pay the bills a little bit more effectively.
- 1:12:45Yeah.
- 1:12:46I just want to sort of second that thought and say there are so many companies that are many, many million dollars of revenue or billions of dollars that take open source and just go, okay, great.
- 1:12:57This is free.
- 1:12:57This saves us money.
- 1:12:58There's not a lot of giving back, right?
- 1:13:01Like if they just put a small portion, a very small portion back into these projects, it would make such a difference.
- 1:13:06So, yeah.
- 1:13:07Yeah.
- 1:13:07I mean, it's like I've made the gag on Twitter a couple of times where, you know, I'm offering corporate sponsorships in Beware.
- 1:13:13And, you know, $1,000 a month, it sounds like it's a lot of money to you and me as individual developers.
- 1:13:18To a company, it's like not even – it's a rounding error on their soda budget.
- 1:13:23But that's effectively a Desi Russell.
- 1:13:26$1,000 is a Desi Russell.
- 1:13:28You can get one-tenth of me for $1,000.
- 1:13:30Yeah.
- 1:13:31The problem is I need 10 of you to agree to buy a Teddy Desi Russell and then I'm working full time.
- 1:13:35Now, there are more than 10 companies in the world who have a very vested interest in Python.
- 1:13:40I just need to work out who they are.
- 1:13:42Yeah, absolutely.
- 1:13:44Before we move on, before we sort of round up the show, there's always two questions I ask at the end.
- 1:13:49So, I'll send them to you now.
- 1:13:51So, first of all, I think you may be able to pull a few from your own project.
- 1:13:56And that's totally legit if you want to do that.
- 1:13:57But there's over 80,000 packages in PyPI.
- 1:14:01What one do you think maybe people don't know about, you want to recommend, you say, this thing's amazing, you should check it out?
- 1:14:07If I may indulge, I actually have two.
- 1:14:09Oh, you may.
- 1:14:09They are both at the – they're not my project, so I will completely be above board there.
- 1:14:14There's no nepotism at all going on here.
- 1:14:15They're both in the sort of the developer space and they're tools that I have found incredibly useful, particularly since one of the downsides to Beware being lots of little projects is that you have – the process of releasing Toga is not trivial.
- 1:14:29There's a lot of things that need to happen because there are a lot of pieces that need to be released.
- 1:14:33And each one of them has a release process, each one of which needs to be tested and all the rest.
- 1:14:36So the two tools – one is called – a tool called Check Manifest, Check-Manifest.
- 1:14:41It is a really, really boring thing.
- 1:14:44All it does is you pip install it into your project, you run Check Manifest, and it checks that your manifest.in file matches what is checked into your version control so that you don't accidentally release a package that doesn't have three files that have to be there for the source code to actually run and compile.
- 1:15:01Okay.
- 1:15:01Excellent.
- 1:15:02It is mind-numbingly simple, but the number of times I have made that mistake, it is paid for itself – it's paid for its free cost on PyPI many, many times over.
- 1:15:13Nice.
- 1:15:13All right.
- 1:15:15So that's number one.
- 1:15:15Cool.
- 1:15:16That's number one.
- 1:15:16The second one is DevPI, which is a version of the Python package index that you can run locally.
- 1:15:24So it is a fully – it follows the full PyPI protocol and all that sort of stuff.
- 1:15:30And effectively, it just lets you run a local PyPI server that you can talk to.
- 1:15:34So you can upload a package to PyPI and see if it works without actually loading it up to PyPI to see what you've broken.
- 1:15:42So you can sit there and upload the half a dozen packages that are part of Beware, realize that, oh, crap, I've forgotten the dependency here between this one and this one.
- 1:15:50And as a result, repackage Toga version 0.2.1 so that it gets the dependency right or misses the file that you forgot to run check manifest this time.
- 1:16:02And test it out in a sandbox environment rather than pushing it to PyPI where once you have uploaded Toga 0.2.1, you can't upload it again.
- 1:16:11You have to release Toga 0.2.2.
- 1:16:13So, yeah, that one has also saved my bacon on more times than I care to count.
- 1:16:17Yeah, that's a great recommendation.
- 1:16:19All right.
- 1:16:20And favorite editor?
- 1:16:21So I am a sublime text person.
- 1:16:23I like it, but I don't love it.
- 1:16:24And this is one of these areas where one of these days, Toga is going to solve this problem for me.
- 1:16:29I have an intellectual love of Emacs, but I can't bring myself to actually use it.
- 1:16:34Partially because the Lisp syntax does my head in.
- 1:16:37And secondly, because the people who developed Emacs seem to be scientifically opposed to user interfaces that make any damn sense whatsoever.
- 1:16:46Every application on the planet has decided that command save saves on a Mac box, but not on Emacs.
- 1:16:53Now, OK, yes, before the Emacs people come out of the woodwork.
- 1:16:56Yes, I know you can configure it, but it does not come out of the box usable for development.
- 1:17:01And that for me is if your tool ships in a form where it is unusable, then you have a problem.
- 1:17:09My classic one that I absolutely hate about Emacs is that, yes, you can.
- 1:17:14Emacs ships with a tutorial.
- 1:17:15That's fantastic.
- 1:17:16Let's do the tutorial.
- 1:17:17If there's something I need to know, let's do the tutorial.
- 1:17:18The first couple of pages of the tutorial teach you about the key combinations for page up and page down.
- 1:17:24I have a button on my keyboard to do that.
- 1:17:26It says page up and page down right on it, doesn't it?
- 1:17:28It says page up and page down.
- 1:17:29And they work really well.
- 1:17:30So stop trying to teach me how to use my keyboard.
- 1:17:32Actually teach me how to do the things in Emacs that are interesting.
- 1:17:35And I know there are many things in Emacs that are interesting, but I can't get there because the onboarding process is toxic.
- 1:17:41Oh, boy.
- 1:17:42You also might have a home and an end button as well.
- 1:17:45Yes, yes, exactly.
- 1:17:46And one of these days, the end goal for me, I'll be a very happy person when I've been able to build a Toga.
- 1:17:52Sublime Text is great because it's cross-platform.
- 1:17:54It's bad because there's no source code.
- 1:17:57It's not open sourced.
- 1:17:58So I want to write an open sourced programmable editor that is the analog of Emacs but programmed in Python but open source and native user interface everywhere.
- 1:18:08That also just happens to plug into all the other really useful Bware tools because I just need it to be an editor.
- 1:18:13I don't need it to be a debugger.
- 1:18:14I don't need it to be a coverage tool.
- 1:18:16I need it to edit things really well and talk out to APIs of other tools when it needs to talk to other tools.
- 1:18:21I think that's a great vision and probably a great place to leave it.
- 1:18:25So it's been really great.
- 1:18:28Is there any final call to action?
- 1:18:29Are you guys accepting contributors or anything like that?
- 1:18:32We are always actively seeking out contributors.
- 1:18:35So this is one of the things I'm moderately proud of in the way that Bware is operated.
- 1:18:39We've got an open offer to anyone of any level of experience to contribute, to be mentored through the process of contributing to Bware.
- 1:18:47And that's not just sort of idle words either.
- 1:18:49This is something that has actually been fleshed out in reality.
- 1:18:52So at PyCon US this year, we ended up filling, I think at the peak, there was something like six or seven tables full of people who were contributing to Bware.
- 1:19:01When anyone contributes to Bware, there's actually a little coin.
- 1:19:05There's a challenge coin that we've had struck thanks to originally from MaxCDN for funding but now RevSys have funded the second pressing of these coins.
- 1:19:14And essentially, as soon as you get a contribution into Bware, you get one of these coins.
- 1:19:17And you can only get it if you contribute to Bware.
- 1:19:19But we had people who literally learned to use GitHub two hours earlier who have now got commits in Bware.
- 1:19:26That's great.
- 1:19:26We have been able to mentor people with very, very little programming experience to be contributors of non-trivial features in Bware.
- 1:19:33So if you go to the Bware website, there is a link in there for how to get involved with contributing.
- 1:19:38One of the big things it shakes off is, yes, okay, this whole imposter syndrome thing, it's real.
- 1:19:43And by the way, the members of the core team have imposter syndrome as well.
- 1:19:47So, yeah, don't worry about the imposter syndrome.
- 1:19:49We will walk you through this.
- 1:19:50We want to help you become the best developer you can.
- 1:19:53And we'll mentor you through that whole process.
- 1:19:55So get in touch.
- 1:19:57And we'll be more than happy to help you get involved.
- 1:20:00All right.
- 1:20:01That's great.
- 1:20:01Russell, thanks so much for being on the show.
- 1:20:03It's been fun to talk about your project.
- 1:20:04Yeah, it's been an absolute pleasure.
- 1:20:05Thank you very much for your time.
- 1:20:06You bet.
- 1:20:07Talk to you later.
- 1:20:09This has been another episode of Talk Python To Me.
- 1:20:11Today's guest has been Russell Keith-Magee.
- 1:20:15And this episode has been sponsored by Rollbar and Hired.
- 1:20:18Thank you both for supporting the show.
- 1:20:20Rollbar takes the pain out of errors.
- 1:20:22They give you the context and insight you need to quickly locate and fix errors that might have gone unnoticed until your users complain, of course.
- 1:20:30As Talk Python To Me listeners, track a ridiculous number of errors for free at rollbar.com slash Talk Python To Me.
- 1:20:38Hired wants to help you find your next big thing.
- 1:20:40Visit Hired.com slash Talk Python To Me to get five or more offers with salary and equity presented right up front and a special listener signing bonus of $2,000.
- 1:20:48Are you or a colleague trying to learn Python?
- 1:20:51Have you tried books and videos that just left you bored by covering topics point by point?
- 1:20:56Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm/course to experience a more engaging way to learn Python.
- 1:21:05And if you're looking for something a little more advanced, try my WritePythonic code course at talkpython.fm/Pythonic.
- 1:21:12Be sure to subscribe to the show.
- 1:21:14Open your favorite podcatcher and search for Python.
- 1:21:17We should be right at the top.
- 1:21:18You can also find the iTunes feed at /itunes, Google Play feed at /play, and direct RSS feed at /rss on talkpython.fm.
- 1:21:27Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
- 1:21:32Corey just recently started selling his tracks on iTunes, so I recommend you check it out at talkpython.fm/music.
- 1:21:39You can browse his tracks he has for sale on iTunes and listen to the full-length version of the theme song.
- 1:21:44This is your host, Michael Kennedy.
- 1:21:46Thanks so much for listening.
- 1:21:48I really appreciate it.
- 1:21:49Smix, let's get out of here.
- 1:21:51Outro Music.