Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#339: Actual Technical People

Published Wed, Jun 7, 2023, recorded Tue, Jun 6, 2023
Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: pystack

  • PyStack is a tool that uses forbidden magic to let you inspect the stack frames of a running Python process or a Python core dump, helping you quickly and easily learn what it's doing.
  • PyStack has the following amazing features:
    • πŸ’» Works with both running processes and core dump files.
    • 🧡 Shows if each thread currently holds the Python GIL, is waiting to acquire it, or is currently dropping it.
    • πŸ—‘οΈ Shows if a thread is running a garbage collection cycle.
    • 🐍 Optionally shows native function calls, as well as Python ones. In this mode, PyStack prints the native stack trace (C/C++/Rust function calls), except that the calls to Python callables are replaced with frames showing the Python code being executed, instead of showing the internal C code the interpreter used to make the call.
    • πŸ” Automatically demangles symbols shown in the native stack.
    • πŸ“ˆ Includes calls to inlined functions in the native stack whenever enough debug information is available.
    • πŸ” Optionally shows the values of local variables and function arguments in Python stack frames.
    • πŸ”’ Safe to use on running processes. PyStack does not modify any memory or execute any code in a process that is running. It simply attaches just long enough to read some of the process's memory.
    • ⚑ Optionally, it can perform a Python stack analysis without pausing the process at all. This minimizes impact to the debugged process, at the cost of potentially failing due to data races.
    • πŸš€ Super fast! It can analyze core files 10x faster than general-purpose tools like GDB.
    • 🎯 Even works with aggressively optimized Python interpreter binaries.
    • πŸ” Even works with Python interpreters' binaries that do not have symbols or debug information (Python stack only).
    • πŸ’₯ Tolerates memory corruption well. Even if the process crashed due to memory corruption, PyStack can usually reconstruct the stack.
    • πŸ’Ό Self-contained: it does not depend on external tools or programs other than the Python interpreter used to run PyStack itself.

Brian #2: Securing PyPI accounts via Two-Factor Authentication

  • Donald Stufft
  • β€œβ€¦ every account that maintains any project or organization on PyPI will be required to enable 2FA on their account by the end of 2023.”
  • β€œOne of the key security promises that PyPI makes is that when you're downloading something, that only the people associated with that project are going to be able to upload, delete, or otherwise modify a project. That when you look at that project and see that it is owned by someone that you trust, that you can be assured that nobody else is making changes to that package on PyPI.”
  • If you maintain a package on PyPI to a point where you are uploading to PyPI or plan to soon, enable 2FA on you account.
  • May as well do it sooner than later. But officially, you have the rest of the year.
  • This has already been a requirement for β€œcritical projects” since last summer. (top 1% of downloads, about 3,500 projects.) See episode 293.
  • Now it’s going to be for everyone.

Michael #3: Propan - a declarative Python MQ framework

  • Propan is a powerful and easy-to-use Python framework for building asynchronous web services that interact with any MQ Broker.
  • It's following by fastapi, simplify Message Brokers around code writing and provides a helpful development toolkit, which existed only in HTTP-frameworks world until now.
  • It is a modern, high-level framework on top of popular specific Python brokers libraries, based on pydantic and fastapi, pytest concepts.
  • The key features are
    • Simple: Designed to be easy to use and learn.
    • Intuitive: Great editor support. Autocompletion everywhere.
    • Dependencies management: Minimization of code duplication. Access to dependencies at any level of the call stack.
    • Integrations: Propan is fully compatible with any HTTP framework you want
    • MQ independent: Single interface to popular MQ:
    • RPC: The framework supports RPC requests over MQ, which will allow performing long operations on remote services asynchronously.
    • Great to develop: CLI tool provides great development experience:
      • framework-independent way to manage the project environment
      • application code hot reload
      • robust application templates
    • Testability: Propan allows you to test your app without external dependencies: you do not have to set up a Message Broker, you can use a virtual one!

Brian #4: Makefile tricks for Python projects

  • Ricardo Ander-Egg
  • A pretty short basic starter template Makefile for Python projects with some cool snippets.
  • Some default settings to have make behave sanely
    • exit on error, warn about undefined variables, disable built-in rules
    • set up working directory correctly if called from a different dir
  • A $(py) definition that picks up the virtual environment if it’s there.
  • Also $(pip) from the virtual env.
  • Default goal and help message
    • cool trick so that make with no arguments just prints the help
    • And also picks up target comments as help text for the target. Neat.
  • Injecting paths into PYTHONPATH, and an example on how that works if you need it.
  • A .venv target
    • create a virtual environment, update setuptools, wheel, build, and install requirments

