We're all familiar with the data science tools like NumPy, Pandas, and others.
These are numerical tools that work with floating point numbers, often to represent real-world systems.
But what if you could exactly specify the equations, symbolically,
like many of us did back in calculus or differential equations courses?
With SymPy, you can do exactly that.
Create equations, integrate, differentiate, and solve them.
Then you can convert those solutions into Python or even C++ and Fortran code.
We're here with two of the core maintainers, Andrei Sertik and Aaron Moyer, to learn about SymPy.
This is Talk Python to Me, episode 364, recorded May 6th, 2022.
Welcome to Talk Python to Me, a weekly podcast on Python.
This is your host, Michael Kennedy.
Follow me on Twitter, where I'm @mkennedy.
And keep up with the show and listen to past episodes at talkpython.fm.
And follow the show on Twitter via at Talk Python.
We've started streaming most of our episodes live on YouTube.
Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.
This episode is sponsored by Microsoft for startups.
Founders Hub to get early support for your startup.
And it's brought to you by Sentry.
Don't let those errors go unnoticed.
Use Sentry.
Get started at talkpython.fm/sentry.
Transcripts for this and all of our episodes are brought to you by Assembly AI.
Do you need a great automatic speech-to-text API?
Get human-level accuracy in just a few lines of code.
Visit talkpython.fm/assemblyai.
Andre and Aaron, welcome to Talk Python to Me.
Thanks for having us.
Yeah.
It's great.
Yeah, it's fantastic to have you both here.
You know, what a cool topic.
Symbolic math with Python.
I think I'd heard of SymPy before, but I didn't fully appreciate, you know, how neat and how advanced it really was.
So people are going to enjoy diving into this and we can talk some internals and whatnot.
And if you're doing anything scientific or computational, this is certainly a project worth checking out.
But before we get to that, let's just hear your story.
How did you get into programming in Python?
Aaron, you want to go first?
I've always kind of been into computers ever since I was a little kid.
I actually started messing around with programming and AppleScript in my family's Macintosh back when I was, like, a really little kid.
Nice.
But didn't really do any serious programming until college when I started taking, like, computer science courses.
And actually, for Python, my college had a free course that they were offering to teach this little language called Python.
So, you know, the CS course that I was taking was in, like, Java and C.
And those languages are – I wasn't a huge fan of those languages.
But I learned about this language called Python, and, yeah, I thought it was great.
Yeah, I was immediately hooked with Python just because it's, you know, it's so easy to use.
It's so easy to just write a program, and you don't have to worry about compilers or all this boilerplate.
Yeah, I'd always been a little suspicious of languages that described themselves that way, which is ironic given how much I do with Python.
But still often when you hear that, it's like, oh, it doesn't need all the symbols, and it's super easy to get started.
That means, like, oh, it's really easy to do easy stuff, but then you can't do interesting things.
And I think one of the things that's special about Python is, like, you can keep going.
You know, you don't have to stop once you need advanced ideas.
That's pretty awesome.
Yeah, it really is.
You're right.
A lot of languages kind of stop.
But Python, I mean, it's got a lot of advanced stuff as well, and it's got a huge ecosystem of libraries you can do just pretty much anything you want in it.
Yeah, for sure.
The big paradox for me is there's a joke T-shirt that I've seen that says, I learned Python.
It was a great weekend, which I think is kind of true.
You can do that.
But at the same time, for many, many years now, I've been studying Python, and there's still just so much more to learn.
One, about the language, and also just, like, as you said, all the different libraries, like, oh, I want to learn Pydantic now, or this other thing, or so on.
Very cool.
All right, how about now?
What are you working on day-to-day?
Yeah, so I work at a company called Quansight.
We do consulting, mostly around open source Python, open source data science stack.
I work about 50% of my time on SimPy as part of a grant, which we might talk about later, I think.
And I also work on different consulting projects.
Actually, right now, I'm part of a project called the Data APIs Consortium, which is trying to standardize the array API libraries for different Python array libraries, the APIs for those.
So, you know, like, NumPy and X-Array and those types of things?
NumPy, PyTorch, Jax, QPy.
So, the idea is that all these libraries have very slightly different APIs, and it makes it hard to write code against that just works against all of them.
So, what we're doing is creating a standard API that all of these libraries will target.
And so, you can write code that will just work with NumPy, but you can also just, instead of importing NumPy, you can import QPy, and that same code will run on the GPU, for example.
Oh, that's fantastic.
Yeah, that's a really good, ambitious goal.
It sounds so easy, and I'm sure it's pretty challenging.
Yeah, well, I think we're being successful.
We just released the first version of the specification, and we've got several libraries that are implementing it already, including NumPy, QPy, several others.
So, it's actually, I think it's being a successful project and should really help push the Python data science ecosystem forward.
Yeah, it sounds like a definitely good step.
Andrei, how about you?
How did you get into programming in Python?
You know, probably in high school, I was trying to figure it out when I got into it.
I think at high school.
I don't know.
I don't remember how I found it, but it was early 2000s, I'm guessing.
It was before NumPy.
It was, I think, it was NumArray, I think.
It was the array library in Python.
And during my undergrad, I was studying physics.
I wanted to play with the mathematical formulas in Python.
So, that's when I started SymPy.
And then I used Python, you know, pretty much, probably close to 20 years now, or over 20 years.
And I cannot say I'm an expert.
You know, it wasn't a good weekend.
I don't know.
A lot of the stuff I'm not that great at, you know, but the basics, I would say I know pretty well.
Yeah, sure.
After my PhD in physics, I went to work at Los Alamos National Lab for about eight years.
Computational physicist.
I use Python.
I use a lot of Fortran, a lot of computational codes, and a lot of C++.
That sounds fun.
There's a lot of Python stuff happening there at Los Alamos.
Yeah, it is.
The NetworkX, I think, library was started here.
And then, very recently, half a year ago, I changed jobs.
I now work at a company called GSI Technology, which is a hardware vendor, as a compiler developer.
And so, at Los Alamos, I started this compiler for Fortran called L-Fortran.
It's a compiler for Fortran, but it also allows you to use it interactively, just like you would Python.
It runs in a Jupyter Notebook, as well, as a kernel.
And at this new company, we are also, in addition to L-Fortran, creating a new frontend called L-Python,
which takes Python, but compiles it through the same pipelines, through the same intermediate representation
and all the backends.
All the code is the same.
So, effectively, it treats Python like Fortran.
So, the same speed, and so forth.
Oh, wow.
That sounds awesome.
It is awesome.
Yes.
Very, very cool.
All right.
Well, super fun to be talking about SymPy with you all today, symbolic math.
I want to start this off, though, with a write-up from Aaron that is maybe not what people would expect
as the first topic to introduce SymPy.
SymPy has been in the news a little bit for the wrong reasons recently, right?
Right, Aaron?
So, it was even on the front page of Hacker News because this company, HackerRank, reached
out to GitHub, sounds like through automated ways, and said, we seem to see some math that
looks like questions we might ask or something like that.
So, we need to completely ban SymPy because they're stealing our interview questions or something
like that, right?
Give us the story.
What kind of madness was this?
Yeah.
So, we sort of just got this notice from GitHub that a DMCA takedown had been issued against
one of the pages on our documentation.
And the way the DMCA works and the way GitHub's DMCA policy works is when somebody issues a notice,
they basically just have to take it down.
And GitHub basically took down the entire documentation site for about 12 hours.
And so, I've got a timeline of everything that happened here in this blog post.
But basically, yeah, they had some company that they were working with to try to find their
solutions on GitHub and issued DMCA takedown notices against them.
And somehow, this SWIRTH IT solutions company decided that our docs was one of these, and they
just issued the notice.
And so, yeah, it ended up taking down our documentation, which immediately, like you said, it made it
to the top of Hacker News and kind of tension.
Because it's too outrageous.
Yeah.
So, the notice itself, it was completely ridiculous.
Like, the stuff that they were claiming was their copyright is probably not even copyrightable.
Like, if you look at the examples on that documentation page that they took down, they're just like
simple math examples.
Yeah.
It was like X squared minus two solution is, you know, negative plus or minus radical two.
Right?
Like, that you shouldn't be able to copyright.
I think that actually predates HackerRank's foundation.
I think it predates HackerRank as a company.
Yeah.
So, the CEO of HackerRank, I guess, noticed the buzz that was being made about it and retracted
the notice.
So, the docs ended up going back online about 12 hours later.
If they hadn't done that, we would have had to issue a counter notice, which would have kept
the docs offline for about two weeks before that counter notice would have taken effect.
And that's just because of the way the DMCA law works.
I also explained how the DMCA law works in this blog post.
If anyone's wondering, like, why would GitHub even do this?
Like, well, they're kind of required to do this kind of stuff by law.
There are some ways I think they could have improved what they did here, which I go over
as well.
But this DMCA law is really...
It's probably like pointing those out.
Yeah.
So, I mean, the DMCA provides what's called safe harbor for places that host user-generated
content, basically.
YouTube, the social media places.
GitHub clearly has a ton of user-generated content that's public.
If you got the source code of Windows or something and you posted it up there, right?
Theoretically, Microsoft might say, you know, we don't really want you hosting this.
It's not supposed to be open source.
Please take it down, right?
So that's the idea.
The way it works, though, is basically once there's a request to take it down, they just
have to...
Here's the part that I think that got missed.
Decide that it's a valid request and then just take it down.
Like, they don't really try to negotiate or determine the right...
The correctness of that assertion, right?
Yeah.
So they sort of have to stay, like, as a disinterested third party, I guess.
And the reason is that in order for them to have the safe harbor, the safe harbor status
sort of frees them from the liability on either side if there is a copyright claim or if there's
a lawsuit or something.
They can just say, okay, well, we're just hosting the content.
The law sort of allows them to do that.
But in order to do that, they sort of have to just...
If they get a DMCA claim, they have to just take it down.
And then if there's a counter notice issued, then they can put it back up.
And the DMCA has these...
The DMCA sort of tells them that if they get a claim, they have to sort of take it down expeditiously.
And if there's a counter notice, they have to put it back up in 10 to 14 days.
So it's...
There's a lot of parts of the law that they sort of have to do.
There's some things I think that they could have done better.
And there's also some things that they already do, which they don't have to do, which are nice,
including they have a repo where they actually post every single DMCA notice that they've received,
going all the way back to 2011, actually.
Interesting.
So you can actually see all the DMCA notices that have been issued against GitHub repositories on that repo.
It's github.com/github slash DMCA.
This portion of Talk Python to Me is brought to you by Microsoft for Startups Founders Hub.
Starting a business is hard.
By some estimates, over 90% of startups will go out of business in just their first year.
With that in mind, Microsoft for Startups set out to understand what startups need to be successful
and to create a digital platform to help them overcome those challenges.
Microsoft for Startups Founders Hub was born.
Founders Hub provides all founders at any stage with free resources to solve their startup challenges.
The platform provides technology benefits, access to expert guidance and skilled resources,
mentorship and networking connections, and much more.
Unlike others in the industry, Microsoft for Startups Founders Hub doesn't require startups to be
investor-backed or third-party validated to participate.
Founders Hub is truly open to all.
So what do you get if you join them?
You speed up your development with free access to GitHub and Microsoft Cloud computing resources
and the ability to unlock more credits over time.
To help your startup innovate, Founders Hub is partnering with innovative companies like OpenAI,
a global leader in AI research and development, to provide exclusive benefits and discounts.
Through Microsoft for Startups Founders Hub, becoming a founder is no longer about who you know.
You'll have access to their mentorship network, giving you a pool of hundreds of mentors across a range of
disciplines and areas like idea validation, fundraising, management and coaching, sales and marketing,
as well as specific technical stress points.
You'll be able to book a one-on-one meeting with the mentors, many of whom are former founders themselves.
Make your idea a reality today with the critical support you'll get from Founders Hub.
To join the program, just visit talkpython.fm/founders hub, all one word.
No links in your show notes.
Thank you to Microsoft for supporting the show.
I want to preface this by saying I'm not a lawyer, so I'm only speculating here.
But one of the things that seems very, very much like it fell through the cracks.
And this part, I think, is both maliciousness and laziness on the worth IT company, as well as,
you know, sort of either laziness or disinterest, I guess, from GitHub.
I don't really know how to characterize it.
But this company came and said, on your documentations, there is content that is copyright.
And it comes from our website.
And it just linked just to the homepage of that other website.
You got to take it down.
That seems like insufficient information to GitHub to go, yeah, well, they said there's a website.
And here's a website.
That website doesn't like this one.
So it should go away.
It should say, do you see these lines of code here?
That was stolen from us.
And here's where it originates.
Or, you know, our thing is not public.
But these are the lines.
They didn't even say what was wrong, right?
It just said, we believe this code is going to destroy them.
It was insufficient even for us if it was an accurate claim.
Because if you look at this page that they put the claim on, it's a huge page.
Because it's got, like, about a dozen different functions on it.
And it just said that they copied our examples.
It didn't say which part of the page was copied or anything.
So, yeah, I mean, I still don't know, like, how they even decided that this was a thing.
That somehow their automation got flagged incorrectly or something.
I don't know.
Like, I don't know if we're ever going to know that.
Yep.
All right.
Well, I don't want to spend the whole time on this.
But let me wrap it up with a quick thought.
The CEO of HackerRank, Vivek, posted a message that said, this was not our intended consequence.
Yes.
But if you send bots running around the internet looking for algebraic equations and saying that those are, you know, like, this is your problem, even if it was not your intent to do these things.
And so they fixed it.
I don't know what they're doing now.
But they said, we're going to stop the whole process for now and figure out what we can do better.
But on the other hand, we should give them props for donating $25,000 to the Senpai project as a, we're sorry.
That's actually kind of cool.
They didn't have to do that.
No, they did not have to do that.
And they did send the money, I think, last week.
And so just...
You guys are all on vacation?
What is this, Hawaii?
I'm just teasing.
Or if the finances are online, you can find them up.
I think it's an open collective and it pretty much almost doubles our budget.
And so it will allow us to really fund all kinds of cool development.
One thing on this note I wanted to say is that I was thinking, so when it all started, I felt like a little guy completely being crushed by some huge corporation or just this.
You know, they just take down the documentation and GitHub just says, you know, it's not enough to put a commit to fix it.
You have to excise the commit from the Git history.
So we would have to figure out exactly what line was copied.
And so I went to the Git history and tried to look up, well, maybe some of our contributors maybe copied some stuff from HackerRank.
So I went to the history, but they didn't see anything.
They did not see any mention of HackerRank.
You know, oh, I copied this from HackerRank.
They didn't see anything like that.
They didn't see anything suspicious.
But the consequence was dire.
And also the documentation is generated from the Simpi source code.
So really, the offending lines are coming from the Simpi repository itself, not just the documentation.
So luckily they missed it.
We were really, I was like, well, this might be, this is terrible.
And then they, oh, and also we thought maybe, maybe this looks like a spam, you know, maybe it's just a spam.
So we kind of ignored it a little bit, not ignored it, but, you know, we didn't know.
And so I emailed GitHub right away, is this real or is this just a spam?
And they got back to us on Monday evening and said, no, this isn't real.
And then the next morning they took down the whole documentation.
So I felt really just, you know, I spent, Aaron and others spent so many hours just trying to figure out what we should do and what the options are.
And I was, it was, Google Summer of course was, Redline was on that Tuesday, I think as well.
So I was just super busy with that.
I just felt, you know, this is, and I'm doing this for free for Simpa.
I don't think I've ever paid anybody to work on Simpa.
I just felt, you know, this is, this is not right.
And then when it got to Hacker News, I thought, you know, I thought about how can the company, what can they do to like fix it?
And I thought, you know, there's not much they can do, the time was wasted.
But then Drag Race got an idea, Oliphant got an idea, well, why don't they donate some money?
And I thought, you know, this would fix it.
And so I didn't think they would do that, but I'm very happy that they did.
As far as I'm concerned, personally, I don't, I think we are even, they, they give us the money and we can use it to really progress the development forward.
So I'm very happy that how it all ended for Simpa.
Sure.
You could pay to hire somebody to work on some important part, or you could pay to have sprints, like bring the people together to work together or something like that.
Right?
Nice.
Yeah.
We're still, we're still talking about what we're going to do.
Cool.
Well, I'm glad it came out well, but what a wild story.
I've had, I've had run-ins like this before, and they are incredibly frustrating.
Even when you're on the right side of it, it's just like, you know, you're, you're up against lawyers from.
Yeah.
You're on, you're on YouTube.
So I've heard that DMCA is going to be pretty bad on YouTube.
I don't know if that you've ever been hit by anything like that there.
I, you know, what's so funny is only once as it happened on YouTube, it's happened for my courses.
It's not exactly, it's happened sort of almost in reverse for my courses.
I put one of my free courses on Udemy as a way to try to reach out to people who didn't already know about my content.
Like, I'll put it up there for free.
People can experience it there, and then maybe they'll go look for other courses for me, like, you know, something like that.
Someone stole my free course, started selling it on Udemy, and it took me two weeks to get them to, to even take it down.
Even though at the beginning, it's a picture of me saying, hi, I'm Michael.
And I'm like, you gotta, we don't believe this is yours.
Like, what do you mean?
Have you watched it?
The person who is the account it's under is absolutely clearly not Michael.
Anyway, on YouTube, what has happened to me is I was doing a webcast way back in the day when people would call in, sometimes on phones,
and somebody interrupted someone else on, during the webcast, and they put it on hold.
And it was really frustrating because their hold music started playing back into the webcast.
And for some reason, the way it was set up by the company I was working with to do it, they couldn't stop it.
So there was just like five minutes of hold music going along with the presentation.
That hold music got a DMCA takedown, and it took down my webcast.
So what are you going to do?
I didn't really mind.
It was kind of a crappy thing anyway, but, you know, it was up there, and it got taken down.
All right, let's talk about Senpai because I think this is a really neat project.
Like I said, when I think about the data science stack and the scientific computing stack of Python,
traditionally what I've thought of is NumPy, Pandas, Matplotlib, the stuff that does numerical processing,
and then maybe visualizes that or does machine learning off of it or something like that.
But Senpai, I think, occupies a slightly different but really important space in this whole computational Python stuff.
Tell us about it.
Yeah, so Senpai, like you said, it sort of stands in contrast to these other libraries in that it's not,
it is a mathematics library, but it's not numerical, it's symbolic.
So the focus is on computing with mathematical expressions exactly.
So, you know, if you tell Senpai to, like you said earlier, solve the equation x squared minus 2 equals 0,
you'll get the exact answer, square root of 2 minus square root of 2.
You won't get a numerical answer like, you know, 0.7, whatever square root of 2 is.
Yeah.
But you'll get that exactly, square root of 2.
And so there's all sorts of things that you can do with symbolic mathematics.
People may be familiar with other similar tools called, it's basically, it's called the computer algebra system.
There's proprietary tools like Maple and Mathematica.
There are some other open source systems that people may have used as well, like Sage and Maxima.
So just, if you've ever heard of any of those, Senpai sort of occupies a similar space.
But Senpai, I guess, sort of stands apart from those in that it's open source and it's also, it's a Python library.
So if you're familiar at all with Python, it's really easy to start using Senpai because it's just Python.
Yeah.
I think people who have not seen this kind of stuff in action should definitely go poke around and check it out.
And we'll talk about some ways in which you can play with it just online with super low effort.
I remember the first time I had been previously using MATLAB or something like that.
And I saw Maple, which is one of the ones you called out, which is a symbolic sort of solving thing.
You can say, oh, here, I want to do the integral from negative infinity to positive infinity of this thing.
And it looks like it would come out of the textbook and it will sometimes even show you the steps.
It's unbelievable.
And that was 20 years ago when I saw it.
I'm like, that's unbelievable that this computer is doing this.
And Senpai is like that, but for Python, which is fantastic.
Yeah.
So it's, you know, it's basically, you know, it's the math that you would learn in a classroom.
Except it, you know, it can also get very advanced.
Like you said, we can do integrals.
We have lots of very advanced mathematical features.
We can do, we have a module for doing various areas of physics, for example.
Nice.
And it's also the foundation of many other things as well.
Just as a, like setting the stage, a preview is you've got algebra, you've got calculus, you've got differential equations, you've got linear algebra and matrices.
It's there's a lot of, a lot of good stuff in here.
Andrei, do you want to maybe give us a little run through of like sort of the selling points of Senpai?
Yeah, that's very easy.
I was an undergrad student and, you know, studied physics or any kind of engineering a lot of times, even math.
You have to do a lot of symbolic, you know, I would say derivations on paper.
And I remember sitting in a physics class and I thought, you know, this, I would like to do this from Python, interactively.
And so that's the idea.
And then of course I sat down and I thought, well, let's get started.
And my friends were telling me, you know, what, you know, can it do Gaussian integrals?
You know, it's this integral of exponential, some polynomial, you know, X squared, for example.
And I said, you know, it cannot because, but it will in five years, just not now.
That's the hard problem.
Oh, and I said, well, then use Mathematica.
It could do it now.
But, but they asked me, well, why don't you use Mathematica?
You know, and I said, you know, Mathematica is great.
Maple as well.
It's absolutely, as you said, Michael, absolutely amazing that, you know, 20 years ago, and it could do all these integrals and, and serious expansion of these functions.
Yeah, I was using Windows NT when I did that.
I like how old that was.
I did too.
I did too, actually.
And so, yeah, and, but, but the motivation is,
to be able to do this from Python interactively allows you to kind of almost program with the symbolics using a language.
That's a pretty decent language that you might already use for something else.
And so what I wanted to do is assign the expression to a variable, then use the variable interactively and write some scripts to kind of handle my, my calculation and maybe save it to a file after that.
And, and so on.
And so that's, once you want to program with that, Mathematica, it allows you to program, but you have to learn.
Yeah.
And so that's why I wanted to have that in Python.
Yeah.
And so that's why I wanted to have that in Python.
Well, the other thing that from this perspective, sitting on the Python or the comp size side of things and looking back is obvious.
I don't know that it is as obvious coming from the other perspective of like, oh, I'm doing a MATLAB.m file or whatever.
But in that world, if you work in MATLAB or Mathematica, you can do what MATLAB or Mathematica does.
Right.
That's a, it's really amazing in its specialty, but it's very specialized and limited.
Right.
You can't build like, you know, FastAPI and database driven apps that are doing some of this kind of computation along the way.
right, if you move it to Python, like this is now, this capability is now accessible for all the applications, not just within, you know, the, the MATLAB or Maple environment.
Yeah.
And I, I guess it's an argument, you know, what's the advantage of Python, let's say for numerical computing, let's use it by or scientific, let's say for scientific computing, but the advantage of Python over, let's say Mathematica.
And I think it's not a clear good answer.
I think Mathematica is great.
And they've done actually, it's quite amazing how good job they've done because they designed the language, I believe in the early eighties and they did not have to really modify the language too much.
Uh, it was same spirit.
So that's kind of amazing.
It's much older than Python.
So it's quite amazing how far, and then it still works pretty well and it's a decent language.
But I think what I like about Python for scientific computing, you know, is that it's open source and it's the language just seems more kind of robust and kind of easier, more imperative.
Don't have to really learn too much.
It seems that anybody can learn it quickly and doesn't seem to have too many kind of things that would surprise you.
Yeah.
Very cool.
So how long ago did you start on Senpai?
I think I started in 2005 or six.
Nice.
It's been going for a while.
Yes.
So that really predates a lot of the scientific computing frameworks that are well known today, right?
So you must have felt good about picking the right horse as you saw, you know, Jupyter or IPython at the time come along and those libraries like that.
Way before Jupyter, IPython was there.
Somebody told me about it and I tested it out and I thought, you know, this is pretty cool.
It looks like Mathmerica.
Then I later, when I talked to Fernando Perez who wrote it, he said, yeah, it's Mathmerica.
That's what I wanted to have in Python.
So kind of the same motivation almost.
Just, you know, so he kind of provided the foundation for the interactive part, you know, with the prompt and the numbers.
This portion of Talk Python to me is brought to you by Sentry.
How would you like to remove a little stress from your life?
Do you worry that users may be encountering errors, slowdowns or crashes with your app right now?
Would you even know it until they sent you that support email?
How much better would it be to have the error or performance details immediately sent to you, including the call stack and values of local variables and the active user recorded in the report?
With Sentry, this is not only possible, it's simple.
In fact, we use Sentry on all the Talk Python web properties.
We've actually fixed a bug triggered by a user and had the upgrade ready to roll out as we got the support email.
That was a great email to write back.
Hey, we already saw your error and have already rolled out the fix.
Imagine their surprise.
Surprise and delight your users.
Create your Sentry account at talkpython.fm/sentry.
And if you sign up with the code talkpython, all one word, it's good for two free months of Sentry's business.
This is a great idea of Sentry's business plan, which will give you up to 20 times as many monthly events as well as other features.
Create better software, delight your users and support the podcast.
Visit talkpython.fm/sentry and use the coupon code talkpython.
When you work with Senpai, we'll see some examples and talk about them in a minute.
You can put it into this pretty printing mode where it attempts with as much as it can within the terminal output to have more formal mathematical representation.
So instead of like E^x, it might put a little smaller x up high and then an E down slightly to the lower left of it like you would try to write it.
It seems that if it's in a notebook, it should be able to do even better, like maybe a LaTeX rendering or something really shiny.
Yeah, it does.
So in the notebook, it'll use the MathJax.
So it'll, it'll, yeah, it'll, it'll just use, it'll look, it'll look great basically.
Cause it, the MathJax looks just like, it's the same as a Logitech document.
Yeah.
Oh man.
Yeah.
And in the terminal we use, we use, we use all these different Unicode characters to, to sort of render it as 2D text in the terminal so that it looks, it looks pretty decent in the terminal considering the constraints of a terminal.
Nice.
And I personally use it.
I mainly use it in the terminal.
I saw it.
Yeah.
So let's go and maybe, maybe we could walk through a little bit on one of the tutorials here.
I mean, obviously we don't want to talk too much code or whatever, but I do think maybe just touching on this, will give people a sense of what it's like to work with this because.
Yeah.
So I think.
Yeah.
Give it, give us a sense of what.
In the tutorial, there's a, there's actually a section somewhere.
Uh, where is that section?
This one perhaps.
But didn't get deleted.
That's, it's in the introduction page.
Yeah, it's on that page.
But, if you maybe, scroll down, to this, the power of symbolic computation is the name of the header.
There you go.
So this is just, this is just sort of a, a bucket list of, just sort of a, a bunch of different examples of, of things that can do.
So just to give you an idea and actually you can see there.
Um, also you can also see the, the pretty printing there as well, that Unicode pretty printing, that it does.
Um, that law tag is what we would see in the notebook.
So you have to run underscore printing using Unicode equals true, right?
It, it doesn't do it by default.
Uh, it, it, yeah.
So that in, in the notebook, it does actually do it by default.
Sure.
But not in the terminal or the rebel.
Yeah.
In the terminal, you need to, you need to run this.
Otherwise it'll just print out like a one dimensional string that, that, you would get.
Um, it would, it looks sort of like what you would input.
Um, but yeah, you can see here, we can, it can take derivatives, take integrals.
Um, if you keep scrolling down, you can see, I think limits and, differential equations.
Um, you can solve.
Yeah.
So let me, let me talk people through just a couple of things, because I think.
Uh, it's a little hard to understand how this might work.
And the trick, I think really Andre, you tell me your thoughts on this is the, the ability
for it to, define these symbols and these functions, here.
Yeah.
So the trick able to represent the expression symbolically.
So you type, X plus Y, and plus some function sine X.
And in, in memory, it represents it as a tree and it, and it, of course, the expression in symbolic
form.
And then it allows, it has all kinds of functionality that allows you to manipulate the expression,
print it, you know, differentiate it.
So many differentiate, or let's say an expression that takes the original expression and creates
a new expression, the derivative.
Right.
With normal math, like pen and paper math, you don't usually define variables every now and
then you say, you know, let X be an element of like the real L, real numbers such that,
whatever.
Normally you just say F of X or F of T or something like that, or Y.
And it just works.
You needed some way in Python to allow you to write expressions like X plus two Y without Python
going, I have no idea what that means.
Right.
Yes, that's right.
So, and yes, you first have to declare what X and Y is.
You declare it as a symbol and then you can use it.
We override the Python operation like plus, minus, and then you can construct the expression.
And so what's nice about Python is that when I started with simple, I mean, I was kind of
investigating the, the, the idea.
What's nice that Python pretty much allows you to override all these operations.
And so you can write it almost like math, you, in exponential, two stars.
Yeah.
Only caveat is that if you write, let's see one divided by two, and we started in Python
two, that gives you a zero, I believe.
And that's very confusing from Synthy's perspective, because you would like it, you would like it
to give, the expression one over two, not, not zero.
And because, and so I, I don't think there is any way still to, to, to fix that, to override
this division.
Yeah.
At least in Python three, you get the right, at least you can load.
I, what you get, I float double precision.
Yeah.
You don't want that.
You want one divided by two as simple expression.
So, so when you have something like that, you have to wrap the number one into a teacher
S.
Yeah.
Or, define some kind of symbol with that value and then use it like, like you have
to go over B from, you know, quadratic equation.
Right.
You could like that kind of thing.
Um, but yeah, so you create these symbols and then you can write simple math that looks
like it's just straight Python.
So you could say X and Y are symbols.
And then you could say something like X plus two times Y plus one.
And that, that isn't not evaluated in any way.
It's just becomes this, like, as you said, as tree, this expression that then you can operate
on, like integrate it, take the derivative of it, find the limit of it, all those kinds of
things.
Right.
So, yeah, that's the basic idea.
Yeah.
That's the basic idea.
Um, and, and you can use it to do any, basically any sort of math that you would normally do,
uh, with, with so that sort of expression, except you're doing it on the computer.
So cool paper.
You can do, you know, just like a real simple example might be, rational polynomials
or something like that.
Like if you had X squared minus one is one equation and then X plus one as another equation,
you could say the first equation divided by a second and get, geez, which did I say minus
that you get X minus one as simplifications.
Another one where you can take something and it'll, it can figure out how to simplify it to
an equivalent form.
That's like, like dividing out factors and things like that.
Yeah.
Okay.
These are, are super neat.
Um, you can do factors.
So like you say, you could say like, polynomial factors, you know, one of the things I don't
know if I should point this out, or maybe this should have been a warning to the whole show.
If you're in high school or early college, this might be a terrible cheat sheet for homework
and other types of is fantastic, right?
If you're in an algebra course, you can do, do your work and then you could type this in and
type this in and go, did I get it right?
Wham.
And out it comes, especially in a notebook.
Right.
Yep.
Yeah.
I mean, I think that's kind of unavoidable these days.
Uh, you know, there's cause I mean, there's, there's also, you know, just graphing calculators
that do this as well from alpha.
I think simple is a great, a great way to do that if you're going to do it because now
you're also learning Python.
Right.
Which I think is, would be great for someone who's like a high school student or an undergraduate
because that, that's an actual useful skill as well.
It might be even more, utilitarian in the long run than the calculus they're learning.
Um, so yeah, you can do like, derivatives and integrals of these equations.
So you could say integrate E to the X times sine of X plus E to the X times cosine of X.
And it will give you the result, which apparently is E to the X sine of X.
I used to be able to do that.
I can't anymore.
Well, you can see that the line above it, it's differentiating that.
So it's just undoing the line above it.
Oh, I see.
Well, that, that does, that is a bit of a cheat, isn't it?
Yeah.
But yeah, I mean that that's, yeah, you don't, that it, the integration is nice.
Cause you don't have to remember all the, these, how to do all this integration by parts
or whatever you would do.
Yeah, exactly.
So another thing it can do is, like concrete.
I forgot.
There's like a better term for that, but definitely integration over a range or, or so.
So you could say integrate from like negative 10 to 20 of sine of X squared, or here's the
example of negative infinity to positive infinity.
And it says that square root of two, you know, radical two, radical pi over two as the answer,
not like point.
What is that point to something, something, something, something, something, I don't know,
something like that.
Um, right.
It gives you the actual theoretical answer, the exact mathematical answer in symbols, which
is amazing.
It is, it's amazing.
And it's also not easy to.
So when I started in SIFI, I knew this is not easy to program.
Like how, how do you program such an integrator?
It's not easy.
But I figured, you know, if I can at least figure, at least get the basics, you know, like
be able to represent these equations at least, that would still be a huge help.
Cause sometimes the expression can be long and be able to manipulate it.
And then as we were joined with, you know, so many, excellent people, they, they contributed
all the, all the features students, mostly actually it was developed by Google summer of
cold students.
And okay.
Yeah.
Cool.
It's, it, it, it, I would not be able to do that.
Let's just put it that way.
It's a, it's a lot of work that's behind it.
Yeah.
I'm looking at this.
I know these concepts just on pure math are hard and then to automate it in general, it's
got to be next level.
Uh, so other things you can do is like, you can define a function.
So here you say, here's a function called Y, and then you can say, well, what if you had
the differential equation that was, you know, the second derivative of Y minus Y equals E
to the T, right?
Solve that.
And then sure enough, outcomes, the solution.
So that's a function for that.
Um, what the function is, which is pretty amazing.
Yeah.
So does things like, eigen values from, linear algebra and all kinds of stuff.
Uh, yeah.
Great.
And then we have in Python, we have stir and repper.
You guys also have late tech, which is pretty cool.
Right.
I just call latex, latex on a function and out it comes with like the crazy escape code.
Latex that you would need for a paper or something.
Right.
Yep.
Yeah.
And this, this actually, I mean, this is only even scratching the surface of, of the, what
Simpa can do.
So it's actually quite a large library.
Yeah.
I don't want to focus too much on just the pure math, but maybe give us a sense of like some
of the things that amaze you.
What do you have in mind when you're saying that kind of stuff?
Uh, that amaze me.
Yeah.
Um, I mean, I'm, I think the whole thing's amazing still, even though I know how it works
and I've been working on it for awhile, but yeah, just the fact that the computer can do,
uh, the same sort of mathematics that you would do, on a piece of paper is, is incredible.
Um, some of the algorithms that to do like integration and stuff are also, pretty interesting
because, they, they sort of, they go beyond what you would learn in a calculus class.
Um, there, there are algorithms that, that can compute integrals that you would, you would
never be able to know how to compute them just using what you'd learn in a, in a calc one
or calc two.
Sure.
Um, but those, those are something that you can actually implement in something like Simpi
and then, Simpi will be able to do those integrals for you.
Um, some of the features that, I mean, if you go on the website, there's a, there's a
huge list of features.
Um, I think, one feature that we didn't mention that's, that's maybe worth mentioning,
um, is, code generation.
So, code generation, means that you take one of these expressions and you turn it
into basically code for another language, whether that's C or Fortran or, pretty much any,
any language that you would want to, translate it into.
And then you can then take that expression and, and, basically convert it into, something
that you could numerically evaluate, very fast in, in whatever language you prefer
to use.
Wow.
Okay.
So you've got your notebook written in Python or something and you've come up with some expressions
and you're like, I would like to just do that in Fortran or C and I, and I don't trust myself
to get it right.
myself to get it right.
So just print out the syntax basically.
Yeah.
Oh, go ahead, Andre.
Yeah.
Well, let's say you want to approximate some function, you know, with a polynomial.
So you, you can use him by to do that.
And then at the end, you just want the polynomial in the form that you can put in your production
code, whether for Tron or C.
So it's still simple to do it.
Then you can copy and paste it.
You know, it's correct.
Assuming there is no back in simple.
Yeah, sure.
Yeah.
But I suspect it's probably pretty straightforward.
Once you've got the expression to break it down into, you know, this is a multiply.
Here's where the parentheses that group it in the expression tree.
But yeah, there's, I mean, there's, there's a few places where it's like, okay, we need
to make sure we get the semantics.
The semantics might be a little different between like C and, and Python or something like that.
Yeah.
So we need to make sure we sort of translate that correctly.
But yeah, it's, I mean, in principle, it's not that hard, but I mean, it's not that hard.
I mean, it's also not something you want to do by hand either because.
Yeah.
It's super error prone if you were to try to do it by hand.
Yeah.
It sounds like a great feature.
That's, that's quite neat.
Maybe we could talk just a little bit internally, Andre, about how you accomplish this.
Yeah.
Like how I started it.
Well, just like, how does it work?
If I give it a, if I give it a, an expression of, you know, e to the x cosine x, and I say integrate
that, like, where do you even start?
Yeah, exactly.
Well, the integration, I guess, I don't know, those more details, there's like a couple different
algorithms, but I'll tell you kind of the basic idea.
When I did, you know, the first thing you do in your search, how do you do symbolic integration?
And then there is this famous algorithm called the RISH algorithm.
So you kind of start studying and then you realize, oh, that's like multiple years of
worth of work to implement this.
And it's kind of fragile and doesn't always work.
And Mathematica, they, as the company, and Perkis Wolfram, they, they managed to do that.
That's a lot of effort, a lot of work.
And they had to invest in a large teams of people, test it carefully and so on.
But in practice, there are other approaches.
And it turns out that you can integrate a lot, you know, wide classes of functions just
by implementing an algorithm that works.
For example, for a polynomial, it's easy.
Anybody, anybody can do it, right?
And then you can add some trigonometric functions.
So you kind of implement algorithm for that.
Then you kind of built your way up.
It turns out when you do that, you can make it very useful in practice.
Maybe it's not as powerful as Mathematica is, but it's very helpful.
So that's how we started.
And then once you have the rules, I mean, first, second, third year of calculus, there's
in math, I, there is a ton of creativity in the calculus classes.
It's a lot of like, I just today we're doing integration by parts today.
We're doing like integration of stuff that's divided or what, you know, like there's a,
there's set algorithms that they tell you to follow.
And once you get the basics, it seems like, I guess you could compose them.
Yeah.
So that was kind of my initial idea.
Let's just kind of do stuff that we know how to do.
And it's kind of straightforward.
But, but then kind of the engineering part comes to it as well, because you don't want,
you want things to always work quickly.
And if it cannot be done, you would like to know the answer.
This cannot be done quickly, not to wait a couple hours.
until it tries all the functions.
Yeah.
And so then it just becomes a lot of, I would say engineering decisions, how to make this
all work.
And I think we are still not done yet.
I think there are a couple of, I would say promising approaches.
one approach is a certain professor, I think, or a professor, I think in Canada, he has,
he figured out how to take all these rules, how to integrate functions and compose them into
just a decision tree.
So you give it an expression and then it just figures out exactly as you said, is it the polynomial?
Is it like dividing?
And so on.
And then the decision tree tells it exactly how to go about it to give you the final formula,
the integral.
Okay.
And here's the small formula you apply to it or whatever.
So you take out these 5,000 formulas and then he takes them and actually he uses Mathematica
and he composes those into a decision tree and then it prints the decision tree as for example,
Python code and so on.
And we still haven't, well actually, so we have a module for that.
And it's something that, what I like about this approach is that it's quick.
In principle, it's quick.
You just go through the decision tree and it gives you a formula or it says it cannot be there.
And I would like, but you know, there are all kinds of practical issues.
The tree is pretty quick.
And so when you encode it in Python, it takes forever to import and so on.
So we are still kind of struggling with these issues, but it just gives you an idea what kind of issues are,
engineering, I would say issues are involved in.
Yeah, that's pretty wild.
I mean, have you thought of or are you using things like Cython or these other types of speed up type things?
Yes.
Yeah, I spent, so maybe 10 years ago, I spent a lot of time investigating how to make Simpy faster.
Simpy is great, it's pure Python, it's easy to contribute to, and for many things it's amazing, just works and that's all you need.
But sometimes you need either larger calculation or a lot of calculations and it's not fast enough.
So how to speed it up?
So we investigated just pure C, Cython, all kinds of tricks in Python itself to speed it up.
Eventually, that kind of led to the SimEngine project.
I decided, let's just use C++.
It's the only tool that I know that actually can deliver the performance and kind of maintaining a bigger project.
So that's SimEngine and then we have Python wrappers and then Simpy can use it.
So there are modules in Simpy such as the dynamic, kind of dynamic, what do I say?
The classical, mechanical, I guess, module that allows you to simulate a solid body, you know, physics.
It's able to use SimEngine out of the hood so it gets much, much faster.
Okay, interesting.
Yeah, so this is a C++ project, but it has Python wrappers for easy Python integration with Simpy and other things.
Yeah, that's cool.
You know, I think that kind of summarizes a lot of scientific Python is there's a really great API.
And when you ask it to do things, it takes the data and hands it off to some C layer that actually does it for Rust or something like that, right?
Yes.
And it's not just writing it in C++.
There are other libraries that also in C++, but to make it really fast, one has to spend the time and figure out how to represent the expression in memory,
how to allocate the memory, how to, so we have to make, you know, reference content pointers, for example.
So that's what, that's the design I chose.
How to make the reference content pointer as fast as possible, things like that.
How to make sure that you can actually maintain it so that it gives you, if you make a mistake, it doesn't give you a segfold, but some kind of a, in debug mode, some kind of ways to debug it, right?
So there's all kinds of engineering, you know, decision behind the scenes.
I asked it to solve this and it went poof and went away.
I guess that means something.
I don't know.
Yep.
So we don't want that.
But anyway, but yes, so the symmetry works.
It's, it, it contains kind of like the core level of the core of Simpy.
Is this what I would, if I go pip install Simpy, do I get this or do I have to do something special to like swap out the computation engine with this?
You have to install it as a separate library.
So if you do just pip install Simpy by default, it only installs Simpy, but, but you can do pip, I think you can do pip install Sim engine.
I use Coda.
So you can do Coda install Sim engine, that install Sim engine as a, as a library.
And in Python, you do import Sim engine, and then you use it kind of like Simpy.
And Simpy can also optionally use it.
Got one to build.
Okay.
Yeah, this looks really neat.
Um, one of the things I wanted to touch on here, and at the top right of the page, if I go just to the Simpy page, it says try it with Simpy gamma.
And so maybe we could sort of close out the conversation a bit with just poking around with this and then maybe highlighting some projects that use it.
So for example, it says, oh, you could just try some random example.
And it's got like algebra, algebraic things I could do.
So it says, you know, polynomial divisor, I'm coming in and copy this.
And if I go, there's a little calculator like thing at the top where I go hit equals, and it will go and run that in,
The polynomial division in this case, it looks like.
Yeah, yeah.
Like what are the divisors of, of this thing, right?
Something like that.
Yeah.
So this is sort of our, our little version of, of Wolfram alpha, but using Simpy under the hood.
Um, it's not quite as powerful as Wolfram alpha.
We don't support like, natural language input.
Um, that sort of thing.
But, yeah, you can, you can kind of get an idea of sorts of things Simpy can do here.
Uh, maybe one of the interesting ones.
If you scroll down a little bit, and click on one of the, integral, the one that says get steps for integrals.
Yeah.
How about this?
I, I'm a big fan of, E.
There's a whole book called E the story of a number.
I have you guys read it.
Uh, no, I haven't heard of it.
You haven't E, E the story of a number is a great book.
It's about like Euler and all that stuff.
Okay.
Yeah.
So if this was just integrate E to the X over one plus E to the two X, right?
Yeah.
So if you scroll down here, hopefully, should see something that says, see steps.
Uh, yeah.
I see under the derivative, for example.
Yeah.
That was pretty interesting.
I don't know if this is the one that has steps, but I saw it in other places.
Um, yeah, maybe that's, maybe this example is not working right now.
Yeah.
There's some, here, let's do, probably the differentiation of something might be, I bet it's got some steps for that, but that was part of what I was talking about.
I don't know what I was talking about with the cheat and not, and I don't mean that in a negative way, but like, it will show you the steps as if it was written out in a textbook, of how like this one right here, like, look at this.
You're going to apply the quotient rule, which is the X of F of X over G of X equals this.
And then you're going to apply this.
And I mean, this is amazing.
Yeah.
Well, I mean, I think, I think it's, you know, it's instructive.
It's not, it's not just cheating.
It's not just cheating.
No, of course it's not.
And I do think it's really instructive because it's one thing to just go take a function or an expression and say, take the derivative of this.
And it says, great.
It's this crazy thing.
Like, how was I supposed to know?
It was like the tan of the cotangent of X or like something like that.
Right.
Um, but if it says, you know, like, look, here's how we got there.
That's yeah.
That's very educational.
Yeah.
So it's not, this, this, but many parts of Senpai don't work like this because, sort of the underlying algorithms don't, don't really work the same way that you would do it by hand.
But there are some that basically work the same way you would do it by hand, like differentiation as an example.
So we can, we can sort of extract the steps and show them to you.
Yeah, this is great.
I'll put this, this explanation example into the show notes so people can, come back and check it out.
But gamma.senpai.org and then just choose some of the examples is really how to do it.
And it's how it gets there.
So very nice.
So let's, let's wrap this up by going to senpai.org.
And then on senpai.org, if you go just down a little bit, there's projects using Senpai that are, they all sound super interesting to me.
You've got like chempy, a package for chemistry in Python, Einstein pi for symbolic numeric, for general relativity.
Are there any of these that you think are particularly neat or stand out to you?
You want to give a shout out to either of you?
Oh yeah.
I, all of them, but I like the pi guy, for example, it's a, it's a very nice package for, you can, can.
Pi dies and dynamics.
Yeah.
So you can, it allows you to simulate, you get kind of like a robot or multiple, you know,
a pendulum, like double pendulum.
You just kind of tell it exactly the relations of the body and then it allows you to write.
And then pi die can derive equations of motion.
And those equations get extremely complicated, real quick.
Uh, for triple pendulum, which just gets very complicated.
Pi die can derive the equations for you, correctly.
And so, it's, it's a, it's a certainly not neat project.
Yeah.
That one's really cool.
So you can see the chem pie kind of stands out for me.
Cause I've, I've always loved chemistry.
Yeah.
Any others that you want to give a shout out to?
Um, well, I guess one, one that I'll mention here, actually it's listed as a sage.
So sage, sage is something that a lot of people might know as sort of an alternative, computer algebra system.
Yeah.
I've actually had a William Stein on the show to talk about it as well from a sage math and,
yeah.
So sage, sage sort of integrates a lot of libraries, including Senpai itself.
You can see Senpai is listed there on the, on the front page of their website.
Yep.
Uh, so, if you use sage, there's, there's a chance that you're actually just using Senpai under the hood.
Uh, so that, yeah, it's, that's, that's one that I like.
Um, a lot of these are, are, are making use of that, the code generation, concept that I talked about where they're, they're basically sort of modeling whatever chemistry or dynamics and in Senpai.
And then, then taking that expression and turning it into something that they can numerically evaluate.
Yeah.
It looks like maybe some quantum computing stuff here.
All right, great.
Now these are all cool.
And I think probably seeing some uses of it, like give people ideas for their own projects.
Let's wrap this up, this, conversation up just, to talk about maybe bridging the gap or bridging the world of computational stuff, symbolic stuff, and then, this numerical side, right?
So I've gone through and I've said, here's some complex function and maybe here's another one.
And I'm going to combine them through whatever in some, some way, and then now generate me a second derivative or whatever it is I need or integrate it.
I've now got a new expression.
Can I somehow take that and turn it into something I can call as a Python function?
Like here's a number of what's the answer effectively, or here's a numpy array.
Give me the evaluation across the numpy array.
Yeah.
So there's, there's a function called lambda phi.
Uh, it's a L A M B D A F Y, which basically does exactly what you said.
It takes an expression and it turns it into a function that you can evaluate with numpy.
Um, so, yeah, that, that workflow is basically exactly what you describe.
You, you, you, you simply derive whatever it is you're doing using the mathematics of,
of your problem.
And then you, you put that inside of lambda phi, and now you have something that you can actually
pass, your data to with numpy, and, evaluate it numerically.
Nice.
That's awesome.
Does it effectively use that, that code generation thing you were talking about?
Yeah.
So under the hood, it's, it's using, it's basically generating code for a language equals.
Okay.
Yeah.
Numpy itself is sort of a language.
It's got its own set of functions.
Um, and right, right.
Instead of looping, you'll, you do sort of vector operations and things like that, which you'd
want it to do that.
Yeah.
Uh, there are other functions, which you can do to, to, instead of calling numpy, if
you want to like call it through C as well, there, there's options for that as well.
Um, but yeah, that, that lambda phi is sort of the, the big one that, that you need to know
if you want to do that.
Okay.
Cause to me, that seems like a really important bridge.
You know, I've got this idea.
I here's my theoretical equations, but at some point I want to evaluate it and make, make the
computer, you know, generate a graph based on these numbers or something.
Right.
Yeah, definitely.
Cool.
Good work on this project.
You guys, it, it's pretty amazing.
And, and the explanation, thing, Aaron, you had me pull out.
That's really cool.
How much it will say, these are the algorithms we applied and, and here's the little lesson
to take from, like why this makes sense here and so on that.
That's a way better than just some sort of numerical integral.
Like you gave me this function and it's 7.2 is the answer.
Like, well, great.
But what do I do with that?
Right.
Yeah.
So maybe people, people could use it as a teaching tool.
Assuming.
Yeah.
There are people who use it in the classroom.
Definitely.
Sure.
Yeah.
Well, before we're done, let me ask you both the final two questions briefly.
If you've got some kind of notable package, maybe it's not the most popular thing, but you,
you know, some Python package that's awesome.
That needs a shout out.
There probably are a lot on this page already and you've already given some, but anything you
want to just, call out real quick.
Um, well, so perhaps unrelated to Senpai, a little bit, but,
It can be unrelated, anything.
Yeah.
Um, well, I, I, I'd have to say one of my favorite packages that I use, is this
testing library called hypothesis.
Yeah.
I'd actually like to, to make use of it in Senpai.
We aren't using it right now, but, I'd like to, but, if you haven't used it before
the, the idea, it's sort of, it sort of flips the, the idea of, of how you do tests on its
head a little bit.
Um, instead of, instead of sort of coming up with a bunch of examples and sort of testing
that they, your function, you know, does the right thing on, on the, on different inputs,
you just sort of tell it what your function should do.
And then it takes care of the job of, of generating examples.
And the end result is that you, you end up testing a lot more of your code than you would
with a normal test.
And you get, you end up with much more robust code as a result.
So I recommend checking it out.
It's called hypothesis.
I don't know if you've had hypothesis on this.
I have, it's been quite a while.
It's been three or four years at least, but yeah, it's, it's a very neat project.
And I'm glad to see it's still going strong.
I hear a lot about it.
Andre.
Oh, I was going to say, do you want a Python package or any package?
Uh, Python.
If you got one, if not, we can fall back to any.
Uh, yeah, I was going to actually have both of these also.
I also discovered it kind of actually relatively recently.
Um, yeah.
Yeah.
I recommend people to check it out.
Which one?
Sorry.
Oh, the hypothesis.
Oh yeah.
Uh huh.
Sure.
And I did talk about it way back in the day.
This is 2016 had a David McIver on to talk about it.
So that was cool.
All right.
And then final question.
If you're going to write some code, some Python code, what editor do you use?
I use Emacs.
Emacs right on.
And I use Wim.
Oh, and you guys still get along.
Yeah.
Of course.
No, just teasing.
That's awesome.
All right.
Well, thanks so much for being here.
You know, final call to action.
People are excited to get started with Senpai.
Like what do they do?
How do they get started?
Where do they go?
Uh, well, so the easiest way is, if you go to Senpai.org, like you said, like,
uh, you said, you can try it online.
Uh, there's also a link there to, to download it.
Um, yeah.
Otherwise, you know, I would say, if you're going to go to Senpai.
Uh, you know, you can, if you really want to get dive in, you can join our mailing list,
uh, or, you can follow us on Twitter.
We're at Senpai and, yeah, it, the, basically the easiest way to get it.
Is it just pip install Senpai or condo install Senpai and you'll have it.
Nice.
Andre.
Yeah.
That's a,
or simengine.org.
You can like, you like the plus plus version.
Nice.
And you have the tutorials that I highlighted.
I'll link in the show notes so that you can go through on Senpai.org as well.
Fantastic.
Really nice work.
I love to see you bringing this to all the developers and data scientists and stuff.
So thanks for being here and sharing Senpai.
No, thank you for having us.
You bet.
Yeah.
Thank you so much.
Thank you.
This has been another episode of Talk Python to me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
Starting a business is hard.
Microsoft for startups founders hub provides all founders at any stage with free resources
and connections to solve startup challenges.
Apply for free today at talk python.fm/foundershub.
Take some stress out of your life.
Get notified immediately about errors and performance issues in your web or mobile applications with
Sentry.
Just visit talkpython.fm/sentry and get started for free.
And be sure to use the promo code talkpython, all one word.
Want to level up your Python?
We have one of the largest catalogs of Python video courses over at Talk Python.
Our content ranges from true beginners to deeply advanced topics like memory and async.
And best of all, there's not a subscription in sight.
Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show.
Open your favorite podcast app and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct
RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days.
If you want to be part of the show and have your comments featured on the air, be sure
to subscribe to our YouTube channel at talkpython.fm/youtube.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
We'll see you next time.
Bye.
you
Thank you.