Issue #565

Buffer Flushing, Async Bugs, SQLAlchemy 2.0, and More

Feb. 21, 2023

Buffer Flushing, Async Bugs, SQLAlchemy 2.0, and More
#565 – FEBRUARY 21, 2023 VIEW IN BROWSER
The PyCoder’s Weekly Logo
How to Flush the Output of the Python Print Function
In this tutorial, you’ll learn how to flush the output of Python’s print function. You’ll explore output stream buffering in Python using code examples and learn that output streams are block-buffered by default, and that print() with its default arguments executes line-buffered when interactive.
REAL PYTHON

The Heisenbug Lurking in Your Async Code
When using the create_task() function in asyncio it is very important to maintain a reference to the created tasks. Although this requirement is documented, it is easy to forget and can have some very hard to understand consequences.
WILL MCGUGAN

Leaving Serverless Postgres for Crunchy Bridge
Find out why vanilla Postgres is a more cost effective and simple way to manage your database than Postgres “compatible” databases. Read a customer case study on lowering costs, getting a better database experience, and better support on Crunchy Bridge →
CRUNCHY DATAsponsor

What’s New in SQLAlchemy 2.0?
SQLAlchemy 2.0 was launched in January. This article reviews the latest changes, whether it is worth the upgrade, and how to go about it.
MIGUEL GRINBERG

PyCon US 2023 (Salt Lake City, Utah) Schedule Available
PYCON.BLOGSPOT.COM

Django Security Releases Issued: 4.1.7, 4.0.10, and 3.2.18
DJANGO SOFTWARE FOUNDATION


Discussions


Why Type Hinting Sucks!
REDDIT


Python Jobs


Software Engineer - Backend/Python (100% Remote)
CLOSE 📍 ANYWHERE

Python Video Course Instructor
REAL PYTHON 📍 ANYWHERE

Python Tutorial Writer
REAL PYTHON 📍 ANYWHERE

More Python Jobs >>>


Articles & Tutorials


Latest Attack on PyPI Users, Crooks Are Getting Better
Over 400 new malicious packages have been uploaded to PyPI that use a malicious JavaScript extension to monitor infected machines for crypto-currency interactions with the intent of stealing credentials. Packages are named based on typos of many of the most popular PyPI downloads.
DAN GOODIN

PySport Open Source
This site is a collection of open source Python and R tools for sports analytics, including scrapers and API wrappers for a variety for sites, data plotting, and analysis. It is maintained by PySport.
PYSPORT.ORG

Show Open-Source Some Love by Joining The Big Fix 2023
Join Snyk between February 14 and March 14 to help make security x100 times better in 2023 with The Big Fix event! Find and fix vulnerabilities while networking with your fellow engineers. Register for free →
SNYK.IOsponsor

Getters and Setters in Python
In this video course, you’ll learn what getter and setter methods are, how Python properties are preferred over getters and setters when dealing with attribute access and mutation, and when to use getter and setter methods instead of properties in Python.
REAL PYTHON course

Python Basics: Building Systems With Classes
In this video course, you’ll learn how to work with classes to build complex systems in Python. By composing classes, inheriting from other classes, and overriding class behavior, you’ll harness the power of object-oriented programming (OOP).
REAL PYTHON course

The Essential Django Deployment Guide
Going from “it works on my machine” to deploying to the public can be a daunting task. This guide details the choices between VPS and PaaS systems, how to choose, what the options are, and what you need to know to get your Django code live.
SAAS PEGASUS

The Dangers Behind Image Resizing
When training an ML model on image data you likely want smaller, consistently sized images. That means image processing in your pipeline, but the expectation that image resizing is the same across libraries can cause unforeseen problems.
ZURU.TECH

Should You Write a class Without @dataclass?
This article makes the argument that you should always use @dataclass for building classes in Python. Read on to understand why, and maybe respond to Glyph’s call-to-action to tell him if you think he’s wrong.
GLYPH LEFKOWITZ

Caching a Lot of Methods in Python
This article goes deep on functools.lru_cache() including all the arguments against using it, and how to argue with the arguments. Learn how to cache the results of your functions with a single line of code.
ADRIAN

Google OSS Project Python Style Guide
This is the style guide for any Google-originated open-source projects and a conversation on Hacker News about its content.
GOOGLE


Projects & Code


Brought to you by Real Python for Teamssponsor
Online Python training created by a community of experts. Give your team the real-world Python skills they need to succeed →

ApiLogicServer: Customizable Database Web App Projects
GITHUB.COM/VALHUBER

Pathfinding-Visualizer: Visualize Pathfinding With Pygame
GITHUB.COM/TAUSEEF-HILAL

django-prose: Wonderful Rich-Text Editing for Django
GITHUB.COM/WITHLOGICCO

CausalPy: Causal Inference in Quasi-Experimental Settings
GITHUB.COM/PYMC-LABS

📆🐍 Upcoming Python Events


PyCon Namibia 2023
February 21 to February 24, 2023

PyKla Monthly Meetup
February 22, 2023

Heidelberg Python Meetup
February 22, 2023

Weekly Real Python Office Hours Q&A (Virtual)
February 22, 2023

SPb Python Drinkup
February 23, 2023

PyLadies Amsterdam + MLOps.Community Meetup
February 23, 2023

PyCon PH 2023
February 25 to February 27, 2023

PyDelhi User Group Meetup
February 25, 2023
Happy Pythoning!
Copyright © 2023 PyCoder’s Weekly, All rights reserved.