Python Trending Weekly
ISSUE 61

PyPI Admin Key Leak Incident

2024-07-20 Season 3

TL;DR

A leaked PyPI admin token nearly caused the worst supply-chain attack imaginable, caught by binary secret scanning; free-threaded CPython opens up for experiments, and exo turns everyday home devices into an AI cluster.

Articles 12 Projects 12 Media 2 Discussions 2
🦄

Articles & Tutorials

× 12
01 Binary secret scanning helped us prevent (what might have been) the worst supply chain attack you can imagine jfrog.com

JFrog's security team uncovered a PyPI admin key leak that could've been catastrophic - we're talking access to 200+ repositories across python, pypa, psf, and pypi organizations! The admin had hardcoded the key in source code and later removed it, but it lingered in cached pyc files. This shows that source code security scanning isn't enough - binary security scanning is equally crucial!

02 Incident Report: Leaked GitHub Personal Access Token blog.pypi.org

The PSF Infrastructure Director (the person involved in the previous incident) published an incident report revealing that the leaked key had been committed about a year ago - thankfully, it wasn't maliciously exploited! Key takeaways: set appropriate expiration times for tokens, exclude __pycache__ and *.pyc files when building Docker images, and keep your source code clean.

03 【Network Security】「Vulnerability Reproduction」(Part 6) Exploring Prototype Chain Exploitation and Pollution in Python juejin.cn

From the "Learning Security Testing from 0 to 1" series, this article explores Python prototype chain exploitation and pollution through a Flask web app's server-side template injection attack. It helps readers understand prototype chain concepts, mechanisms, and potential security risks in Python.

04 Free-threaded CPython is ready to experiment with! labs.quansight.org

Python 3.13 is dropping in just over 2 months - ready to experiment with the GIL-free feature? This article introduces the free-threaded-compatibility repository, provides resources, and tracks open-source project support for no-GIL. It also covers two thread safety issues discovered in numpy and pywavelets.

05 Several Methods for Python Performance Analysis: Finding That Special One in Your Code juejin.cn

Learn how to use the profilehooks library to detect Python code performance, then leverage Snakeviz and gprof2dot visualization tools to analyze data, identify major performance bottlenecks, and achieve effective optimization.

06 Creating a Simple Pastebin Service in Python and Flask muhammadraza.me

Pastebin is an online service for sharing code and text. This article shows how to build one with Flask, supporting text pasting, programming language selection, and shareable URL generation, with detailed explanations of each code component. (Fun coincidence: we also received a long-awaited open-source project submission this week - a simple pastebin built with async Flask, shared by @yuxiaoy1!)

07 Debug note:CPython GH-121528 manjusaka.blog

@Manjusaka strikes again with another CPython bug fix! In Python 3.13 Beta, the PEP-683 implementation plus surrounding changes caused some extensions compiled under older versions to fail in Python 3.13.

08 Sharing Something Interesting: I Helped Fix a CPython Bug mp.weixin.qq.com

@Komeiji Satori also fixed a CPython bug! It was about Python's tuple cache pool issue - the final code change was just adding an "=" sign, but the process of discovering and reproducing the issue from source code really deepens your understanding of the Python interpreter.

09 How a Decorator Crashed My Flask App: Lessons Learned suyogdahal.com.np

What should you watch out for when writing Python decorators? The article's answer: always use functools.wraps - without it, multiple decorator usage can cause naming conflicts.

10 Proper Python Project Structure 2024 matt.sh

The article argues that using requirements.txt, manually creating and entering venv virtual environments, manually setting PYTHONPATH, and using setup.py to build extensions are all bad practices. The author presents a poetry-based project management solution instead.

11 Here’s how you can build and train GPT-2 from scratch using PyTorch differ.blog

Ever wanted to build your own GPT? Curious about how large models are trained? This article introduces and implements the basic components of large models, like tokenizers and data loaders. (Note: Part 2 of this series is Building and Training GPT-2)

12 10,000-Word Condensed Edition: 800 Links from Python Trending Weekly Season 1! pythoncat.top

