Pamela Fox - Teaching Python, Accessibility, and Tools

Brian:

Pamela Fox, thank you for being on the show.

Brian:

You've been on, I think, all of the related podcasts. You've been on Python bytes and Testing Code, which I'm changing the name to to Python test.

Pamela:

Oh, that's what I thought I saw your your toot about Python test in the stickers. I thought that Pytest was rebranding, and I thought, like, maybe Pytest was getting picked up by Python, like, putting in the standard library. Oh, no. I I made up a whole story for it in my head about what Python test was.

Brian:

No. Yeah. So this this episode is supposed to be about you, but I'm gonna go off anyway. The, the podcast started as the the Python testing podcast, and it was a mouthful. So I shortened it to Test and Code, but then that's dumb because it's an ampersand and no, you can't do that.

Brian:

So it's and in there, and then none of those words are searchable very well. So

Pamela:

Right.

Brian:

Also, I just I don't know why. I don't think I had I don't think I had the python test.com website owned then, when I did the switch, or I would have picked that. I mean, probably. But so I'm just putting it back. So it's not really that interesting of a story.

Pamela:

I think that all the podcasts should have more alliteration. Like, if I if I actually started a podcast, it would, you know, clearly start with Pamela and Pamela's podcast. But then it could be like Pamela's Python podcast or Oh, yeah. Pamela's Python playground. I've seen, like, pee wee's playground.

Brian:

Oh, yeah. But that's, like, personal protective. Isn't 3 piece isn't that something to do with, like like, masks for COVID or something?

Pamela:

I think that's PPE, personal protective equipment.

Brian:

PPE. Okay. Got it. Mhmm. Mhmm.

Brian:

Yeah. Pamela's pie Pamela's perfect Python podcast.

Pamela:

There you go.

Brian:

Yeah. And you could do it, like, always. So it's Pamela's perpetual per perfect.

Pamela:

Well, except when I give up on Python and, you know, go back to JavaScript or or switch to Go or something.

Brian:

I forgot your, you were JavaScript for a while or still are.

Pamela:

You know, I, yeah, I I was very much into JavaScript, because I didn't even go to Python conferences. I think I went to 1 Pycon AU, like, way back, maybe 2010 or something. I think that was the only Python conference I went to. But I meant I went to many, many JavaScript conferences. So I've always, been a bit more in the JavaScript front end community, and that's probably because of doing teaching and for, you know, t JavaScript was always a more teachable language than Python just because of being able to do it in the browser.

Pamela:

Mhmm. But, you know, lately, I got into teaching Python. And now we can teach Python in the browser because we have Py died. So so, now I can do more Python.

Brian:

That's cool. Yeah. I think we I think we talked about Pyodide and your work with that a little bit on last time we talked. But so I'll I'll link to that show if I could find it, in the notes. But the, you've been doing a lot of you're you're still doing a lot of teaching and everything.

Brian:

Right?

Pamela:

Or Well, so now, Yeah. I mean, I've got a full time job now, where I've, you know, I'm at Microsoft, and I'm a cloud advocate on the Python team. And that keeps me really busy, especially because I have a 1 year old and a 4 year old. So, I do still do some teaching on the side from that. I mean, I consider advocacy to be a form of teaching.

Pamela:

That's, like, how I approach advocacy is, like, how can I share this knowledge? But I do also do some more teaching teaching on the side, for, right now, mostly for Girl Develop It, which is an organization that teaches to women and nonbinary folks.

Brian:

Okay. That's very cool. What can you tell? That's like the elevator pitch, I guess. Is there more to it than that?

Pamela:

Well, we yeah. So we, TDI has been around for a long time. It was, I got involved, actually, back in Australia. This is, like, in 2010 when I was at Google Sydney, and I started a Sydney chapter then. And that was back when we were doing, like, in person workshops and then I, you know, moved back to San Francisco And we had lots of in person workshops all over San Francisco.

Pamela:

So I've seen, like, the inside of every office because we would have our venues every like, you know, everything hosted us. So I've been inside, you know, Twitter, Microsoft, Hack Reactor Galvanize, Relic, New Relic, whatever. Yeah. New Relic. So, we would have workshops just all over the city, you know, whoever would have us.

Pamela:

So it would just be a bunch of us, you know, Saturday. Like, I went hard. So, like, our JavaScript workshops would be, like, Saturday from 9 AM to 5 PM and Sunday 9 AM to 5 PM. And we covered, oh, like, a lot in that time. Right?

Pamela:

And they were really fun. I because I I I got a kick out of it. So that was really fun. Then, of course, you know, the pandemic happened. And so now there's not as much on I don't even know if any of the chapters do anything in the local, you know, actual physical in person workshops.

Pamela:

Most of the or all of the workshops are online. Okay. So, you know, we'll get on Zoom. But the cool thing is that means that, you know, I can have students from, outside the Bay Area as well.

Brian:

I think a safe place where you just take the dudes out of it or at least that's mostly the idea. Is that is that an idea, or am I am I reading too much into it?

Pamela:

Yeah. I mean, there's a lot of idea behind it. It's, part of it is just trying to make sure that, people feel invited. Right? That it's like this is like, knowing this is something that is for you.

Pamela:

Because 11 you might look at some other workshop and think like, oh, I'm gonna show up and feel out of place. People don't like feeling out of place. Right?

Brian:

Right.

Pamela:

Especially if you already feel like you might be out of place, especially if you're new to something, you know, and and you're you're still learning things. It's just really easy to start having thoughts that you don't belong somewhere. Right? So how can we increase the likelihood that somebody feels like they belong somewhere? So one way is by saying, like, hey.

