Latest / Talk Python To Me / #59: SageMath - Open source is ready to compete in the classroom
Transcript
- 0:00What do you do when you're a high caliber mathematician or a scientist and you want to
- 0:03share your algorithms and code? Sounds like a job for GitHub, doesn't it? But the problem is often
- 0:08this work is done on proprietary platforms such as Magma, MATLAB, Mathematica, and others.
- 0:12Not only can you not share your licenses for, say, MATLAB, but there are often proprietary
- 0:18separate libraries and tools for specialized work. These are expensive products. One example
- 0:23from my distant past was using the wavelet toolbox on MATLAB. MATLAB itself is over $2,000
- 0:29and the wavelet library is another $1,000. So to share my code, you must have both licenses
- 0:35yourself. This is a problem. Well, if you're William Stein, you take this problem and you turn
- 0:40it into an opportunity to build an open source competitor to MATLAB and related platforms.
- 0:44This episode is all about SageMath, an open source feature-rich option for scientists and mathematicians
- 0:50built by over 500 contributors and consisting of over 500,000 lines of Python and Cython code.
- 0:57This is Talk Python To Me, episode 59, recorded May 10th, 2016.
- 1:24Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the
- 1:30ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter
- 1:35where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm
- 1:40and follow the show on Twitter via at Talk Python. This episode is brought to you by Hired and SnapCI.
- 1:47Thank them for supporting the show on Twitter via at Hired underscore HQ and at Snap underscore CI.
- 1:53During the conversation, we talked about running SageMath on Windows and some of the challenges there.
- 1:59We mentioned that the new Ubuntu subsystem coming to Windows 10 this summer may make this easier.
- 2:04Well, just after we recorded this episode, someone did indeed post a message to the SageMath mailing list
- 2:09showing it running on the Ubuntu subsystem on Windows 10. So look for more goodness in that area down the line.
- 2:15Now, let's chat with William.
- 2:17William, welcome to the show.
- 2:19Thank you.
- 2:20Yeah, it's super exciting what we have to talk about today. We're going to talk about
- 2:23building quite a large ecosystem of computational mathematical tools with Python and a bunch of
- 2:33other related technologies, Cython, C, IPython, lots of stuff, right?
- 2:38Mm-hmm.
- 2:39Yeah, it'll be a lot of fun. But before we get into it, of course, tell me your story. How do you get
- 2:43into programming and Python? You're a mathematician by training, right?
- 2:47Yes. Yeah. So I've always been into programming since I was like five years old, but I got very
- 2:56much into mathematics. As an undergraduate, I was a computer science major for a little while,
- 3:01and then I switched to mathematics since I love it, especially number theory. And then I went to
- 3:06graduate school at UC Berkeley from 1995 to 2000. And while I was at graduate school, I got heavily
- 3:13involved into computing with various objects that come up in number theory. And so I had to write a
- 3:19lot of code in order to compute with those objects. So I just wrote a huge amount of C++ code using a lot
- 3:27of the libraries in the mid-1990s. It was really painful. It would take like 30 minutes or an hour to
- 3:32compile, do lots of templating. And I wrote a little interpreter so I could create modular forms and
- 3:38other mathematical objects and compute with them. And I was doing this sort of all in isolation without
- 3:47using much beyond some C++ libraries. And then I found out about a computer algebra system called
- 3:53Magma, which was extremely powerful for computing in abstract mathematical domains. It's kind of,
- 4:01it's in a way, kind of a competitor to Mathematica or MATLAB, but aimed much more abstract mathematics.
- 4:07So it has heavy support for group theory, abstract algebra, graph theory, etc. And very little support
- 4:14for symbolic calculus. But it's what I needed for my PhD thesis work. So I worked really heavily on it.
- 4:20It's extremely powerful system. And I wrote maybe 30 or 40,000 lines of code that are included with
- 4:26that software. I went down and visited them in Sydney, Australia a few times. But one frustrating
- 4:33thing about Magma is that it's closed source. I saw a talk by Manjul Bhargava, who recently won the
- 4:40Fields Medal. But back in 2003, he was talking in Paris about using Magma for some research on quadratic
- 4:47forms. And he was running into some brick walls due to it being closed source. And I also kind of took
- 4:53stock of my own computing environment at the time. I used Linux, LaTeX, Emacs, and everything on my
- 5:00computer was open source, except Magma, which was the one program that I cared about, and which really
- 5:05mattered for my research. So I thought that was ridiculous.
- 5:08Right. That's the most important thing. Yeah, the most important thing that you actually were working
- 5:12with was the one that you had the least control or visibility into, right?
- 5:17Yeah, exactly. And at that time, I was also using Python a lot, not for mathematics, but for
- 5:25kind of scripting mathematics. So if I wanted to do a bunch of computations on a cluster, I would start
- 5:30them. I would write little scripts via Python to start up the computations. I wrote websites using
- 5:35Python. So I was using Python a lot, kind of as a complementary tool to mathematical computation.
- 5:41And so I was at least familiar with Python because of this. And it was back in 2002, 2003, when Python
- 5:47was more primitive than it is now.
- 5:50Right. That's just a little before it started to get its scientific legs under it with things like
- 5:57NumPy and SciPy. And it wasn't quite there, but it was on the verge of that breakout, right?
- 6:02Yeah. But it still was a pleasant interpreter environment. And it had modern features like
- 6:08multiple inheritance, you could define your own data types, had good exception handling, etc.
- 6:13And so I really appreciated some of the functionality it had over, say, Magma. Magma,
- 6:18though, has a massive library and is incredibly powerful. It misses a lot of basic features of a modern
- 6:25programming language, which by modern, I mean, say, at least as good as C++ in 1993. I was used to at
- 6:32least having exception handling and being able to define my own classes and so on.
- 6:36Right. That's one of the challenges of not just Magma, I would say, but, you know, things like
- 6:42R to some degree, MATLAB, Mathematica, all these various highly specialized tools that are great at
- 6:49solving some type of computation or some kind of problem. But when you have to go and build a full
- 6:54application out of it or something, it kind of hits a wall, right?
- 6:58Yeah, exactly. There are a whole bunch of special purpose math languages designed by mathematicians.
- 7:04And though they are pretty good for mathematics, they don't really compete with what you get when
- 7:12you have computer science people systematically put full-time effort into designing a language
- 7:17and then a whole ecosystem around that language. And so the difference between trying to write a
- 7:22non-trivial program in Python versus Magma is that with Python, you have this massive ecosystem of
- 7:28tools plus a language that's very general purpose. Whereas with Magma or Mathematica or MATLAB,
- 7:33it's really good maybe for parts of the math things, but for the other parts, just manipulating strings
- 7:39or whatever, it can be pretty painful.
- 7:41Yeah, absolutely. So you were working with Magma and you couldn't really use it in the way that you
- 7:48wanted to, sort of like a web front end or as the backend for a web front end. And that's one of the
- 7:54problems you run into a lot with these types of software. I'm specifically thinking of MATLAB because
- 7:59I have the most experience with it, but there's all sorts of little, you know, pay for this bit,
- 8:03pay for that bit. It's registered on that machine. Like the rules are just crazy, right? And so you got
- 8:10frustrated with this. Yeah.
- 8:11Yeah. So in particular with Magma, the project director sent me in a message saying that I wasn't
- 8:18allowed to use it as a general purpose compute engine on the backend for my websites. And that
- 8:25was very frustrating. It wasn't just a matter of pay them or not pay them or get the right license
- 8:28since they're a little more informal than that. And they don't really have kind of official licenses.
- 8:33So that was like a huge wake up call that I really needed to do something. And so I decided I was going
- 8:39to survey the open source landscape again for math software and see what's out there and then switch.
- 8:44But when I looked around, it was really kind of frustrating back then. There were a number of
- 8:52programs that kind of competed with Magma, but were much more specialized. And despite Magma's language
- 8:59being fairly primitive compared to say Python, the other systems had languages that were much, much more
- 9:04primitive yet. So, I mean, it's kind of hard to emphasize how primitive they are. It's kind of like
- 9:11using, I don't know, assembly programming. I mean, things like different namespaces, that sort of thing is,
- 9:17is an advanced feature compared to what's available in some of those languages. So I couldn't really bring
- 9:23myself to go back to that. And also there's a huge amount of functionality that got implemented in Magma
- 9:29over about a decade. And it just wasn't implemented anywhere in open source, which was a serious problem
- 9:36as well. So there was just a massive lack of functionality. So what I decided naively first to
- 9:43do is just choose a language. And I spent about six months to a year evaluating options like OCaml and
- 9:49directly writing something myself in C++ and using Python. And at the end of the day, I chose Python
- 9:55because the language was most similar to Magma's. And so I thought it would be easier to get users over
- 10:01from Magma. And also the Python C API was kind of like what Magma had, but much cleaner as far as how
- 10:09Magma itself is implemented. And so one thing about Python is that if you want to write a function that you
- 10:15can use from the interpreter and is really fast, you can write it in C if you need to. And it's just as fast as if
- 10:20you wrote it in C. And that's kind of a basic requirement if you're going to write code that will be used for
- 10:24research, that you can write very, very fast code. So Python was good enough. And then I decided I would just sit down
- 10:30in Python C and me, and I would look at maybe code from other projects and look up algorithms and implement
- 10:36everything I needed. And this lasted about three hours. And I realized how insanely hard that would be to do.
- 10:43And I completely switched courses and decided that purely out of laziness, I would try to wrap existing
- 10:50code in whatever way I had to do so. So using P expect pseudo TTY type stuff, using C libraries,
- 10:59and we're adding C libraries to existing computer algebra systems, etc.
- 11:04So maybe not everyone knows expect. Actually, a lot of people don't know. What was it? They know
- 11:09C, of course, but what does P expect? So one way if you have a, say, Python program,
- 11:15and you'd like it to interact with some other kind of bizarre, let's just let's say there's a program
- 11:21called Symmetrica or something, just some one researcher wrote it has a command line interface,
- 11:26and it doesn't have any C library interface or anything. But you really want to call functions
- 11:31in there and run some code there and get the results. What P expect will do is let you basically
- 11:36simulate the terminal and use Python to programmatically feed code into the other program,
- 11:43look at what output it produces, and then parse that output and return it. So it abstracts things away
- 11:48and makes it look like you're calling some functions in a Python library. But really behind the scenes,
- 11:54things are really more or less being copy pasted into a terminal. It's nice because you can interface
- 12:00with a black, a closed source black box this way, if you need to. And the drawback is that it's brittle,
- 12:07and it's potentially slow. There's a lot of latency. Instead of, well, there's a several millisecond
- 12:13overhead to every single thing you do, which is painful. You really want the overhead to be a microsecond,
- 12:18not a milliseconds. So there's like a order of magnitude of 1000 latency, which can be really
- 12:23annoying. Interesting. So yeah, yeah. So you were, you were naive and hopeful and you just said,
- 12:30I'm going to go write this. And then you basically just said, all right, forget that. Let's try to find
- 12:35all the good building blocks that are already built and build upon them. And that's a very open source
- 12:40way of problem solving as anyway, right? Yep. So I think about it this way. Like when I worked with Magma,
- 12:46my team was all the other people, you know, working on that project. And when I switched to trying to do
- 12:51something open source, the team was all other people in the entire open source sort of world,
- 12:55everybody that contributed to open source. And definitely the easy way to go would be to
- 13:00choose the best libraries for number theory and commutative algebra and graph theory and so on and
- 13:05put them all together. And they weren't kind of built to be put together or to be called from Python,
- 13:11Python. But it, no matter how hard it would be, it's way easier to provide a library interface to
- 13:17one of those other systems that you can then use from Python very efficiently than to write one of
- 13:22those systems from scratch. Like each of those systems took decades and decades of work to write.
- 13:28So, I mean, total.
- 13:29Yeah. And to debug them and fine tune them and, you know, that kind of stuff's very hard to know,
- 13:34even if it's right some of the time.
- 13:36And a lot of the algorithms, you really kind of have to be in the throes of a PhD
- 13:40focused for years just to understand what the algorithms are and how they work. And
- 13:44like, there's just no way one person can replicate that despite wanting to.
- 13:50That's interesting. So in the end, you decided, all right, Magma is cool, but it's, it's got all
- 13:57these restrictions and I'm going to go put this thing together. And what you built was called
- 14:01SageMath, right?
- 14:02Yes. Yep. So I built SageMath, which is, well, basically what it is, is it's a Python library,
- 14:13but many of the dependencies are these tricky to compile C programs or Fortran programs or whatever,
- 14:20which were written by mathematicians only to run on Linux, maybe just for their research.
- 14:26And so in addition to just being a Python library, it's also a build system,
- 14:30kind of like Anaconda, but obviously a little bit before that. And it targets a different type of
- 14:37dependence, like different types of packages. It's a build system. It's a Python library,
- 14:43library. And then to make it more friendly for mathematicians, it has a customized IPython
- 14:48command line. And also around 2006, we wrote a web-based graphical interface, which is like the
- 14:55IPython notebook, but we wrote it a few years earlier. And it was before things like WebSockets
- 15:00and a lot of nice modern JavaScript functionality existed.
- 15:04Back in the dark days of JavaScript, when it was earning its bad reputation.
- 15:09Yep. It was, we started writing it right when I think Google Maps and Gmail appeared.
- 15:13And there was this thing called Ajax, which let you update a web page without refreshing.
- 15:19And so we had that little bit of functionality, but the thing we didn't get was a consistent
- 15:23or a persistent connection. So instead we had to do polling techniques and all kinds of tricks that
- 15:29were ugly.
- 15:30Yeah. Very interesting.
- 15:31In order to make it like, when you do a for loop in Python, you want to see the output as it appears.
- 15:35And in order to do that, we had to do a lot of hacky stuff.
- 15:38Yeah. So I think the way maybe to conceptualize it is this is an open source alternative to
- 15:43something like Mathematica.
- 15:45Exactly.
- 15:45Or MATLAB maybe, but it's, it leverages a lot of the good data science, scientific tooling
- 15:52of Python, like IPython notebooks, for example.
- 15:55Exactly. So initially I just wanted it to be good enough for my number theory research, number
- 16:02theory being my research area. But the second developer wasn't a number theorist. The second
- 16:07person I could get on board is did research in coding theory. And so he wanted a bunch of
- 16:12functionality that had little to do with number theories. And then he also wanted to teach
- 16:16undergraduate courses like calculus and differential equations. And so I started adding a lot of
- 16:21functionality related to those classes, just so that the range of applicability would get
- 16:26bigger and I could get a few more developers and things sort of growing, started growing
- 16:31that way. And so this, the system quickly went from being just for number theory to being much
- 16:36more general. And in order to kind of focus development and decide what it should be, we chose the motto
- 16:42or the mission statement to create a viable open source free alternative to Magma, Mathematica,
- 16:49Matlab and Maple. Our focus, none of the developers really have a focus on numerical computation.
- 16:55So we, in Sage itself, in the Sage library, focus more on algebraic aspects of things. So arbitrary
- 17:03precision arithmetic, working with very quickly with large integers and rational numbers, doing linear algebra,
- 17:10where you have no roundoff error, that sort of thing. And for the more numerical parts, the kind of viable
- 17:16alternative to Matlab, we just incorporate libraries like NumPy, SciPy,
- 17:20et cetera. Yeah.
- 17:22Which the Python community has done an amazing job of developing over the years.
- 17:25Right. And that's definitely gaining speed now, right?
- 17:27Yeah. It's absolutely incredible now. I mean, we wanted all along to be a viable alternative
- 17:32to Matlab. And I remember in 2006, trying to write statistics,
- 17:36functionality, and all this kind of stuff for Sage directly. And just being like, I don't want to do
- 17:42this at all, but it's part of what we're trying to do to get more users. So here I am doing it.
- 17:46And I'm so happy that the community has come along and just made Python absolutely first rate in
- 17:52statistics and numerical computing so that we can just incorporate that functionality.
- 17:56Yeah, that's really great. One thing I think before we get too far into the details would be
- 18:00interesting for the listeners is just the scale of this project, the number of developers, number of
- 18:06lines of code, the technologies involved. Could you just give them like a quick sense of that?
- 18:10Sure. So the project itself incorporates about 100 packages. We have done a lot of development at what
- 18:18we call Sage Days workshops. And those we often have about 10 to 15 per year. We've had, I think,
- 18:2780 Sage Days workshops so far. They're kind of inspired by the pypy workshops that happened about
- 18:33a couple of years ago. But basically, we come together for a week and do lots of development.
- 18:39The number of contributors to Sage is around 500. So those are people who have contributed
- 18:43directly to the Sage library. Of course, Sage itself incorporates all these other open source
- 18:49packages, which have their own contributor groups. The amount of source code, I don't know the exact
- 18:55number, but it's on the order of several hundred thousand lines of actual code. And the code is about
- 19:02maybe 60% Python and maybe 40% Cython code. So there's a very, very large amount of Cython code that we've
- 19:11written. And functionality wise, we do cover very wide range of areas of mathematics. So almost anytime
- 19:19somebody comes to use it, they find that there is something for the area of math that they're interested in.
- 19:25This episode is brought to you by Hired. Hired is a two sided curated marketplace that connects the
- 19:42world's knowledge workers to the best opportunities. Each offer you receive has salary and equity presented
- 19:47right up front, and you can view the offers to accept or reject them before you even talk to the company.
- 19:52Typically candidates receive five or more offers within the first week and there are no obligations
- 19:57ever. Sounds awesome, doesn't it? Well, did I mention the signing bonus? Everyone who accepts a job
- 20:02from Hired gets a thousand dollar signing bonus. And as Talk Python listeners, it gets way sweeter.
- 20:07Use the link Hired.com slash Talk Python To Me and Hired will double the signing bonus to $2,000.
- 20:12Opportunities knocking. Visit Hired.com slash Talk Python To Me and answer the call.
- 20:18That's awesome. That's a really large scale project. And I think it's a cool success story.
- 20:30So it's written in Python and Cython, which is kind of a flavor of Python. But you also chose Python as
- 20:38basically the programming language of the system itself, right? Like MATLAB has its .in files with its own
- 20:45language. Mathematica has their own language. But you sort of said, hey, Python is a good match for
- 20:50the mathematicians.
- 20:51Yes. So this is a decision that I made, I would say, purely out of laziness originally. As a CS undergrad,
- 21:00I had written an interpreter. I took a course in writing interpreters. And I tried to do that again
- 21:07for some of my number three research. And I also had just seen how hard it is to really develop a
- 21:13programming language. And I really didn't want to do it. And moreover, the MAGMA group, I had often made
- 21:19requests for them to improve their language. And they responded that though they could get grant funding
- 21:23for the mathematical algorithms, they had a huge amount of trouble getting any funding for the actual
- 21:29language because their funding sources were in mathematics. So I was kind of scared for a number of
- 21:34reasons off from writing my own language. And basically, I'm like, well, I mean, it just follows
- 21:42the same principle of reusing third party libraries and computer algebra systems to reuse a third party
- 21:47language as well. I decided to use Python. It was criticized a lot by math people, because like literally
- 21:54every other project like Sage that's ever happened up until that point used their made up their own
- 21:59language was kind of like the thing you had to do. How has that criticism changed over time?
- 22:03Do they still feel that way? Or has it become more accepted?
- 22:07Way more accepted. And it's now considered a huge advantage. And often when people when I hear people
- 22:14convincing other people to switch from Mathematica to Sage, at all levels, both at research and undergrad
- 22:20teaching, one of the biggest, maybe the strongest arguments is that Python, the language is just a better
- 22:26language. Because the syntax is easier for the students. And it's it prepares them for other
- 22:32possible employment opportunities and down the line. So that's pretty interesting. Because when
- 22:38I was studying math at university, I did study C++ and scheme and other things because I took some
- 22:46computer science classes. But my math education really taught me just the math,
- 22:52math lab language, whatever you call that. I'm sure there's a name for it. But you know,
- 22:58that that's a very limited skill set to take away if I go out into the job market, right? But if people
- 23:05as part of learning their their math and doing their research, their statistics, whatever, become
- 23:11semi-proficient in Python, just sort of silently in the background, that's a really cool side effect.
- 23:18Yeah. And I have had many PhD students who learned Python really, really well as a result of working
- 23:25with me. And they really do use it in their jobs today. Like one of them, Robert Miller, who wrote a
- 23:32huge amount of our graph theory functionality, now works as a data scientist at Google. And another one,
- 23:37Simon Spicer, also works as a data scientist, but at Facebook. And they use Python, both of them use
- 23:42Python really heavily in their jobs.
- 23:43That's cool. Do you know if they use SageMath there?
- 23:45I don't think either of them use SageMath for their jobs. But I do know that SageMath is used
- 23:50at Google by some people, but not necessarily my students.
- 23:54Okay, yeah, that's very cool. What would you say to people who are maybe just straight up using
- 23:59NumPy or Matplotlib today? Maybe they're using an IPython notebook, like, should they consider using
- 24:07SageMath? And what would it offer them?
- 24:08It depends on what you're doing. So SageMath does symbolic things, and it can be very efficient at
- 24:14doing them. Like you have a large matrix, and you want to do something with it, and you want to have
- 24:19no rounding errors at all. Or you want to do something with linear algebra over finite fields or coding
- 24:25theory. Basically, Sage provides a lot of functionality that's complementary to the numerical things that are
- 24:31offered by NumPy and SciPy. It overlaps some with SymPy, S-Y-M-P-Y, though it has a lot of functionality that isn't in
- 24:40SymPy. And in many cases, it can be a lot faster. So also, another remark is that Sage now uses Jupyter
- 24:48Notebooks as our default graphical user interface. So when you download and install Sage, you get Jupyter
- 24:53Notebooks. One big drawback, which I hope to address in the future, is that currently, by far, the easiest way to use
- 25:00Sage is to install our self-contained distribution. And it's completely separate, really, from PyPy,
- 25:07the Python packaging repository. And it's not something that you can just install in your own
- 25:13Python environment. Right. There's no pip install SageMath. Yeah. Not yet. Yeah. I really, really hope
- 25:18there will be in the future. But right now, that isn't the case. Right. And so that interferes with easy
- 25:24adoption by existing Python users. That's true. But you do have a pretty decent way of getting it. You can go
- 25:30like on the Mac, you can go download just a DMG, just a disk image. Or on Linux, you can get a tarball.
- 25:38And it's kind of all self-contained there. So it's not too hard to get started with, right?
- 25:42Yeah. A lot of our users just want to do math rather than deal with installation. And so we do put a huge
- 25:49amount of effort into making it easy to just install. So we have Windows, Linux, and OS X binaries ready to go.
- 25:57So the Windows one currently is a virtual machine that you run. And then it provides a server. And
- 26:03then you get a Jupyter notebook that you can use Sage through.
- 26:05I see. So maybe you run Internet Explorer, but then you're requesting back into like a Linux thing on a
- 26:12virtual box or something?
- 26:13Exactly. Yeah. That's how currently, that's our main supported environment in Windows right now.
- 26:17Okay. Yeah. That's an easier way to get some of those libraries to compile for Windows, right?
- 26:22Yeah. That is a seriously hard problem to get some of those libraries that were not built for Windows,
- 26:27the C libraries or Fortran to compile there, right?
- 26:30It's really, really hard. We've, we tried for years and are still trying to natively port Sage to Windows.
- 26:38And I don't know if or when it will ever succeed.
- 26:41Yeah. Yeah. Interesting.
- 26:43It's like a, I don't know, in the Sage project, there's a lot of these sort of tall mountains that are
- 26:47very difficult to climb and four or five people will try and fail. And then the sixth person will succeed.
- 26:53Like writing a really good implementation of working with what are called finite abelian groups was one
- 27:00thing where it just seemed like one person after the other tried and failed. And then eventually somebody got it.
- 27:05And I hope porting Sage to Windows will be a similar thing. Some combination of
- 27:09the right approach and Microsoft Windows getting more friendly to PostSix style programs.
- 27:16Yeah. Well, you know, did you, I don't know if you heard, you are in Seattle, right? So maybe you heard
- 27:22that Microsoft in this summer, they're shipping a new version of Windows 10 and it comes
- 27:28with the ability to run native Linux binaries on the command line.
- 27:33Yeah. So that's just awesome. And Microsoft is going in the right direction that we should
- 27:38have something that works natively by maybe using, well, using that. It sounds really likely
- 27:43actually.
- 27:43It's, it was, it's gotta be a huge step in the right direction for you guys. So I don't
- 27:48know if it'd fix it, but it's definitely not a negative.
- 27:50Yep. Absolutely.
- 27:51So one thing that's interesting, well, there's, there's a bunch of interesting things I want
- 27:56to ask you about this. Let's start with this one. So doing math is obviously computational,
- 28:03right? Computationally intensive and having more computational power is, is key on modern
- 28:10hardware. That means parallelism, right?
- 28:12Yep. It can.
- 28:16How does it leverage, like multi-core machines? Does it support like parallel computational
- 28:21parallelism and things like that in it?
- 28:23So one thing that surprises me a lot over the years, at least in pure mathematics, the
- 28:30sort of parallelism that we have to do is usually what's called embarrassingly parallel sometimes.
- 28:35So somehow it's a lot easier than what people do in numerical computing with, you know, earthquake
- 28:41simulation or whatever, where they have some big distributed computation and each step depends
- 28:46on previous steps and there's lots of data flying all over the place and you have to use MPI or
- 28:51something to do it. So the parallelization that typically comes up is you want to evaluate some
- 28:58function F, 10,000 values of N. And so you just do it pretty easily and there's no real
- 29:04dependencies between them. So basically using fork, just using stuff built around fork, you can do pretty
- 29:11good parallelization that works pretty well for us as I've found.
- 29:17Yeah. Okay. So in the embarrassingly parallel case, you just basically split it across processes
- 29:23or something like that and a problem is solved, right? They've, they got their own guild, but who
- 29:27cares? Cause it's theirs.
- 29:28And you also, if you use a database, so you have your, you can have a process startup query a database
- 29:34for some things that haven't been done, do them and put the results back in. So simple techniques
- 29:40like that have pretty kept, I don't know, the community pretty happy. Some of our parallelization
- 29:46issues aren't too ridiculously hard. There are, there are much more subtle, interesting, like low
- 29:51level parallelization techniques that go into Sage where there's some C library or C++ library,
- 29:58some Sage developer writes like David Harvey is a guy who wrote some super fast code for
- 30:03polynomial multiplication and it uses parallelization techniques. And so Sage just kind of, or really Sage
- 30:11via some, via Python just calls out to this library. The library happens to do things in parallel and
- 30:17then give back a result. And so there's lots of little places like that where we have libraries
- 30:21that just implicitly do things in parallel. They're like highly multi-threaded and you don't even know
- 30:26they're, they're doing it unless you, you know, explicitly look right. So there's that level.
- 30:31And then there's also the level of other, of forking. I wrote a decorator for Python called
- 30:37parallel, which is included in Sage. So you put app parallel before a function. And then if you call
- 30:43it with a list of inputs, it will, it'll fork the process, call the function with each of those inputs
- 30:49up to the number of processors you have, and then get the results and give them back to you as a generator.
- 30:54So there's some little things like that that are built into Sage and it takes care of some
- 30:58possibly tricky surprises that would happen behind the scenes involving sub processes and so on.
- 31:04That's really awesome. That's a very, Pythonic little statement you made there. I'm going to put a
- 31:09decorator on it. It's going to, you know, fork this off and return it as a generator. I mean, that's,
- 31:14that is really great.
- 31:15Yeah. And it works really well. We have code that like nested functions written in Cython that just
- 31:22happen to have an app parallel decorator on them and then they'll fork and regroup properly.
- 31:26And the code itself is just probably two pages of code, maybe three pages. It's not a lot of code.
- 31:31Yeah. It's just getting the right, concept or the Zen of the style to make it really,
- 31:38um, expressive or whatever. Right.
- 31:39Yep. there's a lot of, there's a ton of pieces of little things like that all over in Sage,
- 31:44where I would like to separate them out as Python libraries, like individual standalone Python
- 31:50libraries, and then have Sage pip install them as part of its kind of build process. So that would
- 31:56make them much more widely available to the community. And then when they're running the context of Sage,
- 32:00they would know to do the extra things that Sage needs and they wouldn't do those things.
- 32:04otherwise. We also have a pre-parser. So for mathematicians, just an example, if you type two
- 32:11slash three in Python two, which is what Sage uses, you get zero, which is floor division in Python three,
- 32:18you get 0.666666. And neither of those are what pure mathematician expects. Pure mathematician
- 32:24expects to get two thirds, which is like an exact rational number. So in Sage, we have a little pre-parser.
- 32:31So when you use Sage directly via its own command line, which is this modified IPython
- 32:35interactive command line, it will take each line of input and then do a little bit of parsing to it.
- 32:41for example, when you type two slash three, it replaces it by integer of two slash integer of three.
- 32:47And then that allows you to make your own custom integer type. And then there's a bunch of other
- 32:51things similar to that. would like, for example, when you use the carrot symbol, which in Python
- 32:57means exclusive or a lot of mathematicians are used to that meaning exponentiation because that's what
- 33:02it means in LaTeX.
- 33:03Right. Not as opposed to double star or something like this. Yeah.
- 33:06Yeah. It's really like, so in Sage, when you type the carrot symbol, it gets converted to double star
- 33:11before it gets sent to Python. So there's, you don't do it. Mathematicians almost never do exclusive
- 33:17or, but they do exponentiation constantly when typing in polynomials and all kinds of things.
- 33:23so it's this optional thing that makes the Sage interface more friendly to mathematicians. It gives
- 33:28us our own kind of new language, but in a very well-defined minimal way, which is just built on top of
- 33:34Python. And in most cases, the things that get pre-parsed would be invalid Python code. And it would be nice to
- 33:40connect us with Python packages. It would be nice if we could take this pre-parser and make it a standalone
- 33:45Python package, which Sage just happens to use. And maybe like we have various interesting functionality in there,
- 33:52like square brackets, one dot dot 10 gives you the list of numbers from one to 10. It's kind of like the notation you'd have in
- 34:00MATLAB or Maple instead of using the range function. And there was a Python PEP to implement it, but it didn't get
- 34:06accepted. But so many Sage people wanted it. Robert Bradshaw just implemented it anyways and added it to the pre-parser.
- 34:13So it would be kind of neat if this whole pre-parser were made more generally available and then Sage just happened to use it.
- 34:34Continuous delivery isn't just a buzzword. It's a shift in productivity that will help your whole team become more efficient.
- 34:39With SnapCI's continuous delivery tool, you can test, debug, and deploy your code quickly and reliably.
- 34:46Get your product in the hands of your users faster and deploy from just about anywhere at any time.
- 34:51And did you know that ThoughtWorks literally wrote the book on continuous integration and continuous delivery?
- 34:57Connect Snap to your GitHub repo and they'll build and run your first pipeline automagically.
- 35:02Thanks SnapCI for sponsoring this episode by trying them for free at snap.ci slash talkpython.
- 35:17Maybe it could even have different grammars for different areas.
- 35:21Like maybe geologists do something different for the mathematicians. Who knows?
- 35:25Yeah. And so maybe somebody is proposing some great matrix operations to include in Python eventually.
- 35:31And maybe they git added to Python 3, but they're not in Python 2.
- 35:35You could use the pre-parser and still have those.
- 35:36And everything just gets converted to straight Python.
- 35:39So you could convert everything and then stick it in a Python library if you need to.
- 35:43That's cool.
- 35:43You said that in your documentation you say you have a UI kit for adding user interfaces to calculations and the app.
- 35:50That sounds pretty cool.
- 35:52What's the UI technology there and how does that work?
- 35:55Do you remember?
- 35:56Yeah, I'm not quite sure what that refers to.
- 35:59Yeah, okay. No worries.
- 36:00Yeah, sorry.
- 36:01That was written long ago, right? Okay.
- 36:03And there's a lot of people.
- 36:04The other problem is there's 500 contributors.
- 36:06So I have very limited knowledge.
- 36:10Sure, no worries.
- 36:10I'll ask you another sort of math question.
- 36:13One of the things when you're writing scientific and especially mathematical papers for academics and so on is you use LaTeX.
- 36:22So you can very precisely express symbolic mathematics like integral signs and things like that.
- 36:30And this is built right into it, right?
- 36:32Yeah, so the connection between Sage and LaTeX is, of course, mathematicians all use LaTeX.
- 36:39So we have a Dunder method.
- 36:41Well, it's really just a single underscore method, underscore LaTeX underscore, and it's defined on most objects that you create in Sage.
- 36:49And it gives back the LaTeX representation of that object.
- 36:52It works a lot like the wrapper method in Python, but it's to give you a LaTeX representation rather than...
- 36:58Right, right. That's awesome.
- 36:59Yeah, so we have...
- 36:59And it kind of recursively goes down the stack.
- 37:02So if you make a matrix with entries that are rational functions over some other thing, then there's automatically a way to turn that entire matrix into a LaTeX representation.
- 37:12And that gets used in the graphical user interface fairly automatically if you want, like in Jupyter Notebooks or in Sage worksheets.
- 37:19Also, we have a LaTeX package called SageTec, which lets you write a LaTeX document and then use commands like backslash Sage right inside the LaTeX document.
- 37:34So you can write something like consider and then in dollar signs backslash Sage.
- 37:39And then in braces, you can put some expression and it will get evaluated using Sage whenever you LaTeX the document.
- 37:45And then the result's cached.
- 37:46And you can also put blocks of code and the output gets automatically put into your LaTeX document.
- 37:51So basically it makes it so your LaTeX document can have executable Python code.
- 37:56But it's really...
- 37:58I mean, there's a similar thing like this for just Python.
- 38:00But for Sage, it also gives functionality for graphics.
- 38:04And it knows that Sage objects can be... have a LaTeX representation and it uses that automatically when typesetting the results.
- 38:12Yeah, that's really cool.
- 38:13So it's something that was written at the first Sage days way back in 2006.
- 38:17Yeah, yeah, really nice.
- 38:18Long, long ago.
- 38:19So...
- 38:20And it's been developed ever since.
- 38:21So another part of this system that I think is really interesting is Cython.
- 38:27And Cython actually...
- 38:28This I had no idea about.
- 38:30I just want to talk to you about SageMath.
- 38:31But Cython actually came out of this project, right?
- 38:34Yes, in the following sense.
- 38:35So when I started Sage, I mentioned before that Python plus the Python C API was kind of like the killer combination that meant that I could implement what I wanted in Sage on top of Python.
- 38:48So I had all these little benchmark programs and I would try to implement them in other languages like OCaml, like these really fast functional compiled languages.
- 38:58And I would get something that was fast, but it wasn't quite as fast as I could write in C.
- 39:01And if you kind of look, basically overall C lets you write really fast code and Python lets you use C code to write new functions.
- 39:10But the Python C API is pretty challenging and potentially error prone.
- 39:14You have to do manual reference counting all over the place.
- 39:16And the different...
- 39:18The ways in which the Python C API functions work can take a while to learn.
- 39:22And I really envisioned a lot of people, including me when I'm tired or just really want to get work done, writing code.
- 39:30And I wanted to write a huge amount of code.
- 39:31And I didn't think it was really viable to write directly against the Python C API.
- 39:35I would mess up some reference counting and get seg faults.
- 39:38And that just wasn't what I wanted to do.
- 39:40And so I started planning to write some Python program that would generate code against the Python C API.
- 39:46And I got excited about the possibility of doing that.
- 39:51And then I started searching around and found a program called Pyrex, which is like the glassware, P-Y-R-E-X, by Greg Ewing, who is a Python contributor.
- 40:00And he wrote this amazing program where you could write code.
- 40:05It looked almost like Python, but it would get converted into C extensions.
- 40:09And those would get linked into Python.
- 40:12And so that was really amazing.
- 40:14But it lacked a lot of functionality.
- 40:16Like it didn't have list comprehensions.
- 40:18And there were just a lot of little things.
- 40:21You couldn't do nested functions.
- 40:23Also, he didn't use revision control or anything.
- 40:25And he just kind of made it a zip archive every once in a while.
- 40:29It seemed like he worked on it mainly during the Christmas break each year or something.
- 40:33Those were the early days.
- 40:34A lot ago, right?
- 40:36So, yeah.
- 40:36So this was like 2004, 2005.
- 40:39And it was an absolutely awesome project.
- 40:42But it kind of wasn't really going anywhere.
- 40:44And so I started adding functionality I needed to Pyrex.
- 40:49And that was...
- 40:52I mean, I don't really like writing compilers very much.
- 40:54It's not my thing.
- 40:55I'm not very good at it.
- 40:57But I had this PhD student, Robert Bradshaw, who I mentioned before, who now works at Google.
- 41:01And he started diving in and writing a lot of really tricky stuff and doing all these optimizations to Pyrex.
- 41:08And I thought that was pretty cool.
- 41:10And then another guy, Stefan Benel, who is the developer of LXML, which is a Python library,
- 41:16he was forking Pyrex to add all kinds of things as well.
- 41:19And then at the same time, I made up a project called SageX for making Sage faster.
- 41:25And it was just a combination of some of these Pyrex forks.
- 41:28The name was really bad, though.
- 41:30SageX.
- 41:30And we were just distributing it inside of Sage.
- 41:33So that was kind of stupid.
- 41:34And so after about a year of that, I looked at this book by Fogel called Producing OSS.
- 41:40It's on his website, producingoss.com.
- 41:43And I think it's inspired by the Subversion Project.
- 41:46It's a great book.
- 41:48And I started...
- 41:49You know, like when you read a book...
- 41:51To me, like when I read a book, I kind of as an exercise think about a lot of stuff while I'm reading the book.
- 41:55And so I started thinking about SageX and Pyrex.
- 41:58And then I was brainstorming for a name for this thing and kind of thinking,
- 42:04I should make this into a proper open source project.
- 42:06And then I came up with this name, Cython, which is like Python, but C.
- 42:11But I thought it was a better name than SageX, which is hard to say.
- 42:15And sort of doesn't have anything to do with Python or C.
- 42:18And so I Googled it.
- 42:19And there was only one hit, which I could find.
- 42:22And it was a picture of this punk rocker in England who called himself Cython flipping you off.
- 42:28And so I thought, I'm safe.
- 42:30You'll probably not lay claim to this, really.
- 42:34Exactly.
- 42:35So I thought, I'm safe.
- 42:36I can choose this as a name.
- 42:37And then I wrote to...
- 42:38Or I talked to my PhD student, Robert, and to Stefan Benel.
- 42:42And I'm like, so I'm going to start this project and make you the lead developer.
- 42:48And each of them said no.
- 42:49And so I was a little worried about that.
- 42:51So I made them both lead developers and kind of like stepped back from it, made the website, bought the domain name.
- 42:57And though they both sort of decided not to be the lead developer, they together did an amazing amount of work.
- 43:04And then other people started contributing.
- 43:06And I mean, it really has blown up a huge amount since then.
- 43:10So I did try to push their direction to be, make it so that Cython can compile all of Python.
- 43:17Like you could take the standard Python test suite and just build it and see how fast it is compared to Python.
- 43:22And the systems really got deep because part of the test cases for Cython is compile all of Sage, which is huge, and then run the Sage test suite.
- 43:33And also there are sort of things we need, like when you're running blocking C code, you want to be able to hit control C and have that interrupt the running code.
- 43:40And so in Sage, we put a lot of work into writing something that would let you interrupt blocking C code that was written using Cython.
- 43:49Martin Albrecht recently separated that out as a separate project that you can pip install.
- 43:54So you can use it in your own Cython code.
- 43:56Right. Okay. That's really cool.
- 43:57So that's kind of where Cython came from.
- 43:59And I think it's been steadily progressing over the years.
- 44:03Very often there are things that come along which kind of sound like they do something similar, but Cython is just so battle-tested.
- 44:10And no matter what, like if you want to write some fast code that you can use from Python and you're willing to understand the basics of C data types, you can use Cython and do it and get it done.
- 44:22And if you want to make some code that's usable from C or C++, like a C or C++ library available to Python with no overhead, then you can do that via Cython.
- 44:32So it's very different than SWIG, Standard Wrapper and Interface Generator, where SWIG will automatically take a C++ library and make it usable from Python.
- 44:41But there's some Python code between the C++ library and you, and that slows things down a lot.
- 44:48So with Cython, we do things like make it so you can use a third-party library that provides basic arithmetic addition and multiplication, say, in a finite field.
- 44:57And we can make that so it's very, very fast.
- 44:59So it just takes on the order of 100 nanoseconds to do additions and multiplications.
- 45:03So it really, really eliminates overhead and makes using very, very low-level C code possible.
- 45:08Yeah, that's really awesome.
- 45:10How applicable is that in general?
- 45:13Is this something you would only use on math?
- 45:15Or if you've got a web service backend and there's a section that needs to go faster, would Cython be something you might consider?
- 45:23I think it's really, really aimed towards very compute-heavy loads.
- 45:29So it doesn't help much if your problem is IO-bound.
- 45:33And then the new Python async stuff is probably way more useful, or something like Twisted.
- 45:39Yeah, absolutely.
- 45:39So it's really, really all about compute-heavy, non-asynchronous.
- 45:43You have a synchronous thing like a for loop where you have a doubly nested for loop that's doing some calculation in the inside.
- 45:50And you want to make that one part really, really fast, as fast as you could possibly write it in C.
- 45:55That's what Cython lets you do.
- 45:56Okay, very cool.
- 45:58And that's the sort of thing that comes up a lot in math programming.
- 46:01Yeah, of course it does.
- 46:02Matrix multiplies and all sorts of things, right?
- 46:05Yep.
- 46:06So the sort of next step that you might take this whole project is rather than having people download 800 megs of all those packages and run it locally,
- 46:16it's just fire up a web browser.
- 46:18And so you started cloud.sagemath.com, right?
- 46:21Yes.
- 46:22Yep.
- 46:22I started that in 2013.
- 46:25And my initial motivation was that I had been teaching courses for just repeatedly every year for about a decade to undergraduates on how to use open source math software for kind of math.
- 46:38So I get like 40 or 50 math or math CS stats econ undergrads.
- 46:44And the whole course is about how to, you know, program in Python, program in Cython, use lots of functionality from Sage, use NumPy, use LaTeX a little bit.
- 46:53And the installation challenges for the students were pretty bad.
- 46:57And so for quite a while, they would use, they would often just use the Sage notebook server we had running, but that could only handle maybe a dozen people at once.
- 47:05It really wasn't very scalable.
- 47:07And all it did was give you Sage.
- 47:10So you could type in Sage code and see the output, but it didn't have a terminal and it didn't have LaTeX.
- 47:15And so I decided to write something that was much more all-inclusive where you could teach a whole course about anything related to basically open source scientific software and do it all in one unified place where the students in about, you know, 15 seconds are up and running.
- 47:31So that was the motivation.
- 47:33And something I've refined over the last few years.
- 47:37I've taught using it a couple of times now and written some research papers and a book all within Sage Math Cloud.
- 47:43And there have been several hundred other people who have done courses using it now.
- 47:48Yeah, that's, that's really great.
- 47:49I can just imagine the first day of these sort of computational math classes where it's like, all right, so what we're going to do is we're all going to download this.
- 48:00Like my download canceled.
- 48:02Mine won't install.
- 48:03Mine installed, but it won't launch.
- 48:05You're just like, ah, why?
- 48:06This is not what this class is about, right?
- 48:09But you've got to plow through that if it's on the machines, right?
- 48:12So this, this is really cool.
- 48:13And, you know, it's a really slick web app that you guys have built.
- 48:16Thanks.
- 48:17Yeah.
- 48:18So I've, I've been working on an enormous amount for the last couple of years with some input from Jonathan Lee and Nicholas Rund, who are two UW undergraduates.
- 48:28And also Harold Schilley, who's been working on Sage since about 2007 and who lives in Vienna, Austria.
- 48:34So we've done, we've written this application and it has, I don't know, around about 4,000 users each day.
- 48:45And it'll often have about 400 active users at once.
- 48:48So it's a pretty heavily used.
- 48:50And the usage is heavy because people are really running code.
- 48:54And they're running lots of Jupyter notebooks and Sage worksheets and editing LaTeX documents and maybe running long-term calculations.
- 49:01It all runs on top of Google Compute Engine, but it's also entirely top to bottom open source.
- 49:06And some people download it and install it on their own computers.
- 49:10Okay.
- 49:10That's a really interesting component of it that you can get a local server version.
- 49:15Yep.
- 49:16And it provides, so what it gives you is real-time collaborative editing of terminals, Jupyter notebooks, LaTeX documents.
- 49:25It also has a course management system built in for assigning homework to students and collecting it.
- 49:29And everything's collaborative in that you can see other people editing, kind of like Google Docs.
- 49:34There's also chats and stuff.
- 49:36Yeah, that's fantastic.
- 49:37And you've got a lot of features there.
- 49:39Like, it's not just for, say, running Python code, but you can run C or Go, or there's the ability to open terminals, just Linux Bash or something like this, right?
- 49:51Yep, absolutely.
- 49:52So it's kind of like those online IDEs, but, you know, like cloud9.io or one of those.
- 49:59But our target audience isn't at all programmers.
- 50:02It's just people who, especially students who just want to get up and running quickly with open source math-related software.
- 50:09And we also have really good support for R and Julia and Octave and so on, especially because Jupyter notebooks have kernels for all these languages.
- 50:17Right.
- 50:18You just pass it right along to Jupyter and let it deal with it, right?
- 50:21Yep, exactly.
- 50:22Nice.
- 50:22So you've got a lot of cool stuff in your GitHub, which I'll put in the SageMath GitHub, and I'll put a link to that in the show notes.
- 50:31And one of my stuff on there was stuff to do with Docker.
- 50:34How does Docker fit into this?
- 50:36First, there is a SageMath Docker image that Eric Bray, who I think is a guy in Europe, in France, who I think has the distinction of being the first full-time person to work on Sage.
- 50:48So NSF grants for Sage have kind of dried up recently.
- 50:51But in Europe, they just got this huge $8 million grant called Open Dream Kit.
- 50:57It's across the European Union, and it supports open source math software, including Sage.
- 51:02So the Europeans are really, really supporting open source math software.
- 51:05And Eric created some really nice Docker images for running Sage.
- 51:09So you just do like Docker run dash something SageMath, and you're up and running with Sage.
- 51:16So it's yet another way of installing Sage.
- 51:18And there's a Jupyter version of it.
- 51:20So that's one thing.
- 51:21So SageMath Cloud doesn't currently exactly use Docker.
- 51:26We use Cgroups and a lot of the stuff that Docker is built on.
- 51:29But I think it will use Docker extensively in the next few months under the hood.
- 51:35You won't know the difference, but it will just make things run a little smoother and be more scalable.
- 51:40Yeah, and let the Docker folks manage that kind of stuff and not you, right?
- 51:44Yep.
- 51:44Yeah, exactly.
- 51:45Yeah, yeah.
- 51:46Very cool.
- 51:46All right.
- 51:47We're getting kind of to the end of the show.
- 51:49One thing I wanted to recommend for people is if this is all interesting to you guys, go to cloud.sagemath.com.
- 51:56You can create an account there and check it out.
- 51:58But there's also a video like right on the landing page there that gives the two-minute story of this.
- 52:04If you want to share it, that's cool.
- 52:06And it features you and a bunch of other people in there, which is cool.
- 52:09And you've got some pretty sweet skating in there.
- 52:13Yep.
- 52:13I own the biggest skateboard ramp in the Northwest and I skate it a lot.
- 52:18So I'm really into skating large half pipes.
- 52:20Wow.
- 52:20That's really cool.
- 52:22Is it?
- 52:22This is at your house?
- 52:23It's at a friend of mine's house, thankfully.
- 52:24It's not at my house.
- 52:26Nice.
- 52:28Nice.
- 52:28That's really cool.
- 52:29When I was growing up, my brother built a quarter pipe.
- 52:32So we periodically hurt ourselves.
- 52:35So I think that was cool.
- 52:36Yeah.
- 52:36I got into skateboarding with my brother.
- 52:38We skateboard together a lot still.
- 52:40Oh, yeah.
- 52:41That's great.
- 52:41That's great.
- 52:41All right.
- 52:43So I think it's probably a good time to wrap up our conversation.
- 52:47So let me ask you two questions I always ask my guests.
- 52:49First, even though you can't pip install SageMath, there's still a lot of packages that you guys
- 52:56must use.
- 52:56And so do you have a favorite PyPI package that is really helpful to you that maybe other
- 53:01people don't know about?
- 53:02Well, okay.
- 53:03Let's see.
- 53:04First, again, I really wish the answer was SageMath.
- 53:07I did.
- 53:09I posted my first ever package to PyPI.
- 53:12How do you say it?
- 53:13PyPI.
- 53:14Guido says that PyPI and some of the core developers say PyPI and PyPI conflicts with PyPI the runtime.
- 53:22So I'm with PyPI as well.
- 53:25Okay.
- 53:25So I posted to PyPI a PyGSL package.
- 53:30So I'll say that that's a brand new one that wasn't there before.
- 53:32I did it because a physicist who wanted to use it in their class on SageMath Cloud wanted
- 53:38this.
- 53:38GSL is the GNU scientific library, and they wanted these Cython bindings to the GNU scientific
- 53:43library to be available.
- 53:44And the only way to do it was to download some zip file off of SourceForge.
- 53:49And that sucks.
- 53:50So yeah, anything on SourceForge these days is a little suspect.
- 53:53So I set up a PyPI account and figured out how to...
- 54:00I took the zip file, then I pushed it.
- 54:02So I myself became the kind of manager of the PyGSL package on PyPI.
- 54:08Yeah, lovely.
- 54:09It took me about two to three minutes to learn how to do so.
- 54:12So my answer is that package or push your own package, especially some old thing on SourceForge
- 54:17that should be pip installable and make it pip installable.
- 54:20It's easy for anybody to make things pip installable.
- 54:23Yeah, it's surprisingly easy to register a package and upload it and so on.
- 54:27It's...
- 54:28You just more or less create an account and just use the built-in tools and the set of tools
- 54:33and stuff.
- 54:34Yeah, it's really nice.
- 54:34Yeah, absolutely.
- 54:35Awesome.
- 54:36And then what editor do you use when you write Python code?
- 54:39So I dogfood everything.
- 54:42So I do absolutely all of my development of SageMath Cloud and Sage from within SageMath Cloud.
- 54:49And the editor of SageMath Cloud is...
- 54:51It's built on top of Codemirror, which is a web, like a JavaScript-based code editor.
- 54:58So I added things like multiple panes so you can split the view and see two points in the
- 55:03document at once.
- 55:04And also because the editing is synchronized, you can just open multiple browser tabs to
- 55:08see multiple points in the same document at once.
- 55:11And then I also have various plugins for the kind of functionality I felt like I really needed,
- 55:16like deleting, trailing, white space, and so on.
- 55:18So my answer is Codemirror, which is probably not the most popular answer, but that's my
- 55:23answer.
- 55:23Oh, oh, one other thing.
- 55:24I think that's really cool.
- 55:25One other thing is in SageMath Cloud, there's a history.
- 55:28So whenever you edit, every keystroke almost is recorded.
- 55:32And there's a slider that lets you slide back and forth and see the past, all past versions
- 55:37of your document.
- 55:37And so like when I'm editing code, I'll be like, oh, I wanted to look at what it was like
- 55:42three minutes ago or 10 minutes ago and copy something from that.
- 55:45And you can very easily do that with a little slider.
- 55:48So you get kind of a whole third dimension of time when editing.
- 55:51So it does have some benefits.
- 55:53Yeah, that's a really nice feature.
- 55:54I feel like a system has reached some level of maturity and well-roundedness and goodness,
- 56:03basically, when it can create itself.
- 56:06You know, when you compile C with a C compiler, when you write like PyPy, you know, you run
- 56:14Python with Python, these types of things.
- 56:16It's pretty cool.
- 56:17So it's nice to hear you're doing that for your editor.
- 56:19Awesome.
- 56:20So before we say goodbye, what should people know about getting started with this?
- 56:27If they want to check it out, what should they do?
- 56:29So just type Sage or SageMath into Google and you'll get to the SageMath.org website.
- 56:35And that has all kinds of documentation.
- 56:37There's like probably 10 to 15,000 pages of documentation there, links to books and so on.
- 56:42And there's a big link to, which just says SageMath online.
- 56:48And if you click that, it takes you to the SageMath cloud site that we've been talking about.
- 56:53And there's also something called SageMath cell, which gives you a single,
- 56:57one single input box where you can type in a block of Sage code and see output.
- 57:02And you can also embed those blocks inside of your own static website.
- 57:05And there's an API for doing that.
- 57:07So go to the website SageMath.org.
- 57:10You can either download it or go to the cloud site and use it online.
- 57:14It's all 100% open source, top to bottom.
- 57:17William, this is quite an achievement.
- 57:19I really love looking inside of it because you solved a lot of cool problems and a lot of
- 57:25excellent technologies come out of it.
- 57:27So congratulations.
- 57:28Thank you.
- 57:29Yeah.
- 57:29It's been good to talk to you.
- 57:30Take care.
- 57:31Okay.
- 57:31Thanks a lot.
- 57:31Great talking to you.
- 57:32Yeah.
- 57:32Bye.
- 57:34This has been another episode of Talk Python To Me.
- 57:37Today's guest was William Stein.
- 57:39And this episode has been sponsored by Hired and SnapCI.
- 57:41Thank you guys for supporting the show.
- 57:43Hired wants to help you find your next big thing.
- 57:46Visit Hired.com slash Talk Python To Me to get five or more offers with salary and equity
- 57:50presented right up front.
- 57:52And a special listener signing bonus of $2,000.
- 57:54SnapCI is modern, continuous integration and delivery.
- 57:58Build, test, and deploy your code directly from GitHub.
- 58:01All in your browser with debugging, Docker, and parallels included.
- 58:04Try them for free at snap.ci slash Talk Python.
- 58:07Are you or a colleague trying to learn Python?
- 58:10Have you tried books and videos that left you bored by just covering topics point by point?
- 58:15Well, check out my online course, Python Jumpstart by Building 10 Apps at talkpython.fm slash
- 58:20course to experience a more engaging way to learn Python.
- 58:23You can find the links from this show at talkpython.fm/episodes slash show slash 59.
- 58:30Be sure to subscribe to the show.
- 58:32Open your favorite podcatcher and search for Python.
- 58:34We should be right at the top.
- 58:36You can also find the iTunes feed at /itunes, Google Play feed at /play, and
- 58:41direct RSS feed at /rss on talkpython.fm.
- 58:45Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
- 58:50You can hear the entire song at talkpython.fm/music.
- 58:54This is your host, Michael Kennedy.
- 58:56Thanks so much for listening.
- 58:57I really appreciate it.
- 58:59Smix, let's get out of here.
- 59:00I'm dating with my voice.
- 59:03There's no norm that I can feel within.
- 59:04Haven't been sleeping.
- 59:06I've been using lots of rest.
- 59:07I'll pass the mic back to who rocked it best.
- 59:10I'm first, developers, developers, developers, developers, developers, developers, developers,
- 59:16developers, developers, developers, developers, developers, developers, developers, developers,
- 59:22you