Core Devs Say A Fond But Firm Farewell To Python 2

Saying that it was finally time for the community to bid a “fond but firm farewell to Python 2”, core developer Benjamin Peterson marked the release of Python 2.7.18 on April 20th; officially ending support for the 2.x branch of the popular programming language. It was hardly a snap decision. Python 3.0 was released all the way back in December 2008, and it was never a secret that the newer branch was not only incompatible with the earlier version, but that it would eventually superseded it to become the standard.

But migrating the incredible amount of Python code in the wild over to the latest and greatest was easier said than done. Millions upon millions of lines of code used in everything from Linux distributions to virtually every major web service needed to be reviewed and migrated over to Python 3. In many cases the changes were relatively minor, but when code is being used in mission critical applications, even the smallest of changes are often avoided unless it’s absolutely necessary. The voluntary migration took far longer than expected, and the end-of-life (EOL) for Python 2 was pushed back by years to accommodate developers who hadn’t made the necessary changes yet.

Given the somewhat fluid nature of the Python 2 EOL date, it seems fitting that this last final release would come several months after the “official” January 2020 deadline. The intention was for it to coincide with PyCon 2020, but just like so many of the events planned for the first half of the year, the in-person conference had to be canceled in favor of a virtual one due to the COVID-19 epidemic. That might have stymied the celebration somewhat, but the release of Python 2.7.18 will still be looked on as a special moment for everyone involved.

Continue reading “Core Devs Say A Fond But Firm Farewell To Python 2”

Yes, You Can Put IoT On The Blockchain Using Python And The ESP8266

Last year, we saw quite a bit of media attention paid to blockchain startups. They raised money from the public, then most of them vanished without a trace (or product). Ethics and legality of their fundraising model aside, a few of the ideas they presented might be worth revisiting one day.

One idea in particular that I’ve struggled with is the synthesis of IoT and blockchain technology. Usually when presented with a product or technology, I can comprehend how and/or why someone would use it – in this case I understand neither, and it’s been nagging at me from some quiet but irrepressible corner of my mind.

The typical IoT networks I’ve seen collect data using cheap and low-power devices, and transmit it to a central service without more effort spent on security than needed (and sometimes much less). On the other hand, blockchains tend to be an expensive way to store data, require a fair amount of local storage and processing power to fully interact with them, and generally involve the careful use of public-private key encryption.

I can see some edge cases where it would be useful, for example securely setting the state of some large network of state machines – sort of like a more complex version of this system that controls a single LED via Ethereum smart contract.

What I believe isn’t important though, perhaps I just lack imagination – so lets build it anyway.

Continue reading “Yes, You Can Put IoT On The Blockchain Using Python And The ESP8266”

Get Organized With This Raspberry Pi E-Ink Calendar

Like many hackers, we love e-ink. There’s something mesmerizing and decidedly futuristic about the way the images shift around and reconstitute themselves. Like something from Harry Potter, but that you can buy on Alibaba instead of from a shop in Diagon Alley. But as anyone who’s used the technology can tell you, the low refresh rate of an e-ink screen limits its potential applications. It works great for reading books, but beyond that its struggled to find its niche in a world of cheap LCDs.

But [Zonglin Li] has recently wrapped up a project which shows that e-ink has at least one more use case: personal calendars. You can get way with only updating the screen once a day so the refresh rate won’t matter, and the rest of the time it’s going to be static anyway so you might as well enjoy the energy savings of leaving the screen off. With a Raspberry Pi behind the scenes pulling data from the Internet, it can populate the calendar with everything from your personal schedule to when your favorite podcast drops.

In practice, [Zonglin] is actually updating the display every hour as he’s included the current weather conditions on the top left of the screen, but even still, this is a perfect application for the very unique properties of e-ink displays. The display is a 7.5 inch 640×384 model from Waveshare that retails for about $50 USD, so between the display, the Raspberry Pi, and something to put it all in (here, a picture frame) this is a pretty cheap build compared to some of the large format e-ink displays out there.

The software side is written in Python 3, and [Zonglin] has documented how others can easily plug in their own information so it can pull schedule data from Google Calendar and local conditions from Open Weather Map. The MIT licensed source code is also very well organized and commented, so this could serve as an excellent base if you’re looking to create a more comprehensive e-ink home information display.

If this seems a little too pedestrian for your tastes, you could always put together an e-ink movie player, a surprisingly functional Linux terminal, or a very slick ESP8266-based name tag. If you’ve got the better part of $1K USD and don’t know what to do with it, you could even get an e-ink license plate.

Thread Carefully: An Introduction To Concurrent Python

The ability to execute code in parallel is crucial in a wide variety of scenarios. Concurrent programming is a key asset for web servers, producer/consumer models, batch number-crunching and pretty much any time an application is bottlenecked by a resource.

It’s sadly the case that writing quality concurrent code can be a real headache, but this article aims to demonstrate how easy it is to get started writing threaded programs in Python. Due to the large number of modules available in the standard library which are there to help out with this kind of thing, it’s often the case that simple concurrent tasks are surprisingly quick to implement.

We’ll walk through the difference between threads and processes in a Python context, before reviewing some of the different approaches you can take and what they’re best suited for.

Continue reading “Thread Carefully: An Introduction To Concurrent Python”

Stop Using Python 2: What You Need To Know About Python 3

Though Python 3 was released in 2008, many projects are still stuck on Python 2.

It’s understandable that porting large existing codebases to a new version is a prospect which sends a shiver down many a developer’s spine. But code inevitably needs to be maintained, and so when all the shiny new features that would fix everything are in a new version, is it really worth staying rooted in the past?

We’ll take you through some of the features that Python 2 programs are missing out on, not only from 3.0 but up to the current release (3.7).

Continue reading “Stop Using Python 2: What You Need To Know About Python 3”