Pamela:

These are workshops that are specifically for women and non binary folks. And, you know, and that's that helps. Right? It lowers the the barrier for feeling like you belong.

Brian:

My youngest is in high school now. She's gonna take a Python class in school, but I think that some virtual training or some I mean Yeah.

Pamela:

There's also I don't know what Girls Who Code is doing these days. So Girls Who Code, I've also taught for them. They specifically target, you know, k to 12, students. And it's funny because the naming is just horrible of everything. Like, girl development is actually for adult women.

Pamela:

It's because it's supposed to be like, girl, develop it.

Brian:

I don't know. Oh, okay.

Pamela:

And then Django Girls, I think, is also kind of for usually, adults. Maybe it's got a mix of ages. I actually haven't been involved in Django Girls. But Girls Who Code is very specifically, like, high school high school, middle school level. I don't know if they're in middle school yet.

Pamela:

But, when I taught it, it was at a high school in San Francisco, and it was, like an after school program. And so they what they do is during the year, they have after school programs. And then during the summer, they have these on campus programs, so they get to, like, go Pixar and Microsoft and Google. And I actually stopped by the Pixar one, which is so cool because I like any excuse to stop by Pixar because I'm, of course, a huge Pixar fan girl because who's not? So, you know, you get to walk in and take your picture with, you know, Buzz Lightyear.

Pamela:

So so cool. You've you've been to Pixar? Yeah. I mean, it's, like, down the street, technically. It's, you know, it's Emeryville.

Pamela:

It's not far from me here. And I I did work with Pixar, at Khan Academy because we have this, Khan Academy Pixar curriculum kind of thing, and it it does mix in a little bit of programming. So you can program the rigging of, like, a drawing of a snowman and stuff. So I did actually go in order to have a meeting with them, which is which is really cool and, like, because they got a tour, but I I'm happy for any excuse to to go there, so I did also go there to see the Girls Who Code. So that's really cool.

Pamela:

So they do a summer program. And during the summer, they'd learn all sorts of things including Python, last I checked. And then if they enjoy that, the students can go back to their high school and start up a chapter of Girls Who Code at their chap at their at their high school as long as they get, like, support of a teacher. So that can be a really cool model because it's like like, they get all this, you know, knowledge and enthusiasm and energy from this summer experience, and then they can try and bring it back to their high school and share it with others. Because I know it can if you're, like, the only one that's into it, you know, interested in something, it can be hard to keep up the hobby.

Brian:

That's pretty cool that you're, I guess, giving back. You teach as an advocate, though, right, also, or do you not? I don't know what an advocate does.

Pamela:

It depends what you think of an advocate as doing. So I like to think of what I'm doing as teaching, but other people think of it as selling. And I think there's, like, everything. Yeah. There's different lenses.

Pamela:

So, I tend to veer more towards the thinking trying to at least thinking of myself as a teacher. So it's like, here's some technology. It's out there. Let me teach you how to use it. Right?

Pamela:

And so, you know, so going on streams and conferences and writing blog posts and all of that, it's it's at least a form of knowledge sharing.

Brian:

Is there a difference?

Pamela:

Well, I think, like, it's so one thing is different, actually, like, removing like that, you know, obviously in paid position part of it is the difference between teaching a language and teaching a tool. That I've seen a huge difference in because I've done that. I've I've taught Python the language. I taught it at UC Berkeley for a few years before starting this position, and I've also started taught, taught it online for, a course on this, up limit website. And so there, I'm teaching the language, which is, like, you know, tea and teaching programming, the idea of programming.

Pamela:

And that is that is really it's really different from teaching a tool. So when you're teaching the language and teaching the ideas of programming, like, there's just it the it's it's hard, actually. Teaching is really hard. Part of why I've I've you know, I I don't do it all the time is because it's actually hard. Like, it's I I am, like, not able to there's some concepts I'm not I don't teach well because they're hard to teach, and I haven't, you know, figured out how do I teach this concept.

Pamela:

Like, every time I teach object oriented programming, like, I change up the order in which I, you know, teach things. Because I'm like, oh, should I show the class first? Should I show the admit first? Do I talk about self? When do I talk about self?

Pamela:

How do I talk about self? Should I show bound method? Like, it's really hard to teach OOP, in a, like, logical sequential order, and I haven't figured out the right, you know, exact right sequence there. So that, I so I, you know, I and I so I do teach Python sometimes, and I have an I have a Python intro curriculum that I use. But I do think it's actually pretty hard.

Pamela:

I would contrast that to teaching a tool. Like, a tool is, like, you know, seeing, like, oh, this is how you use a function. There here, I'm just, like, I'm teaching the people who already know what a function is. They they understand the idea of parameters and return values. Somebody already knows what a function is, then you're just showing them, oh, here's a function and this is what it takes us with outputs.

Pamela:

Right? You're just showing them it exists. It's way different than the fundamental idea of what is this abstraction that's a function. Why do I even have functions? What is a return value?

Pamela:

What is a side effect? So I would say with with my job, I tend to be teaching more tools. Whereas in when I'm teaching, like, a Python intercourse, it's it's a lot more, fundamental concepts.

Brian:

Okay. But even with tools so my I guess I'm hoping that it's not just, like, here's how to use absolutely every feature of this tool, but, I like I like tutorials that are you're trying to get this done. Here's how to do it with this tool.

Pamela:

Mhmm. Mhmm.

Brian:

Because you don't need, like I, a friend of mine had an interview and they had, one of the requirements was, knowing the Microsoft office suite well, and I'm like, nobody knows it well, except for the people, even the people that work on it probably don't know it well. There's like a 1000000000 functions in there. But, knowing how to use it to to get things done, a lot of people know how to do that. Anyway, not not to bash Microsoft, but,

Pamela:

No. I don't I don't even know how to use it because, well, I because I'm on a Mac. I don't know. I don't use a lot of the software right now.

Brian:

What was it?

Pamela:

I mean, if you're like, my very first program was in Microsoft Word. If we're gonna go way back, my very first, like, quote, unquote program was Microsoft Word with this plugin called I think it was called Internet Explorer Assistant, because I think it's when Internet Explorer was around, and you could you could export your Microsoft Word document as a web page. And that is how I made my first web page. So I, you know, forever indebted to Microsoft Word for letting me export my first webpage.

Brian:

Okay. This is terrible though. I mean, I had to deal with a whole bunch of web pages that were exported from Microsoft Word as an internal web page, like a company thing and, like, hey. Just put this up. Like, no.

Brian:

This is that. Anyway,

Pamela:

well, cool. Yeah. You probably had to, like, actually look at the HTML, and then

Brian:

Oh, yeah.

Pamela:

That's probably really horrible.

Brian:

Yeah. Yeah. Well, I'm kind of one of those customizer people too, so I'm I'm like, well, if we're if we have to grab data to and this is a this is a toll side project, but side thing. But, there were we got into web scraping really early. Like, people were like, oh, we could publish stuff.

Brian:

So now we need web scrapers to get the data off. So we have, like, one company that's one group is publishing, taking data that's in very readable format, like machine readable, publishing it as a horrible website, and then somebody else trying to scrape it to get the original data out. You could just share the data between the two teams. Right? Why?

Brian:

Anyway, but now we have, like, rest endpoints, and we can do that a little bit easier.

Pamela:

Mhmm. Mhmm. But,

Brian:

so what what kind of tools are you mostly advocating for at Microsoft, or is it everything that Microsoft sells?

Pamela:

Well, being on the Python team, it's, you know, the intersection between Python and Microsoft. And, actually, we're specifically on the Cloud FMC team. So it's it's, you know, Python and Azure. So a lot of it is figuring out how to, you know, get Python apps working well on Azure, especially as you're kinda hosting platforms. So recently, I've been working with my colleague, Jay Miller, on, using cookiecutter.

Pamela:

So that's the Python package cookiecutter, which can generate it can generate repos based off templates. So we use the cookiecutter in order to generate at this point, we're at, like, 17 repos, I think. Seventeen different repos that show, like, how do you deploy Django fast API Flask on Azure app service, Azure container apps with, like, 4 different types of, SQL or Mongo servers, database servers.

Brian:

Oh, wow.

Pamela:

So that that is a really cool I'm really excited about that use of cookie cutter, because, basically, you know, there's a lot of stuff that's in common across, across all those things. Right? You know, a lot of shared code, but there's also things different. Right? Obviously, a fast API app is different from a Flask app, and, you know, a Postgres model is different from a Mongo model.

Pamela:

So we just kinda, like, swap in, you know, swap in things. But I'm now, like, an expert on what is the exact difference between, you know, Flask and FastAPI because we've ported the the, you know, the the same app. And we even have, like, functions that translate between 2 because we actually manage to reuse the same templates for the most part. So we're using, like, the same Jinja 2 templates, because they're you know, they basically can all use that. And, we just swap out some you know, we have, like, some Jinja filters that can that can, like, swap out the database queries if we if we really need to.

Brian:

Okay. Interesting. Cool. Are you are you having fun being an advocate still? I mean, I think the last time we talked, you just sorta started.

Brian:

So

Pamela:

Yeah. Yeah. Now it's been, like, more than a year. Yeah. It's totally fun because there's still, my gosh, Just so there's just so much to learn.

Pamela:

And, yeah, I just really I really like learning. I get pretty excited by it and, like, you know, like, staying up all night trying to figure something out. So, right now, I'm also working so I kinda spent my time between that project and also working on our Chat GPT on your data samples. That's, like, combining Chat GPT with Cognitive Search in order to answer questions based off of data, like, in order to keep Chappie g constrained to those those search results, which I think is a nice use of, of of LLMs. Because, you know, we've seen that LLMs can make stuff up when they're just doing something without any constraints, but here we're actually giving it constraints.

Pamela:

So that's really interesting. And what I was working on just now was, how to evaluate the you know, whether, a particular prompt flow is is working to answer the questions nicely. And it's funny because you use chat gbt to evaluate chat gbt. So we, like, we send off, like, all these, like, ground truth answers off and then, tell chat gbt, like, please evaluate this in terms of, fluency and give it a 5 1 to 5. And then you get back a bunch of scores.

Pamela:

So it's it's a it's a really entry field. There's also some other metrics as well, that use, you know, other ways of comparing, you know, the new answers to the ground truth answers. But the primary metrics are using chat gbt 4 in order to evaluate the other LLM.

Brian:

Nice. Sounds neat.

Pamela:

Yeah. It's Pretty interesting.

Brian:

You said you're like this day up at night, but you got small kids. How do you do that?

Pamela:

Well, I yeah. Sorry. I really should sleep more. I'm I'm I've never been super good at sleeping. So I I try to get to bed.

Pamela:

I still co sleep with my baby. So I go, like, into the bed at 8:30, and, she likes to sleep in my arms. So we have to start off in my arms. So while she's in my arms, I'm either reading a book on the Kindle or I'm, like, you know, doing some code on the laptop. And then, you know, when she's settled in, then I I try to go to bed.