Our newsletter's Season 1 and Season 2 each featured around 800 links and over 60,000 words - that's pretty mind-blowing! Wonder how many people have actually read everything? This article extracts all Season 1 links, categorized by type, making it easy for newcomers to browse and discover gems they might have missed!

🐿️

Projects & Resources

× 12
01 exo: Run your own AI cluster at home with everyday devices github.com

Build AI clusters on your iPhone, iPad, Android, Mac, and Linux devices. Supports LLaMA and other popular large models with automatic cluster device discovery. (2K stars)

02 kaskade: a text user interface for kafka, which allows you to interact and consume topics from your terminal in style! github.com

A sleek text user interface built with Textualize for managing and consuming Kafka topics, with Protobuf deserialization support.

kaskade:  a text user interface for kafka, which allows you to interact and consume topics from your terminal in style!
03 G-Scraper: A GUI web scraper, written completely in Python github.com

A simple visual web scraping project built with Requests + BeautifulSoup4 + PyQt5. Supports scraping multiple elements from multiple URLs, handles login/registration, and features comprehensive logging.

04 source2RSS: A Python framework for converting information sources to RSS github.com

Runs scrapers periodically to get information feeds and updates corresponding RSS sources, or saves data and generates RSS feeds when APIs receive data. (Shared by @AlterNao1)

05 mandala: A simple & elegant experiment tracking framework github.com

Supports automatic saving, querying, and version control of Python function-level operations, with the ability to store and track individual elements in collections.

mandala demo
06 jurigged: Hot reloading for Python github.com

Lets you update code while it's running! When you modify functions, it affects all call sites simultaneously; when you modify modules, it only reruns the changed lines without loading the entire module. (1.1K stars)

07 wenet: Production First and Production Ready End-to-End Speech Recognition Toolkit github.com

A production-oriented full-stack solution that achieves SOTA results on many public speech datasets. (3.9K stars)

08 mem0: The memory layer for Personalized AI github.com

Provides an intelligent, self-improving memory layer for large models, enabling personalized AI experiences across platforms and applications. (10.8K stars)

09 MinerU: One-stop data extraction tool supporting PDF/web pages/multi-format e-books github.com

Features Magic-PDF and Magic-Doc capabilities, converting PDFs, web pages, or multi-format e-books to Markdown format.

10 promptdoc: Designed to manage a collection of Prompt templates for multiple versions, scenarios, and applicable models github.com

A prompt template management project built with Flask + MongoDB, supporting basic CRUD operations.

11 disposable-email-domains: a list of disposable and temporary email address domains github.com

Contains nearly 4,000 disposable domain email addresses, useful for registering virtual users. (2.7K stars)

12 fastembed: Fast, Accurate, Lightweight Python library to make State of the Art Embedding github.com

A framework specifically designed for generating embeddings, supporting popular text models. No GPU or PyTorch dependencies required - uses ONNX runtime and outperforms OpenAI Ada-002. (1.2K stars)

🐢

Podcasts & Videos

× 2
01 SE Radio 624: Marcelo Trylesinski on FastAPI – Software Engineering Radio se-radio.net

From the podcast hosted by IEEE Computer Society and IEEE Software magazine, featuring a senior software engineer at Pydantic who's also a maintainer of Starlette, Uvicorn, and other projects. The discussion focuses on FastAPI's design, implementation, and applications.

02 The Python Show Python 42 - Harlequin - The SQL IDE for Your Terminal pythonshow.com

Harlequin enables visual SQL operations in the command line terminal. This podcast episode features the library's author discussing the project's origins, why they chose TUI over GUI, lessons learned, and more.

🥂

Discussions & Questions

× 2
01 I'm a Python Backend Developer, How to Create a Modern and Fast Frontend? reddit.com

A Reddit thread exploring the best/newest frontend tech stack options. HTMX appears with surprisingly high frequency!

02 What are the Cost-Effective Solutions for Implementing Scheduled and Delayed Tasks in Python in 2024? v2ex.com

A V2EX thread discussing various Python task management solutions.

ESC
↑↓ select · ↵ open175 issues