Latest articles

Subscribe via RSS

  • Ever had a Python function behave strangely, remembering values between calls when it shouldn’t? You’re not alone! This is one of Python’s sneakiest pitfalls—mutable default parameters. Recently someone asked for help in our Pybites Circle Community with a Bite exercise that seemed to be behaving unexpectedly. It turned out that this was a result of modifying a mutable parameter passed to a function. For folks new to programming it is not obvious why modifying a variable inside a function might cause a change outside of that function. Let’s have a closer look at the underlying issue. What is a Python Variable When considering variables…


  • When Bob and I first started Pybites, there was no way I could have imagined it’d grow to what it is today. Launching our first products was a massive moment for us both, not just because these were ways to sustain the business, but because we were actually HELPING people. People were coming to us and utilising our services to better themselves and their communities. The desire to help people and make some real change in the world become one of our core values: Lifting People Up. This value system has led to our very first partnership. The excitement we…


  • In this post, I will build a simple fitness tracker app using Python Reflex. Reflex is a Python library that allows you to create reactive applications using a functional and declarative approach. We will use Reflex to create a simple fitness tracker app that allows you to log the amount of workouts completed per week. This is how it will look: Install Reflex After making a new directory and cd’ing into it, I’ll use uv (anybody not yet using this amazing tool? 💡) to initialize a project and install Reflex: The awesome thing about uv is that you don’t have…


  • What is this pattern about? The Pipeline design pattern (also known as Chain of Command pattern) is a flexible way to handle a sequence of actions, where each handler in the chain processes the input data and passes it to the next handler. This pattern is commonly used in scenarios involving data processing, web scraping, or middleware systems. In this blog post, I’ll walk you through a specific example that leverages Python’s powerful functools.reduce and partial functions, along with the BeautifulSoup library for parsing HTML content. This code showcases the Pipeline pattern applied to HTML table extraction and processing. What…


  • So, you’re a Python developer or you just use Python to make your life easier by writing utility scripts to automate repetitive tasks and boost your productivity.Such Python scripts are usually local to your machine, run from the command line and require some Python skills to use including for instance setting up a virtual environment and knowing the basics of using the CLI.You may have wondered what it involves to convert a script like this into a web app to make it available for other users such as your family members and co-workers. In this article, I’ll walk through the…


  • Exact-RAG is a powerful multimodal model designed for Retrieval-Augmented Generation (RAG). It seamlessly integrates text, visual and audio information, allowing for enhanced content understanding and generation. In the rapidly evolving landscape of the Large language model (LLM), the quest for more efficient and versatile models continues unabated. One of the latest advancements in this realm is the emergence of eXact-RAG, a multimodal RAG (Retrieval Augmented Generation) system that leverages state-of-the-art technologies to deliver powerful results. eXact-RAG stands out for its integration of LangChain and Ollama for backend and model serving, FastAPI for REST API service, and its adaptability through the…


  • The repository pattern is a design pattern that helps you separate business logic from data access code. It does so by providing a unified interface for interacting with different data sources, bringing the following advantages to your system: A practical example Let’s use Python and sqlmodel (PyPI) to demonstrate this pattern (code here): Note: In this implementation, we did not add error handling to keep the example relatively small. You should ensure that if something goes wrong (e.g., database connection issues or file access errors), the program can handle the error gracefully and provide useful feedback. The example might be a bit…


  • We are excited to announce that we’ve extended our Newbie Bites from 25 to 50 Python exercises! 🎉 The importance of exercising when learning how to code 💡 We’re passionate about this new batch of exercises because they require active engagement, which is crucial for learning how to code. Passive methods like reading books or watching videos don’t help concepts click or stick. Our exercises involve writing code that is validated with pytest. This immediate feedback helps you understand mistakes and learn more effectively. You’ll encounter errors, re-think your approach, and practice deliberately. Why double the number of Newbie exercises?…