Extras

Michael:

Joke: Actual technical people

Episode Transcript

Collapse transcript

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:05 This is episode 339, recorded June 6th, 2023.

00:10 Is it the 6th? Yeah.

00:11 I am Brian Okken.

00:12 I'm Michael Kennedy.

00:13 Today's episode is sponsored by InfluxDB from Influx Data.

00:18 Thank you, and we'll talk about them more later in the show.

00:22 If you want to reach any of us or the show, we have a contact form, of course.

00:28 And then also M. Kennedy at Fostadon and Brian Okken and Python Bytes, all Fostadon locations.

00:36 If you're listening to us on a recording or on YouTube or on a podcast player,

00:44 please join us on YouTube at pythonbytes.fm/live, at least occasionally,

00:49 because it's fun to have people hanging around while we're recording.

00:52 It's usually Tuesdays at 11, and you can watch older versions there, too.

00:57 So let's kick it off with something stacky.

01:01 Something stacky.

01:02 You feeling like some pancakes?

01:03 A stack of pancakes?

01:05 Yeah.

01:05 How about a PyStack?

01:07 So the reason I was late to this recording, Brian, was I was just talking with Pablo and Matt,

01:13 maintainers and creators of PyStack.

01:16 Have you heard of PyStack?

01:18 I have not.

01:19 So PyStack is a tool that uses forbidden magic to let people inspect the stack frames of a running Python process,

01:26 or even a core dump that was captured from a Python process that crashed,

01:32 helping you quickly and easily learn what it's doing.

01:35 How cool is that?

01:36 Pretty good.

01:37 Yeah.

01:37 So here's the deal.

01:38 Yeah.

01:39 So here's the deal.

01:39 I've got a Python app.

01:41 This is especially important if you have mixed code.

01:44 So if you're talking with C, C++, Rust, those kinds of things, because it will cross those boundaries as well.

01:50 But let's just say pure Python even.

01:52 I've got a Python web app, and I go to the server, and I try to connect to it.

01:59 It won't really respond.

02:00 It connects, but it just hangs.

02:01 Go to the server.

02:02 It's not 100% CPU.

02:04 In fact, it's 0% CPU usage, so it's not spinning and busy.

02:08 What the heck is it doing?

02:09 Is it a deadlock?

02:10 Is it waiting on the database?

02:12 What is going on?

02:13 So what you can do, even in production, you can go up to that process, and you can say,

02:18 give me a snapshot of exactly what this process is doing.

02:24 And what you see is you see a call stack.

02:27 Let me find an example here of what it looks like.

02:30 It looks like this.

02:31 Silly zoom.

02:32 So what you'll see is like, hey, on this particular thread, we're seeing on this file,

02:38 on this line, this function was called.

02:40 And check it out.

02:41 It even has the arguments passed to the function.

02:44 Oh, wow.

02:44 That's nice.

02:45 Yeah.

02:45 And then you can see what function that's calling with the arguments passed to it, and

02:49 what function that's calling with the arguments passed to it.

02:51 You can do this on a running function without altering its behavior, basically.

02:56 It doesn't inject any code or anything.

02:57 The only behavior it alters is that it freezes it for a second, potentially, which could,

03:02 I guess, make something time out.

03:03 But other than that, you could do this in production even to see what's happening.

03:07 And what's extra cool is if even if the process crashes, you can grab the core dump and it will

03:15 go back and analyze that as if it was a running process.

03:18 Oh, that's pretty cool.

03:20 Yeah.

03:20 So there are a ton of features.

03:22 If you can get to the section where it says, what can PyStack do?

03:26 So it works with both running processes and core dump files.

03:29 It'll tell you if a thread is currently holding onto the gill, if it's waiting to acquire it or

03:36 it's trying to drop it.

03:37 So you can, you know, one of the examples that Matt and Pablo spoke about was they were calling

03:43 into custom C code.

03:45 That was a Python extension.

03:46 That call that was coming in, that was, that was acquiring the GIL.

03:52 But then there in the destructor for some object that it was waiting for it to go away, it

03:58 was like waiting on a background thread to do some cleanup.

04:02 That background thread also was trying to do a callback to let Python know what's happening

04:06 and was trying to acquire the gill, but it couldn't.

04:09 So because the one that was waiting on it was already holding the GIL and wasn't going to

04:14 give it up because that's how the GIL works.

04:15 Right.

04:16 So you can use it for like these deadlock situations and see if it's running a GC, you

