Lighter Python images using multi-stage Dockerfiles

A very interesting feature coming with Docker 17.05 is multi-stage builds in the Dockerfile. This feature allows to implement a simple pipeline during the build phase and carry artifacts between stages. Previously, if you wanted to deliver lightweight images, you would have had to implement the builder pattern.

First, you would build an image with all the development dependencies, build the project and generate your artifacts, export them using docker cp or anything similar and then add those files to a new image, with a lighter base. This was a common patter, for example, for generating lightweight images of statically-compiled Golang applications.

[Read More]

Using adafruit-ampy for the ESP8266

I recently wrote a blog post about how to work with MicroPython on the ESP8266. In that post, I used a tool named webrepl to connect to the board and upload the Python code over the air.

That could be a feasible workflow once the ESP8266 is already in a WiFi we can access from our laptop, but sometimes that is not the case. And, of course, the first time we need to connect the board to the WiFi, which needs to be done over the serial connection.

[Read More]

From Nikola to Hugo

Today I have migrated the static generator for this site from Nikola to Hugo. Part of the motivation has been trying a new technology, part of it, having less movable parts. Nikola is great but carries quite a lot of dependencies (specially with the themes). My previous workaround involved building a Docker image with the tools, and using that image inside a GitlabCI pipeline that built the statics and deployed them to my server.

[Read More]

Building a Slack button with ESP8266/MicroPython

In a recent post I explained how I implemented a “push to Slack” button using the Wemos D1 (ESP8266) board, programmed with the Arduino-like interface. Having discovered that it is possible to use MicroPython on the board, now I will re-write the software in Python.

In order to do so, the first thing to do is install the MicroPython firmware on the board. These are the steps to achieve that first milestone.

[Read More]

Building a Slack button with ESP8266/Arduino

I have recently discovered the powerful ESP8266-based development boards. These boards have built-in WiFi connectivity and many GPIOs, low consumption and can be programmed in many different ways. In this article I will show how to build a smart button that sends a message to a Slack channel, using a Wemos D1 mini pro.

This board can be programmed in many different ways. In this article, I will show how to do it using the Arduino-compatible programming interface. To make it really easy, we will use the PlatformIO command line utility. I will suppose that you have it installed and you are able to run the platformio command.

[Read More]

FOSDEM 2017

Last weekend I went to FOSDEM 2017. In this post, I will share links and notes regarding several talks I have attended to.

Etiene Dalcol (@etiene_d) spoke about Making wearables with NodeMCU. Although I have very little knowledge of the Lua programming language I attended to this talk because I had heard about NodeMCU as a firmware to power the mighty ESP8266 dev kits. During the talk, Etiene discussed the different boards available in the market (I didn’t know about the ESP8285, a good alternative), how to upload the Lua code to them and several examples, including a party dress with LEDs attached that changed patterns controlled by her wristwatch (and even by the music volume itself).

[Read More]

Codemotion 2016 highlights

This weekend I have attended to Codemotion 2016. I have gathered some links of talks and workshops that I consider really worthwile to review:

dotGo 2016

This week I have attended to the dotGo2016 conference in Paris. It is a one-day, one-track, 20-minutes-per-talk conference. Very few laptops, people were really focused attending to the dense talks. Here I will highlight some concepts that I have found interesting in some of the talks:

Dave Cheney(@davecheney) talked about first class functions (Don’t fear the first class functions), how to implement them in Golang and why they are sometimes a good choice because of the advantages of passing behaviour (encoded in functions) over raw data structures. You can find the example code here. Some examples are inspired by Bryan Boreham’s An Actor Model in Go talk from Golang UK 2016 conference.

[Read More]

An intro to Hypothesis

I have recently listened to the Episode 67 of the TalkPython podcast, which is an interview with David MacIver, the primary author of the Hypothesis Python library.

The concept of property based testing immediately caught my attention so I decided to give it try.

The rough idea behind property based testing is focusing not on specific examples of inputs and otputs but checking the properties of the expected results. It has many concepts in common with functional programming. And, as with other functional programming tools and constructions, it can be used in Python although your code is not entirely functional (of not functional at all).

[Read More]