Python Trending Weekly
ISSUE 25

Python Trending Weekly #25 (2023-11-04)

2023-11-04 Season 1

TL;DR

Ruff, the Black-compatible formatter that's blazingly fast, steals the show; when to upgrade to 3.12, why to ditch requirements.txt, and building an async ASGI framework from scratch are also practical reads.

Articles 12 Projects 12
🦄

Articles & Tutorials

× 12
01 Ruff: A Blazing Fast, Black-Compatible Python Formatter astral.sh

I introduced Ruff, the fastest code analysis tool, in April this year, and found that it is not limited to the positioning of Linter, but also provides some Formatter functions. Now, it has released a major update and officially become the fastest Python code formatter, which is more than 30 times faster than Black and 100 times faster than YAPF!

Performance without cache, formatting about 250,000 lines of code
02 When Should You Upgrade to Python 3.12? pythonspeed.com

Python 3.12 is out, and you are eager to upgrade. Is now the best time to make the jump to 3.12? The article suggests that you wait until December for the 3.12.1 bug-fix release because the new version has these issues: incompatible packages, missing binary packages, and every major release has a bunch of issues that need to be fixed.

03 Python 3.12: An Epic Release That Went Under the Radar manjusaka.blog

The author believes that Python 3.12 is more significant to Python than 3.5's "async/await" and 3.6's "Type Hint"! The author mainly analyzes three aspects of improvement: observability brought by PEP-669, performance improvement brought by PEP-684 for non-GIL, and the new C API in PEP-697 that ensures compatibility across versions.

04 Do Not Use requirements.txt Anymore quanttype.net

The author provides two suggestions: do not use pip and requirements.txt to manage Python dependencies, and recommends using Poetry instead. The main problems with pip are the lack of a lockfile and the hassle of manually managing virtual environments. In addition to Poetry, the author also mentions Hatch and PDM.

05 Why Is the Django Admin Interface So Ugly? coderedcorp.com

Django provides a default admin interface, Django Admin, whose UI hasn't changed in many years and looks outdated. Why don't Django maintainers improve it? The author found out its history and the reasons for such design by interviewing several maintainers. The main point is that Django Admin is for internal administrators and shouldn't be exposed to end users.

Django Admin Interface
06 My User Experience Porting Off setup.py gregoryszorc.com

A long article by the author of PyOxidizer, who encountered an issue where python setup.py in CI failed with setuptools import errors when using Python 3.12 for another library. The author went through a complex and time-consuming process to find a solution, highlighting the confusing state of Python's packaging ecosystem.

07 Boost Your Coding Efficiency with Ptpython realpython.com

Ptpython is a feature-rich and user-friendly Python REPL, and this is a very detailed tutorial on how to use it. The highlighted features include history, input validation, autocompletion, automatic indentation handling, customizing the interactive shell, embedding ptpython in scripts, and more.

08 100% Test Coverage Is Not Enough: Property-Based Testing in Python blog.robertroskam.com

While test coverage is important, it is not a silver bullet. This article demonstrates the shortcomings of test coverage with examples and briefly introduces how to do property-based testing with Hypothesis.

09 Writing an ASGI Web Framework from Scratch in Python cnblogs.com

Is it difficult to write an asynchronous ASGI web framework from scratch? What knowledge do you need to know, what functions do you need to implement, and what problems do you need to think about? This step-by-step tutorial is a great learning material, allowing you to understand web framework design, asynchronous programming, functional encapsulation, and project management.

The lifecycle of a request
10 How to Hide Plaintext Passwords in Python Logs? cnblogs.com

It is a security requirement not to print plaintext passwords in logs, but there are too many possible scenarios where passwords may be printed. How can plaintext passwords be hidden efficiently? This article introduces two implementation schemes based on the logging module: a custom filter and a custom formatter, which use specific rules to filter plaintext passwords.

11 From Chaos to Cohesion: Building Your Own Monorepo monadical.com

A monorepo is a code repository that stores all projects, possibly containing different languages and frameworks. This means that its dependency management and CI/CD are different from those of ordinary code repositories. This article introduces how to use GitHub Actions as a CI/CD tool to build a simple Python monorepo.

12 Python Is a Compiled Language eddieantonio.ca

We are used to calling Python an interpreted language because it interprets and executes code line by line at runtime. Many people also know that Python actually has a compilation process, and the interpreter compiles before executing. However, the author does not stop there. Through Socratic dialogue and several rounds of experiments, he leads readers to rethink "interpretation" and "compilation": they are false dichotomies that limit the possibilities of programming languages. Python is both an interpreted and a compiled language!

🎁 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 ccxt: Cryptocurrency trading API with support for 100+ exchanges github.com

A JavaScript/Python/PHP/C# library for cryptocurrency trading with support for many Bitcoin/Ethereum/Altcoin exchange markets and merchant APIs. (star 29.5K)

02 uDjango: A Django microproject in a single file github.com

This project is a demo project for DjangoCon US 2023, showing a minimal Django application in a single file with less than 10 lines of code.

03 esmerald: Highly Scalable, High-Performance Web Framework github.com

A ready-to-use web framework built on top of Starlette and Pydantic for building modern scalable API applications, supporting both synchronous and asynchronous, providing features like DAO, ORM, ODM, dependency injection, permission management, etc.

esmerald: Highly Scalable, High-Performance Web Framework
04 Python-Type-Challenges: Learn Python Type Hints Through Online Challenges github.com

An interesting project that includes a series of challenges from beginner to advanced levels, allowing you to practice using type hints online.

05 Mify: Microservice Infrastructure, Code Generation Tool github.com

Generates OpenAPI http server, built-in Prometheus metrics, provides structured logging, supports multiple language code generation.

06 de4py: Python Reverse Engineering Toolkit github.com

A state-of-the-art Python deobfuscator designed for malware analysts and reverse engineers, featuring a beautiful UI and a bunch of advanced features.

07 public-apis: A collective list of public APIs for developers github.com

A very, very extensive list of public APIs, covering pretty much everything under the sun. (2k stars)

08 FunASR: End-to-End Speech Recognition Toolkit github.com

FunASR is an open-source speech recognition toolkit developed by Alibaba DAMO Academy. It provides a range of functionalities, including automatic speech recognition (ASR), voice activity detection (VAD), punctuation restoration, language modeling, speaker verification, speaker separation, and multi-party conversation speech recognition. (1.2K stars)

09 XHS_Downloader: A Tool for Downloading Xiaohongshu Images and Videos github.com

Supports downloading Xiaohongshu images and videos in batches, with a mechanism for ensuring the integrity of the downloaded files.

Image of XHS_Downloader
10 RSS-GPT: Generate Summaries for Your RSS Feeds Using ChatGPT github.com

Uses a simple Python script, automated with GitHub workflow, to call the OpenAI API to generate summaries for RSS feeds, then pushes the newly generated RSS feed to GitHub Pages. Easy and quick to set up, no server required.

11 codespell: A Tool for Checking Code for Common Misspellings github.com

Checks source code for misspelled words, supports multiple running modes, can specify ignored words and files, and can be used for pre-commit. (1.5K stars)

12 codeshell: A Large-Scale Code Model Foundation in Multiple Languages github.com

With 7 billion parameters, trained on 500 billion tokens, and a context window length of 8192, CodeShell achieves state-of-the-art performance on authoritative code evaluation benchmarks. (1.2K stars)

ESC
↑↓ select · ↵ open175 issues