04:22 can see both the call stack in intertwined for both Python and C or C++ or Rust altogether.

04:30 And it'll even do things like go out and find the debugging symbols for say your Python runtime.

04:37 Even if you don't have it, it can potentially go and get those and bring that extra information

04:42 in.

04:42 What else should we see here?

04:45 Safe to use on running processes.

04:46 You can run it on a process in memory running process without pausing it at all, which will

04:54 minimize the impact it might have.

04:56 But it'll also potentially have like not 100% precise information.

05:00 It could be out of sync.

05:01 So yeah, it even works on like corrupted process core dumps because the process died because it

05:07 got corrupted memory or something.

05:09 So if you've thought about GDB or some of these other types of things because you're like,

05:14 oh my gosh, I've got to figure out why this crashed.

05:17 Here's a core dump.

05:17 Let me start looking at it.

05:19 Well, PyStack may be the thing you want.

05:21 That's pretty cool.

05:22 And one final bonus for you, Brian.

05:25 Suppose you have a pytest test.

05:28 This one.

05:30 Suppose you have a pytest test and that test while it's running deadlocks or is very slow or

05:38 something like that, you can have PyStack as a pytest plugin.

05:43 And then when you run your code, how do you do it?

05:46 I think it's you just, where is it?

05:49 You know, but anyway, when you run it, you can say basically analyze my test.

05:55 And here's a certain threshold to consider a failure and take a snapshot of that and so on.

06:00 Yeah.

06:01 I like the threshold notion of just like, if it gets this bad, tell me why.

06:05 Yeah.

06:06 Nice.

06:06 Cool.

06:07 Cool.

06:07 So if people want the full details, I suppose they could go check out the YouTube live stream

06:12 channel for Talk Python now or in three weeks, they could listen to the podcast.

06:17 But super, super cool tool.

06:20 If you've got a process that is crashing, that is hanging, maybe it's doing this in production

06:24 and it only gets deadlocked after, you know, 12 hours of being hammered on.

06:29 You can't easily just debug it locally and get this to happen.

06:32 Or if it's completely crashed and you have a core dump, this, these guys are doing lots

06:36 of magic to make it possible.

06:38 Nice.

06:38 Yep.

06:39 Cool.

06:40 Well, next, I kind of want to give everybody some news.

06:44 So last year, actually, it was in July last year.

06:49 So we talked about in episode 293, we talked about some giveaway, some PSF, the PSF saying

06:58 that there's like the top 1% of the critical packages are going to have to use two-factor

07:04 authentication.

07:05 And it was big drama at the time, right?

07:08 Yeah, well, because like there was some confusion over the keys and stuff like that,

07:11 or hardware keys and, and, and, and yeah, some pushback against that or just some confusion

07:17 around it, I think.

07:18 But we've seen some, some even more attacks against Python projects in the last year.

07:25 I mean, it's only, it's only, it's been less than a year since that.

07:28 And so the change is this year, PyPI is going to require everybody to use two-factor authentication,

07:37 not the top 1%, the top 100%.

07:40 So, and it's, you got till the end of the year, I think.

07:45 And it's, let's see, we were linking to an article from the Python package index saying,

07:53 securing PyPI accounts via two-factor authentication.

07:58 And as of today, they're going to require, they're announcing that every account that maintains,

08:05 every account that maintains a project or organization on PyPI will be required to enable two-factor

08:12 authentication on their account by the end of 2023.

08:14 So that's the news, really.

08:16 There's some discussion as to why in this article, but there's some information on how to, how to prepare.

08:25 But it's not, I mean, it's not that bad.

08:27 I did it last year.

08:28 If you've got, especially if you're already using a smartphone, I think that using something like Authy

08:36 or something like that on a smartphone would work just fine.

08:40 So, yeah.

08:41 What else?

08:42 There's, it's kind of, I guess there's not much really more to say.

08:46 about it is that this is happening and you got to kind of do it.

08:49 You got to do it by the end of the year.

08:51 But why not?

08:52 Why wait?

08:53 Just go ahead and do it.

08:54 And it's really everybody.

08:55 So it's, so let's say you've got an open source project and there's like, you know, 20 people

09:00 contributing.

09:00 That would be cool.

09:01 Maybe there's like five, but if only one of you is ever pushing to PyPI, then it's just

09:06 one of, I think it's just one of you, unless you're doing an organization thing.

09:09 I think it's just a person pushing.

09:11 So if other people are on Git and not using two-factor for Git, but they're,

09:16 just pushing to your repo.

