The Spaghetti Code Behind the AI Boom

How much of the AI technology is built on glued together Python code?

May 15, 2024 · 4 min

Accessible Large Language Models (LLMs) using LangChain

Large language models are getting more accessible every day with reduced resource requirements and easy to use wrapper libraries. Langchain is one of the leading ones to get started with Python and language models.

May 27, 2023 · 2 min

How to split a Python requirements file?

Sometimes it is beneficial to have different requirements file in a project depending on the runtime environment. This post shows how to easily maintain multiple requirements.txt files.

September 13, 2022 · 1 min

How to generate plots using unit tests in Python?

This elegant Python library called unitreport allows you to use matplotlib inside unit tests to generate self-contained HTML reports. It creates a robust, modular and self-contained approach for analysing datasets, models and more.

September 3, 2021 · 4 min

How to handle logging in Python?

Let your application tell you what is going on at critical steps with effective usage of logging. In this post, I talk over a simple setup for using the logging library in Python.

June 29, 2021 · 4 min

Where does Pylint look for configuration files?

Pylint is a popular linting tool for the Python programming language, and often it needs to be configured. Pylint looks at several different locations to load its configuration.

May 25, 2021 · 2 min

How to hash a dictionary in Python?

You might notice that the in-built Python hash function does not work with dictionaries. That’s for good reason because it can be inconsistent across platforms. In this post, I talk about a simple method using standard libraries to hash a Python dictionary in a more stable manner.

July 30, 2020 · 2 min

Argparse with multiple files to handle configuration in Python

There many methods for handling configuration files within a project and it can be difficult to find a solution that works well. In this post, I talk about a small library that allows argparse to work well across multiple files while still providing the expected argparse features such a help pages.

July 17, 2020 · 5 min

How to discover and run unit tests programmatically in Python?

Sometimes you might want to run unittests from another Python script and gather its results instead of running python3 -m unittest manually. Running test cases programmatically is quite easy and gives you a lot of control on what happens during or after running the test cases.

June 11, 2020 · 2 min

How to handle configuration in Python?

Configuration files can get messy when dealing with a large number of external parameters. The built-in solutions like argparse might not be scalable or clean enough to manage external parameters. In this post I look at an alternative YAML based solution that implicitly passes configuration to functions.

October 24, 2018 · 4 min