Pamela:

So I try to be in bed by 10 o'clock, and then usually I'm up again at 5 because she wants to be back in the arms. And so I actually end up doing a lot of coding between 5 AM and 7 AM just with one hand because she wants to be in the she wants to be in the arms. And I'm awake now, so it's time to do something.

Brian:

Okay. Nice. That's that's cool. And you're, able you're, I assume, remote work? You're not in the office or anything?

Pamela:

Yeah. Yeah. I've never been in the I've been in the Microsoft San Francisco office, but I've never been, I don't think, in any other office. So, yeah, it's all remote work. And so I've been I mean, I was remote even my very first job out of college was also developer relations, and that was for Google.

Pamela:

And I was working on the Maps API, JavaScript, and Flash, if we're gonna go way back. And, and that was that was all remote as well. So I'm I'm very used to the the idea of being a remote worker, because we've been doing it for so long and especially for advocacy. Because I think with advocates, it's like, so you're traveling so much of the time anyway or at least in the past. We would be traveling so much of time anyway.

Pamela:

Like, you know, you know, why not just, assume that you're gonna be remote a lot of the time?

Brian:

Now has travel picked up? Conferences have started doing in person things again. Do you know if we're gonna see more advocates at conferences? Or

Pamela:

Yeah. It's a good question. We last we checked, we were told we don't have much of a travel budget, especially for, like, you know, going up and going to London. You know, like, you're really I mean, you spend a lot of money. I estimate for me, I'm happy that we don't have a travel budget because I feel like I used up my carbon, you know, like, a carbate offsets or whatever.

Pamela:

I used them up when I was at Google because I did so many flights all over the place. Right? So now, you know, I'm older. I've already traveled a bunch. I've got, you know, the 2 young kids.

Pamela:

So I'm actually pretty happy to do everything everything virtually, that we can. So I I'm I'm somewhat dreading getting logic. I'm like, no. I wanna stay at home. But I do yeah.

Pamela:

I think it's gonna pick up, but we'll see. It's it's, we're we're we're still pretty constrained because there's also so many virtual events, and it's it's kinda hard to decide, like, where where do you get the most benefit? Like, do you, you know, how much benefit do you get from going, you know, traveling too far to some in person event, versus the benefit you could get from, you know, doing virtual events?

Brian:

Right. And I guess it's different, though. I mean, like, I'm at, like, PyCon, for instance, I'm hanging out at the the booths all all, like, half the time talking to people and and teams and everything. But, if I'm doing a virtual like, go to a virtual event, I'm I'm not I know there's, like like, a lot of the companies have little hangout places where you can talk to them. Not doing that, really.

Brian:

I don't

Pamela:

Right. Yeah. Especially for an exhibitor. That's true. Yeah.

Pamela:

I I think that people aren't, like, chatting up. They're not really chatting up virtual exhibitors so much. Yeah. Because I even like, I volunteered. I was like, you know, I can be a virtual exhibitor, and they're like, it's not a thing.

Pamela:

Like, okay.

Brian:

Yeah. Yeah. Not a thing.

Pamela:

Because I I feel bad that yeah. Because there's been conferences I've been asked to go to. But as, you know, when last year having a very, very small baby, I just couldn't go. Yeah. So I would volunteer to be a, you know, help however I could virtually.

Pamela:

But, yeah, I went a it's it's, it doesn't work as well unless, like, it it conference has really set out to make it work.

Brian:

So I forget. Are you are you in the Bay Area then?

Pamela:

I am in the Bay Area. Yeah. Yeah. I'm, yeah, near Pixar. Alright.

Pamela:

Near near Berkeley. Near Berkeley. Yep. Because I was teaching at UC Berkeley.

Brian:

Okay. The only the only reason why I know where Emeryville is is because there's a, Amtrak station there.

Pamela:

Mhmm. Mhmm. Yeah. I've taken it.

Brian:

And I, had to chase it all over the place, to try to get my mom back on the train, because we missed it. But, anyway

Pamela:

Yeah. I know. I have taken that train because if I need to go down to Mountain View, but it's like I don't think people realize Bay Area is huge. I didn't realize it. When I first moved to the Bay Area, I was working for Google Mountain View and I was like, oh, I'll live in Berkeley.

Pamela:

I know Berkeley's part of the Bay Area and Mountain View is part of the Bay Area. So, therefore, I'll live in Berkeley.

Brian:

Oh, they're Berkeley.

Pamela:

I realized, like, Berkeley is, like, really? I didn't know that. I didn't I was working for Google Maps, but neglected to look at a map. So I was, like, taking, like, you know, like, it was, like, 2 hours to get there. And then if I miss my shuttle, I'd have to take, like, a $100 taxi ride down there.

Pamela:

I did have to do that multiple times because that was back when I actually did have some in person meetings. So, yeah. Yeah. So looking at a map, Bay Area is actually really big. And depending on where you're trying to go, it can take a really long time to get there.

Brian:

Yeah. We had, so I was in when I started my career at HP, I was in Santa Rosa. HP had, at the time, they had a camp they owned a campground near I I don't know. One of the San Jose. So we're like, all we have to do is, like, register for it and go, and we get a free campground.

Brian:

That's cool. Let's go camping. It was, like, 4 hours to get there or something because we we we're like, we'll leave Friday afternoon. No. Don't don't leave Friday afternoon, Santa Rosa, to try to get to the South Bay.

Brian:

It's a it's bad. But, anyway, live and learn.

Pamela:

