This feature dives into actionable techniques for improving Python code quality, addressing common issues like nested loops, long functions, and unclear conditionals. It provides practical refactoring examples using list comprehensions, modular functions, ternary operators, type hints, and the Loguru library for better logging.
https://dev.to/resource_bunk_1077cab07da/your-python-code-is-ugly-heres-how-to-fix-it-40dm
https://dev.to/resource_bunk_1077cab07da/your-python-code-is-ugly-heres-how-to-fix-it-40dm
👍1
This recounting by Max Bernstein details a real-world performance optimization saga from developing a custom Python runtime, where a seemingly innocuous string function bottlenecked Django performance. The analysis reveals how a naive Python implementation of str.rpartition led to excessive, costly UTF-8 indexing operations, emphasizing the need to look beyond surface-level profiler results to find the true cause of slowdowns.
https://bernsteinbear.com/blog/silly-perf/
https://bernsteinbear.com/blog/silly-perf/
Max Bernstein
Optimizing Django by not being silly
I just saw this post and it reminded me of a time when we had a similar situation, but with string operations in our VM. The project is now defunct but the code is open. Let’s go back in time.
Use Typer (type hints) to define the interface for your Django management commands.
https://github.com/django-commons/django-typer
https://github.com/django-commons/django-typer
GitHub
GitHub - django-commons/django-typer: Use Typer (type hints) to define the interface for your Django management commands.
Use Typer (type hints) to define the interface for your Django management commands. - django-commons/django-typer
This demonstration walks through creating a functional Python compiler using Python, explaining the core steps from source code to execution. It breaks down tokenization, Abstract Syntax Tree (AST) generation, bytecode compilation, and interpretation with a simple virtual machine.
https://dev.to/resource_bunk_1077cab07da/how-i-built-a-python-compiler-yes-really-1dgp
https://dev.to/resource_bunk_1077cab07da/how-i-built-a-python-compiler-yes-really-1dgp
DEV Community
How I Built a Python Compiler (Yes, Really!)
Take this as an GIFT 🎁: Build a Hyper-Simple Website and Charge $500+ And this: Launch Your First...
This Pybites exploration delves into Python generators, explaining how the yield statement enables memory-efficient, on-demand value production crucial for large datasets. It details the mechanics of generator functions, the conciseness of generator expressions, and the advantages of their lazy evaluation and state preservation capabilities.
https://pybit.es/articles/generator-mechanics-expressions-and-efficiency/
https://pybit.es/articles/generator-mechanics-expressions-and-efficiency/
Pybites
Optimizing Python: Understanding Generator Mechanics, Expressions, And Efficiency - Pybites
Python generators provide an elegant mechanism for handling iteration, particularly for large datasets where traditional approaches may be memory-intensive.
👍1
Phil Eaton’s recent blogpost explores how to embed Python within Rust for the purpose of running tests, offering a hands-on guide to setting up a Rust-based test runner that can execute Python noscripts and even expose Rust functions to Python code. This practical walkthrough highlights the flexibility of combining Rust’s performance with Python’s noscripting capabilities for more dynamic and parallel test scenarios.
https://www.enterprisedb.com/blog/embedding-python-rust-tests
https://www.enterprisedb.com/blog/embedding-python-rust-tests
EDB
Embedding Python in Rust (for tests)
The latest generation of pr
A Self-adaptation Framework🐙 that adapts LLMs for unseen tasks in real-time!
https://github.com/SakanaAI/self-adaptive-llms
https://github.com/SakanaAI/self-adaptive-llms
GitHub
GitHub - SakanaAI/self-adaptive-llms: A Self-adaptation Framework🐙 that adapts LLMs for unseen tasks in real-time!
A Self-adaptation Framework🐙 that adapts LLMs for unseen tasks in real-time! - SakanaAI/self-adaptive-llms
👍2
Installing Python dependencies with pip can be frustratingly slow, especially in CI pipelines or when building Docker images. This guide discusses how to speed up the process by focusing on using pre-built wheels instead of source distributions, leveraging package caching, disabling bytecode compilation when appropriate, and considering faster alternatives like uv, a Rust-based package installer that parallelizes downloads and skips bytecode compilation by default.
https://pythonspeed.com/articles/faster-pip-installs
https://pythonspeed.com/articles/faster-pip-installs
Python⇒Speed
Faster pip installs: caching, bytecode compilation, and uv
Installing packages with pip can be slow. Learn some ways to speed it up.
OpenTelemetry is an open source, vendor-neutral observability framework that provides standardized APIs, libraries, and tools to collect telemetry data-such as metrics, logs, and traces-from your application, allowing you to monitor different systems and platforms seamlessly and future-proof your monitoring setup. To add OpenTelemetry to a Django application, you can use either automatic or manual instrumentation: automatic instrumentation involves installing packages like opentelemetry-instrumentation-django and configuring environment variables and your Django settings to export data to an observability backend (such as Elastic), while manual instrumentation gives you finer control by adding tracing and metrics code directly to your views and models, enabling custom monitoring of application behavior and performance.
https://allthingsopen.org/articles/what-is-opentelemetry-add-django-application
https://allthingsopen.org/articles/what-is-opentelemetry-add-django-application
All Things Open
What is OpenTelemetry and how to add it to your Django application | We Love Open Source • All Things Open
OpenTelemetry is an open source, vendor-neutral way to add monitoring features to your application. It is designed to allow you to monitor different systems using different backends in a standardized... Read More
👍2
David Guillot’s experiment investigates how web push notifications, when combined with Progressive Web Apps (PWAs), can offer a compelling alternative to traditional mobile apps for user engagement. By leveraging Django and packages like django-webpush and django-pwa, the article demonstrates a practical approach to implementing reliable, native-feeling notifications on both desktop and mobile-highlighting UX design considerations, technical constraints (such as iOS requiring PWA installation for notifications), and offering a live demo to gather community feedback on usability and device impact.
https://david.guillot.me/en/posts/tech/web-push-notifications-an-experiment/
https://david.guillot.me/en/posts/tech/web-push-notifications-an-experiment/
David Guillot
Push notifications without a mobile app: an experiment (with Django)
Today I want to talk to you about a combination of technologies that I don’t see often implemented, yet I wonder why: Web Push Notifications and Progressive Web Apps.
And I’d like you to try it, with kittens 😸
🔔 Why?
Say you have a small news website, or…
And I’d like you to try it, with kittens 😸
🔔 Why?
Say you have a small news website, or…
MicroPie is an ultra-micro ASGI Python web framework that gets out of your way.
https://github.com/patx/micropie
https://github.com/patx/micropie
GitHub
GitHub - patx/micropie: MicroPie is an ultra-micro ASGI Python web framework that gets out of your way.
MicroPie is an ultra-micro ASGI Python web framework that gets out of your way. - patx/micropie
This DataCamp blogpost demonstrates how to use Python for analyzing and predicting Bitcoin price patterns through time series analysis, focusing on both long-term and short-term trends. The article guides readers step-by-step through data collection, preprocessing, decomposition (additive and multiplicative), and the application of technical indicators like moving averages and RSI to uncover seasonal cycles, micro-patterns, and actionable trading signals in Bitcoin’s volatile price history.
https://www.datacamp.com/blog/python-bitcoin
https://www.datacamp.com/blog/python-bitcoin
Datacamp
Bitcoin Price Patterns: A Time Series Analysis in Python
Learn how to analyze and predict Bitcoin prices using time series analysis in Python.
Nelhage’s exploration of CPython’s new tail-call interpreter uncovers how an LLVM regression inflated early benchmark gains. This article details computed-goto mechanics, the LLVM 19 regression, and broader lessons in performance engineering.
https://blog.nelhage.com/post/cpython-tail-call/
https://blog.nelhage.com/post/cpython-tail-call/
Made of Bugs
Performance of the Python 3.14 tail-call interpreter
A deep dive into the performance of Python 3.14's tail-call interpreter: How the performance results were confounded by an LLVM regression, the surprising complexity of compiling interpreter loops, and some reflections on performance work, software engineering…
In “Binary Search as a Bidirectional Generator,” the author proposes treating the classic binary search as a bidirectional Python generator. This exposition shows how Python’s send method enables ergonomic, decoupled control flow for efficient search routines.
https://mathspp.com/blog/binary-search-as-a-bidirectional-generator
https://mathspp.com/blog/binary-search-as-a-bidirectional-generator
Mathspp
Binary search as a bidirectional generator
This article proposes an implementation of an ergonomic binary search algorithm implemented as a bidirectional generator.
Julia Evans’s “Terminal Rules” catalogs seven de facto conventions that make terminal programs behave predictably, from signal handling to color and input handling. This breakdown walks through rules such as using Ctrl-C to quit noninteractive programs, Ctrl-D to exit REPLs, and disabling colors when piping output.
https://jvns.ca/blog/2024/11/26/terminal-rules/
https://jvns.ca/blog/2024/11/26/terminal-rules/
Julia Evans
"Rules" that terminal programs follow
Recently I’ve been thinking about how everything that happens in the terminal is some combination of:
A collaborative note taking, wiki and documentation platform that scales. Built with Django and React. Opensource alternative to Notion or Outline.
https://github.com/suitenumerique/docs
https://github.com/suitenumerique/docs
GitHub
GitHub - suitenumerique/docs: A collaborative note taking, wiki and documentation platform that scales. Built with Django and React.
A collaborative note taking, wiki and documentation platform that scales. Built with Django and React. - GitHub - suitenumerique/docs: A collaborative note taking, wiki and documentation platform ...
👍2
Engineer’s Codex’s “The Boolean Trap” warns developers against using boolean flags in APIs and shows how they can hinder code readability and extensibility. This analysis advocates for using enums to represent function parameters, demonstrating how they improve clarity, maintainability, and future-proofing in real-world software design.
https://read.engineerscodex.com/p/the-boolean-trap
https://read.engineerscodex.com/p/the-boolean-trap
Engineerscodex
The Boolean Trap
Use enums instead
👍2
Akshay Kagrawal, Myles, and Dylan Madisetti’s “Python, not JSON: a new plaintext file format” rethinks Jupyter notebooks as importable, reusable Python modules instead of monolithic JSON blobs. This walkthrough shows how marimo files deliver Git-friendly diffs, module imports, pytest compatibility, and embedded SQL and Markdown for a maintainable interactive computing experience.
https://marimo.io/blog/python-not-json
https://marimo.io/blog/python-not-json
marimo.io
Reinventing notebooks as reusable Python programs
Designing a Python notebook that blends the best parts of interactive computing with the sanity of code
👍1
Claudio Santini’s primer on Unvibe reveals a Python library that treats unit-tests as a reward function, guiding LLM-driven Monte Carlo Tree Search to generate code that passes all tests. It details how Unvibe decorates functions with @ai, uses unvibe.TestCase for granular scoring, and iteratively refines implementations by feeding back assertion errors to the model.
https://claudio.uk/posts/unvibe-a-python-test-runner-that-generates-correct-implementations.html
https://claudio.uk/posts/unvibe-a-python-test-runner-that-generates-correct-implementations.html
claudio.uk
A Python Test-Runner that generates correct implementations
Unvibe: A Python Test-Runner that generates correct code
👍2