skip to navigation
skip to content

Planet Python

Last update: February 18, 2025 09:43 PM UTC

February 18, 2025


PyCoder’s Weekly

Issue #669: Joining Strings, MongoDB in Django, Mobile Wheels, and More (Feb. 18, 2025)

February 18, 2025 07:30 PM UTC


Real Python

Concatenating Strings in Python Efficiently

In this video course, you'll learn how to concatenate strings in Python. You'll use different tools and techniques for string concatenation, including the concatenation operators and the .join() method. You'll also explore other tools that can also be handy for string concatenation in Python.

February 18, 2025 02:00 PM UTC


PyCharm

Which Is the Best Python Web Framework: Django, Flask, or FastAPI?

Search for Python web frameworks, and three names will consistently come up: Django, Flask, and FastAPI. Our latest Python Developer Survey Results confirm that these three frameworks remain developers’ top choices for backend web development with Python. All three frameworks are open-source and compatible with the latest versions of Python.  But how do you determine […]

February 18, 2025 10:00 AM UTC


Python Software Foundation

Where is the PSF? 2025 Edition

February 18, 2025 06:30 AM UTC

February 17, 2025


Real Python

Python News Roundup: February 2025

2025 looks to be an exciting year for Python. A new type of interpreter improves the performance of the upcoming Python 3.14. Additionally, the community is busy developing third-party libraries, challenging each other with new puzzles, and planning conferences.

February 17, 2025 02:00 PM UTC


Python Bytes

#420 90% Done in 50% of the Available Time

Topics include PEP 772 – Packaging governance process, Official Django MongoDB Backend, Developer Philosophy, and Python 3.13.2.

February 17, 2025 08:00 AM UTC


Quansight Labs Blog

Mastering DuckDB when you're used to pandas or Polars

It's not as scary as you think

February 17, 2025 12:00 AM UTC

February 14, 2025


Kay Hayen

Nuitka this week #16

Hey Nuitka users! This started out as an idea of a weekly update, but that hasn’t happened, and so we will switch it over to just writing up when something interesting happens and then push it out relatively immediately when it happens.

February 14, 2025 11:00 PM UTC


Django Weblog

DjangoCongress JP 2025 Announcement and Live Streaming!

DjangoCongress JP 2025, to be held on Saturday, February 22, 2025 at 10 am (Japan Standard Time), will be broadcast live!

It will be streamed on the following YouTube Live channels:

This year there will be talks not only about Django, but also about FastAPI and other asynchronous web topics. There will also be talks on Django core development, Django Software Foundation (DSF) governance, and other topics from around the world. Simultaneous translation will be provided in both English and Japanese.

Schedule

ROOM1
ROOM2

A public viewing of the event will also be held in Tokyo. A reception will also be held, so please check the following connpass page if you plan to attend.

Registration (connpass page): DjangoCongress JP 2025パブリックビューイング

February 14, 2025 10:12 PM UTC


Eli Bendersky

Decorator JITs - Python as a DSL

Spend enough time looking at Python programs and packages for machine learning, and you'll notice that the "JIT decorator" pattern is pretty popular. For example, this JAX snippet:

import jax.numpy as jnp
import jax

@jax.jit
def add(a, b):
  return jnp.add(a, b)

# Use "add" as a …

February 14, 2025 09:49 PM UTC


Hugo van Kemenade

Improving licence metadata

What? #

PEP 639 defines a spec on how to document licences used in Python projects.

Instead of using a Trove classifier such as “License :: OSI Approved :: BSD License”, which is imprecise (for example, which BSD licence?), the SPDX licence expression syntax is used.

How? #

pypproject.toml #

Change pyproject.toml as follows.

I usually use Hatchling as a build backend, and support was added in 1.27:

 [build-system]
 build-backend = "hatchling.build"
 requires = [
 "hatch-vcs",
- "hatchling",
+ "hatchling>=1.27",
 ]

Replace the freeform license field with a valid SPDX license expression, and add license-files which points to the licence files in the repo. There’s often only one, but if you have more than one, list them all:

 [project]
 ...
-license = { text = "MIT" }
+license = "MIT"
+license-files = [ "LICENSE" ]

