Latest / Talk Python To Me / #74: Past, Present, and Future of IronPython
Transcript
- 0:00Have you heard of IronPython and Jython?
- 0:01These two alternate implementations of Python were created by Jim Hugenin.
- 0:05They run on top of the .NET and JVM runtimes.
- 0:08On this episode, we're going to look at the story of IronPython.
- 0:12It's been around for many years, although the last few years it's been somewhat stagnant.
- 0:16That's why I'm thrilled to introduce you to Alex Earle,
- 0:19who, along with Benedict Eggers, has become the maintainer of the IronPython project.
- 0:24It's great to see IronPython getting the attention that it deserves.
- 0:27We'll talk about IronPython past, present, and future in this episode of Talk Python To Me.
- 0:32This is episode number 74, recorded August 31, 2016.
- 0:54Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 1:09This is your host, Michael Kennedy.
- 1:11Follow me on Twitter, where I'm @mkennedy.
- 1:13Keep up with the show and listen to past episodes at talkpython.fm.
- 1:17And follow the show on Twitter via at Talk Python.
- 1:21This episode is brought to you by Hired and SnapCI.
- 1:23Thank them for supporting the show on Twitter via at Hired underscore HQ and at Snap underscore CI.
- 1:30Hi, Alex. Welcome to the show.
- 1:33Hey, thanks for having me on, Michael.
- 1:34Yeah, I'm excited to talk to you about IronPython and its history and its future, even more importantly.
- 1:40Where is it going, right?
- 1:41So that's going to be a great conversation.
- 1:42Yeah, definitely.
- 1:42Yeah, I'm looking forward to share it with everyone.
- 1:44Before we do, though, let's get to your story.
- 1:46Like, how did you get into programming in Python?
- 1:47You know, as of probably most people my age, mid-30s or so, I kind of got started programming back in the Q&A days.
- 1:53I like, there's a game that came with a computer called Gorillas, where there are two gorillas and you threw bananas at each other.
- 2:00And I like to go in and modify that and make the bananas like purple or just change things about it.
- 2:06So that's kind of my first introduction to programming.
- 2:09From there, I didn't really do much until high school when I took a computer programming class for C++.
- 2:15And it was really fun and I enjoyed it.
- 2:17But my first introduction to Python was in college.
- 2:20I had a buddy who I was in several classes with.
- 2:23His name is Travis Hartwell.
- 2:24He introduced me to Python.
- 2:26I'd never even heard of scripting languages or anything like that.
- 2:28I'd only done C or C++.
- 2:30You're like, where's the compiler?
- 2:31Exactly.
- 2:32Yeah.
- 2:32I can just run these files, you know.
- 2:34So it was pretty awesome.
- 2:35And it was so easy to do things that were like way more complex in C++.
- 2:41You know, the lists, dictionaries are awesome.
- 2:46Functions you can use to sort or find things in them.
- 2:49And then he introduced me to lists, comprehensions and stuff like that.
- 2:53My mind was blown about how easy it was to do things in Python compared to C or C++.
- 2:58And so I've just had a love of Python ever since then.
- 3:02I didn't use it a ton in college except for in one class our professor actually let us.
- 3:08He said, if you can write a program to do your homework for you, go ahead and do that.
- 3:12It is a math class.
- 3:14And so I used Python and basically wrote some easy functions to do all my homework for me for certain assignments.
- 3:21And so that made me love Python even more.
- 3:23I could do my homework for me.
- 3:24So that was pretty awesome.
- 3:26Credit to that professor who's like, look, if you can think outside of the box and solve this problem, do it.
- 3:32That's really cool.
- 3:32Yeah.
- 3:33It was like a math for algorithms type class.
- 3:37It was kind of breaking down algorithms into math.
- 3:40And it was really cool to apply Python to that because, I mean, Python is great at that sort of thing.
- 3:46Yeah, sure.
- 3:46Was that like graph theory type stuff and those kinds of things?
- 3:49Exactly.
- 3:50Yeah.
- 3:50Yeah.
- 3:50Yeah.
- 3:51It seems like you could totally automate that for a lot of them.
- 3:53Find the most efficient path here.
- 3:55Well, guess what?
- 3:56We'll just try them.
- 3:56Beautiful.
- 3:57Okay.
- 3:58So that was, yeah, that's how you got into programming in Python.
- 4:01What do you do today?
- 4:02Where do you focus now?
- 4:03I work for a validation group, actually.
- 4:06So most of my work is actually done in Assembly or C.
- 4:11I write code that runs on embedded chips.
- 4:14As part of my job as well, I also develop some software tools that we use to automate our tests and so forth.
- 4:23And that's where I really got into Iron Python.
- 4:27So I write software tools and develop a software infrastructure for embedded processor testing.
- 4:32Okay.
- 4:33Yeah, that sounds fun.
- 4:34All right.
- 4:34So you mentioned Iron Python.
- 4:35And I think Iron Python is definitely one of the interesting alternative Python interpreters or runtimes out there.
- 4:44And we've talked about alternate runtimes before on the show, like PyPy, for example.
- 4:50But I think it's maybe worth just touching on the concept that there are other interpreters or runtimes out there because maybe not everybody's heard of what the options are.
- 5:00Could you give us like a little bit of a rundown of what the options are?
- 5:03Sure.
- 5:03So as you mentioned, you mentioned PyPy, which is a JIT-enabled fast interpreter for Python.
- 5:09There's also what we call it from Iron Python.
- 5:11And I don't know if other Python interpreters call it this, but CPython, which is the main one developed.
- 5:17You know, you can go to python.org and download the installation or it comes on if you're running like Linux or something, it usually comes on Linux.
- 5:25We call that CPython because it's based on the C language.
- 5:28Yep.
- 5:29And I feel like if people don't really know what version of Python they have.
- 5:32Yeah, it's definitely true.
- 5:33You know, you type like Python something and that's usually the CPython, but there are other Pythons.
- 5:39JIT-enabled Python is another option.
- 5:42It's developed on the Java framework.
- 5:45So it runs on the JVM, the Java virtual machine.
- 5:48And then there's us, Iron Python, which is developed on the .NET runtime.
- 5:52So those are kind of the main ones that I know about.
- 5:56We've kind of looked at those ones in particular as kind of the main areas where we can focus on compatibility and optimization so that we can perform well.
- 6:07Yeah, those are definitely the main ones.
- 6:08That's great.
- 6:09And so if you don't realize that there's a bunch of interpreters or runtimes, however you want to think of them, for Python, you know, there may be a better choice than the default Python, the CPython implementation for your project, depending on what you're trying to do.
- 6:24So let's talk about Iron Python, because that one's been around for a while.
- 6:29A lot of the ones you mentioned, they're not brand new.
- 6:31There are some new things coming out that maybe we'll touch on a little bit later, some of the JIT-based ones like Pigeon and so on.
- 6:37But let's talk about Iron Python.
- 6:40It's been around for a while.
- 6:40When did it get started?
- 6:41Do you know?
- 6:42It got started at Microsoft, I think it was around 2006.
- 6:47It's been around for about 10 years.
- 6:50Right now it has an Apache license.
- 6:53Microsoft kind of took it to a certain point and then they decided to open it up to be run by the community.
- 6:59And so they open sourced it as Apache license.
- 7:03And so that's the license we currently have.
- 7:06Yeah, I remember it was licensed under a different license, like the Microsoft open source license or something that people are like, what is this?
- 7:13Right?
- 7:13And then finally they switched it to the Apache license.
- 7:16Just go, here's something you're totally familiar with.
- 7:18Already approved.
- 7:19Go with that.
- 7:19Yeah.
- 7:20It was MSPL, I think.
- 7:22The MS public license or something like that.
- 7:24And it had some weird stuff within the license that people were like, I don't really want to touch this because, you know, it's a Microsoft license.
- 7:31So moving it to Apache was a huge benefit to the project.
- 7:35Yeah, that's great.
- 7:36So it was started by Jim Hugenin, is that right?
- 7:39Yeah, he was the one who did Jython as well.
- 7:41So it's kind of a funny story.
- 7:43The whole way that Iron Python came around is Jim had started working on Jython and he saw this .NET framework come out.
- 7:50And he said, oh, I'm going to go show that a Python implementation would be horrible to run on the .NET framework.
- 7:57And so he kind of started out Iron Python as a way to show that .NET was a horrible platform to work with.
- 8:03But it ended up being great.
- 8:04He said, it's a wonderful platform.
- 8:06It's great to write these languages for.
- 8:08And they run really well on top of it.
- 8:11He started out as kind of trying to attack .NET and ended up loving it.
- 8:15And he even was hired by Microsoft to continue development on Iron Python.
- 8:19Yeah, I remember that.
- 8:20And I think he worked there for like six years before he moved on to Google.
- 8:23It's really funny.
- 8:24You start out to prove something that is totally inadequate.
- 8:28You're like, wait, it's not totally inadequate for this thing.
- 8:30That's pretty interesting.
- 8:31Yeah.
- 8:32Do you know how similar Jython and Iron Python are?
- 8:35I've never really done a lot of work with Jython because I don't do tons of Java.
- 8:40They kind of aim at similar ideas, kind of bridging the gap between either Java and Python or the .NET framework and Python.
- 8:47The implementation is very different, mainly because there's while Java and the .NET framework or C# are similar in ideas because they have garbage collector.
- 8:58They're all object-oriented and that sort of thing.
- 9:01Really, the way that the different platforms solve things can be quite different.
- 9:05The way that they implemented things in Jython is actually, I believe, quite different in how things are implemented in Iron Python.
- 9:12Like their object structure, how they interact with the actual Python modules and then represent those in the Java runtime.
- 9:21That can be very different from how we do it in Iron Python.
- 9:25Okay.
- 9:27I forgot one detail.
- 9:28I just wanted to make sure people understood why it's called Iron Python.
- 9:31Iron stands for implementation runs on .NET.
- 9:35Okay.
- 9:36So that's why it's in Python.
- 9:38Right, right.
- 9:39You have a couple of languages.
- 9:40Like you had Iron Ruby as well.
- 9:42Well, they did when they started out at least.
- 9:44And it is under the project that you're maintaining.
- 9:46Before we get to that, though, maybe tell us a little bit about why would I choose Iron Python over CPython?
- 9:54The .NET framework has a lot of capabilities.
- 9:57And there's a lot of things.
- 9:58There's the WPF.
- 10:00There's Windows Forms for writing GUI apps.
- 10:03There's network libraries that may or may not be available in Python as a module.
- 10:09And so really the place that I use Python the most or Iron Python the most is creating a scripting environment for my applications.
- 10:18When I write my tools, I generally develop in C# and I use Windows Forms or WPF to create these tools.
- 10:24And to provide a scripting interface for those tools, Iron Python is very good at embedding into a C# application and accessing the components that you give it access to.
- 10:39It's very easy to provide it access to like a text output window.
- 10:44And so it can write to a text output window very easily that's developed in C#.
- 10:49I've tried doing similar things with CPython.
- 10:52I've used Boost Python to try embedding Python into an application.
- 10:56And I ran into some issues with wanting to rerun scripts over and over and over.
- 11:01I got weird assertions and seg faults and stuff like that.
- 11:05So for me, embedding Python in an application is very easy with Iron Python.
- 11:10And that's my biggest use case as a software engineer using Iron Python.
- 11:15Okay.
- 11:16So I guess, yeah, you can embed CPython pretty easily, especially if you're doing a C-based application.
- 11:22Then that probably makes a lot of sense.
- 11:24But if you're already writing in C#, this might be better because you can share information across it better, right?
- 11:32Like your classes and libraries in one language are available to the other.
- 11:36Does it go both ways?
- 11:37Yeah, you can definitely access Iron Python objects and stuff from C#.
- 11:42One of the tools I actually developed was we have a hardware team that they develop boards with FPGAs and stuff on there.
- 11:51And they wanted a way to test their hardware platforms.
- 11:54And so I created a GUI that interfaces with Iron Python.
- 11:58And they write scripts to test these boards.
- 12:01And I use the unit test module.
- 12:02And so they write their tests in the standard unit test format.
- 12:05But I can parse those objects and find all the unit tests from my C# GUI and present those.
- 12:12And they can select which ones they want to run and run those tests to test the hardware boards out.
- 12:17Oh, that's nice.
- 12:17So you, like, load the Python modules and inspect what tests are there and then present some kind of custom runner on top of it?
- 12:24Exactly.
- 12:25Yep.
- 12:25Okay.
- 12:25Oh, that sounds really cool.
- 12:27So we were talking about C#.
- 12:29And a lot of people say, you know, C# means Windows only.
- 12:34And a lot of people doing Python are not interested in Windows.
- 12:37Does it run outside of Windows or is that required?
- 12:40Yeah.
- 12:40So we do have pretty basic support for running on Linux under Mono right now.
- 12:46We definitely want to improve that because, you know, we want to be everywhere that people want to use C# and Python.
- 12:53So whether that's Linux or, you know, OSX or Windows, we really want to provide a solution to everybody.
- 13:01So we're going to put some focus on improving our support for Mono as well as .NET Core, which runs on Linux right now.
- 13:10Yeah, yeah.
- 13:10That's really interesting.
- 13:11I think that that's going to unlock a lot of things like this that used to be tethered more or less to Windows to set them free to run on, you know, Linux machines in a data center or something like that, which definitely opens up the appeal, I think.
- 13:25What about performance?
- 13:27Like, is there a performance benefit doing this versus CPython?
- 13:33Are there performance penalties, but you get the integration?
- 13:37What's the story?
- 13:38So one, I think, so performance benefits, we do outperform CPython in several benchmarks.
- 13:43I don't have the details right now.
- 13:46Recently, someone ran that.
- 13:47They compared CPython, PyPy, and IronPython.
- 13:50And we outperform CPython in many cases, but PyPy definitely outperforms us right now.
- 13:56I think that really probably is related to the global interpreter lock because we don't have that in IronPython.
- 14:03It can help us in a lot of those benchmarks.
- 14:06One of the things that we do have, something that we definitely need to look into optimization and performance problems is startup time.
- 14:12It takes us a lot longer than CPython to get started, you know, actually executing the Python code.
- 14:18And so that's something that we're planning on looking at.
- 14:20Sure.
- 14:20Yeah.
- 14:21If you're just going to run a little bit of code and then shut back down, maybe it doesn't make so much sense.
- 14:25I think PyPy also has that challenge that it takes a lot longer to get rolling at a high speed.
- 14:31But once it's up in a sort of like a web app type of environment where it starts and runs for a long time, then it's better.
- 14:38Yeah, definitely.
- 14:39Okay, great.
- 14:40Now, one of the things I thought was really intriguing about IronPython, and you brought it up, is the lack of the GIL or the global interpreter lock.
- 14:48And that seems to be one of the challenges for doing real parallel, computational parallelism in Python.
- 14:55You can do it and you can use the, you know, multi-process support and things like that.
- 15:00But, you know, straight up threading when you're just doing computational stuff is challenging, right?
- 15:05Is that more doable in IronPython?
- 15:08Yeah, I would say so.
- 15:09Because we don't have that, the GIL in IronPython, when we have something that can be spread across multiple cores, which .NET supports very well, you can really take advantage of multiple cores and not running into that, the GIL, which can slow you down.
- 15:23Okay, so people are out there and maybe they have some project and they're trying to use parallelism.
- 15:28How hard would it be for them to switch from running, you know, CPython to try out IronPython with their code?
- 15:35Like, what's the chances of them taking what they have and running it with a different interpreter and having it work?
- 15:41It depends quite a bit on what modules they're using.
- 15:44Because we're running as a .NET application, we really can't use C modules, C-based modules.
- 15:52So if you have something that's based on a C module, it's hard for us to interact with that right now.
- 15:58Now, we do have a side project that had started a while ago when we were working on 2.6, Python 2.6 compatibility called Ironclad, which allowed us to interact with C modules.
- 16:11It was kind of abandoned for a while, and now we're going to try and bring it back so that we can reuse some of those C modules that CPython provides so that more things are compatible under IronPython.
- 16:22Okay, yeah, I mean, that seems really important to me.
- 16:26I think one of the lessons from PyPy is it's really great, but it had these huge challenges around some of the popular packages that relied heavily on C, like NumPy, for example.
- 16:37And they went so far as to try to implement their own version of NumPy in PyPy or in Python, in pure Python.
- 16:44And that just seems like such a hard battle to, like, look at all the open source projects that are successful out there and go, let's just reimplement all of those.
- 16:52And instead have to date, right?
- 16:55Yeah.
- 16:55It seems almost impossible.
- 16:56Yeah, it's hard to play catch up.
- 16:58It feels like you're always playing catch up, and that's a hard position to be in.
- 17:01For one thing, you're trying to maintain compatibility with the language itself, which can change slightly from rev to rev, even on just the 2.7 baseline.
- 17:10But then you have the open source projects that provide modules that are native or written in C, and those can be difficult to keep up with as well.
- 17:19So it's definitely a trial that we're trying to work on and figure out.
- 17:23Yeah, it sounds like Ironclad would be really important, or something filling that role at least.
- 17:27How do you end up becoming one of the maintainers?
- 17:30And you have a co-maintainer as well, right?
- 17:33Yeah.
- 17:33So my co-maintainer is Benedict Eggers.
- 17:36He's located in Germany.
- 17:37He was kind of what really kind of kicked off the resurgence of IronPython, I would say.
- 17:44Ever since Microsoft open sourced it, I had been working, doing some stuff, because I was using it in my job.
- 17:51So I wanted it to be a good piece of software.
- 17:54And Jeff Hardy was the maintainer at the time.
- 17:58And he's gotten, as with all of us, we go through hills and valleys of how busy we are with our jobs and family and stuff.
- 18:06And he just reached a point where his job and his family were taking up a lot of time, as they should.
- 18:12And he just didn't have the time that he thought he could put into helping IronPython be successful.
- 18:17And so Benedict kind of pushed some buttons using some Twitter conversations between Jeff and myself and Benedict to kind of push.
- 18:27And Jeff finally realized that he could pass it off to myself and Benedict.
- 18:32Myself, because I had some history with the project and so forth, and Benedict, because he really had some excitement about it to get it going again.
- 18:41So that's kind of how I got in there.
- 18:43And Benedict is good at making people excited about things.
- 18:47And so I got excited about IronPython again.
- 18:49How nice.
- 18:50We started making plans for the future.
- 18:52Yeah, yeah, that's cool.
- 18:53And it's interesting that was over Twitter.
- 18:55I feel like people outside the development space don't really appreciate how special Twitter is in connecting you to people you would otherwise not be connected to.
- 19:07Yeah, I mean, you can go to a site for a project and see like an email address for a developer, but you don't know, is it current?
- 19:13Are they using that email address?
- 19:16But Twitter, it's so easy to connect real fast.
- 19:18Yeah, and the messages are small enough, you're likely to get a response.
- 19:21If you write some 500-word email, people are just going to ignore you most of the time if they're busy or whatever.
- 19:27But yeah, so I think it's really cool that that started out over Twitter.
- 19:31This portion of Talk Python is brought to you by Hired.
- 19:45Hired is the platform for top Python developer jobs.
- 19:48Create your profile and instantly get access to 3,500 companies who will work to compete with you.
- 19:53Take it from one of Hired's users who recently got a job and said,
- 19:56I had my first offer on Thursday after going live on Monday and I ended up getting eight offers in total.
- 20:01I've worked with recruiters in the past, but they've always been pretty hit and miss.
- 20:05I tried LinkedIn, but I found Hired to be the best.
- 20:07I really like knowing the salary up front.
- 20:09Privacy was also a huge seller for me.
- 20:12Sounds awesome, doesn't it?
- 20:13Well, wait until you hear about the sign-in bonus.
- 20:16Everyone who accepts a job from Hired gets $1,000 sign-in bonus.
- 20:19And as Talk Python listeners, it gets way sweeter.
- 20:22Use the link Hired.com slash Talk Python To Me and Hired will double the signing bonus to $2,000.
- 20:27Opportunity's knocking.
- 20:29Visit Hired.com slash Talk Python To Me and answer the door.
- 20:32So do you want to talk a little bit about the internals, about how this works?
- 20:44I know how it works in CPython.
- 20:46We have Python bytecode and we have this eval loop that will go through and pull out this bytecode.
- 20:53Instead of a JIT compiling it, it will just interpret it and piece it all together.
- 20:57What happens in IronPython?
- 20:59How is it the same or different?
- 21:00Sure.
- 21:01It's kind of a similar concept.
- 21:04We parse the Python code into an abstract syntax tree.
- 21:08And then we kind of do some optimization or, yeah, you can call it optimization.
- 21:14So when something is executed, we generate what's called a call site for that operation.
- 21:20So that in the future, if we execute the same code or similar code,
- 21:24we have an optimized version of that code that we can then call.
- 21:28So we basically take the Python and we convert that into the abstract syntax tree.
- 21:33And then that gets converted into like a Lambda, basically, in the .NET world.
- 21:38Something that we can execute.
- 21:40And we cache off the compiled or optimized version of that call so that if we get another git adder call,
- 21:48for instance, we have an optimized version of that that we can call
- 21:51and we don't have to recompile it into the Lambda format from the abstract syntax tree.
- 21:55Okay. That's interesting.
- 21:56So every instruction when I run Python code in IronPython is JIT compiled eventually?
- 22:04Yes. Because it gets converted into a .NET IL, which is the intermediate language,
- 22:10the JIT will run on that code when it's executed and can get cached off.
- 22:15All right. That's a really interesting difference than, say, PyPy.
- 22:18Because when I talked to the PyPy guys, they said it initially runs through CPython,
- 22:24but if it runs enough, they're like, all right, this is the hotspot.
- 22:27We're going to JIT this part.
- 22:29But it doesn't always JIT, which is interesting.
- 22:32I think it makes it a little less predictable, perhaps, in the way that PyPy works.
- 22:37So that's pretty cool.
- 22:38So I guess that means things like garbage collection apply as well, right?
- 22:43The standard garbage collection that you would know from there.
- 22:47Yeah, definitely.
- 22:48So the .NET framework includes garbage collection.
- 22:50And so we don't, unlike the CPython, which has to do reference counting on objects in the internals,
- 22:56we don't have to do that.
- 22:58It's all done automatically for us.
- 23:00And the GC takes care of anything that's not around anymore.
- 23:03Well, that definitely makes it easier on you as an implementer.
- 23:06What are the benefits or drawbacks of that versus, say, reference counting in CPython?
- 23:11In CPython, it's deterministic because you're telling the runtime when something is no longer needed.
- 23:18And so it can clean it up right then.
- 23:20In running under .NET with IronPython, the garbage collection is non-deterministic.
- 23:26So it can run even during a critical point in your app and slow things down slightly.
- 23:32Now, because we're running on .NET, we can have multi-core stuff.
- 23:36So the garbage collector may be running on one core.
- 23:39And so you still have, like, three cores out of four that can actually execute code.
- 23:44But there is a non-deterministic garbage collector.
- 23:47And Jython would have the same issue.
- 23:49Java runtime garbage collection is also non-deterministic.
- 23:52So it's a similar issue or problem between the two managed frameworks.
- 23:58Interesting.
- 23:58Yeah, I remember playing around with some of those ideas and checking out the performance,
- 24:03realizing that allocation was actually faster a lot of the times in some of the GC spaces.
- 24:09But you paid for it later when it had to be cleaned up because that was way more complicated
- 24:13because the compacting GCs and simplifying.
- 24:16You don't have to, like, find an empty slot in the free space.
- 24:20Those usually get compacted.
- 24:22Okay, that's pretty cool.
- 24:23So you brought up some of the different types of apps that you can build with IronPython.
- 24:29Want to give us a bit of a rundown on that?
- 24:31So you said you could build WPF apps, which is sort of the standard Windows UI framework these days.
- 24:37What else?
- 24:38So we actually have a module, a WPF module.
- 24:41So you can import WPF, and it provides kind of higher-level ways of interacting with WPF that are more Python-like.
- 24:49So it makes it easier to develop those sort of things.
- 24:52Benedict actually does quite a bit with WPF on IronPython.
- 24:56We also have, you can write Windows Forms, which is kind of the older format of Windows applications.
- 25:03WPF is supposed to replace Windows Forms, but it hasn't happened yet.
- 25:08People still write Windows Forms apps.
- 25:10You can write Windows Forms apps under IronPython.
- 25:13Now, you have to start them differently than you would a, like a command line application.
- 25:19On Windows, when you're running a Windows application, it has to have an event loop in order for it to process Windows events and things like that.
- 25:28The normal command line client doesn't have that message loop, so it can't run Windows Forms apps or WPF apps.
- 25:37So we actually have a separate interpreter executable, which allows or has an event loop started up so that your forms applications and stuff work correctly.
- 25:48Oh, that's interesting.
- 25:49Yeah, because it has to plug in basically to that already running event loop or something like that, right?
- 25:54Exactly.
- 25:55Yep.
- 25:56Okay.
- 25:56And can you build, what do you distribute, I guess?
- 26:00Like, do people have to have IronPython installed in the system?
- 26:05Can you give them, like, an executable that's self-contained?
- 26:09What thing do you give to people to run?
- 26:11We do have what's called the IronPython compiler, which is basically what it does is takes any .py files that you want,
- 26:19and you can actually also include the Python standard library,
- 26:22and you can build a standalone executable that is basically a, has the Python code as a resource embedded inside,
- 26:32and then some wrapper code to pull out those resources and execute it as if you were running it from the command line using the IPy interpreter.
- 26:40So you can create pretty standalone executables.
- 26:44They are pretty large because you're embedding everything inside,
- 26:46but you can distribute a single executable that has all of the data inside for running your application.
- 26:54Oh, that's pretty awesome.
- 26:54Does that take, like, external packages?
- 26:57Like, if I'm using requests or passlib or some of these things, will it get sucked in and become part of my project?
- 27:04Right now, we don't have automatic dependency checking for that,
- 27:09so you would have to specify the path to the .py file on your system.
- 27:14But that is something we're looking into.
- 27:16I recently created a patch for Module Finder for IronPython because we don't have bytecode,
- 27:22and Module Finder uses bytecode, the Python bytecode, to determine what's being imported.
- 27:27But I created a patch that uses the AST module to find all the imports within your project as well.
- 27:34And that's something I'm going to roll into the IronPython compiler
- 27:36so that it can automatically find the dependencies that you're using and include them.
- 27:42Okay. What's the timeline on that?
- 27:43Probably in the next major release of the 2.7 branch that we're working on.
- 27:49We are working on IronPython 3, which would be 3.x support,
- 27:53but we're still maintaining the 2.7 release track as well.
- 27:58And so probably the next major release.
- 27:59We're going to do another minor release here pretty soon because we had some regressions.
- 28:04It was our first release as project owners, and we were human, so we made a few mistakes.
- 28:08But we're working to fix those and get out kind of a minor release.
- 28:13But I think in the next major release, we can include that type of support.
- 28:18So what's the story with Python 3 versus Python 2 since you brought it up?
- 28:22Sure. So in .NET, all strings are Unicode.
- 28:26So we've had some Python 3-esque support for a while now because of that.
- 28:31It also caused us problems with some of the 2.7 modules, but that's kind of a different story.
- 28:36But we are working on implementing all of the features for the most recent 3.x series.
- 28:43It's in a separate code repository from the IronPython 2.
- 28:47Because we're going to make some fairly significant changes to the parsing logic for the new language features and things like that.
- 28:56But it also allows, you know, a lot of those Unicode issues will go away with IronPython 3, which, because Python 3 switched to Unicode as well.
- 29:05Sure. So is that something I can use today or is it still being worked on?
- 29:10It's still being worked on. We don't have all the language features in yet.
- 29:13We're working on trying to get out a first release in the end of October that has language features implemented.
- 29:21And then we're going to work on fixing bugs and making sure all the tests are passing.
- 29:26And we're really trying to push standard library features upstream so that you can use the normal Python standard library.
- 29:35Right now we have some changes in the standard library and have a local version of it.
- 29:39So you can't just go and grab the standard library of CPython and use it with IronPython and have it work.
- 29:44But we want to push those changes upstream so that you can use the normal CPython standard library with IronPython 3.
- 29:52Okay. Yeah. It seems like a great plan.
- 29:54You touched on threading. And one thing I did want to ask you about, since we're talking about Python 3,
- 29:59is there's some coroutine parallelism features in Python 3 with the async and await keywords.
- 30:06And C# also has async and await keywords.
- 30:10So is there some special tie-in, like does async and await do anything extra cool on IronPython versus regular Python 3?
- 30:20The async and await stuff is something we haven't implemented yet, but I think it's going to be fairly easy because C# and .NET have the async and await already built in.
- 30:30But that's something we haven't implemented yet in the IronPython 3 yet.
- 30:34Okay. And speaking of implementation, we said that CPython is not mostly Python.
- 30:39Mostly it's C code in the actual low-level parts, right?
- 30:43So I had some of the standard library. But what is IronPython written in?
- 30:47IronPython is written in C#.
- 30:49And so the native modules or some of the built-in modules are implemented in C#.
- 30:54We replicate the functionality of the native C modules, things like underscore hashlib, underscore SSL,
- 31:03things that are imported in the Python module like SSL.py or hashlib.py.
- 31:09We implement those and try and create them as feature-complete as possible in C#.
- 31:14Okay. And how hard is it to match those things up? Do you have like tons of tests? Do you run the standard Python tests to verify your code or anything like that?
- 31:23Yeah, we definitely use all the tests that are already there for the CPython in the standard library.
- 31:28We use those heavily. In addition, we have some features that we test for like COM, which is a Windows technology, the common object model.
- 31:37We have some stuff that makes it easier to work with COM objects. And so we have some tests that do that.
- 31:42We have tests for interaction between C# and IronPython to make sure that if you're hosting IronPython in your application, it continues to run well.
- 31:53So we do use the CPython tests and then we add additional tests on top of that.
- 31:58Right, because you're trying to add additional functionality, I guess, in addition to what they're providing.
- 32:01Okay. So also you talked about Windows apps. Can you build web apps, which is maybe where Python is used more?
- 32:09Yeah. So Benedict has been working on something that we recently imported into the Iron Languages repository or organization on GitHub, which is IronPython ASP.NET MVC.
- 32:20And basically what it does is allows you to write ASP.NET MVC apps, web apps in IronPython or in Python.
- 32:28So you can define your routes and that sort of thing in Python. So it's a really exciting thing.
- 32:34And that's one of the things we really want to get running under .NET Core as well.
- 32:37Yeah, that sounds awesome. If you could get that running on .NET Core so I could develop that on my Mac and deploy it on Linux, that's pretty interesting.
- 32:46Yeah, and you still get the power of some of the .NET libraries that may not have a Python module to do.
- 32:53Sure. Okay. Well, yeah, that sounds pretty exciting. I'm looking forward to that.
- 32:56What about managing local environments?
- 33:00CPython has great support for virtual environments, especially in Python 3. It's got VEMD built in.
- 33:06Do you guys have this concept of virtual environments with what you built?
- 33:10We had some patches upstream to virtual ENV because there are some things that we were having some issues with.
- 33:17They requested us to make some changes and all that kind of happened back when development was really kind of dying out on IronPython.
- 33:26So it's something we need to resurrect and re-look at, but it's definitely something we want to support because people love that as part of CPython.
- 33:33So we'd really like to provide that as part of IronPython as well.
- 33:37Yeah, yeah. It's definitely pretty important. Okay, cool.
- 33:40And then you also have something called PyLauncher.
- 33:42How does that relate? Is that like the thing that will sort of associate with Python files and run them, or what's the story of that?
- 33:49It is a launcher. I don't know if you're familiar with Visual Studio at all.
- 33:53Visual Studio has a bunch of different formats for their project files, and so they have what's called a Visual Studio Launcher.
- 33:59Visual Studio Launcher will get the format of the file that it's received and determine which version of Visual Studio that you have on your system you should open it with.
- 34:08And that's kind of what PyLauncher does as well.
- 34:10It allows you to have multiple different Python versions on your system and launch a different one based on different things within the files.
- 34:19Right, okay.
- 34:19So you mentioned Visual Studio, and Visual Studio is fine if you're on Windows, but if you're not, then you don't really have it.
- 34:27And I'm also a fan of PyCharm, as people listening to the show know.
- 34:30Could I, say, open PyCharm and write IronPython apps with it?
- 34:34Yeah, I mean, we do run on Mona right now.
- 34:38So, which we'll install on OSX or on Linux.
- 34:41And so, you know, some people I know who are working on IronPython itself use like Emacs or Vim or, you know, their favorite editor.
- 34:51And they write the Python and then they execute it from the command line using the ipy.exe.
- 34:56So if you're developing the Python itself, you can write it anywhere and run it under the interpreter.
- 35:03Now, there is an awesome tool from Microsoft called the Python Tools for Visual Studio, which is basically a free Python ID if you're running on Windows.
- 35:12They do an awesome job of a lot of stuff.
- 35:15And that kind of started out of IronPython initially.
- 35:18And so that's kind of why I like it.
- 35:20But, yeah, you can use basically any ID you want to write the Python.
- 35:23And then you just execute it under the IronPython interpreter.
- 35:27All right.
- 35:27Yeah, that sounds really cool.
- 35:29Yeah, I remember the IronPython tools for Visual Studio just became the Python tools for Visual Studio at some point, right?
- 35:36Yeah, and so they work with IronPython.
- 35:38They work with CPython.
- 35:39I don't know if it works with PyPy.
- 35:41I've never tried that.
- 35:43But as I've created this tools here at work that use IronPython, I've had to recommend, you know, GUIs for people who are, you know, hardware engineers and stuff like that to write Python.
- 35:53They can get syntax highlighting, IntelliSense type stuff or auto-completion stuff of methods and parameters, documentation.
- 36:01So, yeah, Python tools is very good for that.
- 36:04Most people here run Windows.
- 36:06So, it's easy for me to recommend Windows tools to them.
- 36:08Yeah, it's an easy sell if it already runs there.
- 36:10We all want to ship our software faster, respond to user requests quicker, and build an edge on the competition.
- 36:30But the faster you go, the more likely a bug or issue will slip by and cause your users grief.
- 36:35I have the same trade-offs with my Talk Python websites and infrastructure.
- 36:38That's why I use SnapCI.
- 36:40Every time I check in at GitHub, SnapCI springs into action.
- 36:44A clean copy of code is pulled from GitHub.
- 36:46A Python 3 virtual environment is created.
- 36:48All the packages and dependencies are installed.
- 36:50The unit tests are run.
- 36:52Finally, I'm notified in Slack and a menu bar on my Mac about the outcome.
- 36:55That way, I know it's safe to ship a shiny new version of my web app.
- 36:59Ship your software faster with a 30-day free trial at snap.ci slash Talk Python.
- 37:13Yeah, there's a whole, let's say, vibrant debate that we could start about whether you should use IDEs or you should use something minimalistic like Emacs or Sublime, relatively speaking.
- 37:25Maybe we shouldn't really go into it.
- 37:27I kind of lean a little more towards the ID side myself on the PyCharm space.
- 37:31And I think the tools, if you are on Windows, I think the Visual Studio tools are pretty sweet as well.
- 37:37I've played with them a little.
- 37:38So one thing that I thought was interesting that I saw on the mailing list going around was about the time that you took over, I think,
- 37:46there was a meeting that said there's a bunch of urgent issues and we're going to sort of reset the direction of IronPython.
- 37:53Yeah, when was that?
- 37:54So we had our first community meeting a couple months ago.
- 37:58We've been trying to have them every two weeks on Thursday.
- 38:01And we have them on Gitter.
- 38:03I don't know if you're familiar with Gitter.
- 38:04It basically allows you to use your GitHub credentials and organizations to have meeting rooms in a web page.
- 38:12Yeah, and they're generally like around a project on GitHub, right?
- 38:15Exactly, yeah.
- 38:16So we have one for our organization, which is the Iron Languages organization.
- 38:19Sure, so tell people what the GitHub URL is.
- 38:21Of course, I'll put it in the show notes.
- 38:23Sure, so we're at GitHub.com forward slash iron languages forward slash main is currently the main repository for the Python 2.7 branch.
- 38:36Then there's GitHub.com forward slash iron languages forward slash iron Python 3 for the work we're doing for Python 3 support.
- 38:44All right, excellent, yeah.
- 38:46Cool, I'll definitely link to those.
- 38:48So the meeting, the first meeting, some of the issues that people brought up were this idea of Iron Ruby.
- 38:54What is it doing here?
- 38:55Does it make sense in Iron Python?
- 38:57Do you want to talk about that a little?
- 38:59Sure.
- 39:00So when Microsoft open source the code, they had two languages are basically implemented on top of what's called the dynamic language runtime, which is kind of a set of classes or objects that make writing dynamic languages on top of .NET a little easier.
- 39:15It does all that stuff about the call sites that I talked about, caching things and converting an abstract syntax tree into the lambdas for calling the code and so forth.
- 39:26So they had Iron Python, which is an implementation of Python, and they had Iron Ruby, which was an implementation of the Ruby language on top of the DLR.
- 39:35So what we kind of did is we split out Iron Ruby into its own repository under the organization.
- 39:41And I submitted a message to the Ruby mailing list, say if there's anybody interested in taking up Iron Ruby and keeping it alive.
- 39:51And so there were a couple of people who responded.
- 39:53And, you know, we're willing to help them in any way we can.
- 39:57But we really kind of just split it out so that they could lead their own destiny wherever they want to take it.
- 40:02Yeah, that makes a lot of sense to me because while there's some similarities, there's a lot of differences between those two communities and languages.
- 40:09And I feel, I mean, maybe correct me if I'm wrong, but I feel like the mission of Iron Python these days is no longer to say we're going to be this cool thing that shows off the ability to do dynamic languages on .NET.
- 40:23It's all about making the Python as an alternate implementation special, right?
- 40:29And so then that makes Iron Ruby being tied up in it make a lot less sense, right?
- 40:33Yeah, and it really, we don't want to tie them down either with the decisions that we make going forward.
- 40:39We don't want to impact them in a negative way if they want to keep it alive and keep it going.
- 40:43So allowing them to have their own space is, I think, a good way to let them do what they need to do and let us do what we need to do to make both of our languages the best we can.
- 40:55Yeah, excellent.
- 40:56Okay, I'd say that's a good choice.
- 40:59And then when you moved over from where it used to be hosted to GitHub, there was something like 960 issues that were just sort of stale out there.
- 41:08And you're like, what do we do with these?
- 41:10Did you end up throwing them all away?
- 41:12Did you keep them?
- 41:13Like, how do you manage that transition?
- 41:15So, and all those issues were originally filed on CodePlex, which was Microsoft's open source competitor, if you will, to GitHub.
- 41:24I actually wrote a Python script that ported them, did a screen scrape using Beautiful Soup on CodePlex because they didn't have an API to do this.
- 41:31And then importing them into GitHub using one of the GitHub Python modules.
- 41:35Nice.
- 41:36That was a lot of fun.
- 41:37Yeah, who says they don't have an API?
- 41:38They do, they just don't know it.
- 41:40That's right.
- 41:40So anyway, there were these 960-odd issues.
- 41:44Some of them were as old as 2006 or 2007, pretty old.
- 41:52And so what we decided to do in the meeting is to go through and we marked them all as what we called untriaged,
- 41:59where we said we just basically didn't know what was going on, what needed to happen, or anything like that.
- 42:05And we have about 10 people who were in the community meeting that said that they would go through issues and try and triage whether they're a valid issue still,
- 42:14whether it's something that doesn't exist anymore so we can just close it out, or things along those lines.
- 42:19And so we've been working on that.
- 42:21I think we're down to about 800.
- 42:22So we haven't made a huge amount of progress, but we are making progress on triaging the issues
- 42:28and seeing, you know, we need to fix these issues.
- 42:30Some of them that we've triaged, we've fixed as well.
- 42:33So some of them were very simple fixes to make.
- 42:36We just had to know that we're still an issue and then go in and fix it.
- 42:40But we're slowly making our way through those and porting things from the untriage state to either closed or,
- 42:48yes, this is still an issue, to I don't know what we do with this.
- 42:52Let's talk about this one further.
- 42:54Sure.
- 42:54I think that highlights one of the real big challenges, the unglamorous side of running a large open source project, right?
- 43:03Like, probably if you could have your dream, whatever you want to do technically for your time, what do you want to dream about?
- 43:10It's probably not triaging 900 old issues that might not even be relevant, right?
- 43:15But it's important work.
- 43:17Yeah.
- 43:18It can be very satisfying to see that count go down.
- 43:21Yes, I'm sure.
- 43:22You know, it's been sitting around this 906 time.
- 43:25And so seeing it go down is very satisfying.
- 43:28Sure.
- 43:28Well, when I look at open source projects, you know, on GitHub or whatever, that's one of the indications of whether or not I want to trust this thing still being around, right?
- 43:38How old are the issues?
- 43:40Are they getting responded to?
- 43:41Also, pull requests.
- 43:42Like, you'll see projects that have year-old pull requests, which seems just so sad because somebody went to the extra effort of fixing code for you,
- 43:50and you didn't bother to pull it in or even respond, you know?
- 43:53Yeah.
- 43:54I agree completely.
- 43:54Yeah, it's tough.
- 43:56You also talked about release schedules.
- 43:57What's the story there?
- 43:58How often?
- 43:59What versions?
- 44:00Two, three, so on?
- 44:02Sure.
- 44:02Well, we're going from having like one release every four years to we'd really like to get on a more regular release schedule.
- 44:11So we did three beta releases or RC releases, release candidate releases, before we did the most recent 2.7.6.3 release.
- 44:22That was our final or our most recent final release or stable release.
- 44:27And so we really want to do that, you know, every couple months, do a full release with the fixes and stuff so people know that we're actively working on it and we're actively fixing issues.
- 44:37Yeah, okay, cool.
- 44:38Every couple months, we'd like to do a final release or, you know, either a minor release or a major release.
- 44:43Yeah, that's way better than every four years.
- 44:45Yeah.
- 44:45Yeah.
- 44:46Nice.
- 44:48All right.
- 44:48Then you also talked about continuous integration, IronPython 3, which we touched on a little bit, and then IronCloud or the ability to support C extensions.
- 44:57And I definitely want to just put my vote in to say, from what I've seen, the challenges that PyPy ran into, if you can support C extensions in a super clear, automatic way, that could seriously unlock the adoption.
- 45:12Yeah.
- 45:12Yeah, definitely.
- 45:13It would be a huge benefit for people using IronPython.
- 45:16And we wouldn't have to implement as many of the native modules in C# or whatever.
- 45:22Now, there may be cases where we want to because we can optimize it better without the GIL.
- 45:27But because the native libraries would assume there's a GIL there.
- 45:33So there are some things we'd probably still keep in C# or implement in C# because we would want to avoid the GIL.
- 45:39Yeah, that makes sense.
- 45:39But it would be nice to let that be a choice and not a necessity.
- 45:42Definitely.
- 45:43Definitely.
- 45:44Yeah, yeah.
- 45:45Awesome.
- 45:45All right, Alex.
- 45:47We're getting near the end of the show.
- 45:48At the end of the show, I always ask people a couple of questions.
- 45:51So let me put them to you now.
- 45:53On PyPI, there's over 80,000 packages, so many out there that you can use and just, you know, so many people probably haven't even heard of.
- 46:03Like, what's an amazing one that you'd like to sort of shine a light on?
- 46:06It's not a super, like, glamorous module, I would say.
- 46:10But my brother and I use Python with the PySerial module.
- 46:14We actually wrote an application that allowed us to interact with our body bugs.
- 46:18So I don't know if you're familiar with body bug.
- 46:20Like, it's an armband that you wear that tracks different things, like your bolts, and it's got a step counter and stuff like that.
- 46:28Oh, nice.
- 46:29And you have to have a subscription on their website to interact with it.
- 46:33And so we kind of looked around on the web and found some information on how to interact with it over the serial port.
- 46:39And so we use PySerial to interact with our body bug and get the same data that the website would get.
- 46:44Oh, that's awesome.
- 46:46It's not a glamorous module, but it was a lot of fun to be able to reverse engineer and do stuff like that with our body bugs.
- 46:51Sure.
- 46:52No, but it's a cool story.
- 46:53And, you know, you have these companies with weird restrictions and business models or whatever.
- 46:57You're like, you know, that's my data.
- 46:58It's on my arm.
- 46:59Come on.
- 46:59Exactly.
- 47:00Yeah.
- 47:00Yeah.
- 47:01Nice.
- 47:01I could probably guess what you're going to give me for the next question as an answer.
- 47:05But what's your favorite editor when you write Python code?
- 47:08Actually, I use Vim for most of my Pythons.
- 47:11I know I said Python tools from Visual Studio is awesome, but a lot of times I'm doing some quick edits to the Python code or something like that.
- 47:18So I got introduced to Vim years ago in college, and I use that quite a bit.
- 47:23I've tried using SpaceMax, which has a Vim mode for Emacs.
- 47:29But plain old vanilla Vim is kind of my go-to editor.
- 47:33Oh, right on.
- 47:34Very cool.
- 47:35All right.
- 47:35Well, any final call to action?
- 47:37Are you looking for people to help out on the project, people to try it out?
- 47:40What do you guys need?
- 47:41Oh, absolutely.
- 47:41We'd love to have anybody who wants to.
- 47:44You don't even need to, you know, write C#.
- 47:47There's all sorts of documentation we need to figure out.
- 47:50We do reuse a lot of the Python docs, but there are some things specific to Iron Python.
- 47:56Testing things out, see if there's still issues.
- 47:59We're still in that issue disposition time.
- 48:01So anybody's on to GitHub and look at the issues and see if they can reproduce it or give us a little bit more information.
- 48:08They'll kind of push us towards getting a fix faster.
- 48:10So anybody who wants to get involved, we'd love to have them on there.
- 48:14They can add on the mailing list, which we have through Python.org.
- 48:18It's Iron Python users.
- 48:19Yeah, we would welcome anybody who wants to help out.
- 48:22That sounds great.
- 48:23All right.
- 48:23If it sounds interesting to you, get out there and check it out.
- 48:26Alex, it's been fun to talk about Iron Python.
- 48:28I'm excited to see this coming back to life.
- 48:30It plays an interesting role in the ecosystem.
- 48:34So nice work and keep it up.
- 48:36Hey, thanks for having me on.
- 48:37It's been a blast.
- 48:38You bet.
- 48:38Talk to you later.
- 48:40This has been another episode of Talk Python To Me.
- 48:43Today's guest was Alex Earl.
- 48:45And this episode has been sponsored by Hired and SnapCI.
- 48:48Thank you both for supporting the show.
- 48:50Hired wants to help you find your next big thing.
- 48:53Visit Hired.com slash Talk Python To Me to get five or more offers with salary and equity presented right up front.
- 48:59And a special listener signing bonus of $2,000.
- 49:02SnapCI is modern, continuous integration and delivery.
- 49:06Build, test, and deploy your code directly from GitHub, all in your browser with debugging, Docker, and parallels included.
- 49:12Try them for free at snap.ci slash Talk Python.
- 49:15Are you or a colleague trying to learn Python?
- 49:18Have you tried books and videos that just left you bored by covering topics point by point?
- 49:23Well, check out my online course, Python Jumpstart by Building 10 Apps at talkpython.fm/course to experience a more engaging way to learn Python.
- 49:32And if you're looking for something a little more advanced, try my WritePythonic code course at talkpython.fm/Pythonic.
- 49:39You can find the links from this episode at talkpython.fm/episodes slash show slash 74.
- 49:46Be sure to subscribe to the show.
- 49:49Open your favorite podcatcher and search for Python.
- 49:51We should be right at the top.
- 49:52You can also find the iTunes feed at /itunes, Google Play feed at /play, and direct RSS feed at /rss on talkpython.fm.
- 50:01Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
- 50:06Corey just recently started selling his tracks on iTunes, so I recommend you check it out at talkpython.fm/music.
- 50:13You can browse his tracks he has for sale on iTunes and listen to the full-length version of the theme song.
- 50:19This is your host, Michael Kennedy.
- 50:20Thanks so much for listening.
- 50:22I really appreciate it.
- 50:23Smix, let's get out of here.
- 50:25Outro Music.
- 50:46*outro music*