09:18 I think that's still fine.

09:20 That doesn't matter.

09:21 It's the people actually actively interacting with PyPI that need to be authenticated.

09:26 Yeah.

09:26 That's what it sounds like to me as well.

09:28 It's kind of, if, if you're actually have an active account on PyPI, right?

09:33 It's not necessarily GitHub.

09:34 Although I think GitHub itself also has a 2FA requirement now.

09:37 And there is some discussion here about like people that don't interact with their, with

09:43 a project, but still have a PyPI account.

09:45 And I'm not exactly sure why.

09:46 Apparently there's some people that need it that, I don't know.

09:50 Why would you have a PyPI account if you're not pushing stuff to?

09:53 Yeah.

09:54 Yeah.

09:54 That's a good point.

09:55 It is a good point.

09:58 Well, so there was so much drama about it and there was that person that deleted their,

10:05 all their packages because they were frustrated as like a thing of protests and it caused some

10:10 issues.

10:11 And well, I'm fine with this.

10:13 This is, this is great.

10:14 I think it's supply chain issues are really, really serious.

10:18 So it's, it's okay with me.

10:20 Yeah.

10:21 Me too.

10:22 So shall we thank our sponsor?

10:25 We shall, but first I just want to point out.

10:28 Yeah.

10:28 I think Authy is a fantastic option for the 2FA stuff that you were pointing out, right?

10:33 As you mentioned, like one of the things that is a huge hassle for, for a lot of the systems

10:39 is guess what?

10:40 You can install this 2FA tool onto your phone and it's completely safe.

10:45 And all that local, that 2FA, it'll never go anywhere until you want to get a new phone.

10:49 And then you're completely out of luck and you've got to somehow reset it or worse, you lose

10:53 your phone, but it's not, there's no way to recover the 2FA code.

10:56 So what I really like about Authy is it will, you can install it in multiple locations.

11:00 Like you can install it on your desktop and your mobile device.

11:05 And they're just in sync.

11:06 If you add one somewhere, it appears elsewhere.

11:09 So if people feel like TFA is a huge pain, I think Authy is one of the choices that's

11:13 pretty good for that.

11:14 I didn't know.

11:14 You can also do like 1Password and so on.

11:17 But to me, having the passwords there and the 2FA thing in the same place seems to violate

11:22 some aspect of security.

11:24 I mean, I know 1Password is pretty safe, but 2FA should be about having the password and

11:29 the thing separated in my mind.

11:31 And so I don't use my password managers 2FA thing.

11:34 Yeah.

11:35 I just thought, I thought I had like just a couple accounts with Authy and I just looked

11:39 and I've got like, I got a scroll.

11:40 I've got a whole bunch of things on Authy right now.

11:43 Yeah.

11:43 I think I have 40 or so myself.

11:45 All right.

11:46 Now let's tell people about our sponsor.

11:47 All right.

11:48 This episode of Python Bytes is brought to you by Influx Data, the makers of Influx

11:53 DB.

11:54 Influx DB is a database purpose built for handling time series data at massive scale for real-time

12:00 analytics.

12:00 Developers can ingest, store, and analyze all types of time series data, metrics, events,

12:05 traces on a single platform.

12:07 So dear listener, let me ask the question, how would boundless cardinality and lightning-fast

12:13 SQL queries impact the way you develop real-time applications?

12:17 Influx DB processes large time series data sets and provides low latency SQL queries,

12:23 making it a go-to choice for developers building real-time applications and seeking crucial insights.

12:29 For developer efficiency, Influx DB helps you create IoT, analytics, and cloud applications

12:35 using timestamp data rapidly and at scale.

12:38 It's designed to ingest billions of data points in real-time with unlimited cardinality.

12:44 Influx DB streamlines building once and deploying across various products and environments from

12:50 the edge, on-premise, and to the cloud.

12:53 Try it for free at pythonbytes.fm/influx DB.

12:57 The links are also in your show notes on the podcast.

13:00 Thanks, Influx DB, for supporting the show.

13:03 Yep.

13:03 Thank you.

13:04 Thank you.

13:04 Everyone check them out to help support the show.

13:07 All right.

13:08 Let's talk about queues, Brian.

13:10 Okay.

13:11 Yeah.

13:11 So I want to talk about Propan.

13:13 Now, Propan is a project that's not, you know, tens of thousands of GitHub stars.

13:19 I think it looks pretty compelling.

13:22 It's put together by Lance Nick, Lance Nick, Lance Nick, Lance Nick, I'm going to go with

13:27 over here on GitHub.

