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 is the third article in the author's series on decorators, extracting three generic use cases from real-world usage in a variety of open source libraries: intercepting calls, acting as function registries, and enriching function behavior.
If this were a big company interview question, how would you implement the algorithm in the title without using heaps or binary search trees? The article teaches a lot by proposing a minimally viable solution, refining the code step by step, and comparing the time complexities of different approaches.
Performance Analysis of Python's
dict()
and{}
What are the differences between the two ways of creating a dictionary in Python: dict()
and {}
? This article provides an in-depth analysis by looking at their bytecode and the CPython interpreter source code. In terms of performance, the conclusion is that {}
is faster than dict()
. (Note: Python Why series has written about Python Puzzle: Which is faster, []
or list()
? Why? How much faster?)
The Taipy team has developed an enhanced Markdown API that generates graphical user interface elements in your content by adding tags.
This article introduces seven techniques for optimizing memory in Python: using __slots__
in class definitions, using generators, using mmap
for handling large files, reducing the use of global variables, taking advantage of short-circuit evaluation of logical operators, choosing appropriate data types, and using string interning.
How does Python garbage collection work? Why does CPython use reference counting? What problems can a generational garbage collector solve? How can you view and debug reference cycles?
How are Postgres and DynamoDB used and how should you choose between them? The article compares their ORM, queries, performance, backups, migrations, and provides recommendations for choosing a solution based on different scenarios.
A detailed official blog tutorial that uses Pandas for data cleaning, Altair/Plotly for data visualization, and Streamlit for the front end.
Scrapscript is a tiny, pure, functional, content-addressable, web-first programming language. The author introduces its design principles, features, implemented and in-progress features, and the process of implementing it with Python.
X.509 is a PKI standard that defines the format of digital certificates and standardizes certificate attributes. Version 42.0.0 of Cryptography provides X.509 related APIs. The article introduces its significance and the problems it solves.
The author's disappointment is not about the drawbacks of dynamic typing compared to static typing, but that Python does not take full advantage of the strengths of dynamic typing. Dynamic is not the opposite of static; dynamic means types can change at runtime. The author hopes to enhance the power of dynamic analysis, hoping that "test amplification" of dynamic typing is easier, rather than turning to type annotations or static typing.
This article is a response to the previous sharing, illustrating the superpowers of Python's dynamic typing through the magical techniques (monkey patching and dynamic metaprogramming) used by libraries such as Werkzeug, Pony, Django, fluent-compile, and Pytest. Python can do more than you might think.
🎁 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
A framework for building custom AIs based on any large language model, deployed with Docker. API first, extensible with plugins, with an admin panel, and remembers conversations and documents. (star 1.6K)
This tool allows you to hide files of any type inside an image of your choice, without affecting the visual quality of the image. It supports image decoding, image comparison, CLI, UI, cross-platform, encryption, and compression.
Supports real and complex floating-point arithmetic with arbitrary precision, and provides a large collection of functions specifically designed for mathematical use.
Provides a thread-safe interface for SQLite database operations, with queue-based statement execution.
A single HTTP implementation in Rust, avoiding the common dependency combination of Gunicorn + uvicorn + http-tools. Supports ASGI/3, RSGI, and WSGI interface applications, and HTTP/1 and HTTP/2 protocols. (1.5k stars)
FastAPI + HTMX combination, featuring decorator syntax, support for any template engine and server-side rendering library, built-in Jinja2, support for both HTMX requests and regular requests, support for synchronous and asynchronous routes, and more...
A technical manual for LLM/VLM training engineers and practitioners to help train large language models and multimodal models successfully. (6.9k stars)
By co-designing a frontend language and a runtime system, it makes interactive LLMs faster and more controllable. It supports multiple chained generative calls, advanced prompting techniques, control flow, multi-modality, parallelism, and external interactions, with a high-performance runtime powered by RadixAttention.
Deploy ChatGPT as your own Telegram bot, supporting GPT-4, GPT-4 Turbo, and DALLE 2, supporting group chats, built-in 15 special dialogue modes, supporting viewing OpenAI API expenses, etc. (star 4.5K)
Its Chinese name is "HuixiangDou", which proposes a set of algorithms pipeline for answering technical questions, with low deployment cost, supporting complex scenarios such as group chats, supporting WeChat groups, lark groups, Feishu groups, DingTalk robots and other IMs.
Using models such as ID Base model, InsightFace model, ID ControlNet model, Ipadapter_instantid, etc., the official provides 8 styles.
Supports lora, supports multiple batches, supports general styler, the official provides 10 styles.
🐼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.