Issue #628

Random Web App Ports, unittest, TypeIs vs TypeGuard, and More

May 7, 2024

Random Web App Ports, unittest, TypeIs vs TypeGuard, and More
#628 – MAY 7, 2024 VIEW IN BROWSER
The PyCoder’s Weekly Logo
TypeIs Does What I Thought TypeGuard Would Do in Python
In this post, Redowan discusses the fact that TypeGuard has always confused him, and that the newer TypeIs feature does what he thought TypeGuard should do. Read on to learn about them both.

Python’s unittest: Writing Unit Tests for Your Code
In this tutorial, you’ll learn how to use the unittest framework to create unit tests for your Python code. Along the way, you’ll also learn how to create test cases, fixtures, test suites, and more.

Webinar - Make Open Source Suck Less
Tired of dependency conflicts, corrupted environments and “works on my machine” issues? Learn the shortfalls of standard package and environment tools (i.e. pip and venv), and how you can achieve reproducibility, dependency management and security at scale - Watch the Webinar On-Demand →

Avoid Conflicts and Let Your OS Select a Python Web App Port
Hard-coded port numbers can be problematic during development because they prevent you from running multiple instances of the same server process in parallel. This article explains how to work around this issue by letting your operating system automatically select a random port number.
CHRISTOPH SCHIESSL • Shared by Christoph Schiessl

Quiz: The Python Calendar Module
In this quiz, you’ll test your understanding of the calendar module in Python. It’ll evaluate your proficiency in manipulating, customizing, and displaying calendars directly within your terminal. By working through this quiz, you’ll revisit the fundamental functions and methods provided by the calendar module.

Quiz: What Is the __pycache__ Folder in Python?
In this quiz, you’ll have the opportunity to test your knowledge of the __pycache__ folder, including when, where, and why Python creates these folders.

Pydantic v2.7.0 Released


Everything Google’s Python Team Were Responsible For
Google recently laid off the majority of their internal Python team. This post to HN, from one of the former team members, covers just what that team was responsible for. The ensuing discussion also includes comments from others on that team as well.

Python Jobs

Senior Python Engineer: Generative AI, Social Media x Web3

More Python Jobs >>>

Articles & Tutorials

Working With Global Variables in Python Functions
In this video course, you’ll learn how to use global variables in Python functions using the global keyword or the built-in globals() function. You’ll also learn a few strategies to avoid relying on global variables because they can lead to code that’s difficult to understand, debug, and maintain.

Embarking on a Relaxed and Friendly Python Coding Journey
Do you get stressed while trying to learn Python? Do you prefer to build small programs or projects as you continue your coding journey? This week on the show, Real Python author Stephen Gruppetta is here to talk about his new book, “The Python Coding Book.”

How to Watermark a Graph With Matplotlib
“Matplotlib is one of the most popular data visualization packages for the Python programming language. It allows you to create many different charts and graphs.” With it you can even put a watermark on your charts, this tutorial shows you how.

Software Friction
Friction is everywhere in software development. Two setbacks are more than twice as bad as one setback. This article discusses the sources of software friction and what you can do about it.

The Magician’s Sleight of Hand
Even functions in Python are objects and can be re-assigned and manipulated. This article shows a problem that at first looks impossible, but can be handled with a few key re-assigments.
STEPHEN GRUPPETTA • Shared by Stephen Gruppetta

4 Software Design Principles I Learned the Hard Way
Leonardo talks about four principles of software engineering he’s learned though his career. Some are against common practice: DRY may not be you friend.

Isolating Risk in the CPython Release Process
This is a quick summary of the changes to the CPython build process to help reduce the risks caused by extra dependencies.

Building Reusable Components in Django
This tutorial looks at how to build server-side, reusable UI components in Django using the django-viewcomponent library.
MICHAEL YIN • Shared by Michael Herman

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 →

vet: A Poetry Plugin for Establishing Chain of Trust

octarine: WGPU-based 3D Viewer

Python Turtle Bingo

pacemaker: For Controlling Time Per Iteration Loop in Python

vulture: Find Dead Python Code

📆🐍 Upcoming Python Events

Weekly Real Python Office Hours Q&A (Virtual)
May 8, 2024

Python Atlanta
May 9 to May 10, 2024

DFW Pythoneers 2nd Saturday Teaching Meeting
May 11, 2024

PiterPy Meetup
May 14, 2024

Leipzig Python User Group Meeting
May 14, 2024

IndyPy Monthly Meetup
May 14 to May 15, 2024

PyCon US 2024
May 15 to May 24, 2024

Flask Con 2024
May 17 to May 18, 2024
Happy Pythoning!
Copyright © 2024 PyCoder’s Weekly, All rights reserved.