Skip to the content.

Pebbles

Configuration Files as Python Objects

In this article, we will build an object-oriented approach to configuration management that reads a traditional config.ini file and exposes its configuration values through Python objects and attributes. This creates a clean and intuitive interface for working with configuration data while keeping it separate from the application logic.

Read article →

JSON Data as Python Objects

In this article, we will build an object-oriented approach to working with JSON data, transforming JSON structures into Python objects that can be accessed through familiar attributes. This provides a cleaner and more intuitive way to work with nested data without repeatedly navigating through dictionaries and keys.

Read article →

Metaprogramming: Declarative JSON-to-Object Mapping Using Python Descriptor and Class Decorator

This article explores class decorators through a practical JSON-to-object mapping problem. The solution uses a class decorator to dynamically install field mappings, reducing boilerplate code and enabling intuitive attribute-based access to nested JSON data.

Read article →

Metaprogramming: Declarative JSON-to-Object Mapping Using a Metaclass

This article explores Python metaclasses through a practical JSON-to-object mapping problem. The solution uses a custom metaclass to process field mappings during class creation and enable intuitive attribute-based access to nested JSON data.

Read article →

JSON Parsing by Creating JSON models dynamically

Learn how to transform JSON data into Python objects dynamically, eliminating the need to define data-model classes manually. Explore recursive JSON processing, nested objects, and collections while accessing structured data through familiar dot notation.

Read article →

Building a Flexible Logging Abstraction

In this article, we will build a flexible logging abstraction that encapsulates Python's built-in logging framework behind a clean and reusable interface. The abstraction will provide configurable log levels, handlers, and consistent message formatting while keeping the application code independent of the underlying logging configuration.

Read article →

Time Profiling in Python

In this article, we will explore time profiling in Python by measuring both wall-clock time and CPU time. We will use Python's profiling tools to examine where execution time is being spent and differentiate time spent waiting from time spent actively using the processor.

Read article →

Memory Profiling, Measuring Data Structure Memory Usage with a Large COVID-19 Dataset

In this article, we will explore memory profiling in Python using the built-in tracemalloc module. We will represent the same large dataset using different Python data structures and measure their memory footprints to understand the trade-offs between different data representations.

Read article →

Implementing the Result Object Pattern for Robust Python CLI Validation

Explore how to implement the Result Object Pattern in Python CLI applications to handle input validation, represent success and failure explicitly, and manage errors without relying on exceptions for expected validation scenarios.

Read article →

Transforming Mappings into Semantic Attribute Interfaces

Explore how to transform mapped data into expressive, attribute-based interfaces using dynamic attribute access, eliminating repetitive key lookups and simplifying data access.

Read article →