Rebuilding Makefile Targets Only When Dependency Content Changes

Posted on Sun 25 February 2018 in GNU Make • 6 min read

TL;DR:

  • GNU Make decides whether to rebuild a ‘target’ file based on the modification times of ‘dependency’ files of the target.

  • In some cases those dependencies’ modification times can change without the contents of the files changing, thus forcing an unnecessary rebuild.

  • If make was to decide whether to rebuild by looking at the hash of the contents of the dependency files instead, it would only rebuild when the contents changed.

  • I wrote a …


Continue reading

Building VS Code Extensions in Docker Containers

Posted on Fri 23 February 2018 in Editors • 3 min read

TL;DR:

  • VS Code is an editor that allows you to write and share custom extensions.

  • These extensions require Node.js and npm installed, which you might not want to install locally - especially given recent, scary issues.

  • Instead, using the Dockerfile and commands below, you can build extensions inside a Docker container and still test and run them inside the VS Code installation on the same machine without Node installed.

Background

I’ve been using …


Continue reading

Docker Container for a simple Flask App

Posted on Wed 01 March 2017 in Containers • 3 min read

Continuing the recent microservices trend, I tried to containerise a previous project, a small REST datastore - microstore.

I’m not going to go into detail on what containers are (not least because I don’t think I could!) - but briefly they are a way to package up an app and it’s dependencies so they can be run in their own mini-environment. The best intro is just to follow the tutorial here.

Creating the Container …


Continue reading

Python Microservice Logging

Posted on Sat 25 February 2017 in Logging • 5 min read

After looking into microservices recently, I was running multiple terminals and switching between them to look at logs as they are written to screen. This was a little awkward so I thought it was worth looking for the right way to log to a central location from multiple microservices. Ideally I wanted do this just using the Python logging library, and without adding more dependencies to every service.

This meant a lot of reading around …


Continue reading

REST APIs Notes and References

Posted on Sun 12 February 2017 in REST • 1 min read

After working to create a REST API and client recently, here are some notes and resources I found useful. I’ll keep adding to this as I find new info.

General notes

  • Resource collection names should always be plural.

  • Depending on who (client vs server) names resources, creation switches between PUT/POST:

    • client names resources:
      • PUT /kittens/<my_kittens_name> - creates a resource there
    • server names resources:
      • POST /things - Creates a new thing at /things/<autogened_id>, with …

Continue reading

Python REST API Client Adhering to a Swagger Schema

Posted on Sat 11 February 2017 in REST • 3 min read

After building a REST API I left it alone for a while before coming back to try and get a client working properly.

Similar goals here to back then - find a good library to use going forwards that does the heavy lifting and make a simple example project. I chose a simple microservice that provides an API for decks of playing cards - like a casino dealer type of thing - which would be a client of …


Continue reading