Python Function Pipelines

Posted on Sat 02 June 2018 in Software Development • Tagged with Python, Unix, pipeline, functional programming

If your Python code represents a function pipeline, it should look like a function pipeline. This post presents a simple, strongly-typed function pipeline for your personal projects to make beautiful, explicit, Unix-like pipelines in Python. Requires Python 3.6 or greater.


Continue reading

Smaller Python Docker Containers with Multi-Stage Builds and Python Wheels

Posted on Sat 21 April 2018 in Software Development • Tagged with Docker, Python, pip

If your Docker Python build requires system dependencies that are NOT required at runtime, structure your build as follows:

  1. Use a multi-stage build
  2. Stage 1 installs system dependencies and uses them to build local wheels
  3. Stage 2 begins from the same base as Stage 1, copies wheels from Stage 1, and installs the wheels
  4. The rest of your build will be based on Stage 2

If you follow these steps, you'll end up with the smallest-possible Python Docker container with all your Python dependencies intact.


Continue reading