Python Trending Weekly
ISSUE 84

Python Best Practices in 2024

2025-01-04 Season 3

TL;DR

Modern best practices for Python development cap 2024 alongside a Flask year in review, and minimind trains a 26M-parameter GPT from scratch in three hours.

Articles 12 Projects 12
🦄

Articles & Tutorials

× 12
01 Modern Good Practices for Python Development stuartellis.name

A comprehensive Python development practices guide covering Python selection and management, development tools (package management, formatting, and code checking), language syntax usage, testing tools, packaging tools, logging, virtual environments, and more. It's pretty much all-encompassing.

02 State of the Art Python in 2024 4zm.org

What are the best practices for creating Python projects in 2024? What tools are recommended? The author's list includes uv, ruff, pyproject.toml, pyright, pydantic, pytest, and click. The article received lots of upvotes and replies on Reddit.

03 A Year In Review: Flask in 2024 blog.miguelgrinberg.com

What interesting things happened in the Flask community in 2024? The author reviews Flask's development from several perspectives, including version releases, framework development speed, new features, backward compatibility, competition, and popularity.

04 Introducing Annotated Logger: A Python package to aid in adding metadata to logs github.blog

GitHub's vulnerability management team has open-sourced a new logging library called Annotated Logger. It uses decorators to log function and class execution, supports custom log objects, sends JSON-formatted logs, and supports adding fields like Git branch and vulnerability names to logs.

05 Cowboy Debugging Python Memory Leaks rtpg.co

How do you debug memory leak issues in Python? The author shares the objgraph library, which can view memory object growth and trigger runtime checks through signals. The article shows how to use it to locate and visualize memory leaks, helping to quickly identify and resolve memory leak problems.

06 All your Python project in one file with shiv bitecode.dev

How do you use shiv to package a Python project and its dependencies into an executable zip file (zipapp)? How does shiv improve runtime speed? What other features does shiv support, and what issues should you watch out for when using it?

07 Project Quarantine blog.pypi.org

The official PyPI blog introduces the project quarantine feature, which allows administrators to flag potentially harmful projects and prevent malicious software from being installed. The article covers implementation details of this feature. Since August 2024, about 140 projects have been flagged for quarantine, with only one being corrected.

08 Debugging Python with VS Code and Sentry blog.sentry.io

How do you set up and use debugging features in VS Code? The article covers installing extensions, configuring debug environments, using breakpoints, adding variable monitoring, handling common exceptions like FileNotFoundError and JSONDecodeError, and shows how to use Sentry for continuous monitoring and debugging in production environments.

09 Build your Jupyter dashboard using Solara blog.jupyter.org

Introduces using Solara's UI components to create an interactive dashboard in Jupyter, with the final product allowing users to filter, visualize, and explore datasets on a map. The second part of the series covers how to deploy the service, and the third part introduces adding more components to extend the dashboard.

10 Disposable environments for ad-hoc analyses ericmjl.github.io

juv is a tool for simplifying Python environment management in Jupyter notebooks, allowing dependencies to be embedded directly in notebook files for easier setup and sharing. The article also covers integrating juv with pyds-cli for temporary data analysis, enhancing reusability and reducing environment conflicts.

11 Python: spy for changes with sys.monitoring adamj.eu

The sys.monitoring introduced in Python 3.12 can listen for specific events on particular code lines, providing fine-grained control. The article demonstrates through practical examples how to use it to monitor changes to sys.path, how to set up monitoring callback functions, and shows its powerful utility in debugging complex code.

12 Implementation and Extension: Applications of the Boids Algorithm people.ece.cornell.edu

The Boids algorithm is an artificial life program that simulates flocking behavior in birds, producing realistic natural bird dynamics. The article provides an in-depth explanation of Boids algorithm implementation, introduces how to implement Boids animation on TFT displays, and explores possibilities for adding complex behaviors like predators and roosting behavior.

🐿️

Projects & Resources

× 12
01 enlighten: Enlighten Progress Bar for Python Console Apps github.com

A Python console colored progress bar library with the advantage of writing directly to stdout and stderr, supporting Jupyter Notebooks.

02 migrate-to-uv: Migrate a project from Poetry/Pipenv to uv package manager github.com

Helps you quickly migrate Poetry/Pipenv projects to the currently popular uv package manager.

03 minimalistic-fastapi-template: This is a simple but robust FastAPI project ready for your startup! github.com

A modern, production-ready FastAPI project template supporting CRUD, async SQLAlchemy with PostgreSQL, custom exception handling, CI and testing pipelines, pre-commit code checking, and one-click Railway deployment.

04 minimind: Train a 26M parameter GPT from scratch in 3 hours github.com

Train a tiny language model under 30M parameters completely from scratch, with fast inference and even training possible on regular personal GPUs. Not just an open-source model implementation, but also a tutorial for getting started with Large Language Models (LLMs). (3.2K stars)

05 adrf: Async support for Django REST framework github.com

Enables Django to support async class and function-based views, supporting Django 4.1+.

06 FastVideo: accelerating large video diffusion model github.com

A lightweight framework for consistency distillation of video diffusion models, achieving 8x inference acceleration. Supports distillation/fine-tuning/inference of state-of-the-art open video DiTs.

07 codegate: CodeGate: CodeGen Privacy and Security github.com

A local gateway that ensures AI-generated suggestions follow best practices while protecting code integrity and safeguarding personal privacy. Use AI with confidence without worrying about security and productivity.

08 shrlnk: get to customize your links all you want github.com

An open-source URL shortening service implemented in Python, providing a free website. Supports creating and customizing short links, link management and tracking, and social media preview effects. Backend built with Flask + SQLite, frontend JavaScript supports mobile responsive design.

09 dutch_vocabulary: send an automated email each day with three C1-level dutch words github.com

Uses AWS CloudWatch event rules to trigger Lambda functions, leveraging databases and ChatGPT to get Dutch words, English translations, and example sentences, automatically sending emails.

10 mixbox: a library for natural color mixing based on real pigments github.com

A new mixing method for natural color blending that generates saturated gradients with hue variations and natural secondary colors during mixing, closer to real pigment colors. (2.7K stars)

mixbox: a library for natural color mixing based on real pigments
11 Kats: a kit to analyze time series data github.com

A lightweight, easy-to-use, extensible framework for time series analysis, from understanding key statistics and features, detecting change points and anomalies, to forecasting future trends. (5.4K stars)

12 ajenti: Ajenti Core and stock plugins github.com

A modular server management panel for Linux and BSD, developed with Python3 and AngularJS. Low memory footprint and CPU usage. Can run on low-end machines, wall plugs, routers, and other devices. (7.6K stars)

ESC
↑↓ select · ↵ open175 issues