Year: 2016

Putting the MMAP backed array library on PyPi

Given that the MMAP backed array library I have been working on is now in use with multiple projects I figure that the time has come to put it up on PyPi. The project started off as an in-house library that was used in a few projects, given we were making something fast for our

Refactoring: Heuristics library episode 2 – Separation of concerns

In this video we discuss the separation of concerns and apply that to improving some of the code: Summary Discussed the separation of concerns concept Improved code with this in mind Set up an upstream repository and updated the fork of the repo to get new upstream changes Made a PR with the changes in

Resolving CFFI install issues on Ubuntu

Some of my Python projects rely on a variety of packages, most of which install flawlessly via PIP. Recently I’ve been setting up a new machine running Ubuntu 16.04 and I ran into a few issues installing CFFI via PIP. Essentially CFFI requires some packages that are not installed by default on Ubuntu 16.04, the

Refactoring: Heuristics library episode 1 – introduction

We have a whole new refactoring series thanks to a library Billy has asked us to improve: Summary Here’s what happened in this video: First look at code Fixed mutable default parameter Set up Tox for testing Required writing a file Set up TravisCI for continuous integration Set up Coveralls for test coverage reports

Generating python bindings from C++11 with pybind11

Code for this tutorial found here: Recently I was involved in some discussion sparked by this blog post where “rdrewd” was talking about benchmarking a simple program that generated prime numbers in Python. The thing about this that I like is that it’s a very good example of a situation where making pragmatic decisions

Deprecation warnings in python

When you are maintaining a package you want to be able to deprecate functionality and be able to give your users advance warning when you know that something is going away in the future. Because we wish to warn users without breaking the code we want to have the ability to give information without changing

Which techniques help us be more productive?

A couple of years ago I was asked by a junior developer if I had any suggestions for techniques they could learn about to improve their productivity. It was a great question, one which I’m really glad I was asked as it showed interest and also got me seriously thinking about how you can improve

Testing for exceptions with Jasmine

I just made a PR to the KaTeX library to help fix some cryptic error messages. To do this I had a few places raise exceptions early instead of propagating deeply into the code before breaking in strange places with cryptic error messages. The library can only deal with expressions that are strings so I

Refactoring: Python server script episode 3 – modules

Summary Introduced modules Started cleaning up various global variables Removed “magic numbers” and replaced with named variables Links: Modules tutorial for Python 2 Modules tutorial for Python 3 David Beazley’s PyCon 2015 talk on modules  

Refactoring: Python server script episode 2 – environment setup

Summary Here’s a quick summary of what happened in the video: Set up a virtual environment for packages Updated PIP pip install –upgrade pip Installed packages then stored those packages in requirements.txt Ran into hard-coded platform specific paths that stopped script from running Dealt with exceptions that caught everything Try with no except: In this