RAG, Pyrefly vs. ty, Nested Loops and Functional programming
with some more interesting news, articles, packages and projects
News
Monkey-Patched PyPI Packages Use Transitive Dependencies to Steal Solana Private Keys
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.
Python 3.13.4, 3.12.11, 3.11.13, 3.10.18 and 3.9.23 are now available
Registration is now open for Python for Good
Python Discord Event: Project Show-and-Tell
This will be an opportunity for community members to present their Python projects.
Articles
Decorators and Functional programming
In this article, Racey Chan explained key functional programming concepts: function composition, currying, closures, etc, using Python decorators through practical examples.
# Racey Chan
Python RAG API Tutorial with LangChain & FastAPI – Complete Guide
In this article, Vitalii Honchar explained how to build AI-powered apps that can chat with uploaded PDF files. He showed how to implement Retrieval Augmented Generation (RAG) using FastAPI
for the API and LangChain
to interact with OpenAI.
# Vitalii Honchar
Nested Loops in Python
Nested loops are often discouraged, but they make perfect sense in scenarios like handling multidimensional data or generating patterns. In this article, Amanda Adoyi explained what nested loops are, shared practical examples, highlighted common pitfalls and offered tips on how to optimise them.
# Amanda Adoyi
Loading Pydantic models from JSON without running out of memory
When working with large JSON files and loading them into Pydantic, memory usage can become a concern. Instead of using model_validate_json
, it's better to use parsers like ijson
to handle data efficiently. In this article, Itamar Turner-Trauring explained how to do that and also shared another memory-saving approach using dataclasses with __slots__
for better performance.
# Itamar Turner-Trauring
Pyrefly vs. ty: Comparing Python’s Two New Rust-Based Type Checkers
Last month, two new Rust-based Python type checkers pyrefly
and ty
were released. Both of them are in the alpha stage. While they share some similarities, they differ significantly in design and features. In this article, Edward Li dove deep into both tools, highlighted their differences and what makes each one unique.
# Edward Li
Interesting Packages and Projects to Explore
asyncpg - A fast PostgreSQL Database Client Library for Python/asyncio.
PAR LLAMA - Terminal UI for Ollama and other LLM providers
Fabric - High level SSH command execution
Dataclasses JSON - Easily serialize dataclasses to and from JSON.
Copier - Library and command-line utility for rendering projects templates.