Best of Planet PythonJanuary 2025

  1. 1
    Article
    Avatar of planetpythonPlanet Python·1y

    Create Project-Less Python Utilities with uv and Inline Script Metadata

    Learn how to create and run Python utility scripts with inline metadata using uv. This method avoids the need for a full Python project and simplifies dependency management by embedding metadata directly into the script. The post provides an example script for searching and fetching details from the Google Books API, along with additional examples for summarizing YouTube videos and scraping articles.

  2. 2
    Article
    Avatar of planetpythonPlanet Python·1y

    The Absolute Minimum Every Python Web Application Developer Must Know About Security

    When developing Python web applications, it's essential to follow basic security principles: never store passwords in plain text, always use salted hashes or delegate password management to modern frameworks, and ensure data is encrypted both in transit and at rest. The Defence in Depth approach emphasizes multiple layers of security, including the use of TLS for network security and understanding cryptography algorithms. The guide also covers important security principles, the OWASP Top Ten vulnerabilities, and the CVE warning system.

  3. 3
    Article
    Avatar of planetpythonPlanet Python·1y

    Decorators | Pydon't 🐍

    Learn about the decorator pattern in Python, why it exists, how to use it, and when to use it. This post explains how the decorator pattern helps write more modular and efficient code, with practical examples like caching and timing functions. It also covers creating custom decorators, using functools.wraps to preserve function metadata, and decorators with arguments. Additionally, it touches on class decorators and their use cases.

  4. 4
    Article
    Avatar of planetpythonPlanet Python·1y

    How I run standalone Python in 2025

    The author shares their experience of managing Python projects in 2025. They use uv for Python version and dependency management, replacing tools like pip, pyenv, Homebrew, and Poetry. The author explains how they handle Python executables for standalone scripts using a custom bash script that integrates uv to quickly run scripts with specific dependencies.

  5. 5
    Article
    Avatar of planetpythonPlanet Python·1y

    We have been writing Ansible tasks wrong

    The author discusses a preference for writing Ansible tasks in a way that resembles Python code due to its procedural clarity. They explore how Ansible’s declarative nature can still benefit from programming language constructs like if-else, loops, and exception handling. Examples are provided to show how tasks can be written more intuitively, although some limitations remain.