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
How can we use Golang to run Python code? What are the usage limitations regarding Python versions and hardware? This article uses Docker to solve the problem of environmental dependencies and successfully runs Python code with Golang using the open-source project cpy3. It has a sequel, Implement Python Computing Services with Golang and Docker, which encapsulates ordinary Python software packages as high-performance services that can be called via gRPC.
Many programmers tend to overlook one thing: the time spent reading code is much longer than the time spent writing it! This means that code readability is very important, so when we “fulfill requirements”, in addition to considering the user's functional requirements, we should also pay more attention to how to write readable code.
@NoHeartPen Contribution: After reading the 吐槽 about conda in the first issue, I started to pay attention to this problem, but I haven't found a relatively systematic summary. After reading this article, I finally had a general idea (this article not only wrote "how to do it", but also wrote "why", which made me change my bad habit of not building a virtual environment and give up tossing conda). In addition, I attach the translated version How to Relieve the Pain of Python Packaging.
Travis Oliphant, the creator of NumPy, once said that if NumPy had GPU support at that time, there would be no deep learning frameworks like Tensorflow and Torch. CuPy is a NumPy-compatible library with GPU support (7K stars). This article introduces its installation and the basics of arrays.
Why is it said that everything in Python is an object? Why is Python much slower than other statically typed languages? This article starts with the CPython object constructor and introduces the underlying data structure of CPython, the process of object creation, and the implementation of dynamic typing.
A long article about building an API application with Flask + Flask RESTful, using the Flask-SQLAlchemy extension to implement ORM operations on a MySQL database, implementing registration, login, and logout interfaces based on JWT authentication, solving cross-origin issues, and deploying the application with Docker.
This article explores request and response handling in Django, covering the basics, the lifecycle, and detailed explanations of the HttpRequest and HttpResponse objects. It also discusses Django views and request and response handling, as well as considerations for security and asynchronous handling. Finally, it compares and contrasts Django with other frameworks such as Flask and FastAPI in terms of request and response handling.
The author encountered many issues when adding Mypy type checking to a production project: many libraries don't provide pyi types, TypedDict has limited use, Optional types require many assertions, mixin classes need to implement protocols, and Django models don't support generics. In short, adding type checking to a legacy project is painful and is best considered from the beginning.
Notion is a powerful knowledge management software, this tutorial teaches you how to use Python to operate Notion's database: create integration, create pages in the database, query databases and pages, update pages, delete pages.
How to package Rust code as an extension that can be used by Python? maturin and setuptools-rust are two mainstream ways. However, when prototyping, the packaging and integration process is still quite troublesome. This article introduces a new library rustimport, which can directly import Rust code from Python! The article introduces how to use it, the most common performance mistakes for Rust beginners, and some pitfalls when using rustimport.
Python's newlines and indentation are fundamental parts of its program structure. What role does whitespace play in Python's syntactic parsing, and how does the lexer handle newlines and indentation? What are the advantages and disadvantages of Python's whitespace? How does Python parse the code and generate the abstract syntax tree?
Introduces 7 methods to remove duplicate values from a Python dictionary: using for loop, using dictionary comprehension, using setdefault() method, using values() and set() methods, using collections.defaultdict(), using list comprehension, using dict.fromkeys() and values().
When should you profile your project for performance optimization? What should you focus on before tuning the performance, and what tools should you use? This article introduces tools like time, timeit, cProfile, Pyinstrument, perf and some performance optimization skills.
Introduces 3 very useful libraries: JMESPath (star 1.9k) can easily query elements in Json, inflection can easily process strings (such as batch modifying camel case variable names to snake case naming), more-itertools is similar to the standard library itertools, providing many methods to operate iterable objects (star 3.1k).
Have you ever seen a Python monorepo with nearly 30k files (excluding tests)? 400 developers around the world are working on it together, how to avoid chaos? The author introduces the practice of hierarchical management of the code warehouse, the architecture and tools used (import-linter), and some difficulties overcome.
🎁 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).
Threads continues to be one of the hottest topics in tech this week with the new release of this project that reverse-engineers its API, allowing you to use Python to interact with many of Threads' features.
This project uses RSS to fetch blogs from tech companies like AWS, Apple, DeepMind, Google, Meta, Stripe, etc., calls gpt-3.5 to generate summaries, stores the data in supabase, and hosts a Next.js website on Vercel.
Adds modern, responsive component functionality to Django templates without the need for a Javascript framework. Supports a wide range of features including form validation, redirects, loading states, partial updates, scroll triggers, messaging, Javascript integration, and more.
It can batch convert image links from local to image server, image server to local, and image server to image server. (Submitted by @Zeeland)
Image of imarkdown execution process
Can AI improve the accuracy of weather forecasting? Pangu-Weather is a 3D high-resolution model that forecasts global weather rapidly and accurately. This repository provides resources including pseudocode, pre-trained models, inference code, and more.
Fine-tuned with 4 million instructions in the Chinese medical and general domains, it supports various natural language processing tasks in the medical field, including health education, medical examination questions, report interpretation, medical record structuring, and simulated diagnosis and treatment. Based on this large model, there are already many applications, such as XrayPULSE, an application combined with X-ray image models:
Scan virtual environments for unused dependencies, supporting Poetry, Pipenv, PDM, requirements.txt files, and PEP-621 pyproject.toml files.
A large language model for self-media creation, live broadcasting, and operation, which can understand the core concepts and strategies of Douyin operation, short video creation, massive Qianchuan delivery, live broadcasting operation, etc., and supports content creation, platform operation, advertising delivery, etc.
A meta-programming framework that assigns different roles (e.g., product manager/architect/project manager/engineer) to GPT, enabling them to collaborate and complete complex software development tasks. With just a single line of requirement, it can generate user stories/competitive analysis/requirements/data structures/APIs/documentation, etc. (3.7k stars)
An AI assistant that builds on your personal Markdown notes, PDF files, Github code repos, and photos, enabling search and chat, and can be interacted with via multiple interfaces including browser, Emacs, Obsidian, and mobile.
A command-line chat tool that lets GPT create new projects or modify code in existing git repos. It can easily commit, compare, and revert changes with no manual copy/pasting. (2.3k stars)
The official implementation of a CVPR 2023 best paper, enabling: natural language question answering and reasoning over image content, object labeling in images, natural language image editing, and more.
Python is used extensively at Netflix, for use cases such as CDN, demand forecasting and resiliency, security, machine learning, and more. This podcast episode discusses Netflix's experience with Python. Also shared is an older blog post from their official blog that got 8k likes, titled "Python at Netflix".
- Python Bytes #343 So Much Pydantic! (English)
This episode covers a lot of topics, but two of them are about Pydantic: the release of version 2 and an awesome-pydantic list of open source projects using Pydantic.
A question on Zhihu, with many highly upvoted answers in the front row, each showing their own unique skills!
PEP-703 has been one of the most anticipated proposals in the Python community this year (I covered it earlier this year!). Last month, Guido mentioned on the forum that it would be great if they could get backing from a tech company like Meta. Well, good news everyone, Meta stepped up last week and pledged engineering resources. The news has been met with much discussion on platforms like Twitter and Hacker News (see HN thread).
- 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.