Yeah. Yeah. My partner was actually called into a meeting in Santa Clara, and I just said, no. You're not going. Yeah.

Pamela:

That's just it's just too far. He actually did had to go to San Francisco today to the office and even that wreaked havoc. So we're because we're just so used to the, you know, remote from home lifestyle that it really wreaks havoc anytime we, you know, try to attempt any sort of commute.

Brian:

Yeah. When and I don't know if it's still there. One of my favorite shops was in, Berkeley, I think, Castle in the Air. Anyway, couple of the artists that I love are in that area, so I'll I'll have to plan a visit here sometime soon. But this isn't the specifically the testing podcast.

Brian:

That's the other one, but, you wrote down Ally testing or a, I think that

Pamela:

Accessibility.

Brian:

Accessibility. Okay. Yes. I should have known that. I could have looked it up, but it's was it a is it a l l y or

Pamela:

a y? It's often I mean, I don't know why I use it because I hate it too, but it's often abbreviated as a 11 y.

Brian:

11 y.

Pamela:

Okay. I'm not sure the origins of it, but it's it's always it's always been abbreviated that way for so long. And I I always find it so hard because I I try to pronounce everything I see. So I look at that. I'm like, what?

Pamela:

But then when you accessibility is also a really long word. So I think that's Okay. You know, why it came about. But yeah. So accessibility testing.

Brian:

Okay. So what what why do you care about that? And, I mean, I know why we should care about it, but why do you care about it?

Pamela:

Well, I just I think that, you know, what I observed is that what, you know, what people measure is what ends up mattering. And right now, people are you know, they're getting into, like, tests and stuff like that. They're, like, measuring, you know, measuring their their unit tests and or their end to end tests. But a lot of people are not measuring accessibility. And if they're doing anything with accessibility, it's, you know, maybe they're having a QA test.

Pamela:

Maybe they're getting an audit, which would be great. But they're just not measuring it. So I think we need to make it easier for people to measure what matters and accessibility, you know, matters. So I've been working on various tools, and I gave a talk at North Bay Python about, some of the tools I wrote, some Pytest packages to make it easier to do automated accessibility testing, using the axe core library and Pytest and Playwright.

Brian:

Really? Okay. What's axe core?

Pamela:

So axe core is actually a JavaScript library, which is why it's very interesting to use it from from Python. But it's a JavaScript library, which makes sense because axe core, what it'll do is you actually inject it into a page and it looks at the rendered page, which is really important for accessibility because accessibility is like, can you can you use it? Right? And if an element is in is in front of another element or if something has, like, low contrast and, like, you know, against this background. Right.

Pamela:

So this this library specifically is dealing with the rendered page, not with the static HTML. Because you can do some sort of static HTML analysis to, like, find, like, oh, I'm missing your alt text. Of course, everyone's missing their alt text. But there's a lot more to accessibility than just missing alt text. It's, you know, stuff about, you know, the tab order of headings and whether things can actually be clicked to and if something's being hidden and if the contract contrast is too low and all that stuff.

Pamela:

Right? Yeah. So axe will evaluate all of those things on the rendered page, and then it gives you back these results. And, you know, and then you can do whatever you want with results. And so axe axe core is what's used by pretty much everything, like browser extensions that measure accessibility.

Pamela:

They're all I think almost all of them are using axe core. You know, lots of JavaScript libraries use it. And so what I did was just, you know, wrote up some Python packages that, you know, hopefully make it a little bit easier to, to use axe core. And so they basically, you know, in conjunction with Playwright, which is an end to end testing library, You know, you get your Playwright page, and it'll just inject the axe core JavaScript into the page, get the results, and give them back to you as a Python dictionary.

Brian:

Cool. Is it is it hard to I mean, the if I if I don't know where to start, is it how is there a way to just get started? If I've got I've got a website, I'd like to know if it's if it's meeting accessibility standards. Can I just point x core at it, and it'll tell me whether it's good or bad or not? Or is there is there more to it than that?

Pamela:

Yeah. Yeah. Good question. So if you're just getting started, you might wanna actually start with the, you know, the browser extensions.

Brian:

I

Pamela:

think they they're they're gonna be a little bit easier, more user friendly for you to understand. So I really like, the accessibility insights extension. It's actually from Microsoft, but it does a really nice job of, like, it it'll actually, like, you can run it on your page, and it'll highlight the things that are wrong so you can just see very visually. And the thing that's really cool about it that I absolutely love is that if your contrast is too low, which is almost always the case, everybody has contrast issues on their site, The contrast is too low, it'll automatically suggest. It'll actually, like, do the math and say, you know, your background color is currently this light green.

Pamela:

Here's how you can make it a slightly darker green, and then you would meet the accessibility contrast ratio needs. Okay. So that's that's what's really, really cool about it. So I would start with the browser extensions actually and, just to give that you know, to get your hands around it. And then, you know, once you've got, you know, basic stuff fixed, then you could think about automation.

Pamela:

Right? I think automation makes sense if you've got, you know, you know, a website that could become less accessible over time, then, you could go ahead and, bring it in. Now I showed 2 different ways of doing this in in my talk, and I also have blog post about it. Because one way is just checking, asserting that you have no violations. Right?

Pamela:

That's the goal the golden ideal. Like, there are no violations on my site. Amazing. If you can do that, that is fantastic, and you could just have no violations forever. Right?

Pamela:

