Topic Archive

Best Practices

  • There are few things in software engineering that induce panic quite like a massive git merge conflict. You pull down the latest code, open your editor, and suddenly your screen is bleeding with <<<<<<< HEAD markers. Your logic is tangled with someone else’s, the CSS is conflicting, and you realise you just wasted hours building on top of outdated architecture. It is easy to think this only happens to juniors, but it happens to us all. Case in point – this week it was the two of us butting… HEADs (get it?). When you code in isolation, you get comfortable.…


  • The issue with traditional performance tracking is that it is often an afterthought. We treat performance as a debugging task, (something we do after users complain), rather than a quality gate. Worse, when we try to automate it, we run into the “Noisy Neighbour” problem. If you run a benchmark in a GitHub Action, and the container next to you is mining Bitcoin, your metrics will be rubbish. To become a Senior Engineer, you need to start treating performance exactly like you treat test coverage. The Solution: Continuous Performance Guardrails If you want to stop shipping slow code, you need…


  • Most Python web frameworks make you choose between testability and convenience. You either have clean code with complex test setup, or you use global state and hope your tests don’t interfere with each other. FastAPI’s Depends() solves this elegantly. Here is an example how you would use it in your API: What’s happening here: Type-safe – Your editor knows repo is a SnippetRepository. Full autocomplete, type checking works. Automatic cleanup – The context manager ensures the database session closes, even if an exception occurs. No global state – Every request gets its own session. No risk of one request interfering with another. Testable –…


  • It’s January! If you look back at yourself from exactly one year ago, January 2025, how different are you as a developer from then to now? Did you ship the app you were thinking about? Did you finally learn how to configure a proper CI/CD pipeline? Did you land the Senior role you were after? Or did you just watch a lot more YouTube videos and buy a few more Udemy courses that you haven’t finished yet? If the answer stings a little bit, you aren’t alone. Over the last six years of coaching hundreds of developers in PDM, Bob…


  • The missing 66% of your skillset

    ·

    ·

    2 min read

    Bob and I have spent many years as Python devs, and 6 years coaching with Pybites and we can safely say that being a Senior Developer is only about 1/3 Python knowledge. The other 60% is the ecosystem. It’s the tooling. It’s all of the tech around Python that makes you stand out from the rest. This is the biggest blind spot keeping developers stuck in Tutorial Hell. You spend hours memorising obscure library features, but you crumble when asked to configure a CI/CD pipeline. (That’s not just made up by the way – many of you in dev roles will have seen…


  • In my previous Pybites article, I showed how I built and deployed a book tracking API using FastAPI, Docker, and Fly.io. That project taught me a lot about backend development, containers, and deploying modern APIs. But a backend alone isn’t enough—users need an interface. And FastAPI’s Swagger UI, while useful for testing, just isn’t user-friendly enough for everyday use. So, I decided to build a frontend. My goal? A fast, Python-based UI with minimal hassle. That’s when I turned to Streamlit. In this article, I’ll explain why I used Streamlit and how I was able to connect my deployed backend…


  • 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…


  • Virtual environments are vital if you’re developing Python apps or just writing some Python scripts. They allow you to isolate different app requirements to prevent conflicts and keep your global OS environment clean. This is super important for many reasons. The most obvious one is requirements isolation. Let’s say that you’re working on two different projects: Although you can install both Python 3.6 and Python 3.10 globally on your OS, you may have to manually set the default version which may end up breaking some packages in your OS that expect the other version. As for other packages, “requests” in…


  • Introduction Python’s versatility in supporting different programming paradigms, including procedural, object-oriented, and functional programming, opens up a rich landscape for software design and development. Among these paradigms, the use of static methods in Python, particularly in an object-oriented context, has been a topic of debate. This article delves into the role and implications of static methods in Python, weighing them against a more functional approach that leverages modules and functional programming principles. The Nature of Static Methods in Python Definition and Usage: Static methods in Python are defined within a class using the @staticmethod decorator. Unlike regular methods, they do…


  • In this article let’s look at the functools Standard Library module and 6 cool things you can do with it (be warned, a lot of decorators are coming your way! 😍) … 1. Cache (“memoize”) things You can use the @cache decorator (formerly called @lru_cache) as a “simple lightweight unbounded function cache”. The classic example is calculating a Fibonacci series where the intermediate results are cached, speeding up the calculation significantly: On my system this code takes 0.02s to complete. 😎 However if I comment the @cache decorator it takes 28.30s because of all the repeated calculations! 😱 Hence caching is…