Pytest’s fixtures are a pretty convenient route to dependency injection throughout your tests. They’re flexible, too, and involve very little “magic.” This means they’re easy to learn, understand, and use correctly. The Pytest documentation explains that a fixture can pass back anything to the caller, including a function. This allows you to essentially create parameterized […]
I recently worked on a legacy Flask app that was in need of refactoring. We were unfamiliar with a lot of the codebase, and we had a monolithic server.py with over a hundred routes. Using Flask’s blueprints, we were able to break the app into logical segments and gain familiarity with the codebase.
Writing a game-playing AI is a fun process, but checking for wins or valid moves can be one of the boring aspects of the project. More often than not, it ends up being a sizable chunk of your computation time as well.
Python has always been an intriguing language to me, but I’ve never been a huge fan of its syntax. I have always liked Lisps, though. Thus, when I discovered Hy a few months ago, I was completely smitten. Then I tried to set up a development environment, and was caught in a morass of old […]
Amazon S3 (Simple Storage Service) allows users to store and retrieve content (e.g., files) from storage entities called “S3 Buckets” in the cloud with ease for a relatively small cost. A variety of software applications make use of this service. I recently found myself in a situation where I wanted to automate pulling and parsing […]
Often times, when writing Python, I run into a situation that requires me to write a simple validation function. def check_validity(item): return item.value_to_check > 0def check_validity(item): return item.value_to_check > 0 This function is easy to test, and it’s clear what it’s supposed to be doing. But as so often happens, I may need to validate […]
Recently I’ve been working on a .NET app that communicates with multiple internet end points. Each end point is a data collector, and numeric data is retrieved over these connections in real time. It is important for the app to be able to do some analysis of the data, such as minimum and maximum value, […]