Now most websites do have accessibility violations, and sometimes they can't fix them because sometimes they're coming from third party libraries. Like, even my, pretty basic website where I write all my slides in HTML using the real JS framework, there's a plugin I use that, has some accessibility issues. But But I I do wanna keep using that plugin because it does increase the usability otherwise. So, so, you know, what I'm gonna do in that case, well, that's why I wrote another a pytest plugin to do snapshot testing. So this one combines the axe core with a pytest snapshot library so that you can save in snapshots that say, here are the current violations with my pages.

Pamela:

And so that way, you know, when you when you update the website, you can make sure that you don't have, more violations. Right? So ideally, your violations go away or they stay the same. Okay.

Brian:

That that's actually awesome. So you have a blog post about this somewhere in a talk and

Pamela:

Mhmm. Okay.

Brian:

Well, I'll get those links from you later, and we can throw them on the

Pamela:

Yeah.

Brian:

Thing because, well, I'm I'm concerned about this a lot because well, even before chat gpt and stuff, we had we're try I mean, it's a noble goal. We're trying to get building for the web easier for people, But Mhmm. Building something good that's accessible to everybody is harder. So having tools around to help people that little easier. Because there's a lot of people that are doing stuff.

Brian:

It's not a big team. It's not there's a lot of websites not built by big companies. Even even some fairly well used stuff is just built by a handful of people. So, Yeah. So making it a little bit easier to do that would be great.

Brian:

The tab thing, I was a chuckling when you said that because that drives me nuts. I'm a I'm I'm a kind of person that uses tab when filling out forms, and it drives me nuts when the tab order just hops all the way all around. Yep. Or tabs onto, an element that there's nothing to enter there. So why why why why tabbing to it?

Brian:

It's just highlighting a word somewhere or something.

Pamela:

Yeah. Yes. That's a great thing. Like, the accessibility, like, you know, we it's often worded as, you know, being for folks with disabilities. But, accessibility, generally, when you make your website more accessible, you're generally making it more usable for everyone.

Pamela:

And then also the thing that came in mind is that many of us have, like, kind of temporary disabilities or situational disabilities even if we don't think that we have a permanent disability. So for me, like I was saying, I do a lot of my coding from 5 AM to 7 AM. If your contrast is low on your website, I literally can't read it. Right? There was, like, a website I was trying to use this morning.

Pamela:

I just could not read it because, you know, my my screen and everything is so dim at that point of, the night. So is, you know, it's just unreadable. So usually, I mean, like, if you make something more accessible, it's it's generally just gonna make things better for everyone in in more situations.

Brian:

Yeah. And that we're starting to kinda go away from there's still some web or, like, mobile only pages, but we're kinda going away from that. I think that we're doing more, what do you call it? Responsive web Responsive. Mhmm.

Brian:

Better. Mhmm. But there's some stuff like my bank still has. Drives me nuts. It it's got a, like, a mobile only version, which is fine.

Brian:

It's more readable, but they take information away. Like, if I'm if I'm looking at, like, my, the list of transactions, like, kind of the, like, the online register thing, It's the amount and then also what the balance is after that transaction. On the mobile one, they take away the balance part. I'm like, why did you take that information? That's

Pamela:

Right. Useful stuff.

Brian:

But

Pamela:

Yeah. I guess they couldn't figure out how to squish it in, but that's a good point. So that's something you could do with the when you're running the test is that you could, like, parameterize your test, and you could run them across different, like, different screen dimensions. So you could run them in, you know, to try and prompt your responsive mode. Because if your if your website has a very different layout, at a small screen resolution, and many websites do because of media queries of CSS, because of responsive web design.

Pamela:

But the in the Pytest side, you could actually parameterize that. And I know you love Pytest parameterization. So, you know, you could go and say, like, I wanna try it at all these resolutions and make sure there's, you know, that there's no violations that, you know, pop up at the smaller screen resolution. Well, I

Brian:

think last time we talked, you were not a Pytest plugin author, so that's cool. How was that experience?

Pamela:

Oh, that was great. Well, thank you. You you helped me figure out how to get started because it's always about getting started. Right? It's like, what repo should I start off with?

Pamela:

Right? And because I found this, like, cookie cutter pie test thing, and then I talked to you about it, but you pointed me at your, crayons repo. So I ended up starting with your crayons repo, and that was really helpful. It just was a bit more, up to date in terms of, I think, the packaging. So so, yeah, that was really helpful.

Pamela:

And, so now now I'm a Pytest author. Now we now we're, like, thinking of, like, what so many other Pytest plugins. Because what I've realized is that part of the point of a Pytest plugin is just making it easy for people to see how to do something even if they don't directly use the plugin.

Brian:

Yeah.

Pamela:

Right? Because there's lots of plugins. Like, there's this Pytest Flask plug in, and it, like, has this live server in it. And we weren't able to quite use Pytest Flask, but we, like, looked at how it was implemented to figure out how how we wanted to, like, set up a live server for something we were testing. So it's just like it increases the discoverability of Pytest solutions, even if you don't end up using the plugin itself.

Pamela:

So that's, interesting observation because I've also noticed I mean, the thing you'll see is that lots of Pytest plugins have not been updated in a long time. Right? This is or lots of Python packages have not been updated in a long time. But I think part of what we need to think about is that, you know, some of these things, you know, they got packaged up and they may not be ever updated again, but now you at least have a nice starting off point to see how you can, you know, integrate something into your own test, whether you use the package or whether you are inspired by the

Brian:

code. Yeah. That's one of the things I think we need to as a community Pytest community, we need to do a little bit better on. There's some plug ins I use that haven't been updated in, like, 3 years. They work fine.

Brian:

Mhmm. But test being able to go in and, just update the test so that it's tested on the most recent Python so that people know that's been updated. I'm like, oh, it hasn't been tested. It's a 37. So, maybe it won't work.