13:28 And it is a powerful and easy to use Python framework for building asynchronous web services

13:34 that interact with any message broker.

13:36 So what are some of the options of the message brokers here?

13:40 We've got RabbitMQ, Redis, Nats, Kafka, SQS, some of the other ones like Redis streams.

13:47 If you're using these and you want a cool declarative way to interact with them, then Propan might

13:54 be your thing.

13:55 So right now what they have is async APIs for you, and they're working on synchronous ones,

14:02 but they don't have them yet.

14:03 So let me just give you an example, Brian.

14:06 Over here, it says, first, let's take the quick start from AIO Pika, which is a way to

14:13 talk, way to listen for events.

14:15 This is the important part.

14:16 Listen for a certain set of events coming into a message queue.

14:20 Okay.

14:20 Okay.

14:21 So what you do is you say, I'm going to connect to the message queue server, and I'm going to

14:27 listen to a particular queue.

14:28 Then you await creating the connection.

14:31 You await creating a channel.

14:33 You await connecting to the queue.

14:35 And once you do it, then you use the iterator.

14:39 You loop over the iterator as messages come in, and then you get them.

14:42 And then you, of course, run that code that does that right.

14:45 That's the imperative way where you do all the steps yourself.

14:49 So this other way is what you do is you go to, you basically create this thing called a

14:54 broker using propan, and you point it at one of these queues, like Redis or something.

15:00 And then you just, kind of like you would in FastAPI or Flask, you say, you put a decorator

15:05 on a function, and you say, at broker.handle, and you give it the name of the queue.

15:09 So if a message comes into that named queue, call this function.

15:13 Oh, I like that better.

15:13 Isn't this nice?

15:14 It's kind of like, I'm listening for this URL, like if, you know, slash courses, slash ID

15:20 of a course.

15:21 I want to get you details about that course, right?

15:23 You would put that in Flask or Pyramid or FastAPI.

15:26 This is the same thing, but for message queue.

15:28 So you say, this function receives stuff that goes to that queue.

15:31 Oh, I like it.

15:32 Yeah.

15:33 That's what those interfaces should be like.

15:34 Yeah, absolutely.

15:36 It totally should.

15:37 So this is pretty interesting already, but it gets a little bit cooler.

15:42 You can go and create one of these apps and just run a server directly, right?

15:47 So you can say, I want to run this as a system daemon on Linux, let's say, and it's just going

15:52 to, you know, use the Propan server to run.

15:55 That's fine, but there's tons of infrastructure around running these types of things as web applications.

16:01 And if you already have a web app that receives like JSON requests, you know, it's got some

16:08 kind of API endpoint, but you also want to have it handle stuff that might be put into the

16:13 message queue.

16:13 Then it has integration with the virtual down into, you can do it manually into any web framework,

16:21 or it's got things like a FastAPI plugin, which is pretty cool.

16:24 Oh, cool.

16:25 Yeah.

16:25 So let's see.

16:27 Actually, if I go to the examples, I'll pull up a Flask one.

16:29 That's probably the best, which you got to use Quart because it's only async.

16:33 That's the Flask async variant.

16:36 So what you can do is in your, let's see, I'll just say in your Quart app, you create this

16:40 broker to sort of listen as well.

16:42 In addition to create your, your Flask or Quart app.

16:45 And then you might have, you know, a function that says app.route, listen for forward slash,

16:51 and that's a JSON endpoint.

16:52 Or you might have broker.handle some queue message, and that's the queue coming in.

16:57 So it's kind of like, well, here's the messages coming in over the web, and here are the ones

17:02 coming over, message queuing.

17:03 But, you know, it's just, it runs in Microwisgee or G Unicorn or whatever.

17:08 Yeah, that's nice.

17:09 Yeah.

17:09 Last thing.

17:10 This is inspired by Pydantic and FastAPI.

17:14 And so let me see about a good example here.

17:19 You can do things like declaring that the body of the message is, is a dictionary, or you can

17:28 have Pydantic base models that are coming in.

17:31 So you can say, here's a Pydantic.

17:32 When a message comes to the message queue, it's going to be represented by, let's say,

17:36 JSON.

17:36 And that JSON, I want to parse into a Pydantic model.

17:40 You can just say, much like FastAPI, in your handler, you say body colon, you know, the name

17:45 of your custom Pydantic class.

17:47 Boom.

17:47 Now it's automatically parsing that based on the type.

17:50 Oh, based on, that's neat.

17:52 And the last thing, they also have this concept of modeling pytest fixtures.

