The most critical issue of our time is climate change.
Yet, when you think about our carbon impact in the software industry, what comes to mind?
Business travel?
Commuting to the office so you don't miss filing that TPS report?
Yeah, those are bad.
But data centers, servers, and our apps consume a substantial portion of the total energy used by modern humans.
In this episode, you'll meet Chris Adams.
He's been advocating for a greener software environment and has concrete advice to make your Python programs more climate-friendly.
The good news is, generally speaking, what we need to do to make our code easier on the planet is the same things we do to make our code faster.
Dive into software and climate on this episode, number 248, recorded December 11th, 2019.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter, where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpython.fm.
And follow the show on Twitter via at Talk Python.
This episode is sponsored by Brilliant.org and Datadog.
Please check out what they're offering during their segments.
It really helps support the show.
Chris, welcome to Talk Python to Me.
Thank you very much for having me, Michael.
I'm really excited to have you on the show.
This is a topic that I've not covered a ton.
We have had a previous show on studying climate science in Python, but we haven't really dove into how that affects us individually
and how the ways that we write software or think about how we host our code or even how fast our website responds directly can correlate to contributing to or alleviating some of the pressure on emissions.
So those types of things are going to be so fun to talk about with you.
Cool.
I'm looking forward to it.
The thing I can tell you is that if it's new to you, you're in good company.
There's lots and lots of people.
And I say this with love who figured out that, yes, the Internet is often someone else's computer,
but that means someone else's computer is running electricity.
And in many cases, that comes from us burning fossil fuels or things.
You're definitely not the only person to be thinking about this.
And more and more of us are waking up to this fact and realizing that we are in quite a pivotal position to change how we work and end up working in a more kind of planet-friendly way, I feel.
There's so many things that are low-hanging fruit that we can do, right?
I mean, obviously, this is a big problem that needs big solutions.
But look, if stuff's easy, let's do it.
So we're going to talk about that.
Now, before we get into that whole side of things, let's just start with your story.
How did you get into programming in Python?
I actually got into programming not through university or anything like that.
I actually studied to become a doctor.
And partly because when I was growing up, my parents were really keen on me becoming a doctor.
So, yeah, I'll be a good kid.
I'll try and become a doctor.
Then I kind of discovered photography.
And I got really, really into that in high school.
And I got so excited about that that my plans for kind of going to, say, kind of Oxbridge or something basically fell by the wayside.
And I got really, really into studying things like media and film.
And I went from there to basically study, yeah, photography, filmmaking, video production, stuff like that, playing with these things.
And I'm showing my age when I say this now.
But I was this is around the turn of the century.
We were just starting to kind of start playing with things like Final Cut Pro and digital video.
Because when I was studying this, we were literally, you know, like cut and paste.
Yes.
I ran it with cut.
We were, when we were making films, we were using like hand winding films, a kind of Bolex camera.
We literally had to kind of cut film and paste it to make films.
That is a really, really hard way to edit video together, right?
I mean, now it's like splice, splice, splice, digital this, transforms that.
It's crazy.
But that's how it was, right?
Like the world has changed so much in 20, 30 years and it's easy to forget.
Exactly.
So we did this.
And at the time there was this thing which was called New Media, which was other ways of kind of expressing yourself or exploring things.
And through that, there was this kind of interest in this thing called digital.
So I kind of started playing around with things like Dreamweaver or ActionScript or stuff like this.
And I thought, wow, this is kind of cool.
Like because there was a load of really interesting art in this field right now because people were trying to explore the medium and what any of that's actually meant.
What kind of kind of impact it would have socially for us, really.
And on the course I was studying, you are basically given quite a lot of freedom, almost too much freedom.
So when we end up graduating, a lot of us had kind of black and white films about ourselves, which was I didn't find that interesting myself.
But we also had a chance to just like mess around with computers to either explore an idea or I guess like try and build some kind of installation or something, which would help you interrogate an idea that you might have come across in the kind of art culture part.
And we had a kind of media education part of the course I did.
And a large part was about things like, say, media ownership and things like the California ideology.
And there were loads of really wild ideas that came across, which in the turn of the century seemed like bonkers concepts.
There was this idea called surveillance, like the way we might kind of relate to computers.
Like you had kind of cultural commentators and artists talking about imagine what it's going to be like when everyone has computers and everyone can film everything.
Right.
Yeah.
And now here we are with our cell phones, right?
Like it's here.
Yeah.
Like the thing.
So I got into this idea.
And one of the things I started working, I really got interested in was this idea by this theorist called Jamekassio.
I think I pronounced his name properly.
He spoke about this idea of the participatory panopticon.
Like when we all have cameras, there will be no real concept of privacy and will forever be kind of recording things and sharing things.
And there was this kind of idea that rather than having kind of big brother, there was millions of little brothers.
And that has all kinds of ramifications on how like how we relate to each other.
So I built I ended up working with a friend of mine because I couldn't really code at this point.
I was just like some I don't know, some art student, really.
And I lived in a part of town which was kind of rough because I didn't know how hard it would be.
I thought, well, maybe we can like get a Linux box, find a way to run it in the car, run it off a like 15 pound webcam, connect to some GPS and some Wi-Fi, run this all off the cigarette lighter of the car and build something like a kind of panopticon thing for ourselves to see how that might change how we think about it.
Yeah. And because we had this whole notion of because on the course, there was all this conversation about, say, the kind of Californian ideology and Silicon Valley in this way that in many cases, lots of companies present themselves as changing the world.
We figured, well, maybe we can kind of dress up in some of that language to explore this as an idea.
So rather than make a film, I figured, let's try to create some kind of intervention using open source software and a kind of cultural, I guess, thing.
So I basically built this thing with a friend of mine or more specifically, my friend did all the coding whilst I was learning how to kind of code and kind of do some of this and work out what a ring buffer was and everything.
And we built a thing which basically was a giant red button on a dashboard hooked up to a webcam that ran a ring buff in front of you.
And what would happen is when you're driving around, if someone cuts you up, rather than screaming at them, because who knows, they might be carrying a knife or a gun or something, you'd pull over and you just hit this button like,
Oh, God damn it. Why can't they drive properly? And that would catch where and how that person almost hit you with the idea being that when you drive home, when you're on the Wi-Fi, you'd upload this video to like YouTube or somewhere.
And the great thing about this is that, well, cars have really handy foreign keys called number plates.
And if you can then expose a feed of this, you could create some kind of business model around this.
So we kind of, as a kind of, I don't know, artsy statement, accidentally ended up building dashcams.
All right.
Right. Yeah, exactly.
Yeah. So we figured, wouldn't it be weird if people had something like this?
Wouldn't that be like, end up with all these strange implications?
Because we kind of designed a business model as an art project around, well, if you provide this information, then maybe the thing that you might get, you might get an incentive to basically film everyone else doing this if you got cheaper insurance premiums.
And because like insurance companies don't need to disclose how they price you, you could have this idea where you could present the idea that you're pricing people off the roads for bad driving, but instead create this kind of horrifying dystopian hellscape where everyone's continually filming each other.
And that seemed more interesting than making a film.
That's a pretty interesting social experiment.
Yeah.
Where'd it go?
Yeah.
So, well, we, so there's the other thing.
There is an idea called, if you look at work with IP, like intellectual property, there's a phrase called prior arts.
And we thought, oh my God, this is, this is, this is horrifying what we're building.
Well, now we've explored this, the implications are terrifying.
So we figured, well, one thing we can do is let's take this prior art idea quite literally and like put it in a gallery.
So it's literally prior art.
And if you do it that way, then you cannot patent it because it's kind of toxic and no one can make any money off it.
And like, of course we were naive students.
All right.
So like, I'm pretty sure large companies have found ways to make money out of data now.
But this was an idea like, yeah, as if anyone would really do that.
Right.
And that was kind of my first exposure into coding.
And that was, that was actually Ruby initially with little bits of C and stuff.
But I found the two of them quite difficult.
And especially back then.
And then when I graduated, I was looking for something similarly interesting and out there.
And I couldn't find much, but the person who I built that with, I mean, he only built this because he was doing a cognitive science course.
And he thought some of the ideas, some of my ideas were kind of funny.
We ended up setting up a company where we figured we're only going to work on open source, nice things.
And we ended up working in a co-working space and find ourselves working on bits of Django or doing some kind of Internet of Things related stuff.
And I think I've just shared a link to some of the earliest code I've ever contributed to.
And like my first Python as a person who could barely write HTML was diving straight into Twisted.
And oh, I'm not sure that was the first code I should have written, right?
Yeah, that's definitely mind bending that async stuff.
Well, look, if you can start out by building, like recreating dash cams in the software and hardware side,
and then you can go contribute or work on code that's for Twisted, I think you'll be all right.
Well, that was actually a kind of interesting project.
That project, the Twisted stuff, there's a story around that, actually.
So what we were doing, we're in this co-working space.
And we were thinking, well, wouldn't it be cool if you could help people understand that there is an environmental impact to how we use buildings?
And maybe if you can do something what we might call now, like flexible pricing around co-working space to kind of incentivize people to use it when it's not so much.
So think of it like, I don't know, load balancing or demand shifting, but with people rather than like servers.
So we ended up working on some things to basically work out the carbon footprint per person per hour of space by inferring presence on Wi-Fi,
but looking at it by tracking the MAC addresses in a co-working space.
Because we could pretty much figure it out that if there is maybe, if every single person has a phone and a laptop,
if you can count the laptops and the phones and you can more or less associate them with each other,
then you get a rough idea of occupancy and usage of spaces here.
And if you know how much energy you're using, you can work that out as well.
Right. And mostly that's probably heating, cooling, that kind of stuff, not people plugging in their laptops.
So if there's one person versus 10 people, it costs almost 10 times as much for that one person in terms of energy.
Absolutely. Right.
So this was one thing you could do.
So if you can encourage people to kind of scrunch together to use that space more efficiently,
then you've got a much more efficient use of that space per person.
And if you think in terms of not buildings, but providing working space, again, which is kind of what you see now,
there are so many kind of lucrative businesses that I've failed to kind of take forward.
You were really early at a lot of these things, right?
Yeah, we ended up doing a lot of stuff like that.
And that was my exposure to messing around with like Python and Twisted because we said,
oh, yeah, we could do that because we figured you're just reading RFID cards, right?
And then my friend Fred Fix, who now lives in Berlin and as a CTO of some of the same companies we were working on part time with that,
we basically had to find a way to make these things speak to some parts of a building to trigger some actuators for sliding doors to work.
And in order to do that, we figured, well, we use Twisted and we need a server to make a door work.
So the link I've shared is door D because it's like a demon for a door.
Oh, nice.
Yeah.
And we had like all these ideas to look to this because the space we're in, they had like an open LDAP installation for the members.
So we, at one point, we kind of hooked this up so that when you walked in or tapped to RFID card,
because you could make that speak to the speakers, you could have like your theme song walk in, right?
Or you could have like loads of silly ideas like that.
Because if you could, yeah, I mean, it's, if you can think of an entire building as like a gigantic Linux box,
then there's kind of fun things you can do.
Yeah, that's really clever.
I like it.
Yeah.
We also realized there's loads of silly things you can do as well.
I mean, I learned firsthand that, so we, yeah, in 2000, I think seven,
I've realized that if you put a door on the internet and you expose an IP address for anyone to use, right?
Then we ended up with scenarios where you had like loads of hacking attempts from China trying to kind of like pwn the door because they just saw it as an IP address.
And we ended up having quite a few phone calls like, Chris, yeah, the door's going a bit weird again.
Can you fix that, please?
Yeah.
The door's got a DDoS attack on it.
What are we going to do?
Yeah, yeah, yeah, yeah.
Like, I'm sure there's a joke about doors and DD doors or something there, right?
But yeah, the DDoS door.
But anyway, there was something like, but we also, when we were working with this,
I realized that there's a reason hardware is called hardware.
And I decided to make, okay, let's work with software a bit more.
And then I started working with Django a bit on a couple of other projects.
And I found Django really, really nice as a framework to work with because it was really well documented.
And I found the community quite friendly.
And yeah, that's probably how I got into programming was kind of artsy student trying to implement things,
realizing that I didn't know what I was doing.
And then realized I had to actually run some of this myself and had to learn how to use servers and stuff.
So I have a bit of a patchy background.
And only in like 2016 did I really start reading about data structures.
And like, oh, God, this would have been so much easier if I didn't know this 10 years ago.
Exactly.
This would have totally, we created this.
Why did I create this?
It just existed.
Yeah.
Man, what a cool series of sort of getting into it, getting into programming experiences.
Those are great.
So what are you doing now?
At the moment, I am splitting my time working with one group called the Green Web Foundation,
where I am currently helping them in kind of rebuild chunks of their stuff in Django and
splitting my time working with a group called climateaction.tech.
And generally working as a kind of consultant, product manager consultant, I've still got where
groups will basically work with me and hire me to help them think through their process.
But I've still got a few old Django clients who I've been looking after and still work
with them every now and again.
So I do a kind of bit of a mixed grab bag of all this stuff.
But increasingly, I find myself doing a lot more work with tech and climate, specifically
speaking to techies who have said, hey, I want to do something more responsible with my
skills, or we're building a project and we figured out that we're using electricity to
run computers.
And maybe we should think about that part there.
Or I'm planning to set up some kind of practice around how we build digital projects.
And we want to be a bit more responsible about the unintended consequences that we might have
when working on that.
So I do a bunch of these things.
And I've started writing about this stuff in a newsletter called Greening Digital, because,
well, greening how we do digital.
It seemed like a relatively straightforward thing.
So that's what I do.
And so, yeah, basically, bits of coding and evangelism stuff with the Green Web Foundation
and a grab bag of mixed stuff, which tends to be Python in many cases, because it's what's
become the language I'm most comfortable working in.
And it's useful because it's the second most popular language in the world now.
So the chances are that things have been implemented by someone who's thought about it longer than
you have.
Absolutely.
There's so many different libraries you can grab.
Those are a bunch of cool projects and organizations.
So the Green Web Foundation idea is one day the internet will run entirely on renewable energy,
and they develop tools to help speed that up, right?
So you're helping them with that.
And then the Climate Action is a global community of tech professionals using their expertise to
support solutions for climate change.
Yeah, that's pretty much it.
Nice.
You'll have to give me the link to your newsletter so I can put it in the show so people can
subscribe to it.
Yeah, absolutely.
This portion of Talk Python to Me is brought to you by Brilliant.org.
It's early 2020, and many of us have made New Year's resolutions.
The best resolution you can keep is investing in your STEM skills.
Whether you're a student, a professional brushing up on cutting-edge topics, or someone who just
wants to understand the world better, Brilliant.org makes it easy with interactive explorations
and a mobile app that you can use on the go.
If you're naturally curious, want to build out your problem-solving skills, or need to
develop confidence in your analytical abilities, then get Brilliant Premium to learn something
new every day.
Brilliant's thought-provoking math, science, and computer science content helps guide your
mastery by taking complex concepts and breaking them into bite-sized, understandable chunks.
Get started by visiting talkpython.fm/brilliant, or just click the link in your podcast player.
Let's talk about climate change at the high level just before we dive into how can we write
code that alleviates that pressure and maybe is a better citizen of the world, digitally speaking,
and also the real effects that it actually has.
And you talked about all this using energy, in particular electricity, right?
Servers running electricity, MacBooks running electricity.
There's a lot of negative news here, but one of the things that I see as a real sliver of hope,
let's put it like that, in terms of this part of the slice, is electricity is awesome because
it often does come from nasty sources like burning coal, but it can come from solar panels.
It can come from wind.
It can come from, right?
It can come from renewable places.
So it's like, you don't have to change anything.
You don't have to change anything at all to completely turn all that stuff to renewable
foundations.
You just need to change the generation of it, right?
Yes.
If it was like airplanes are a serious problem, right?
Or cars, we're working on electric cars.
We're getting there.
But it's diesel trucks.
It's super hard to just say, well, all you got to do is plug it into a different source.
Like, no, diesel comes from a place where it's really hard to make that carbon neutral or
renewable, right?
So in some sense, the story around tech climate is kind of positive in that regard,
I think.
What do you do?
Yeah.
I'm really, really glad you started and started framing it this way, because I think it's really
important for us to realize that a lot of the things that we know and love, like the
internet, for example, it doesn't need to be running on fossil fuels.
And what you spoke about before was the issue is, in many cases, it's our use of fossil fuels
and where we get energy from, not necessarily some of the kind of life choices we make.
Like, yes, there is obviously going to be consequences of burning huge amounts of fossils if we, say,
if we're flying across the Atlantic every second week, for example.
But if there is a way to basically do that without the CO2 emissions from burning fossil
fuels, and increasingly, we are seeing options to make that possible, then I think it's actually
that suggests to us that there's actually a kind of more positive future that we can have
available to us.
And when you, I don't know about you folks, but I don't remember the internet changing or
my experience of Google changing when they switched to green power or when Facebook switched
to running on renewable power.
It's not like the internet started juddering to a halt and it started working different.
It used to be really fast, but now it's kind of clunky.
It doesn't quite burn as well or whatever.
No, it's not a steam engine, right?
It's electricity.
Beautiful.
Yeah, this is the thing.
I mean, this is actually, when we zoom out outside of technology, you'll see that there's
a whole conversation around how do we address some of the wider scales?
And there is this phrase kind of electrification.
Like, we need to electrify a lot of the sources of energy that we use because a lot of it comes
down to our use of energy, not fossil fuels.
But we have, in many cases, kind of grown up with this idea that the only way you can
get energy is from fossil fuels.
And even when it comes to something like aviation, there are actually ways where you can use, say,
excess electricity to create the kind of chemical energy in a way that you could use for, say,
something which needs a high amount of energy density, like, say, flying or trucks or something
like that.
The only problem is we often, or for the last 40 or 100 years or so, we've been not really
accounting for all the costs of getting fossil fuels out of the ground and put them into the sky.
And as a result, we default to basically drilling for fossil fuels when there are other better ways
of experiencing a lot of the same upsides without the unintended consequences that end up causing
avoidable harm.
Yeah, I totally agree. This whole externality thing is frustrating, for sure. You know, Elon Musk,
as much as he does crazy stuff and is kind of weird in some ways, I'm a fan of how he's pushing some of
these ideas forward around like electric cars and so on and solar panels. He came out and said, look,
if we just took some part of the Southwest United States, like Arizona or something, I think maybe he
said Nevada, he said, Nevada, and just took 100 square miles and just covered it in solar panels, that's enough
energy for the entire United States. He also threw in, I don't know, like a five mile square battery or something
ridiculous to carry us through the night. But, you know, I only know that in terms of the US energy, but that's a huge
amount of energy used by the world. It doesn't seem like we as collective citizens of the world are incapable of
generating that much renewable energy. It just seems like a matter of will, almost, because surely we could
create enough solar panels to cover 100 square miles. Like we paved the earth constantly, right? And that's
way more work or, you know, whatever, right? I mean, it just seems like there are these steps that we could
take that would not be, they're not science fiction. We've got to like create a Dyson sphere around the
whole universe or hold the solar system and channel it back. No, it's just like, it's pretty attainable.
So I think this is one of the things that I find both frustrating and inspiring when we have these
conversations, because you've mentioned Elon Musk, and it's very easy for us to immediately kind of
reach for the closest figure to Ironman that we can think of. Yeah, exactly. And like when I grew up
totally like, yeah, he's like Ironman, but his stuff is open source. This is awesome, right? Like we think
about this, but it's also, and when you look at things like the effect, the impact that say, well, just
the kind of like mindset that people think about when it comes to things like EVs and making that
reality, that's really, really, really good. But you've touched on a few really, really important
and interesting things. You need to be able to look things that are kind of more systemic level.
Like there's a reason why you have these things. And in many cases, it's not down to us not having
the technology because we do have the technology. Like right now in 2019, we have seen the cost of
batteries fall by something like, I think more than 85% or around 85% since 2010. And we've seen an even
steeper fall when it comes to solar panels. So it's not like these things are, and to the extent
now that in many cases, deploying new solar is cheaper than continuing to run coal or continuing
to run gas-fired power stations and things like that now. And in Europe, for example, which is where I'm
from and where I'm most familiar, more than half of the coal-fired power stations that we have now are
running at a loss simply because people have started pricing into taking, you know, more accurately pricing
the unintended consequences of coal as well.
Even in the US where the current administration is doing everything they can to prop up coal,
there's still tons, like many, many large coal plants shutting down for the same reason you're
talking about. And you're going to talk about the UK.
Yeah. Yeah. I was going to talk about the UK because the UK and the US are, so the UK has been one of the
fastest countries in Europe to decarbonize its energy, its electricity to the point now that I think
recently we've got around 40% of the grid being powered by renewables.
The often, and this is a, in many cases, this is because essentially it's become so expensive to
run fossil fuels. And you've seen that and you're seeing a similar thing in America. America's emissions
or like a, you know, for every kind of unit of electricity is actually falling quite, it has been
falling pretty quickly. If we just looked at the kind of economics, it would probably be falling even
faster. But in many cases, you have cases where basically there is a, you don't have that, you
have political support to kind of slow down a transition away from a dirty, harmful fuel, which
employs, I think there are more hairdressers than coal miners in America now. Right. So we have these
ridiculous kinds of figures, you know, propping up these industries at the expense of, you know,
hundreds of that millions of jobs in other industries here. And I kind of think that we need
to like, when we spoke about Elon Musk here, right, I think there's a degree that yes, it's really cool
that we have electronic cars, but we also got to think about, well, if we are going to be doing,
if we're going to give someone all the props for that, and basically kind of seeing them like some
kind of Ironman, but open source kind of hero, hero figure, then I think it's fair for us to expect
them to be a bit consistent about how they, about who they support politically, and who they,
and who they fund. And if they're going to be funding groups, which basically slow down climate action,
then I think we need to be prepared to say, hey, it's cool that you're building electric cars,
but can you not do the thing which stops us moving away from fossil fuels? Yeah, because I think it's
we're adults, and we need to be able to have these complex thoughts on our minds. And we also need to be brave
enough to actually address the scale of the situation, because there a lot of it is really,
really freaking scary. But we are capable of addressing this and facing this, if we as long as we actually
just are basically a bit more rational about it in many cases.
Yeah, absolutely. Absolutely. I totally agree. And it's really interesting how it's not really a
technology problem, right? It's a technology challenge, but it's not like it's incapable.
It's not like we have to envision, we have to invent vision or something like that, right?
Now, I guess let's just round out this really, this sort of high level view just by pointing out that I
think yesterday, it was yesterday that Greta Thunberg, the young girl from, is she from Sweden?
One of the Nordic countries.
Yes, one of the Nordics, yeah.
Like climate activists. She was voted or made the time person of the year, which is pretty
interesting. So that I think kind of speaks to a little bit of, you know, people are starting to
pay attention.
Absolutely. I am. She's so, so cool. I'm so, so pleased. And I find this, this child inspiring.
I think we need to be able to be prepared to be able to say, yeah, the actions of these people,
and them having that kind of moral clarity and consistency, I think is really, really inspiring
for the rest of us. And like, we don't all need to be Greta, but I think there are the things she
asks us to do, but basically, Hey, I'm a kid adults. Can you pay attention to the science and do something
with this and basically act like adults? I think that's something that we can respond to. And I
think that speaks to a part of us, which I feel that we, you know, if we look inside ourselves,
we can answer and work in a kind of responsible kind of authentic way. So yeah, it's really,
nice to see that. And I, and I think that we need people like that to be reminding us of what
our responsibilities are as adults are really.
Yeah, absolutely. So let's bring this back to software, right? That's why we're here talking
about this because as software developers or people that use computing in significant ways,
there's actually a lot of concrete stuff that we can do. And code runs everywhere. Code runs on our
phones, code runs on our laptops, but a lot of code, more than people realize, I think runs on data
centers. And so there's an interesting stat that I got from Forbes. I think this is, yeah,
this is only for the U S but the U S data centers use 90 billion kilowatt hours of electricity a year,
which is roughly equivalent to 34 giant coal powered plants. And I think this is 3% of all
either energy or electricity consumption in the United States. Yeah. Total electricity, 3%.
Okay. So these numbers actually feel, is this maybe low? no, these numbers are actually,
yeah, there are, I mean, I was, so this is, you, you get a number of different estimates for this
ranging from like 200 gigawatts, which I think is a billion kilowatts, a hundred gig in a gigawatts,
or 200 gigawatts. It kind of ranges. The estimates vary depending on who you look at.
Right. Does the data center inside a company count or maybe only public data centers or what do they
count? Right. It could really vary who they're counting there. Yeah. So it's kind of mind blowing,
right? I was at, in my role as someone working with the Greenberg foundation, I ended up at this
event, which, was organized, a workshop organized by the European commission on how they're going to do
green public procurement. Because in Europe, they spend something in the region of 45 billion euros each
year on technology and, they want to do that in a more, in a fashion, which is more in line with
the science. And when in line with the fact that they have basically declared a climate emergency as
like the, the block of Europe. So the, because they too have realized that the internet runs on
electricity and servers run electricity, they want to work out how to do this. And even inside that,
when you've got people from Amazon, Google, Microsoft, all of these places, they are still trying to
like saying, Oh, we need a definition of cloud that we can use across this. We need a definition of
what data centers are. And it's kind of bonkers that you do have, you have this ambiguity. And
when you see these numbers, lots of the studies, they will have often use slightly different definitions
of the same thing. Like, does it include Bitcoin mining? Does it not? Is that a data center? Is it
not a data center? Because that kind of power profile is different to how you might use something else.
So it's a long story short is basically these numbers you've shared are, they're not wildly out.
And, the figures that people tend to use for data centers and like the internet in general,
or like a kind of tech is between 2% and 4% of, well, between one and 4% of all CO2 emissions.
So that's in the same ballpark figure as all of shipping or all of aviation.
Yeah, exactly. All flying is like 2.5 or something like that. Yeah.
Yeah. Or Germany. So like, these are like significant numbers and just for like a streaming
video, for example, the figures we see from a recent report by the shift project, they say, well,
all streaming video, that's about the same carbon footprint as Spain, like the country of Spain.
Yeah. And it's cats. It's like viral videos, right? No, of course not all of it.
Actually, I know. it's crazy. I like a quarter of that is porn. All right. So a quarter of Spain is
porn, right? And it's just, yeah, you like the numbers are mind blowing when you look at this,
because we tend not to really be thinking about this kind of stuff because we are so
cause program, because we've done such a good job of abstracting the eventual kind of
implementation details of whatever it is that we're doing that we're not aware of this stuff.
One of the feelings that I have that is like a realization that blows my mind is I can go sit
in a coffee shop or somewhere with my MacBook and I have a pretty high end MacBook, but even if it was
like just a MacBook air, right, I could sit there and I could write my code. I have a little database
server running and get the web app working and whatnot. And then I push a button and
and it goes out and runs on incredible high end servers and massive data centers with like
its own database server and you know, the web front end. And, and it's just like,
it's almost like a disconnect for me that I can work on these little tiny devices and I push a
button and then it's like this great big thing. And of course, I mean, it could scale huge, right?
Like I could, I could scale that out to a hundred servers that for some reason that was a thing.
And it's really easy to disconnect that from your mind to like, I'm actually running a hundred
desktop type things when I just push, push deploy, right?
Oh yeah, you're right. And like, this is, but it's, it's worth being worth being aware that in
many cases that when you put something into the cloud, for example, like over the last say few
years, like at least five years, actual energy usage that was reported by the IEA, the international
energy agency, they've generally said that emissions have been like, so energy use has roughly been
pretty stable in America, at least largely because this has been this massive growth or move from lots and
not sort of relatively inefficient data centers to the cloud, but cloud is massively more efficient.
Right. You have a virtual machine and it's, it's sharing that CPU and that hardware with many other
virtual machines, rather than having a hardware device in my own company's data center.
This portion of Talk Python to Me is brought to you by Datadog. Datadog is a monitoring and analytics
platform that unifies metrics, logs, and distributed traces from your Python applications. Datadog's
tracing client auto instruments, popular frameworks and libraries such as Django, Flask, PostgreSQL,
and AsyncIO. So you can quickly get deep visibility into your applications. Trace requests across
service boundaries, correlate traces with logs and metrics, and plot your application architecture with
the service map. Get started today. Sign up for a free trial at talkpython.fm/Datadog. And Datadog
will send you a free t-shirt.
There is also a flip side to this. And there's a guy and so there's a gentleman called William
Stanley Jevons. 200 years ago, he observed the same impact that we see now when he was looking at how
steam engines were becoming more and more efficient. They were like every individual new generation of
steam engine uses much less coal for the same amount of work. So that's going to result in a kind of fall
in coal usage by the industry. Right. And it turned out not to be the case. It turned out to be the,
it was called William, the Jevons paradox is the phrase. We might also call it the rebound effect
in some cases where as you make something more efficient, you end up seeing more use of it.
So the total amount grows even higher. If you want to sound really posh, you can call it the
Kazum Brooks postulate. And that's one for Wikipedia, right? And that sounds really, really posh. But
basically, as things get more efficient, we end up using them more, which can often result in greater
emissions. If we do not find a way to decouple the emissions, basically, there's a line and
you need to, there's a degree at which it ends up with more emissions or not emissions.
And this is kind of why tech in many cases is being presented as one of the kind of wonderful
hopes of the future. Because if we could only find a way to make better use of the tools we have,
often through technology, then there's a chance that we could kind of steer this economy away from
the iceberg and into something more like, I don't know, Star Trek than Mad Max, I suppose.
Yeah, let's definitely stay away from Mad Max. Now, you've given a couple of presentations on this,
and I'll link to those in the show notes. You've got the slides up, and those are really helpful
with cool pictures. One company that you called out that I use for credit card, when people buy
courses on my platform, it goes through Stripe. The company you called out is Stripe for being a good
citizen on how they report and account for their emissions. Can you talk to that real quick?
Yes. I'm wary about kind of diving too deeply into this. And it's probably useful to have the slide
that we are going to refer to. But if an organization is going to talk about carbon,
or talk about being kind of environmentally responsible, if they're not really talking
about scoped emissions, then they're kind of doing it wrong. All right. Because this is generally
considered the sensible way to talk about it. And you have three main kinds of scopes, which are
generally kind of considered ways to account for emissions from different things you do. So scope one might be
emissions from you burning fossil fuels yourself. I've burned 100 gallons of gas. So that's my
carbon footprint. Yeah. Yeah. The example I use in talks is coffee, because lots of us like coffee.
So if you burn gas to heat up a kettle to make coffee, that's like scope one emissions, right?
Scope two is emissions from electricity that you use. So that might be someone else miles away burning
coal so that you can use a kettle to heat up some water to make coffee. All right. So companies like,
Amazon and Google, who tend to use a lot of electricity, they're going to have very,
very high scope two emissions in most cases.
Right. Because some is lost on the wire, there's some inefficiencies at the plant,
all that kind of stuff, right?
Yeah, absolutely. And that kind of speaks to the fact that a lot of us don't tend to,
like we don't physically burn coal ourselves to power a computer, but someone's burning it
somewhere in our behalf, right? So in many cases, that might be kind of those large companies scope
two emissions. And we wouldn't really have very high scope one emissions ourselves in many cases.
But scope three is the kind of biggest source of emissions for most of us. And the slide that I
think you're referring to shows Stripe having quite low scope one and scope two, which makes sense,
because they are large, large customers of kind of cloud giants. So therefore, scope three is basically,
the example I use is imagine you're walking into Starbucks and paying for coffee. So someone somewhere
has burned fossil fuels to generate the heat to make that coffee or to make sure you're in a nice,
warm space. So it's kind of in your supply chain, really, that needs to exist for you to make coffee.
And for most of us, our emissions are going to be in scope three, because we are mostly purchasing
services and selling services to other people, if we're developers rather than, I don't know,
miners ourselves, you know?
Right, right. There's a lot of knock on effects out in three, right? Like,
we've got to fund the military who sends a bunch of people to some unstable place. And
how much carbon do they spend to just ensure political stability so that then the oil company
can send, you know, a bunch of machines over there to mine it up and ship it? Like, there's a lot of
stuff happening that's not just the carbon captured in that, you know, bit of oil.
Yes.
We should think about this for basically our code as well, is what you're saying.
Yeah.
As developers, I think the concept that we have a dependency chain to the stuff we do
shouldn't be an alien one. Like, we're continually using dependencies from lots of other people.
And this is how people in the kind of climate world think about dependency chains, really.
Because this is something that we're used to using anyway. Like, if we have a requirements.text file,
then there's something happening there that we're aware of. So intuitively, it should be
something that we can kind of internalize as a concept, really. It's just that we tend not to
quantify this.
Yeah. I mean, that was sort of what my example of the coffee shop push was. It's kind of like,
it's so easy to, like, it stops here. You know what I mean? But it really, that's just the beginning.
To be concrete, you have some interesting mental models that you talk about that help bring this and
think about it and some tools we're going to talk about and some steps. So you have platform,
which is the infrastructure that you run, right? This is, I guess, the cloud directly,
a lot of times. Packets, which is the stuff that flows between you and your other services or
people who are considering them. And then process about how your organization works, which is maybe
a little more tangential to that. So let's start a platform.
Yeah. Okay. So I've tried to take this concept of scopes and find some kind of comparison for
what you might do as a developer or as a kind of tech professional, because it feels like speaking
about scopes is often quite abstract for a lot of us. And it kind of makes sense to
talk about things we would use ourselves. So I talk about packets, because in many cases,
a lot of us, that might be infrastructure that you might use yourself or the servers that you run.
And when you have something like that, you've got kind of like levers. So one lever might be how you
provision the infrastructure that you use to kind of meet demand. And, you know, we could go back to
examples where you used to kind of physically provision servers in a rack. And then you just hope that
you and your provision for the most possible load, because it's going to be really hard to scale that up.
Right. Right. Especially if you have to buy machines. And like you said, put them in a rack.
If on Fridays, you have to handle 100 concurrent requests, but most times it's 10, you buy machines
for 120 and you run them all the time.
Yeah, exactly.
Probably.
Yeah. And most of the time that results in you, because computers don't scale all the way down,
you're basically burning loads of money. But it turns out that because computers use fossil fuels,
a lot of the time they're burning lots of fossil fuels. There are unintended consequences to that,
which result in lots and lots of CO2 emissions. And yeah, you have that. And as we've got better
at provisioning, or if you are a kind of developer, the way you might provision might have an impact.
So rather than having a giant, giant physical server, one thing you might do instead is have
some kind of scaling thing or working with VMs or dockers or whatever thing that makes it possible
to kind of scale that way. That's one way.
Yeah.
Like Kubernetes is pretty easy for them.
It also seems to me, I would like to hear your thoughts on this, that if you're purchasing
VMs in the cloud, I know there's other stuff like serverless and so on that kind of does this
automatically. But if you're say purchasing, I guess even Docker, but if you're purchasing say servers
and virtual machines, you can buy them or provision them with dedicated CPUs so that you're guaranteed
to have that CPU core available for you, or you can do it with shared. And I feel a little bit like
if you go and buy the dedicated server, fully dedicated CPU machine, you're kind of locking
out that thing to run all the time, right? Because you've got 12 cores, only 12 people can buy
dedicated machines on that and that's it. Whereas if you're in the more floating kind, you might
suffer a little bit in performance, but it's definitely going to scale down massively when
it's not busy because it's going to be able to share that with other VMs. What do you think?
It's a bit like, okay, let's just use the example of cars, right? I could buy, if I run a business,
I could have like 12 cars, yeah? Or I could like pay for a taxi service to scale up, to scale the
amount of things I'm using at any one point, right? Yes, you having to purchase exclusive use of
something will do that. And in many cases, we will make that decision. But in many cases, we, there's
going to be, there'll be trade-offs that we make and there'll be consequences of us doing that kind
of stuff. And it's very difficult to really kind of give specific guidance on this because it's going
to rely so much on context. And this is why I think in many cases, we kind of need to be able
to understand the full cost of what we do and understand that and be able to make those judgments
in an informed way. Because in many cases, there is an argument for using something like say serverless,
where the kind of economics and the incentives are aligned much, much better.
Right. Serverless, it doesn't even run at all if it's idle, right? It only processes the demand.
Yes. So that's good in some ways. I mean, to be honest, the amount of the kind of energy savings
that come from that, it's quite difficult to really quantify because most of the large organizations that
do provide this tend not to be prepared to share these numbers. And if there are groups who can
share these numbers, it would be fantastic for the good of science because even the professors say,
we don't know either. Like no one knows right now. And it's very difficult.
It's all these giant corporate places that data serve, the whole data center infrastructure.
That's a huge area of competitive advantage. They're making their own hardware. They're doing
all sorts of crazy stuff around cooling and energy. I mean, they don't want to share that. Why would
they want to share that?
Yeah. And like you see this now, even when, absolutely. And even down to just like how long
you hold on to servers in the first place. Like you might assume that in many cases, you, you know,
we might hold, we might assume a server, which takes a lot of energy to turn into a server.
Cause remember like chips are sand initially, right? Like there's a lot of energy from turning
sand into a server or the chips right there. Like we don't really think about it until it's not
something we have to face, but yeah, there's going to be a member because if energy is coming from fossil
fuels and it doesn't need to, but often does, then that's where there's going to be lots of emissions.
If you have a server, which only lasts, if people are swapping out servers every year versus every
three years, that's going to have an impact on the calculations that you actually might have.
So yes, you're, you're absolutely right there.
So one question I have about serverless, like on the face value, it seems obviously that's
going to be better than VMs. Let's say the shared kind, right? I mean, the dedicated ones clearly
are just constantly running, but it also seems to me like each individual requests might take a lot
more energy because it's got to maybe start up some kind of Docker. It's not just running a few lines
of code and already running process. It's every one of those is kind of a fresh go at a new environment.
So even though you can scale infinitely, cause you could hit a hundred thousand servers.
You hit that hard enough, right? But that may per request cost more. There's just like an
interesting trade-off that I was thinking about as we were talking about this.
Yeah. I mean, this is exactly what you see with servers anyway, right? Like we know that if you,
if you're going to buy a physical server, then I mean, when, when Amazon, when various,
when kind of cloud computing products came out in the first place, you know, people say,
Hey, that, why, why would I spend money on cloud when I can buy a server to give me those,
the same resources over a longer period for less money? Like you're paying for the flexibility and
you're paying for the fact that you don't have a giant great server to kind of decommission at the
end of three or five years or something. So in most cases, there will be a higher per request trade-off,
but with the idea being that you're not, you pay slightly more per request for the flexibility
and the efficiency at kind of systemic level, I suppose. But once again, who knows for sure?
Yeah. Who knows? I would, I would guess that serverless is more efficient in terms of energy
in general, but, but I, I don't really know. All right. So one thing I do want to talk about in this
area is, you have some tools, like at each one of these three levels, you have tools in the
Python toolbox, stuff that you can run or things you can do or libraries you can use. So maybe tell us
about the ones that you have for this and I'll throw in a few that I came up with as well.
Yeah. Okay. So basically any tool that can track the amount of CPU usage you're using can also give
you an idea because energy uses fossil fuels, what the climate impacts of a lot of this stuff will
actually be. You know, there is now a moral argument for basically optimizing your code
because, so like that is good news for developers who like performance, right?
Right. You already want fast code now because it means you can, obviously users want it because
faster software feels better and more professional. You want it because it's fewer machines to manage.
it costs less. The data centers want it. And then of course that's all lined up with CO2 emissions.
You found this thing called energy dash usage, which is an NPM tool, right? You can run.
This is actually from, this is a Python.
Oh, Python. Okay. Uh-huh. Oh, it's another one down later. That's NPM, right?
Yeah. So this was designed specifically to address the, I think it was designed as a response to
basically revelations amongst people who are working in technology, working with say AI that, the
kind of, you know, we speak about Moore's law, like it doubles every 18 months, right? So that is,
you know, you know, we see some kind of changing impacts there. I think a year and a half ago,
a paper was released with, showing that the kind of average amount of compute used to achieve
various kinds of goals or breakthroughs with, with AI is doubling every three and a half months.
Right. And, over, I think over a two year period, please don't, I'll share the link
specifically, but because of this, this doubling feature is, it basically results in massively more
energy use. So the point that like something like that might double seven times in the set period,
if you're looking at a three and a half month doubling period compared to 18 months,
it's like 200 X, 200,000 X versus seven X. So you're seeing like a big increase. And, this
was generated. This Python module is basically a tool to allow you to kind of profile some code.
It'll give you an idea of the emissions associated, the energy usage for that by kind of reading some of
the energy usage stuff from some, some, some, I think from some Intel processors share this,
and then they converted that to the CO2 per kilowatt hour, for example.
Right. And then it ties it back to where like you're actually located even.
Yeah, absolutely. That's what it does. And this was designed for people working with machine
learning to get an idea of what algorithms are going to have an impact so that you could make
these decisions upfront or be aware of the trade-offs of using one thing over another. Because
as I understand, and I'm not a data scientist, different machine learning tools or approaches
use wildly different amounts of compute. And this was designed as a tool to show you that. And there's
also a whole kind of syllabus tied to this because this was shared by a professor
who I follow on Twitter when I saw it. I've totally forgot her, the woman's name who did
it. And I feel I'm really, really embarrassed for forgetting her name, but she's been sharing
a load of really interesting stuff in this. And this was work from, I think, a group called
Climate Change AI, who invested a bunch of time into this. So yeah, that's one thing that you've
got.
That's really interesting. I'm trying to look up her name as well, but I couldn't find either.
So another thing in this platform part is, like we just mentioned right before, is faster code is more
efficient code, means fewer servers, means smaller servers, and so on. And there's just a bunch of
techniques that you can apply to your code, right? Like if you use a database, make sure you're using
an index. It's not just faster. It uses less energy, right? If it responds in 10 milliseconds versus
a second, that is a whole lot less work it's doing. Not always, but most of the time when your code is
stuck or waiting, it's something in the chain is cranking as hard as it can to get back to you. Maybe if
you're calling a remote service and there's like a 100 millisecond ping time, that's different. But if it's
not far away, the delay is sort of computation time for something, I would suspect.
Yeah. So some of the concrete examples that I think that might be of some use here would be, and you could
kind of like take a leaf out of some of the nodes book, right? When you have things like
async, if you've got a way of working where you're not blocking and you're able to serve another
request, then theoretically you don't need to be running quite so many machines to do the same
amount of work. Absolutely. If you're using the async and await-based frameworks like Sanic or some
of those, yeah. Yeah. So there are some ways that you can, basically anything that tend to improve
performance, because you're generally using fewer resources to achieve the same kind of result,
it makes a lot of sense. So yeah, you already know these techniques in many cases,
if you're working with Python, for example, and some of the things are directly applicable.
Right. And sometimes people don't bother because it's not slow enough. You know, if you have a
pretty busy web page that loads in 100 milliseconds, but the load is not so high, it's still fast enough,
right? You don't need to necessarily optimize it. But if you could get it down to 25,
it would use a quarter of the energy, right? Yeah.
Like, so profile your code and see where it's at. And just, I don't know, just put that as one of the
trade-offs you think about as you build code and care about it.
Yeah. And this is partly, this is a nice kind of takes us back to the kind of platform packets
process thing that I was just talking about before. So I found platform as a useful thing to talk about.
And like, we've been doing some work with an agency. Actually, there's a group called the Panoply.
They're a kind of transformation agency in the UK. And we did some work as the Greenway Foundation to
basically help them think about how they build, do run digital projects and where,
and we started looking at some of their own projects. And we found that like the platform
part was quite a significant chunk from at least one of the projects they're working on. But there
are also other leverage points that they had, like the packets part and the process stuff.
Yeah. Yeah. Let's talk about packets because that's way harder for us to understand how we pull
those levers. I can choose the type of server I get. I write the code that runs.
I could decide serverless or virtual servers, but I can't decide how my packets get from my server in
New York to you over where you are, right? I can't control that part of the world. Or can I?
No. I mean, well, okay. So there's a dream we have. Yeah. There's a dream like, because if you
actually look into the networks, like there seems like BGP, which control how packets get rooted around.
And if you had knowledge about which kind of parts of the internet are run on green power,
then in the wonderful world, in a perfect world, you might have some kind of green BGP
that knows and favors the greener nodes more than the other nodes.
Right. Not just use latency or something like that.
Yeah.
But until this one gets bad, we're going to flow through this part of the world because
this is the best possible path in terms of CO2 to get this from America to Europe or something.
Well, yeah. So there is, I mean, this is one of the reasons we, at the Green Web Foundation,
we've started releasing open data sets in the hope that someone might take this idea and do something
cool with it. Because so we've got like, we're working on a thing called IP2Green, which will
basically, and there's another thing called GreenTrace, where we're basically building trace
route that hops and shows you whether hops are green or not green, based on what the information
that we have available to ourselves to make something of this possible.
But this is like way in the future, because we're quite a small group. And we were at the
kind of wouldn't it be cool if stage at the moment. But if anyone is interested in doing something like
this, I would love to chat about it in more detail. But until then, yeah, you're right, because you
don't have direct control over the internet. And to be honest, for many of us, that's a feature. And I
think as a feature, because, you know, we root around lots of things. And we know you by treating
censorship like damage, for example, it's good. But it means that because you can't control things
directly, you have to control things indirectly. So you might resort to other techniques that we
already have.
Yeah, and there are a bunch. So there's two, let's start with the projects. There's a project from
Google called Lighthouse. And the idea is it measures the effective user oriented performance
of your web application. And I've spoken about Lighthouse a little bit before I came across this.
And I thought, you know, my sites are super fast. If you go into the web logs, and you look at it,
it says it's sending the response out the door in 10, 15 milliseconds. And I thought, well,
how much more can I improve over 10 milliseconds? You know, no one is going to perceive that,
whatever. And I'll throw it in here. Let's just see how it does. I threw it in there. And it said,
your site is average to slow. What is this thing talking about? Like, no, there's no, what is it
doing? And it considers all these different things that the user perceives. And I spent days rebuilding
all my sites. So I can get it up now to almost 100. Sometimes on a good day, I can get it to hit 100
out of 100. But the idea is it has very concrete steps. And it says you should do things like you
should resize this image to exactly the size that's being displayed instead of shipping a huge one and
letting the site, the client do it. You should use gzip on your stuff you're exchanging on your HTML and
your CSS. You should use really proper caching. All of these things are good. And they're all
perceived by the user to be awesome. So if I have, you know, 100k of CSS, maybe not that much, but a lot
of CSS and a lot of JavaScript, if you only request it once, but you hit the site 100 times rather than
over and over and over again, that is a huge amount of traffic you're alleviating, right? So this tool
actually is really good for controlling what you put on the wire. This is one of the levers that you do have.
And what we decided to do was basically fork this. So we took Lighthouse, forked it, made it refer to
say which parts of the websites were green, and we called it Greenhouse. So it's a plugin. So
anywhere that you use Lighthouse, you can use this to get an idea of which parts of your supply chain
or your dependency chain are running on renewable power. And the thing that we're also doing with
this is to convert some of this. We haven't implemented this yet, but we actually have the data out there and
we've been doing it with some consulting clients. So basically, take this and give people rough ideas of the
CO2 emissions from doing this. But absolutely, like basically green websites are usually good
websites because they're fast and they make good use of the resources that we do already have. And
once again, we already know how to do so much of this. And there are clear steps that you can actually
follow. So yeah, it's a this is kind of what we did. And this is what I've spoken about a few places
before. Like you already have a lot of the tooling already to do this. And in many cases, depending on what
you're building, this may be a more effective place to spend your time than say on say the platform part,
depending on how well optimized your website is or what it's for. And this is this is why it's
important for us as professionals to understand the things and know where we would be where we were
going to spend the limited amounts of time that we do have to improve the full interim experience for
like end users.
Right. And it can be incredibly simple things like turning on caching is oh, I just didn't even realize
that we had forgot to turn on caching for these static files or turning on. Yeah.
Another one is optimizing images. And I talked about resizing them to the right size. But there's a
bunch of cool programs. The one I use called image optimum. Yeah, I'll link to it. But basically,
you grab a folder, you can just grab your whole website and throw it on there. And it'll traverse
it hierarchically to find all the images. And it applies about 10 different algorithms. Yeah,
to shrink it and it'll shrink it like 50% without even losing inequality. It's ridiculous.
Yes. So there's a there's a woman called Hannah. Oh, God, I forgot. She's on Twitter as Hannah P.
And I'll share the link to her. She said a really good deck all about this information. And it's
that basically explains all these things. There's loads of tools out there that we can use to have a
measurable improvement in a bunch of in this stuff here. And in many cases, like that, I'm glad you
mentioned the compression thing. Because when Netflix did this, they basically half the bandwidth bill
for a bunch for a bunch of the projects that implemented this because we just forgot to kind
of switch on like compress or GZIP in something on the server. And there's actually some open source
plugins to existing servers that will do a bunch of this stuff for you on the fly. If you look through
the look for the I think Google page speed plugins, you'll see some of this stuff for Apache and for
Nginx. So there's already stuff out there. And there are also services like ordinary that will do this
stuff. But again, it's worth remembering that useful to know where the impact is going to be because
depending on the usage profile of what you do, this might not be the most effective place to
invest your time if you're going to be thinking about, I guess, the kind of climate impacts of the
way we work.
Yeah. It's something as simple as throwing your images into one of these optimizers. That doesn't
take any thought, right? You're not like, well, if I do this, I might break something. You know,
long as the algorithms are lossless, you really don't have to think at all. You just do it. But if
they're served millions of times, that's a big deal.
Yes, absolutely.
Yeah, there's a lot. I guess the point I'm trying to make is there's a lot of low hanging fruit here.
And the tools that you talked about, Lighthouse, which is a plugin for Chrome,
or Google PageSpeed, which I'm linking to in the show notes is the online version. And then the
greenhouse fork of it that you talked about.
Yeah.
So that was the thing that we have. But there's also, but there's other things as well. There's
one called sitespeed.io, which is basically like a Docker container. You can literally,
if you can run Docker, you run Docker and then point a URL at it and it will give you a report of all
this stuff automatically. Like you don't, I've referred to some things from Google, but there are other
tools around there that will help that you can use. And the nice thing that I've seen with
sitespeed that I really like is that they can give you like, it talks to Grafana and Graphite. So you
can kind of start charting and graphing this stuff so you can see changes. And I believe they're
announcing GitHub actions. So every single time you make a change, you can see whether it's going to
be an improvement or a regression on what you had previously.
Yeah. Yeah. Very neat. All right. So there's a lot more stuff we could talk about on the packet
side, but let's just for the sake of time, let's move on to process, which is more about how your
possibly tech company, possibly other company where you do tech stuff works in more general, right?
Yeah. And like, this is actually, this is the one which in many cases is probably some of the biggest
leverage points available to you, but they're often some of the harder ones to actually start because
they often rely on organizational changes because things like, it's going to be stuff like,
okay, how we think about travel or how we, how we work. I mean, when you look at say the report from,
if you look at Apple sustainability report, right, you'll, I mean, I've shared a link to it. There's
a few things that are really interesting. So, because I did in the talk that I gave recently,
or one of the talks that I've been doing recently is just showing like the emissions from
large companies that we know and admire. So Amazon kind of emissions from Amazon are roughly
same size as Finland for 2018, right? The country of Finland has basically the same emissions as
Amazon, according to their report. Google is about the same footprint as Liberia. So a kind of small
country in Africa and Apple's figures were for the Gambia, right? So that's what I think 0.6 million
tons of emissions. If you don't include the hardware, like making of iPhones and stuff like that,
if you include that, it's basically Mongolia. So the country of Mongolia, all of the output is
basically all the iPhones and all the things we have there. But if you look at just the non,
non-electronics part, most of the emissions, like half of that, half of the emissions from Apple is
from business travel. And more than a third comes from employee commuting. Because in many cases,
a lot of, if you look at, you know, Apple's wonderful campus that everyone has to drive to,
you've just embedded. Yes, it's cool that you've got a nice round canvas and stuff. But now if everyone
has to drive there, there's all these emissions associated with it.
And it's right in the middle of greater San Francisco, which is notoriously gridlocked,
right? There's just like tons of driving and whatnot there. You know, I mean, from that perspective,
they could put it somewhere more remote and that would be better because people could live near it.
But of course, they're not in San Francisco or Silicon Valley. I mean, yeah.
Yeah. Like this is the thing. Like in many cases, lots of remote friendly companies,
there's a very strong environmental argument for it. Because in addition to it being...
There's a huge one. Yeah, you're right.
And this is like, I mean, we're basically in the process of like releasing a spreadsheet to kind of
help you work it, understand the emissions at project level. So you and your team can see where
the levers are that you might actually have. Because on some cases, when we've looked at some
projects, we found that, oh, wow, getting rid of the video on the front page had the same impact
of all of our commuting over the last year, for example, depending on the scale of the company,
right? But in some cases, if you're working where there's loads and loads of driving,
because someone has like a two hour commute each way, then one of the most impactful things you can
do on a project might just be, yes, we're gonna do remote working better, because we don't need to
be driving. And it has all kinds of nice side effects. I mean, in many cases, if you think about
how you work, you can have these other kind of what people refer to as co benefits. So remote work will
often make it more accessible to people with kids, for example, or people who might have mobility
problems. There's all these things that we can do, which also end up having things making things a
bit greener, or just things like thinking about how much we do need to fly, for example,
right? Could that meeting be in zoom? Or do I have to fly from New York to London to have it in person,
right? Yeah, Microsoft is a good example of this. They have an internal carbon price on top of their
flights as a disincentive for them doing this. But also they've set up a kind of green cloud advocacy
kind of group now. And also, like this, this was just a few weeks ago, I know, I think it was last
week that it was it became public. But also, one of the people that he was giving a talk at
DevRelCon about kind of low carbon developer relations, like low co DevRel. And one thing he
was looking at doing is he gets the teams to just track the carbon from what they're doing, or if
they're going to fly, make sure they get a good sense of make sure they make the use of that flight
they're going to do make the carbon count, essentially. Yeah, in many cases, it's a there's
a big argument for just getting better at remote work, which is kind of embarrassing that in tech,
so many of us still aren't all that good at it, really. Yeah, yeah, I did for about 10 years,
I did remote work. And then finally, now I have my own company, I just but I work from a little office
in my house. It's quite nice. Once you get used to it, there's a lot of stuff you got to get used to,
right? Like, you don't want to distractions around the house to mess things up. You don't want to
feel like you're stuck in the office, because it's 8pm. But you're thinking about something,
you go work on it. But at the same time, you got to focus and not just watch TV. There's a lot of
challenges, but I think people can pull those off. They're definitely all better than being in traffic.
So yeah, this is one example. So one thing might have been about commuting, but for the model that
we've been using for process, the other thing was basically, we took into account the efficiency of
the building that you're actually in. And in the UK, and across Europe, there is like a directive,
which basically mandates that every single building has to have a kind of energy certificate,
kind of bit like how fridges might have energy ratings on them. So you have graded grades for
most buildings. And in the UK, if you know the kind of zip code or postcode for that building,
you can work out the emission, you can get a figure straight away for the kind of emissions per square
metre. So if you know that most employees have like 10 square metres of space over a year,
then you can quickly work out this stuff. And if someone's working on a year, you can compare that to,
say, the emissions from running service, or using this much electricity, or the emissions from
sending things over the wire, you can get an idea of where the impacts might actually be.
So this is why I talk about process. And I'm just speaking specifically on the project level,
because there's, we can work a bit more widely as well, and think about the other things that
we actually do. But I'm mindful that it would take a more than the single podcast to talk about some of
the wider things.
Yeah, absolutely. So one final thing I do want to talk about is offsetting air travel. Now,
flying is not good. But if you do have to fly, we already talked about having a carbon values,
but it's really a good idea, I think, to at least offset it with something you can do. There's
places that allow you to do that. It's not perfect, but it's better than doing nothing, right?
Yeah.
No, I agree. I agree with you, yeah.
Yeah, but obviously, like, less travel is clearly, clearly better. But I did want to point out that
there are places that you can go that are pretty good. You talked about Atmosphere.de?
Yeah. So this is a German company that only use one of the, and use what are called the kind of
gold certificates for offsets, which are generally considered to be offsets which do not have
unintended harmful consequences. And where they, the projects that are on this are related to at least,
I think it's three, maybe four of the sustainable development goals. These are kind of one of 17
goals, which are generally considered, these are the things we need to be focusing on to make the
world a better place. So that's what these are. Actually, the person I spoke to on a market,
they, the guy, Asim Hussain, who is doing, he was just doing a talk today at DevRelCon about the
different kinds of offsets and what things you have available and what decisions you need to actually
make for that. And yeah, there's one, there's one in the atmosphere as one example. There's the one
in America called Terra Pass. But generally, if you don't have much time and you cannot avoid travel,
it's safer to just go with something like the gold standards. And I've linked to a gentleman who I,
I kind of have a lot of time for a lot of respect for Kenneth Bowles. He is a, he's a consultant and
he does need to travel sometimes. And he's basically said, look, this is my air travel policy. He's got
a personal travel policy, not like company, you know, companies might have sustainability policies.
This is policy on air travel. He says, look, this is what we're going to do. And if I have to travel,
then these are the things I, you need to take into account if you want me to be joining you for
something. And I feel that there are lots of people who could also do the same thing. And like,
you could literally just copy and paste this.
I'm sure he would be happy and not frustrated if you also adopted his policy verbatim, right?
Basically.
Yeah. I mean,
one of the things he does is say, I'm going to expense the offset if I have to fly to you,
which is totally reasonable. He says, if I have to travel internationally, it might be a hundred
dollars offset, but that's part of the bill. If you invite me to come because I'm not traveling
without them.
Well, this actually speaks to something which is more interesting. I'm seeing some agencies,
some forward looking agencies do now where they basically have, they have carbon budgets on projects
now, because if basically depending on where around the world and the UK does have quite good data on
this, you can have, you can basically work out the rough emissions from say, I know a hundred K of
spend or something like that. So if you have maybe a project where there's going to be,
well, which would cost like 200 K, then it's not a huge leap to say, well, this is, if we know that
there's going to be a hundred kilos of carbon emitted per thousand pounds spent, and this is
a 20 K project to 200 K project, then that might leave us with a budget of if we want to be better
than average and we need to be better than average or improving on what's happening each year to kind
of stand a chance of meeting the scary goals. We spoke at the beginning of the year, they say,
well, we're going to have a carbon budget of 20 tons. So everything we do has to stay inside
that budget. And this is a shared responsibility for us and also the client that we're working with.
So I think there are some ways, yeah, because this stuff can be quantified. And once you have
some numbers like that, in the same way that you have performance budgets for websites, I think you
can use budgets like this to help, you can essentially create the incentives to make it easier to have,
say a remote call versus having to fly or having to travel somewhere. And I think that without this
stuff, it's going to be very difficult for us to basically face the challenges that are raised,
that the science dictates. But we do have the tools and the numbers to actually do this. And I
think many of us like the tech industry is such a rich industry compared to others. And there are so
many people with so much professional mobility who are able to basically say, look, this is how we're
going to work because this is how we chose to come into the industry for this. I think there's a lot to
there's a lot to be said for thinking about this and considering it part of just being a kind of
responsible professional in tech, not in technology to think about these things.
Yeah, well said. One final thought I want to throw out there around this travel stuff. I
try to travel less to conferences. I'm going to PyCon this year as I did last year because it's
important and I have to fly to, right? I went to one other conference this year that I had to fly to,
which is Microsoft Ignite in Florida. It was an interesting opportunity that I had. It was worth it. So I
bought offsets for this and that's all fine and good. That's just what I did and still not my favorite,
but whatever. So one thing I would like to see though, is that have conferences make it almost
the default to have not just me do that. The reason I mentioned that conference in Florida by name is
they had 30,000 attendees. How many of those people do you think offset their carbon?
So this is actually really, no, you're absolutely right. And I think this is, there's two things which
I could share with you, which I think might be interesting for you. So I did some work. I helped
organize a conference called Map Camp, where we basically had a climate sponsor specifically to account for
the fact that we knew that some people were, you know, we made the decision to run a conference
and cause people to be flying here and we chose the venue. So therefore we felt like it's on us to be
accounting for this stuff. And if you kind of just shift it onto the end user, that kind of is a bit
unfair in many cases because you're often already making people to pay for something. And if you budget
for this as part of just how you work, then it's, it makes a lot more sense. And, there are more
group organizations doing this. But the thing that we've done is we actually hired some consultants
to help us work out the emissions associated with that conference. And we also were in the process
of releasing a report, which has all this stuff where we've got the numbers for this. And we could
see what the trade-offs were so that other people can take this information. And, there's also a
really, really cool Django project called Open Footprint, which is exactly related to this kind of stuff.
There's a guy called, Sylvan. Oh, I totally forgot his surname. He's on Twitter as Sylvanus,
but he's been building, him and his team. they've been building Open Footprint, which is a
conference carbon footprint calculation tool to allow you to see what the impact of these things would
actually be. And, for a 600 person conference, it was about, I think we spent, we raised 5k for that.
So some of it was education. Some of it was kind of offsetting is what we used, we used for this,
but I think it should be a norm if we're going to be responsible people organizing these events.
Sure. Absolutely. And it would be ideal if the people putting on the conference did it. I can
imagine there's sometimes like smaller conferences or something. They just feel like they're barely
able to even fund this thing and whatnot. So if they can't do that, you know, maybe they could have a
little checkbox on the registry. It's $230 to join this conference. And it has a little pre-check,
maybe even pre-check it carbon offset, $30 I'm flying or something like that. And you can uncheck it,
but if it's pre-checked and you just hit go, you know, how many people would just expense that back to
their company, right? It seems like such a small thing that would make a huge difference. If you
have to say 30,000 people go into your conference, all of a sudden that's tremendous.
So RussConf does something really interesting in this field. So RussConf EU, they had an event in
Barcelona and because Europe has pretty good trail rail links, they basically said, okay,
we're running this conference. If you want to get here by train and we'd really, really support you
doing that if you can, there's an interrail pass. And here's a way that you can get here by train.
And it's a different way of traveling because interrail is basically, it's a bit like you pay
for a set amount to be able to take any train or almost any train over a set period of like a week
or so or a month. And I did the same thing as an experiment in like low carbon developer relations
by having a two month interrail pass to travel around all little bits of Western Europe. And they
said, here's how to do this. These are the places you might want to drop a visit along the way as part of
this process. So there are groups who do do this and they think of it, they think of the travel as
part of the conference itself. And I've had people talking about like having a sprint bus where people
kind of work and code on something together. Oh, that's cool. Yeah. Like there's loads of ideas.
We just need to be more creative about this if we're going to have events where people physically
need to be around. And that's totally okay. As long as we think about the full cost of this stuff.
Right. Well, I already told you I'd lived in Germany for a year and I'm very jealous of the
rail system you all have over there. So yeah, let's leave it at that. But yeah, I think even things like
conferences, tech conferences could do a lot, even just little default, just check boxes like,
hey, we're going to donate. You're paying 30 bucks to send some money here unless you uncheck this when
you register or whatever. Right. Give some people some levers, but make it at least the default option
to not make it so impactful in a negative sense.
There's a group who are working on, and I'm part of it as a group working on a kind of climate code
of conduct for conferences to address these kinds of issues. And I really like if people do have an
interest, it'd be really nice to hear from them because there's a bunch of us. There's a group
called climateaction.tech, which I invest a bunch of time working on because I find it useful for,
which is basically full of other professionals who are trying to do this. And there's a bunch of us
trying to figure out how to do events greener. So if any of this is interesting to you,
I'd really recommend a joining the community that we have. And yeah, let's talk about some of this
because it's easier to face this stuff as a group and to compare notes together.
Yeah, absolutely. All right. Well, we are over time on this topic, but it was well worth it. It
was a fun conversation, Chris. Now, before you get out of here, let me ask you the final two questions.
If you're going to write some Python code, try to make it fast and energy efficient,
what editor would you use?
Oh, I've gone through a number of editors. I started initially with TextMate ages ago,
and then I started using Sublime. And then I kind of started using Vim because I thought that's
what cool people should be using. I'm not a proper programmer if I use Vim.
And I tried using Emacs, didn't get much luck. And I quite liked Vim. I found myself,
because I do a number of other things rather than just coding, I really am enjoying VS Code. And I'm
finding the, yeah, VS Code is my editor now. It's free. It's quite, it's well designed and-
Super flexible. All the extensions.
Yeah. Yeah, exactly. I'm a big fan of VS Code. It helps me. It saves me from myself in many cases.
Sweet. All right. And then a notable PyPI package that you maybe found interesting or
is relevant to the conversation?
I'd probably say, I think the energy usage one for the AI thing, I think is really interesting. But
otherwise, I think I would really point people to OpenFootprint, the open source carbon calculator,
because we are so good at calculating, you know, we pride ourselves on being informed by data and
being able to quantify things. And I think that if we take that kind of approach to other domains and
domains like this, it will help us make informed decisions about the things we do as responsible
tech professionals.
Right on. All right. Final call to action. People are interested in doing more,
giving them some concrete steps. What do you say?
I think it's important to stress that it's okay to, if you don't know what to do right now.
But I think it's also on you as a professional to invest in developing these skills that we will
need to face when we think about like the science and what, and what basically like children are
saying every Friday, because they're scared and they're expecting adults to kind of step up and
do something about it. And I think it's important to learn to invest in thinking systemically.
And this information is out there and there are books and resources out there. I mean,
I think that's the key thing that I would call people to do is be prepared to invest in skills
that are maybe outside of your kind of traditional domain of technology and learn to think a bit
systemically. And the thing I would say is that there are lots of other people doing this too.
You're not alone. In the group that I help run, climateaction.tech, it's basically full of other
techies who are trying to figure this stuff out and how to do this. And a bunch of the messages and
the links I've shared, I found through really enriching, useful conversations with people who are saying,
what should I do about the fact that I cannot avoid the flying thing? In fact,
the thing with Kenneth, I remember the conversation that directly informed that and the conversations
with say Microsoft saying, okay, here's how we're going to do low carbon developer relations.
I remember seeing the conversation there and the conversation about say, how do we take in,
do something about the fact that, you know, AI and the use of machine learning is this massive growth
in there. What can we do there? Or in say the UK with kind of the government taking a real,
real kind of ownership on the emissions from their infrastructure. I remember the conversation
there saying, yeah, we should be doing this. There are people out there trying to solve this
and it's okay to feel a bit overwhelmed as long as there are, but it's worth remembering there are
other people around to solve this and it's easier to solve this when there are other people and to share
this across organizational boundaries. So yeah, those are the two things. Be prepared to invest and
yeah, join the community.
Super. And we can do it. It runs on electricity. We don't have to change everything. We just can just
change a few things and it'll be, we'll be good, but we got to do it right. Thank you,
Chris, for coming on the show and sharing all this. It was super interesting.
Okay. Thank you again, Michael. And have a lovely round.
Yeah, you as well.
This has been another episode of Talk Python to Me. Our guest in this episode was Chris Adams,
and it's been brought to you by Brilliant.org and Datadog. Brilliant.org wants to help you level up
your math and science through fun guided problem solving. Get started for free at
talkpython.fm/brilliant. Datadog gives you visibility into the whole system running your code.
Visit talkpython.fm/datadog and see what you've been missing. They'll throw in a free t-shirt.
Want to level up your Python? If you're just getting started, try my Python Jumpstart by Building 10 Apps
course. Or if you're looking for something more advanced, check out our new async course that digs
into all the different types of async programming you can do in Python. And of course, if you're interested in
more than one of these, be sure to check out our Everything Bundle. It's like a subscription that never expires.
Be sure to subscribe to the show. Open your favorite podcatcher and search for Python. We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at
/rss on talkpython.fm. This is your host, Michael Kennedy. Thanks so much for listening. I really appreciate it.
Now get out there and write some Python code.
Thank you.
you
Thank you.