Python Newsletter February 22, 2023

Hi From CodeSolid!

I realize it’s been a while; I just got back from a lovely vacation in Colombia.  I realize you’re not hanging on my every word, but let me nevertheless tender a self-serving “Sorry for the delay.”  Here’s the latest from CodeSolid and around the web.

New On CodeSolid

SQLAlchemy Dataclass Example
The recent release of SQLAlchemy 2.0 included improved support for mapping database entities as Python dataclasses.  I wanted to check this out, so I wrote a brief example featuring some data from my blog as input.  I used SQLLite3 to avoid having a complicated database setup, so it’s pretty straightforward.

Around the Python Interwebs

Switching Between Data Streams in a Single Thread
Redowan Delowar wanted to be able to use generators to consume two data streams simultaneously, without using separate threads or processes.  This interesting article was the result.

Discussion of Python Projects Using “Best Practices”
This Reddit thread is worth a look if you want to get a feel for what projects the “Python community” thinks are well-maintained, worth learning, or otherwise representative of Python practices.

Doggy Morse Code
Speaking of “best practices”, newcomers to Python often ask “What project should I work on?”  Here’s a project that proves: 1) It doesn’t matter, just so long as you’re practicing and 2) You should do something whimsical because… 3) See #1.

A Python Derivative Calculator
Here’s another “side project” that’s quite a bit more advanced than Doggy Morse Code.  It’s notable too for the sources it quotes

Happy Birthday to Python
Python turned 32 a few days ago.  I hope it likes the nice newsletter I got it.

Polars List of Resources
As readers of this blog may know, I’m a big fan of Polars as an alternative to Pandas.  This curated list of other resources about Polars is a good starting point for learning more about this awesome Python library.

Installing NGINX, Gunicorn, Uvicorn, and FastAPI
This tutorial shows you how to launch a single, production-ready FastAPI instance fronted by NGINX as a reverse proxy.  This is a good introduction to all the pieces, but one drawback is that it teaches them as a somewhat manual, interactive process (rather than automating it all as a DevOps engineer might want).

New VS Code Python Extension Release
The February 2023 VS Code extension release is one I need to check out since it boasts a feature that’s been on my wishlist for some time – the ability to automatically detect a Python environment when launched from a terminal with a Conda environment or virtual environment (venv) active.