17:59 So you can create functions that will do things like, you know, process requests or give you

18:04 extra information or whatever, you know, what you would do with pytest fixture type things.

18:07 And you can have those as well in here, which is pretty cool.

18:11 So there's a lot of cool, it's like a fusion of interesting Python frameworks for message

18:16 queuing.

18:16 I like it.

18:17 So ask your doctor if propane is right for you.

18:20 Ask your doctor.

18:21 That's right.

18:22 Yeah.

18:22 I, you know, it's, it's interesting because this message queuing type of architecture is

18:27 super powerful at unlocking tons of interesting asynchrony.

18:31 Like, well, if I've got a request come in and I got a, you know, place an order and we

18:35 got to check the warehouse, whether we have them.

18:36 And that's a janky old API call that's slow.

18:40 Like, well, how do I scale that would be one option with threads and async and await.

18:45 The other one would be just like, well, throw that into a queue to say, check that out.

18:49 And then, you know, let it run completely disassociated.

18:52 Right?

18:52 Yeah.

18:53 Scroll to the bottom, the key features.

18:56 So one of the things I want right down there, testability.

19:00 Propane allows you to test your app with without external dependencies.

19:04 You do not have to set up a message broker to test.

19:06 You can have a virtual one.

19:08 That's pretty cool.

19:09 Yeah.

19:09 Yeah.

19:10 This is cool.

19:10 So it's, it's not super popular.

19:12 Like I said, however, it does look pretty neat.

19:15 Sure does.

19:16 All right.

19:17 Over to you.

19:17 So that, that was a little bit of a new thing.

19:20 I want to talk about a little bit of an old thing, which is make files.

19:23 We haven't talked about it for a while, but make files are still fairly popular for Python

19:29 projects.

19:29 I think I I've got them on several internal projects at least.

19:34 And they, they come in handy.

19:36 You got to be careful that a lot of people, sometimes people on your team won't be familiar

19:40 with them, but if it's a common thing for your team to use make files or for you, why not

19:45 use them on a Python project?

19:46 So this, what I'm going to cover is a, an article for getting the author name right now.

19:53 Let's see.

19:53 Ricardo and drag called make file tricks for Python projects.

19:58 And I'm going to hop down to the actual template.

20:01 What it is, it's a, it's a little, it's a small template as a starter template for a Python

20:06 project, but it has some pretty cool features.

20:09 And the, the actual templates at the bottom of the article, but we kind of go through some

20:14 of the different things that you might want to put in there.

20:17 And so to start off some, a little bit, I always forget to do this.

20:21 These are things I want to, I always want to do, but I forget in my make files, things

20:25 like making sure that it fails.

20:27 If anything throws a incorrect error code.

20:30 And also warning, if you did something wrong, like undefined variables or you're using, you

20:37 can turn off this built-in rules.

20:39 And I don't really know what the built-in rules thing does.

20:41 It's just, I find my make files more pleasant if I disabled them.

20:46 So this is good.

20:47 The virtual environment thing.

20:49 So there's a little snippet that he includes that you can use the PY variable to select which

20:57 Python to run.

20:58 So if you already have a virtual environment, it uses that, which is cool.

21:02 That's pretty clever.

21:03 Yeah.

21:03 Yeah.

21:04 And if you don't, it uses the global one.

21:06 And then also with pip.

21:08 So use the, it uses that PY variable to pick pip if it's there or not.

21:15 And it uses the global one.

21:16 So that's pretty cool.

21:17 Actually, it'd probably be better to just blow up if you didn't have a virtual environment.

21:22 Anyway, some of the, some stuff like PWD and current working directory and work root.

21:29 These are good things to add in because sometimes you'll call a make script from a different directory.

21:36 So your actual current directory is different and it mucks things up.

21:39 So there's some good correction there.

21:41 I do like this.

21:43 There's some little magic stuff about default goal and help message.

21:47 And I had to read this a little bit to understand what's going on.

21:50 But what happens is it, the default goal being help means that if you just type make with

21:57 nothing, no arguments, what should it do?

21:59 And a cool thing to have make do is to print out all the things that you can do with the

22:05 make file, like all the, all the targets and what they do.

22:08 And so that's what this does by having these, having this little greps thing.

22:14 Is it grep?

22:17 I don't know if it's anyway, it's searching through your file.

22:19 And, using awk and saying, Hey, if you've got a comment against, at the site of a target,

22:27 that means that's the help message.

22:29 So it'll print that stuff out.

22:30 Oh, that's cool.

22:31 Yeah.