Optionally delete the deprecated licence classifier:

 classifiers = [
 "Development Status :: 5 - Production/Stable",
 "Intended Audience :: Developers",
- "License :: OSI Approved :: MIT License",
 "Operating System :: OS Independent",

For example, see humanize#236 and prettytable#350.

Upload #

Then make sure to use a PyPI uploader that supports this.

I recommend using Trusted Publishing which I use with pypa/gh-action-pypi-publish to deploy from GitHub Actions. I didn’t need to make any changes here, just make a release as usual.

Result #

PyPI #

PyPI shows the new metadata:

Screenshot of PyPI showing licence expression: BSD-3-Clause

pip #

pip can also show you the metadata:

❯ pip install prettytable==3.13.0
❯ pip show prettytable
Name: prettytable
Version: 3.13.0
...
License-Expression: BSD-3-Clause
Location: /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages
Requires: wcwidth
Required-by: norwegianblue, pypistats

Thank you! #

A lot of work went into this. Thank you to PEP authors Philippe Ombredanne for creating the first draft in 2019, to C.A.M. Gerlach for the second draft in 2021, and especially to Karolina Surma for getting the third draft finish line and helping with the implementation.

And many projects were updated to support this, thanks to the maintainers and contributors of at least:


Header photo: Amelia Earhart’s 1932 pilot licence in the San Diego Air and Space Museum Archive, with no known copyright restrictions.

February 14, 2025 03:11 PM UTC


Real Python

The Real Python Podcast – Episode #239: Behavior-Driven vs Test-Driven Development & Using Regex in Python

What is behavior-driven development, and how does it work alongside test-driven development? How do you communicate requirements between teams in an organization? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder's Weekly articles and projects.

February 14, 2025 12:00 PM UTC


Daniel Roy Greenfeld

Building a playing card deck

Today is Valentine's Day. That makes it the perfect day to write a blog post about showing how to not just build a deck of cards, but show off cards from the heart suite.

February 14, 2025 09:50 AM UTC

February 13, 2025


Bojan Mihelac

Prefixed Parameters for Django querystring tag

An overview of Django 5.1's new querystring tag and how to add support for prefixed parameters.

February 13, 2025 09:37 PM UTC


Peter Bengtsson

get in JavaScript is the same as property in Python

Prefix a function, in an object or class, with `get` and then that acts as a function call without brackets. Just like Python's `property` decorator.

February 13, 2025 12:41 PM UTC


EuroPython

EuroPython February 2025 Newsletter

Hey ya 👋 

Hope you&aposre all having a fantastic February. We sure have been busy and got some exciting updates for you as we gear up for EuroPython 2025, which is taking place once again in the beautiful city of Prague. So let&aposs dive right

February 13, 2025 08:36 AM UTC

February 12, 2025


Kay Hayen

Nuitka Release 2.6

This is to inform you about the new stable release of Nuitka. It is the extremely compatible Python compiler, “download now”.

February 12, 2025 11:00 PM UTC


Giampaolo Rodola

psutil: drop Python 2.7 support

About dropping Python 2.7 support in psutil, 3 years ago I stated:

Not a chance, for many years to come. [Python 2.7] currently represents 7-10% of total downloads, meaning around 70k / 100k downloads per day.

Only 3 years later, and to my surprise, downloads for Python 2.7 …

February 12, 2025 11:00 PM UTC


EuroPython Society

Board Report for January 2025

The top priority for the board in January was finishing the hiring of our event manager. We’re super excited to introduce Anežka Müller! Anežka is a freelance event manager and a longtime member of the Czech Python community. She’s a

February 12, 2025 03:08 PM UTC


Python Morsels

Avoid over-commenting in Python

When do you need a comment in Python and when should you consider an alternative to commenting?

Table of contents

  1. Documenting instead of commenting
  2. Non-obvious variables and values
  3. Unnamed code blocks
  4. Missing variables due to embedded operations
  5. Indexes instead of variables
  6. Comment the "why" more than the "what"
  7. Consider whether there's a better alternative to your comments

Documenting instead of commenting

Here is a comment I would not write in my code:

def first_or_none(iterable):
    # Return the first item in given iterable (or None if empty).
    for item in iterable:
        return item
    return None

That comment seems to describe what this code does... so why would I not write it?

I do like that comment, but I would prefer to write it as a docstring instead:

def first_or_none(iterable):
    """Return the first item in given iterable (or None if empty)."""
    for item in iterable:
        return item
    return None

Documentation strings are for conveying the purpose of function, class, or module, typically at a high level. Unlike comments, they can be read by Python's built-in help function:

>>> help(first_or_none)
Help on function first_or_none in module __main__:

first_or_none(iterable)
    Return the first item in given iterable (or None if empty).

Docstrings are also read by other documentation-oriented tools, like Sphinx.

Non-obvious variables and values

Here's a potentially helpful comment:

Read the full article: https://www.pythonmorsels.com/avoid-comments/

February 12, 2025 03:05 PM UTC


Real Python

Python Keywords: An Introduction

Python keywords are the fundamental building blocks of any Python program. In this tutorial, you'll learn the basic syntax and usage of each of Python's thirty-five keywords and four soft keywords so you can write more efficient and readable code.

February 12, 2025 02:00 PM UTC


EuroPython Society

Changes in the Grants Programme for 2025

TL;DR:

February 12, 2025 01:16 PM UTC


Real Python

Quiz: Python Keywords: An Introduction

In this quiz, you'll test your understanding of Python keywords and soft keywords. These reserved words have specific functions and restrictions in Python, and understanding how to use them correctly is fundamental for building Python programs.

February 12, 2025 12:00 PM UTC


Zato Blog

Modern REST API Tutorial in Python

Modern REST API Tutorial in Python

Great APIs don't win theoretical arguments - they just prefer to work reliably and to make developers' lives easier.

Here's a tutorial on what building production APIs is really about: creating interfaces that are practical in usage, while keeping your systems maintainable for years to come.

Sound intriguing? Read the modern REST API tutorial in Python here.

Modern REST API tutorial in Python

More resources

➤ Python API integration tutorials
What is a Network Packet Broker? How to automate networks in Python?
What is an integration platform?
Python Integration platform as a Service (iPaaS)
What is an Enterprise Service Bus (ESB)? What is SOA?
Open-source iPaaS in Python

February 12, 2025 08:00 AM UTC


Kushal Das

pass using stateless OpenPGP command line interface

Yesterday I wrote about how I am using a different tool for git signing and verification. Next, I replaced my pass usage. I have a small patch to use stateless OpenPGP command line interface (SOP). It is an implementation agonostic standard for handling OpenPGP messages. You can read the whole SPEC here.

Installation

cargo install rsop rsop-oct

And copied the bash script from my repository to the path somewhere.

The rsoct binary from rsop-oct follows the same SOP standard but uses the card to signing/decryption. I stored my public key in ~/.password-store/.gpg-key file, which is in turn used for encryption.

Usage

Here nothing changed related my daily pass usage, except the number of time I am typing my PIN :)

February 12, 2025 05:26 AM UTC