Python Weekly (Issue 611 August 3 2023)

Python Weekly - Issue 611

Python Weekly

Welcome to issue 611 of Python Weekly. Let's get straight to the links this week.

From Our Sponsor 

A weekly newsletter featuring the best hand curated news, articles, tutorials, talks, tools and libraries etc for programmers.

News

CPython’s global interpreter lock (“GIL”) prevents multiple threads from executing Python code at the same time. The GIL is an obstacle to using multi-core CPUs from Python efficiently. This PEP proposes adding a build configuration (--disable-gil) to CPython to let it run Python code without the global interpreter lock and with the necessary changes needed to make the interpreter thread-safe.

Articles, Tutorials and Talks

This post is about practical patterns for integrating large language models (LLMs) into systems and products. We’ll draw from academic research, industry resources, and practitioner know-how, and try to distill them into key ideas and practices.

This video discusses dunder methods, when to use them, and when to avoid them. Dunder methods are also called magic methods because they allow you to basically change everything that Python does under the hood. But if you're not careful with them, they can lead to confusing code.

LPython is a Python compiler that can compile type-annotated Python code to optimized machine code. LPython offers several backends such as LLVM, C, C++, WASM, Julia and x86. LPython features quick compilation and runtime performance, as we show in the benchmarks in this blog. LPython also offers Just-In-Time (JIT) compilation and seamless interoperability with CPython.

My previous post (which was honestly created to test out the theme for this site), provided a few code snippets that computed N terms of the sum of inverse squares. I wrote the code in my 4 favorite languages—Python, C, Rust, and Haskell—but when I ran the Python code, it was embarrassingly slow. Compared to the ≈950 ms it took sequential Rust, Python took 70 seconds! So, in this post, we’re going to attempt to get Python some more reasonable numbers.

So, you're doing some sync stuff. But you also need to do some async stuff, without making *everything* async. Hint: asyncio.Runner will get you at least part of the way there.

Here's a video showing you how to add async forms to a Django templates (no page reload) in 2 minutes. The guide uses Alpine.js to add minimal, neat Javascript.

A complete guide that equips you with the knowledge and skills to work with configuration files using Python effectively.

In the first portion, the post will explain what the template pattern is and how it gradually leads to an intractable mess as the code grows. In the latter segments, I’ll demonstrate how I’ve designed a real-world service by adopting the obvious and natural path of inheritance-driven architecture. Then, I’ll explain how the service can be refactored to escape the quagmire that I’ve now started to refer to as the template pattern hellscape.

This article will focus on minimizing GPU memory footprint — for both optimization and inference workloads. Throughput and latency usually get all the attention, but reducing memory consumption without making architecture sacrifices is often just as valuable.

Learn how to calculate the coefficient of variation in Python using NumPy and Pandas. Analyze data variability with ease!

Using seccomp and setrlimit to build a Python sandbox.

Interesting Projects, Tools and Libraries

Smaller & Faster Single-File Vector Search Engine.

Continue is the open-source autopilot for software development—a VS Code extension that brings the power of ChatGPT to your IDE

Real-Time Universal Search Infra for Developers.

Open Source Free ATS Tool to compare Resumes with Job Descriptions and create a score to rank them.

Universal and Transferable Attacks on Aligned Language Models.

An open-source toolkit in which all relevant financial ratios (50+), indicators and performance measurements are written down in the most simplistic way allowing for complete transparency of the calculation method.

Cross-platform display typography in Python.

A simple Python library to make chained attributes possible.

The AI Coding Assistant.

A Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment.

New Releases

Jupyter Notebook 7 is the most significant release of the Jupyter Notebook in years. Some highlights of this release include real-time collaboration, interactive debugging, table of contents, theming and dark mode, internationalization, improved accessibility, compact view on mobile devices.

Our Other Newsletters

 - A free weekly newsletter for programmers.

- A free weekly newsletter for entrepreneurs featuring best curated content, must read articles, how to guides, tips and tricks, resources, events and more.