22:32 some, I don't really muck with my Python path too much, but if you have to muck with

22:37 your Python path for a make file to, to find libraries or something like that, or find

22:43 the code that you're running, there's examples on how to do that, which is nice.

22:48 I guess that's really kind of what I wanted to talk about.

22:51 and I was surprised it's doing all this stuff and it's really, and some examples on how

22:56 you can use the path thing.

22:58 Oh, having, adding a little, create virtual environment within a make file.

23:01 This is nice.

23:02 Just so that people working on the project.

23:04 Yeah.

23:05 Make dot V and V.

23:07 You could have V and V also.

23:08 And it just makes your virtual environment.

23:10 Why do you need a target for that?

23:12 And it's because, and you've, you've discovered this, but sometimes, new Python developers

23:18 kind of forget is that it's, it's kind of annoying to just create a virtual environment.

23:22 It's good to, after you've created it, update the update setup tools and wheel and build.

23:28 And then also if you have a requirements file, why not just install it right away instead

23:33 of having, having that as another command.

23:35 So kind of a fun template for starting make files with Python project.

23:40 Yeah.

23:40 That's, what is that?

23:42 A modern take on an old idea.

23:44 Yeah.

23:45 the, and if you are new to make files, one of the things to be careful about that some

23:50 people don't quite sometimes real remember is spaces matter within make files kind of like

23:56 they do in Python, but spaces and tabs matter.

23:59 So in, in make files, you're using tabs.

24:02 It has to be a tab.

24:03 It cannot be space, unless something's changed that I don't know about, but that,

24:08 that, that has messed me up before.

24:10 So use tabs within make files.

24:12 All right.

24:13 Yep.

24:14 Sounds good.

24:14 Excellent one.

24:15 I guess that's everything.

24:17 Yeah.

24:18 Yeah.

24:18 Any extras?

24:19 no, not really.

24:20 You.

24:21 I got a couple here, just a couple of conference ones.

24:25 So high con Portugal has their call for participation.

24:29 So.

24:30 got, got a little bit of time left on that.

24:34 What is that till the 30th, June.

24:37 And when will it be, it will be September seven to nine, which is cool.

24:43 So if you're in and around or want to go to Portugal, there you go.

24:47 Cool.

24:48 On the other hand, if you happen to be interested in Django and are in, Europe that just got

24:54 announced as well.

24:55 So people can check that out.

24:56 I want to go soon.

24:58 I'm not going, but I want to go.

25:00 Yeah, indeed.

25:01 So that's also announced link to both of those in the show notes.

25:04 Are you ready for a joke?

25:05 Yeah.

25:06 Well, this becomes because apple.com.

25:09 Did you see that they announced this crazy vision thing, Brian?

25:14 Yeah, but it doesn't come with the snorkel.

25:17 It's just the snorkel mask.

25:18 Yeah.

25:19 It's just the snorkel mask.

25:20 It's, it doesn't even come with that little, handheld sub submarine thing that you can

25:26 drag yourself around either.

25:27 So, yeah.

25:28 So they announced if you haven't noticed yet, Apple announced vision pro, which is a $3,500

25:35 ski goggle looking thing.

25:37 That is both augmented reality and virtual reality kind of turn the dial.

25:43 I'm highly suspicious of this.

25:44 I think it's going to not do great, but it does look pretty awesome for certain use cases.

25:51 Like for example, you could sit on the sidelines of a football game and, and get like a 3d view.

25:56 So you could look to the right and see down the sideline and then look ahead and watch

26:00 the game.

26:00 I got that.

26:01 That's pretty epic.

26:02 Is it worth $3,500?

26:03 I don't know.

26:05 We'll see.

26:05 but okay.

26:07 So that's setting the stage for the joke.

26:09 So here's the joke.

26:10 The average pseudo technical person has got like an Oculus Rift in there.

26:15 They got their handheld controllers that they're doing.

26:18 Right.

26:19 And then we have the pseudo, the rich pseudo technical people wearing the Apple one sitting

26:24 there watching TV.

26:25 And then Brian, you want to describe the actual technical people, advanced high tech setup they

26:31 got here.

26:31 That's just a dude at a desk with like, you know, with using a computer, but it's, oh,

26:38 there's important stuff to it though.

26:40 It's dual monitor.

26:41 We will note the dual monitor.

26:43 Yes.

26:44 And the mechanical keyboard.

26:45 These, this is not your average desk worker.

26:48 Yeah.

26:49 Anyway, there's my follow on to WWDC.

26:52 I know I would.

