Latest articles

Subscribe via RSS

  • If you’re doing any type of web development in Python, there’s a good chance you’ve heard about FastAPI by now. If not, go check it out now. It’s performant, intuitive and time saving (thanks to Pydantic / type hinting) and it supports API standards, e.g. OpenAPI (previously Swagger). You cannot leave this powerful framework out of your toolset. And although it’s true you can get an API running with FastAPI really fast and with little code, to build something more serious takes a bit of practice. Hence we created a FastAPI learning path on our platform. In 10 exercises you will write a simple…


  • Listen now: How much deep work do you get done on a typical work day? In our case, we thought plenty. It turns out that lately it’s been less and less. As the authors of Practical Productivity with PyBites this came as quite a shock! But as you’ll learn in this episode, productivity is insidious. You can be well on track with your goals, focus and habits, but then gradually, things start to slide, and before you know it you’re completely off-track. In this episode we talk about how we became aware of this and provide you with some tips to help you…


  • This is the third part of a series of articles dealing with the type annotation system in Python, type hints for short. The second part discussed a set of beginner examples and highlighted the benefits of using type hints. This article series is aimed at newcomers to type hints and wants to help you get started. In this third part, I will continue discussing slightly more advanced examples to further deepen your knowledge about type hints. Each example will cover a certain topic and look at type hints from a slightly different perspective. Most examples will end with a tip…


  • You know those nights when you want to work on writing or your coding project or side gig? You want to grow outside of the confines of a day-to-day job but you feel like the job has taken everything out of you. You get tired. You feel like you’re on the last bar of the battery. At the same time you feel like people around you are advancing and progressing on their projects. “How do people do this?”“How can they not be tired?”“Where do they get the time/energy/motivation?” All these questions float around a pool of wonder as you envy…


  • ,

    A debugging tale

    ·

    ·

    5 min read

    I ran into an interesting issue debugging the other day … I used isort with pre-commit to automatically sort imports before committing my code. This is a huge time saver and I am very thankful for both tools, as well as black and flake8. They save a ton of time and they instantly boost the quality of your code fixing easy-to-avoid mistakes shaving off debugging time. I did a walk-through video the other day on how to use pre-commit here. One thing that puzzled me though was isort’s behavior on the following test module: When running isort through pre-commit it…


  • Facial Recognition with Python

    ·

    ·

    5 min read

    Identifying faces I was asked by Bob to write a guest article for the PyBites blog, so whilst this isn’t my first blog article, it is my first ever guest blog article of which I’m immensely proud and very pleased to have written for Pybites. In this article, I will detail how I used the face_recognition and Pillow modules to extract and then identify faces from a bunch of photographs. I want to credit Brad Traversy as this idea was originally taken from a Traversy Media video I had bookmarked a while ago and recently rewatched (link below this article).…


  • In this article I will share 3 libraries I often use to isolate my environment variables from production code. Why is this important? Separate config from code As we can read in The Twelve-Factor App / III. Config: Apps sometimes store config as constants in the code. This is a violation of twelve-factor, which requires strict separation of config from code. https://12factor.net/config Basically you want to be able to make config changes independently from code changes. We also want to hide secret keys and API credentials! Notice that git is very persistent (PyCon talk: Oops, I committed my password to GitHub)…


  • This article covers how to package your Python code as a CLI application using just the official PyPA provided tools, without installing additional external dependencies. If you prefer reading code to reading words, you can find the full example demo code discussed in this article here: example repo of Python CLI packaged with PyPA setuptools build Run your Python code from the command line Run a Python file as a script Since Python is a scripting language, you can easily run your Python code from the CLI with the Python interpreter, like this: Create a CLI shortcut to bootstrap your…


  • This is the second part of a series of articles dealing with the type annotation system in Python, type hints for short. The first part gave an introduction to type hints. This article is aimed at newcomers to type hints and wants to help you get started. In this second part, I will go over a handful of carefully chosen examples of how to use basic type hints to solve a particular problem and improve the overall code quality and readability. Each example will cover a certain topic and look at type hints from a slightly different perspective. Most examples…