How to find outdated Python requirements

Posted on Sun 07 April 2024 in Python • Tagged with python

Finding outdated Python packages

A quick Python technique this time. You can get a list of outdated Python packages installed on your system with a simple command:

pip list --outdated

That will list all the packages, including their dependencies. That's nice, but sometimes it makes it hard to know what …

Continue reading

Dad Jokes As a Service

Posted on Mon 24 July 2023 in Python • Tagged with python

Everyone loves a good dad joke

... now, if only there were some good dad jokes!

The ICanHazDadJoke site claims to maintain the internet's largest collection of dad jokes. GitHub user CrossNox has made a nice wrapper around their API. Together, this lets you retrieve a random dad joke programmatically.

Why …

Continue reading

Getting a Boolean from any value in Python

Posted on Fri 14 July 2023 in Python • Tagged with python

Getting a Boolean value from any data type

Recently, I was building a webhook that needed to accept and operate on varied data from outside sources. Included in that data were values meant to be Booleans. However, some callers were sending values like "Yes" or "no" or even "-1". I …

Continue reading

Multiprocessing in Python

Posted on Mon 15 April 2019 in Python • Tagged with python

Modern CPUs typically feature multiple cores, which in some sense is like having multiple computers at your disposal. By default, your Python code will run on one core. But when performance is critical, you can use multiple cores to run operations simultaneously. In this article, I'll walk through how we …

Continue reading

Publishing to PyPI

Posted on Fri 25 January 2019 in Python • Tagged with python

I recently published my first Python package to PyPI. The guides I found on how to do so were mostly out-of-date and confusing. Of course, PyPI is reportedly coming out with new updates soon and my instructions here will soon be outdated. In any case, here's my take on how …

Continue reading

Multiple cameras with a single Raspberry Pi

Posted on Sun 02 September 2018 in Python • Tagged with python, raspberry pi, making

The Arducam Multi Camera Adapter board is a neat accessory for a Raspberry Pi. With it, you can connect multiple cameras to a single Pi. A single board supports up to four cameras. According to Arducam, you can stack up to four boards for a total of 16 cameras on …

Continue reading

Ad-hoc objects in Python

Posted on Fri 06 July 2018 in Python • Tagged with python

If you know one programming language, it's natural to look for parallels as you learn a new language. In my case, I've coded in JavaScript for many years while Python is much more recent for me. I regularly find myself thinking "in JavaScript, I'd do ..."

Take object handling. I really …

Continue reading

Reading email with Python

Posted on Thu 10 May 2018 in Python • Tagged with python

For a recent project at work, I needed to read and parse email messages with a python script. I found the documentation confusing, and most of the samples on various blogs and StackOverflow posts to be old and not fully compatible with python 3.x. So, here is an adaptation …

Continue reading