26:53 And that's, that's even, okay.

26:55 I've got the, the big curved monitor.

26:58 So I don't have two right now, but you have two monitors.

27:01 I have one big monitor for my, my working desk and I have a big curved monitor for my gaming

27:07 PC, but just one for both as well.

27:09 I used to have dual monitors and I would, I was always trying to like juggle them.

27:12 I'm like, you know, I just want big monitor.

27:14 That's better.

27:14 Yeah.

27:15 I actually, when we did the pandemic thing, I went to one big monitor at home and then

27:19 at work, I still had the two split ones, but then I was just tired of doing this all day

27:24 long.

27:24 Yeah.

27:24 So I'm like, oh, we got to just, so I went to a big one, but that's kind of privilege

27:30 speak.

27:30 So I don't know.

27:31 It is a little bad.

27:32 Just for people who are interested, I, if I do need a second monitor, like sometimes when

27:37 I'm recording a course, I want to be able to see what the recording is doing.

27:40 So I want to see my video overlaid with maybe what's on the screen with whatever settings,

27:46 like scale, like exactly what's being recorded as the person's going to see it in case something

27:51 goes weird with that.

27:52 So I'll take my iPad, plug it into my mini and then use Duet.

27:58 Duet is a really cool software that I think works on Mac and Windows and basically turns

28:04 that into a second monitor just periodically when you want it.

28:07 You know?

28:07 So that's, that's what I do if I really feel like I need extra, extra space.

28:11 So, so go back to the Apple vision thing or the eye dork.

28:15 What's it called?

28:15 Apple vision.

28:16 Yeah.

28:16 I think it's, I, I, I dork pro.

28:18 there's part of one of the, the things on there is somebody doing a, like a meeting

28:27 where you can supposedly see other people in the meeting, like as if you were still there,

28:32 they were with you or something and I thought, well, that one go up a little bit.

28:37 Yeah.

28:37 This is like the, the group FaceTime is what that is.

28:40 Yeah.

28:40 Except for, oh no.

28:41 Yeah.

28:42 Yeah.

28:42 I see it.

28:42 Okay.

28:42 Wouldn't, wouldn't they see you with the goggles on?

28:46 So if everybody's doing it, wouldn't everybody just, you just be able to see people with goggles.

28:50 that's interesting.

28:52 I think it might scan you and put an avatar of you up there.

28:55 Oh yeah.

28:56 It's an AI you.

28:57 It's not really, I think it's, I think it's an AI you actually.

28:59 Yeah.

29:00 I think so.

29:01 I haven't tried this out.

29:03 And where's your camera?

29:04 Where do you put your camera?

29:05 Like for, so anyway.

29:07 Yeah.

29:08 There's a lot of interesting and stuff.

29:10 I'm actually interesting things and stuff.

29:12 I'm actually excited about announced at, at WWDC vision pro.

29:16 yeah, there's, there's like, for example, large language model dictation for iOS and Mac.

29:24 So I don't know how many people know who have tried this, but I, for multiple reasons have tried to do,

29:30 dictation on the Mac.

29:32 Partly because I have like mild grade at this point, RSI issues.

29:36 And so if I can limit typing, that's good.

29:38 And maybe I've got a lot of stuff I need to blaze through, like a bunch of email or something.

29:42 I'd love to dictate to it.

29:44 But the dictation system on Mac is like 10 years old or something.

29:48 It's really bad.

29:49 You can't even say new paragraph, for example.

29:51 Like, nope.

29:52 They don't just write out new paragraph.

29:54 Whereas on iPhone, you can say new paragraph or do this, or like you can navigate around way better.

29:59 They're not the same systems.

30:00 So both of those are being replaced with like ChatGPT level of AIs.

30:05 And so dictation to your computer or your device is going to get way better.

30:10 And so that means less typing, less RSI, just different input modalities.

30:14 If you need a break, like those kinds of things, I'm really psyched about.

30:17 Vision Pro, we'll see.

30:18 Yeah.

30:19 There's potential there, but there's also way more potential for jokes.

30:24 Yes.

30:25 It's going to be good.

30:26 Speaking of jokes, we'll wrap it up with one from Kim in the audience.

30:29 If an avatar is an option, T-Rexes will be meeting with the elves and talking frogs in no time.

30:34 That would be great.

30:36 I'm here for that.

30:37 Let's do it.

30:38 Yeah.

30:38 I'm here for it.

30:39 All right.

30:39 Bye, Brian.

30:41 Bye.

30:41 Bye, everyone.


Want to go deeper? Check our projects