Python Trending Weekly
ISSUE 30

Python Trending Weekly #30 (2023-12-09)

2023-12-09 Season 1

TL;DR

African Python communities publish an open letter to the PSF that stirs debate; Django 5.0 ships, and Apple's mlx array framework for Apple silicon is another heavyweight release.

Articles 12 Projects 12
🦄

Articles & Tutorials

× 12
01 Python Africa: An Open Letter to the Python Software Foundation pythonafrica.blogspot.com

An open letter to the PSF from Python community organizers in over a dozen African countries. The letter was prompted by the PSF's delayed disbursement of a $9,000 grant to Africa's first DjangoCon, and it highlights other issues within the PSF, including racism, lack of attention to marginalized groups, and non-compliance with local laws. (As an aside, the PSF gave 1% of its grants to Asia in 2022, compared to 16% to Africa...)

02 Django 5.0 Released! docs.djangoproject.com

Django 5.0 was released this week, and it only supports Python 3.10 and later. Key new features: The new Field.db_default parameter allows you to set a default value that is calculated by the database; GeneratedField allows you to create columns that are generated by the database; Field groups and field group templates have been introduced, which simplify the rendering of related elements for form fields. (Bonus: Video introducing new features in Django)

Defining a default value for a database field
03 56 Lines of Python Code to Implement a Flex/Lex skywind.me

Lex/Flex can be used to generate lexical analyzers that process lexical structures in source code. The author implemented a general rule-based lexical analyzer by modifying a program in the official Python documentation, which can be used to handle simple lexical analysis requirements.

04 How to Use Dependency Injection in FastAPI the Right Way so1n.me

This article points out two wrong ways people use dependency injection in FastAPI and introduces how to implement dependency injection in FastAPI using python-dependency-injector.

05 Why You Should Not Overuse List Comprehensions in Python kdnuggets.com

Using list comprehensions appropriately can make your code more concise and elegant, but overusing them will severely impair the readability of your code. The author provides three examples, each implemented with list comprehensions and a conventional approach, allowing readers to appreciate how easy-to-understand code is superior to fancy showmanship.

06 Untyped Python: The Python That Was lucumr.pocoo.org

In his latest post, Armin Ronacher, the creator of Flask, discusses the topic of types in Python. The central thesis is that Python's dynamic typing is an advantage due to its inherent philosophy, which clashes with typing. Typing has its merits, but it also comes with a cost. The author reminisces about the Python of the past.

07 Add Full-Text Search to Your Django Project with django-watson idiomaticprogrammers.com

A very detailed tutorial on adding full-text search capabilities to your Django project using django-watson and PostgreSQL. The library supports searching across multiple models and sorting by relevance. (star 1.2K)

08 Celery Fanout Pattern Explained better-simple.com

The Celery fanout pattern is a task distribution pattern where a single task triggers multiple child tasks to be executed in parallel. The author introduces a practical use case of this pattern, arguing that it is a good way to implement dynamic workflows in task signatures.

09 7 Alternatives to Python Asyncio superfastpython.com

Asyncio is Python's standard library for asynchronous programming, but it's not your only option. This article introduces and compares seven alternatives, including older libraries like Tornado, Twisted, and Gevent, as well as newer ones like Curio, Trio, AnyIO, and UVloop.

10 Inside CPython: What Happens When You Do a+b? codeconfessions.substack.com

A deep dive into the inner workings of CPython's dynamic dispatch mechanism. Dynamic dispatch is the process of determining which method or function to call at runtime (rather than at compile time). Something as simple as a+b can have multiple combinations of types, and the actual computation can be quite different.

11 How to Display an Animated GIF with Python blog.pythonlibrary.org

GIF is an image format that supports animation without audio. Are there any Python libraries that can display animated GIFs programmatically? This article introduces three approaches using tkinter, PySimpleGUI, and Jupyter Notebook.

12 Building a Simple REPL in Python bernsteinbear.com

REPL (Read-Eval-Print Loop) is an interactive environment for a programming language. Python's standard library includes a code module that provides the functionality to implement a REPL. This article demonstrates how to build a simple REPL by incrementally introducing requirements.

🎁 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

× 12
01 Self-operating computer: Enabling multimodal models to operate computers github.com

This is one of the hottest recent projects based on GPT-4v. It allows large language models to view screen content, operate the mouse and keyboard to achieve specific goals, just like humans. The current challenge is that GPT-4v has a high error rate in mouse click location. (5.1k stars)

02 marko: A highly extensible markdown parser github.com

A Markdown parser that focuses on extending the developer experience, following the CommonMark spec v0.30 spec. Speed is not its strength, but it makes it easy to inspect the AST, implement your own elements and renderers. (Submitted by @frostming)

03 WeChatMsg: Export WeChat Chat History as HTML/Word/CSV Document github.com

This project, created by a college student, has been trending on WeChat Moments this week. It allows users to export their WeChat chat history and generate an annual chat report. Its slogan, "My data, my choice," resonates with many users. The exported data can be used to train personal AI! (12.5K stars)

Image of a page from the annual chat report
04 PyWxDump: Get WeChat account information, export chat records github.com

This is a dependency of the previous project, which can decrypt the database, view and export chat records, and support multi-user information acquisition in the WeChat multi-open scenario. (star 1.6K) (PS. I always feel that these two projects will be targeted by WeChat, what do you think?)

05 mlx: An Array Framework for Apple Silicon github.com

A machine learning array framework for Apple silicon with a Python API similar to Numpy. (7.2k stars)

06 DSAlgo: Collection of Interview Questions on Data Structures and Algorithms github.com

A curated repo of awesome data structures and algorithms questions, solved in Python. It also contains a collection of interview questions from big companies and study notes for computer science. (star 1.7K)

07 Python Online Compiler Website pythononlinecompiler.com

An online version of the Python interpreter in a web browser, supporting Python versions 2.7, 3.3-3.10, and pre-installed with most commonly used libraries, including Turtle, Tkinter, Pygame, Numpy, Matplotlib, Pandas, Scipy, etc.

Draw a Small Alarm Clock Online
08 aio-libs: 65 Libraries/Projects Based on Asyncio github.com

It collects libraries related to asynchronous IO in the Python community, including aiohttp, aiopg, aiomysql, yarl, aiokafka, and more.

09 kolo: Visualize Django app execution github.com

A VSCode extension that features frame visualization, beautiful flame graphs, shows the line of code that executed a SQL query, allows jumping directly to the exception location, and more.

kolo feature introduction
10 dnsteal: DNS exfiltration tool that sends files over DNS requests github.com

A tiny tool with only 200+ lines of code that fakes a DNS server to exfiltrate files hidden in DNS requests. It supports multiple files, Gzip compression, custom subdomain information, and more. (1.6k stars)

11 github-trends: Beautify your GitHub profile with customizable cards github.com

Generate contribution calendars, lines of code analysis, contribution graphs in various dimensions, and more for your GitHub profile. Easily embed dynamic badges in your profile page. (6.4k stars)

12 Depix: Recover information from pixelated screenshots github.com

Think pixelating a screenshot makes it secure? Think again! This library recovers plaintext information from images with high accuracy. The repository includes an explanation of the technique and a note on its limitations. (24.7k stars)

Recovering text information example
ESC
↑↓ select · ↵ open175 issues