Brian:

We can try it. It probably works. And a lot of, and so a lot of Python's plugins are they're just little things. They're just like a fixture or, you know, a little extra thing, so it's not gonna break unless Pytest completely changes how they do stuff. I'm, like, one of the people that writes stuff that breaks all the time.

Brian:

Because because I well, the my I wrote Pytest check, which is a a way to have multiple failures per test.

Pamela:

Mhmm.

Brian:

Whereas, normally, an assert stops right away. Your test can't continue. But I'd like to have and I'm doing things because I'm, like, testing waveforms and things like that. So I wanna test both the, like, the the how how loud it is and, what the frequency is. I wanna test a whole bunch of stuff, and I wanna see all of the failures for something because anyway.

Brian:

But, yeah, there's examples for, like, Webbit. Anyway but in order to make that work, I have to, like, kinda dig into the internals of Pytest, and those are not guaranteed to not change, over releases. So, luckily, I've had some Pytest Corp help to keep them updated. But there's another one like, high test repeat, that hasn't been and it just calls it just, parameterizes your test kind of under the hood so that you run a test multiple times. And it works awesome.

Brian:

It hasn't been updated for, like, 3 years, but it still works great. The thing that I, but then I I wanted it by default, it just like, if you have 10 tests and you say, I wanna repeat it a 100 times, it'll take test 1 and run it a 100 times, and they go to test 2 and run it a 100 times. And I'm like, no. I don't want that. I want it to do the all 100.

Brian:

Oh, yeah. Uh-huh. Like, multiple times. But, but there's a parameter for that that that I just didn't know. I just didn't read the read me close enough.

Brian:

So, anyway, I I used to be recommending, now I'm off on tangent, but I used to be recommending Pytest FlakeFinder because by default, FlakeFinder does the whole thing, but, you know, they're both good. But, I'm the packaging story is a little weird. It keeps changing. So keeping up on packaging is a little tough. Are you using Flit then, or are you, keep still using Flit, or are you doing your hat?

Pamela:

Or I think I'm using Flit, especially if you were using Flit. I definitely know we're using Flit because I I also very recently contributed to Flask SQL Alchemy. Okay. And Flask SQLAlchemy does use use Flit. So yeah.

Pamela:

So by default, I don't even, like, I don't even get into the weeds on, you know, all this packaging stuff. I know there's, you know, the that y'all show a lot of them on your various podcasts. I just want something to work. Yeah. Because I'm like, packaging to me is something I don't really wanna deal with.

Pamela:

I just want it to work. Flit seems to just work, so I am happy to to use that.

Brian:

Well, cool. Yeah. So how did you get into using a Digi are you just a user of Flask SQLAlchemy and you wanted to to help out? Or

Pamela:

Yeah. Yeah. Good question. So I I think it started when, so my colleague Anthony Shaw, he had the idea for doing a video about how to use SQLAlchemy 2.0. Because SQLAlchemy 2.0 came out in January of this year, and it's actually a pretty big change in that you can now define your models with, with Python type annotations.

Pamela:

And, you know, everything will will just work. So if you wanna use Python type annotations, you should use SQLAlchemy 2.0. And Anthony's like, oh, we should do some sort of video, you know, using that, in in Versus Code and Copilot and all that stuff, like, for, you know, for our work. So I started digging into it. I was like, oh, this is great.

Pamela:

This is so cool. And then we could, like, port all our samples over. But then I realized all our samples are using Flask SQLAlchemy, which is a, you know, a package, an extension for Flask that makes it easy to use SQLAlchemy models. But it is not compatible with SQLAlchemy 2 point o because so much is, you know, is changed. So, or at least not it's incompatible with the new style of model.

Pamela:

So SQLAlchemy 2.0 does still support the older style, but it's considered legacy. If you wanna use the new typed models, you do need to make changes. And, you know, I told Anthony, and I was like, oh, no. Sorry. It's impossible.

Pamela:

And Anthony is like, well, maybe you should fix it. I'm like, okay. So I'm no. Kudos to Anthony. He he believes in me.

Pamela:

Because I was looking at Flask SQLAlchemy code going like, oh gosh. Like, the SQLAlchemy code I find real I don't know if you've ever, like, casually browse the SQLAlchemy code Yeah. Or even documentation. Like, it's it's so complicated because it's supporting a lot. And ORMs, you know, ORMs are complicated.

Pamela:

Databases are complicated. So there's a lot there's just a lot going on in that code. The class echo Acme code is more approachable, well, especially now that I've been in it. So, yeah, I just I I was like, okay. Like, alright.

Pamela:

Well, I'll just spend some time digging into it. So, you know, spend a couple days, like, trying to wrap my head around it. So I made diagrams. Like, when I'm trying to understand something, I have to make diagrams. So I made these, like, big diagrams in draw.

Pamela:

Io that showed, like, you know, the the different, SQL alchemy classes and how they and interactive. Because that's, like, the way I understand something is by drawing it. If, basically, if I can draw it, then I can understand it. And if I can't draw it, it means I'm still learning it. So yeah.

Pamela:

So eventually figured out, like, okay. I think I have an approach that would be, you know, fairly compatible with everything and then, you know, proposing a pull request. Met David at North Bay Python. So we did, like, an in person code review, which is really nice, and went through all that. David Lourdes, the Flask maintainer, primary Flask maintainer.

Pamela:

And, we got it in couple weeks ago, so I've been porting lots of things over since, and it's really fun because you get to use types now.

Brian:

