Skip to content

Update 486-csnakes-embed-python-code-in-.net.txt #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions transcripts/486-csnakes-embed-python-code-in-.net.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

00:00:16 but using the full libraries, especially the C and Rust-based ones, has been out of reach

00:00:22 until Seasnakes. This project by Anthony Shaw and Aaron Powell unlocks some pretty serious
00:00:22 until Csnakes. This project by Anthony Shaw and Aaron Powell unlocks some pretty serious

00:00:27 integration between the two languages. And we have them both on the show today to tell us all about it.

Expand Down Expand Up @@ -130,7 +130,7 @@

00:07:15 And then finally, there's just not as many packages or options in the .NET space. So it's always been that like, "Ah, okay, well, if I want to learn this, the tutorial is in Python or the package it recommends using is in Python." So it was always kind of like, how do we bridge that gap?

00:07:30 That was kind of one of the early thinkings of just, you know, that's a clear problem space, right? Like a lot of people are learning that, but then going into industry and maybe Python isn't the language that the organization they're working with is using.
00:07:30 That was kind of one of the early thinking's of just, you know, that's a clear problem space, right? Like a lot of people are learning that, but then going into industry and maybe Python isn't the language that the organization they're working with is using.

00:07:43 How do we still have that? A fundamental knowledge that they've gained or the like the tooling they want to use available to them?

Expand Down Expand Up @@ -394,7 +394,7 @@

00:17:58 And that's the difference is that most packages in the ecosystem these days are designed and tested for CPython.

00:18:05 And this is all, at least they're tested for PyPy.
00:18:05 And this is all, at least they're tested for PyPI.

00:18:09 But all the other implementations are pretty much a no.

Expand Down Expand Up @@ -426,7 +426,7 @@

00:19:04 Yeah, I'm Python is one.

00:19:06 Pigeon, we've covered in a past episode.
00:19:06 Pyjion, we've covered in a past episode.

00:19:08 Oh, that's not going to work.

Expand Down Expand Up @@ -558,7 +558,7 @@

00:23:19 And then it would generate a function that can call that for you with .NET equivalence.

00:23:24 And then it handles the the marshalling, like the transfer of the types backwards and forwards between .NET and Python.
00:23:24 And then it handles the marshalling, like the transfer of the types backwards and forwards between .NET and Python.

00:23:32 And like that's most of the project is really about that particular problem.

Expand Down Expand Up @@ -636,7 +636,7 @@

00:27:08 I wish we had this in Python.

00:27:09 I know we have something kind of like it with list compreemptions, but it's not the same.
00:27:09 I know we have something kind of like it with list copromotion's, but it's not the same.

00:27:12 One thing that I really wanted to make sure that we were tackling with this and to Anthony's point before of the, that you've got two very different type systems that you're working with.

Expand Down Expand Up @@ -746,7 +746,7 @@

00:31:27 And they're all running in separate threads in a thread pool in .NET.

00:31:30 And you shouldn't have to worry about the gill.
00:31:30 And you shouldn't have to worry about the gil.

00:31:32 Like you shouldn't have to know too much in terms of what it is and how it works.

Expand Down Expand Up @@ -1108,7 +1108,7 @@

00:44:02 Yeah.

00:44:02 But with UV, V and V, give it a Python version.
00:44:02 But with UV, VENV, give it a Python version.

00:44:06 It can fetch it.

Expand Down Expand Up @@ -1212,7 +1212,7 @@

00:48:16 Yeah.

00:48:17 So one thing I wanted maybe could spend a couple minutes talking about this Anthony is I saw an example where you you showed integrating open telemetry and ASP dotnet and Postgres and all sorts of stuff together, not just a, you know, hello world sort of example, which shows some really cool stuff, but maybe doesn't convince people that they could do cool stuff with it.
00:48:17 So one thing I wanted maybe could spend a couple minutes talking about this Anthony is I saw an example where you showed integrating open telemetry and ASP.net and Postgres and all sorts of stuff together, not just a, you know, hello world sort of example, which shows some really cool stuff, but maybe doesn't convince people that they could do cool stuff with it.

00:48:39 You want to just maybe talk us through some of the moving parts of that to give people a sense of a more realistic example.

Expand All @@ -1224,7 +1224,7 @@

00:48:56 Yeah, well, the front end written in HTML and JavaScript.

00:48:59 The API is written in dotnet.
00:48:59 The API is written in .NET.

00:49:01 You're using Postgres as the database.

Expand All @@ -1238,7 +1238,7 @@

00:49:16 It's just real enough.

00:49:17 The weather demo is like the canonical dotnet demo of when you do file new API projects like here is a weather app.
00:49:17 The weather demo is like the canonical .NET demo of when you do file new API projects like here is a weather app.

00:49:24 So I from a dotnet developer, I feel very much at home.

Expand Down Expand Up @@ -1300,7 +1300,7 @@

00:51:30 And in the Python code, we use open telemetry to show the trace of it talking to the database.

00:51:36 And we we use Python logging and that log information on the trace information all gets put into the same trace.
00:51:36 And we use Python logging and that log information on the trace information all gets put into the same trace.

00:51:42 So from dotnet from start to finish, you see the request come in on the front end.

Expand Down Expand Up @@ -1348,7 +1348,7 @@

00:53:20 And it shows something which is practical in Python and something which is practical in .NET, which is like a proper app with tracing and logging and all the, you know, all those kind of features.

00:53:30 And on the Python side, we're using pandas, which, you know, and we're using numpy, which is the C extension.
00:53:30 And on the Python side, we're using pandas, which, you know, and we're using NumPy, which is the C extension.

00:53:36 And we're using psycho PG, which is like depends on a whole bunch of like third party libraries as well.

Expand Down Expand Up @@ -1406,7 +1406,7 @@

00:55:54 And so on and so forth.

00:55:56 Well, you know, like with sea snakes, you could expose that model, create some surface areas in just Python APIs that is then going to be consumable by a .NET application.
00:55:56 Well, you know, like with Csnake, you could expose that model, create some surface areas in just Python APIs that is then going to be consumable by a .NET application.

00:56:08 So yeah, it's something you can definitely do not 100% sure whether you can do it on mobile.

Expand Down Expand Up @@ -1454,7 +1454,7 @@

00:58:13 That's awesome.

00:58:14 You reach inside of the the ND array, just grab its actual memory and just say, got it. Let's go.
00:58:14 You reach inside of the ND array, just grab its actual memory and just say, got it. Let's go.

00:58:20 Got it. Let's go.

Expand All @@ -1474,7 +1474,7 @@

00:58:54 You know, it will work with 32 bit ints and 32 or 64 bit floats, for example.

00:59:00 So like if you're storing a 2D matrices in 32 bit floats in NumPy and then you want to send that to to .NET to I don't know, like pick out some specific values or like do some calculations in .NET, then you can just chuck that back as a buffer.
00:59:00 So like if you're storing a 2D matrices in 32 bit floats in NumPy and then you want to send that to .NET to I don't know, like pick out some specific values or like do some calculations in .NET, then you can just chuck that back as a buffer.

00:59:17 And there's information in the docs about how to do this and then you can just access the values directly out of memory.

Expand Down Expand Up @@ -1611,4 +1611,3 @@
01:02:23 Thank you.

01:02:24 We'll see you next time.