Python Trending Weekly #13 (2023-07-29)
Welcome to the 13th issue of Python Trending Weekly, a weekly newsletter about Python, AI and general programming techniques. The original version of the weekly publication was written in Chinese, and what you are reading here is the English version translated by ChatGPT.
Most of the content shared here is in English, with a small portion in Chinese, which is indicated in the title. It took a lot of courage for me to publish this weekly publication, originally intended for Chinese readers, to the English-speaking world. Your feedback is welcome, and I appreciate your subscription and support!
Telegram Channel : https://t.me/pythontrendingweekly
🦄Articles & Tutorials
1、Announcing Jupyter Notebook 7
Major update of Jupyter Notebook, highlights include real-time collaboration, interactive debugging, directory, themes and dark mode, internationalization, improved accessibility, compact view on mobile devices.
2、Exploring Weak References and Basic Type Support in Python (Chinese)
Python's basic types Int, List, Dict, Tuple, Str do not support weak references, while Object, Type, Set and other types do support weak references, why is this the case? The article gives its own analysis.
3、Introduction and Python Implementation of Distributed Locks (Chinese)
When should distributed locks be used? How to implement distributed locks with py-redis, what is the process of locking and unlocking? What are the points to note about the lock timeout, how to implement WatchDog to automatically renew the lock?
4、Unleashing the Power of PyScript: Running Python Code in HTML
An introductory tutorial on PyScript, introducing installation, basic knowledge, usage with Flask and advanced features.
5、Faster File I/O Through Concurrency
What is file I/O, why is it much slower than main memory I/O? What factors does the speed of file I/O depend on? What methods are there to improve file I/O performance?
6、How to Write Impeccably Clean Python Code?
The article introduces some best programming practices, covering code structure, pre-commit, type hints, docstrings, lint, Pydantic, spell check, testing and other aspects.
7、Python Logging: Comparing the 6 Most Popular Libraries
The article provides a detailed comparison of the currently most popular 6 logging frameworks: logging, loguru, structlog, Eliot, logbook and picologging. The most recommended are undoubtedly the first two, the others are for interest.
8、Using cProfile to Analyze Module-Level Code
How to use cProfile to perform performance analysis on Python code? The article briefly introduces its usage, and gives two advanced usage methods: context manager and decorator.
9、Mastering Functional Programming in Python
The article introduces the advantages of functional programming, Python's support for functional programming, best practices and errors to avoid when writing Python programs.
10、Python 3.12 Preview: More Intuitive and Consistent f-string
What limitations does f-string have before Python 3.12? What changes will the upcoming 3.12 version bring? New feature preview: embedded expressions can reuse quotes, f-string allows the use of backslashes, comments can be written in multi-line expressions, arbitrary levels of f-string nesting, optimized f-string error prompts...
11、Creating Awaitable Constructors with AsyncMixin
Introduces how to use a mixin named AsyncMixin
to create asynchronous constructors in Python.
12、Finding and Fixing Insecure Direct Object References in Python
Insecure Direct Object References (IDOR) is a security vulnerability, the article introduces the harm of this vulnerability, how to identify and fix IDOR vulnerabilities.
13、Overcoming Performance Bottlenecks with Asynchronous Python: A Deep Dive into CPU-Intensive Code
The author introduces how to identify and optimize CPU-intensive code in feature storage to improve the performance of the core model. What is event loop delay, how to monitor the time consumed by asynchronous code?
14、PEP-720 Cross-Compiling Python Packages
Cross-compiling refers to compiling programs for another architecture on one computer. This PEP attempts to reveal the challenges of cross-compiling and improve upon them.
15、PEP-722 Dependency Specification for Single-File Scripts
There are many solutions for recording and managing third-party libraries in projects. But how to manage third-party library dependencies for single files? This PEP proposes a very simple specification format.
🎁Python Trend Weekly🎁 has been published for free for 13 issues, visit the link below to view all content: https://pythoncat.top/tags/weekly
🐿️Projects & Resources
1、Resume-Matcher: Compare resumes with job descriptions, ranked by scoring
An AI-based resume matcher that scores resumes based on the keywords in the job description. It uses Qdrant (an efficient vector similarity search tool) to measure the match between the resume and the job description.
2、awesome-python-htmx: Selected content for web development using htmx in Python
PyHAT aims to promote htmx+ASGI+TailwindCSS in Python, this project lists some introductory resources, tutorials, design theories, peripheral ecosystems, etc.
3、CodeGeeX2: A more powerful multi-language code generation model (Chinese)
Based on the ChatGLM2-6B pedestal language model, it achieves a Pass@1 pass rate of 35.9% in Python, surpassing the larger StarCoder-15B. CodeGeeX plugin supports VS Code, IntelliJ IDEA, PyCharm, GoLand, WebStorm, Android Studio and other IDEs. (star 1K)
4、Chinese-Llama-2-7b: The first downloadable and runnable Chinese LLaMA2 model (Chinese)
Open source and commercially available Chinese version of the Llama2 model and Chinese-English SFT dataset, compatible with all optimizations for the original llama-2-chat model. (star 1K)
5、docker-llama2-chat: LLaMA2 (official / Chinese version / INT4 / llama2.cpp) (Chinese)
A Chinese open source project, three steps to get started with LLaMA2, the author has written a series of tutorial blogs.
6、taipy: Transforming data and AI algorithms into complete web applications
A full-stack project that quickly builds web applications from data and AI.
7、pyrasite: Injecting code into a running Python process
Allows injecting custom code into a running Python process to achieve dynamic debugging, modifying variable values, cracking encryption, analyzing runtime behavior, etc. Supports various injection methods, including injecting into the Python interpreter, injecting into specific functions, injecting into specific threads, etc. (star 2.7K)
8、python-manhole: Debugging running Python programs
Provides interactive debugging and monitoring functions in running Python processes, using Python's "ptrace" mechanism, by injecting code into the target process, it can be connected via SSH or telnet protocols for remote interaction. Compatible with gevent and eventlet, with some restrictions.
9、vscode-python: Setting up a Python development environment with VScode and Docker
A very comprehensive tutorial project, guiding how to run Python on Docker, set up development environment and container extensions, testing and deployment, etc.
10、webdriver_manager: Webdriver manager for Python
When using frameworks like Selenium and Playwright, you need to manage various browser drivers. This project simplifies the management and usage of browser drivers.
11、lets-plot: Open source plotting library for statistical data
An open-source plotting library by JetBrains, it can create beautiful, interactive statistical charts and data visualizations. It provides a ggplot2-like plotting API for Python and Kotlin developers. (star 1.1K)
A small python-gtk program that edits PDF documents in an intuitive way. Its backend is based on pikepdf, which is a library for reading and writing PDF files. (star 2.3K)
🥂Discussion & Question
1、Steering Council Notice about PEP-703 (Making the Global Interpreter Lock Optional in CPython)
In the 11th issue of the newsletter, we shared "If PEP-703 is adopted, Meta will invest manpower to support", now there is progress, the steering committee plans to accept PEP-703! This post lists several basic principles and a three-stage development plan. Backward compatibility is the top priority, this will not be Python 4.
🐱Sponsor & Support
If you find the weekly valuable, feel free to appreciate or buy me coffee to support!
If you like the weekly, please share it with others who need it, so that more people can benefit from it~