Welcome to the Python Trending Weekly, a weekly newsletter about Python, AI and general programming techniques, with the majority links in English and a small portion in Chinese.
The original version of the weekly was written in Chinese. What you are reading here is mostly translated by LLMs.
Substack Channel : Click to subscribe
🦄Articles & Tutorials
This article gave me a sense of "industry secrets you don't know." Small companies are still sticking with Python 2.7 + Django 1.8, and they are supporting hundreds of millions of dollars in transactions each year. The author also shared several projects, and my feeling is: Maybe you don't need to consider "which language is better" too much. Just choose the one you are familiar with and focus on business implementation.
Python strings allow both single and double quotes, and even triple quotes. This flexibility is great, but it's also a source of conflict for standards pedants. This article shares an interesting story about it, recommended reading!
Why do we need context managers? What problems do they solve? The article also introduces the context manager protocol, the with
syntax sugar, implementing context managers with contextlib
, and four practical use cases.
A deque
is a double-ended queue data structure in the collections
module, similar to a list
but optimized for fast addition and removal from either end. This tutorial covers its basic usage and some advanced use cases.
Python performs type checking at runtime and emphasizes the behavior of objects rather than their types, so it doesn't put much emphasis on "generics" that focus on type safety. However, Python does support generics, and this article introduces how to implement generic functions and generic classes using the typing
module.
Gevent is a high-performance networking library built on top of greenlet, a lightweight coroutine implementation. This article introduces common pitfalls of Gevent and provides solutions.
pickle
is Python's standard library for serialization, but it has a major security risk when deserializing! The article introduces how it works, the root of the security risk, and how the machine learning community collaborated to design a safer alternative format called safetensors
.
This tutorial uses JavaScript and Python to develop an e-book search engine that relies on Glitter (a decentralized database service built with Tendermint) and uses React to develop the page that displays the search results.
Many programming languages have the import
keyword, and their functions are similar, but what are the differences in their underlying mechanisms? This article analyzes the similarities and differences between import in Java and Python, which can deepen your understanding of this topic.
pdm
is an excellent dependency management tool in Python, created by the Chinese developer @frostming. The author plans to write a series of articles about its internal implementation. This is the first article, which introduces what Lockfile is and how Lockfile is generated.
Does Python have pointers? The answer depends on how you understand "pointers". The author gives a brief but insightful answer. Python does not have the classic pointer operations of the C language, but every variable in Python is a pointer, i.e., everything is an implicit pointer. (In addition: A project "brings the pointer hell to Python", which is as superfluous as the Python version with curly braces below.)
The GIL-less feature was finally merged into Python's main branch this week! Here is a long article that provides an in-depth introduction to the GIL, helping to understand how the GIL works and predict where concurrency bottlenecks are located. The article uses many thread timing analysis graphs for easy understanding.
🎁 Python Trending Weekly 🎁 organizes its content into seasons, with every 30 issues forming a season. The highlights from the first season have been compiled for your convenience. You can access them online here (Chinese).
🐿️Projects & Resources
No front-end experience required, quickly build cross-platform, multi-user, real-time single-page applications (SPAs); no SDK needed, development can be done with an IDE or text editor, front-end uses Flutter UI, back-end currently supports Python, with plans to support Go and C#. (8.7K stars) (Contributed by @bear)
A Python project template with various integrations, configurations, and modules, featuring: project setup and template updates with copier
, dependency and virtual environment management with pdm
, containerization with dev container, mypy, ruff, and other commonly used tech stacks. (Contributed by @huxuan_org)
A JS interpreter built on the duktape
engine, used to execute JS code in Python. It has no other external dependencies, and has built-in common transpilers (TypeScript, JSX, LESS, CoffeeScript). It also supports passing parameters, running multiple scripts, global interpreters, loading modules using require
, and installing packages from npmjs.org.
>>> import dukpy
>>> dukpy.evaljs("var o = {'value': 5}; o['value'] += 3; o")
{'value': 8}
An online Python programming website that makes it easy to teach kids how to code through games.
Replaces hard-to-manage traditional queues and pub/sub systems, supports fault recovery, and solves concurrency, fairness, and rate limiting issues. Features low latency and high throughput, supports strategies like FIFO, LIFO, round-robin, and priority queues, allows for customizable retry policies, and supports integrated error handling. (2.4K stars)
Supports JWT authentication, email-based password recovery, and uses Traefik as a reverse proxy/load balancer, with FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS, etc. (17.5K stars)
I think Python's use of whitespace for indentation is its most beautiful design feature! But some people prefer curly braces. This project adds curly braces to Python, with a basic example:
def print_message(num_of_times) {
for i in range(num_of_times) {
print("Bython is awesome!");
}
}
if __name__ == "__main__" {
print_message(10);
}
A simple, requests-like HTTP client built on top of Twisted.
Automatically fetches, aggregates, and categorizes video files based on specified rules, creating metadata files for use with software like Emby, Jellyfin, Kodi, etc. (1.6K stars)
Access Cloudflare protected pages with simple HTTP requests, the only scraper framework with SSL support for authenticated proxies, integrate any Chrome extension with just one line of code, sitemap support, data cleaning support, caching support, provides Selenium shortcuts, and more.
A lightweight cross-platform wrapper around the WebView component, displaying HTML content in a GUI window. Can be used with web frameworks or standalone to bridge Python with the DOM. The latest 5.0 release introduces Android support. (4.2K stars)
Allows you to practice playing the piano directly on a sheet of paper! Currently supports up to two fingers, primarily intended for those who cannot afford a piano.
🐼Subscribe Welcome
- Blog: Explore my independent blog where you can find a collection of original/translated technical articles over the years, along with some reflections since 2009.
- Newsletter: Subscribe to my channel on Substack for a curated newsletter delivered straight to your inbox, keeping you updated on current affairs.
- Github: Access the Markdown source files of this weekly digest on Github and feel free to use them for anything you have in mind!
- Telegram: Beyond notifications for the weekly digest, I consider it an "extra edition," providing additional, more diverse information.
- Twitter: Follow me on Twitter where my feed is filled with numerous accounts of developers and organizations in the Python community.
Top comments (0)