So now you're you've you've helped out with SQL alchemy.

Pamela:

Yeah. Or with, like, Flask. It's more about the Flask. And now I'm in, like, the Flask Discord. I'm not usually in a lot of Discords, but, I'm I'm adding to the list.

Pamela:

So yeah, generally, like, what you see is, like, lots of Flask extensions could use some help contributing and, you know, Oktoberfest is coming up. So this could be a good time for folks to get involved. The hard thing is that a lot of times the Flask extension, like, maintainers don't even have time to, like, review port requests. Right? Because a lot of these things have been made in, you know, people's free time.

Pamela:

That's why it's nice that I have an employer that supports, doing some open source contribution as well. But, yeah, the hard thing is that you both need people to make the pull request, but you also need people to review the pull requests and be comfortable with them and do the release. Right?

Brian:

Yeah.

Pamela:

So I think we should probably be focusing on, you know, like, things like just checking, like, does this work with the latest Python? Like or are there any, like, like, bug fixes? Right? If we can get, like, all like, more of the Python packages just to have their basic bugs fixed, like, things that have, like, kind of regression bugs, like, you know, something doesn't work with the latest Mac m one. Right?

Pamela:

There's a lot of Mac m one or, you know, arm architecture issues that have popped up in the last few years. So, I think that would be the thing to, you know, to focus on in terms of making our Python package ecosystem more robust is just trying to fix bugs and check compatibility and feel confident.

Brian:

Just this last week, a colleague of mine was looking at something. We're we're trying to do some other little tool, and he's like, didn't you write something for that? And I'm like, yeah. It's over here. And I and I heard myself in my head thinking, if you have any issues, let me know.

Brian:

And out of my mouth said, if you have any issues, well then fix them. Anyway

Pamela:

That's good. We should we should change to just that. If you have any issues, fix them and send a PR that has full tests as well. Thank you.

Brian:

Well, one of the things so I was, like, looking into I brought up pytestrepeat, and it's a it's a package that I'm like, why hasn't it be up been updated? And a lot there's so there's things like Alchemy, SQL Alchemy. There's an we kinda think that the team's probably not as big as we think it is. I I think it's like, oh, there's tons of people using it, so it's they're they're good on support, but they might not be. But then there's other smaller things, things, like just a little plug in, like a pipe disk plug in or something that somebody wrote because it was helpful to them.

Brian:

But if if if they're not bothered by it being out of date, it probably won't get updated.

Pamela:

Mhmm. Mhmm.

Brian:

There was one thing that you mentioned I wanted to follow-up on, and you said that you were possibly gonna learn Go. Was that a joke, or are you thinking about Go? Or because I thought all the Python devs are learning Rust these days. So

Pamela:

Oh, yeah. I so, I mean, I just mentioned to you. I I actually learned Go I actually organized the first Go workshop ever back in Google Australia because Go, you know, it came out from from Google when I was at Google. So and I was at Google Sydney, which is where, Rob Pike and, Nigel Tao and and other members of the Go team were. And so Go was, like, being created while I was there, and I actually helped hire their 1st developer advocate.

Pamela:

It was actually my friend, Andrew. So and he was he was amazing at it. And so and we did, like, the first Go workshop. So I I technically have done Go for quite a bit. And at Khan Academy, we did, I did work on porting the Khan Academy Python code to go.

Pamela:

Okay. So I have used go a little bit, but it's I've used it so little that I keep on forgetting it. And, I'm also just slightly burned by the amount of structs that we use. Like like, anyway, I called structception. We just it was just so many structs inside.

Pamela:

It was just too many structs. But if you haven't done go yet, don't let me, you know, paint it. I I think the team behind it is is brilliant because I I worked with them and, you know, Rob Pike and Nigel and, Brad and and yeah. They're the so I I think it's it's a it's a great language. And now I understand a lot more about concurrency.

Pamela:

I actually keep thinking about Rob's talk. So Rob gave a talk in at an in person conference in San Francisco. It was like a Heroku comp, I think.

Brian:

Okay.

Pamela:

And it was about con concurrency is not parallelism. I think that was the name of the talk. And at the time, I didn't really understand the talk, but I loved it because Rob's wife is an illustrator, and she is responsible for the amazing gopher graphics. If you ever seen the gopher illustrations for Gordie the gopher. Yeah.

Pamela:

So she illustrated the whole talk, and it has these amazing graphics of gophers, being, like, doing concurrent things versus parallel things. And they're, like, cardiac stuff off to a mine. So I was just kinda just really amazed by how adorable those gophers were and was just having a hard time wrapping my head around the concurrency versus parallelism. But now I'm increasingly using a lot more, async await, in in Python code and realizing the need for it and actually trying to, like, you know, document it and, and and share that more. And so I actually keep thinking about about that talk.

Pamela:

So I actually wanna go back and even I think I've watched it a couple of times, but now I wanna watch it again because now I think, it's it's really gonna sink in. So, you know, even if I'm not using Go, you know, actively, the, concepts from it are still really helpful.

Brian:

Oh, cool. Neat. I'll have to go check check it out. I do like a good talk, especially one with good animation. So Yeah.

Brian:

Nice. Well, thanks so much for, for chat chatting with me today. It was nice.

Pamela:

Yeah. It was really fun. Anytime.

Creators and Guests

Brian Okken
Host
Brian Okken
Software Engineer, also on Python Bytes and Test & Code podcasts
Pamela Fox
Guest
Pamela Fox
A Principal Cloud Advocate in Python at Microsoft.
Pamela Fox - Teaching Python, Accessibility, and Tools
Broadcast by