Including data in Python packages

Posted on Thu 02 December 2021 by Austin Bingham

Every time I need to include data in a Python package, I find myself going in circles checking existing projects, blog posts, and every other resource I can find to figure out the right way to do it. For something so seemingly straightforward, including data in a package always turns …

Running Jest tests in VS Code with custom environment variables

Posted on Wed 17 November 2021 by Austin Bingham

Currently the most popular Jest test runner extension for VS Code is vscode-jest by Orta. For most common setups, this extension works without any configuration needed to VS Code. In my case, though, I needed to enable Node's support for ECMAScript modules. The Jest documentation lists a few ways to …

Python virtual environments with pyenv on Apple Silicon

Posted on Tue 20 April 2021 by Ekaterina Nikonova

Apple's recent transition to the new architecture for its Mac computers has caused rather predictable problems for developers whose workflow depends on certain versions of pre-compiled libraries for x86 architecture. While the latest releases of Python come with a universal installer that allows to build universal binaries for M1 systems …

Software Process Dynamics

Posted on Thu 15 October 2015 by Rob Smallshire

At the Software Architect 2015 conference in London I presented "What if? Supporting decisions with software dynamics simulations". [1] This talk introduces the idea of performing numerical simulations of software development teams and the products they build. The value in such simulations is to inform policy decisions and guide deliberate …

Event-Sourced Domain Models in Python at PyCon UK

Posted on Tue 22 September 2015 by Rob Smallshire

At PyCon UK 2015 I led a very well attended workshop with the goal of introducing Python developers to the tried-and-tested techniques and patterns of Domain Driven Design (DDD), in particular when used as part of an event-sourced architecture.

The two-and-a-half hour workshop was comprised of excerpts from our training …

Event Processing with Transducers

Posted on Fri 27 March 2015 by Rob Smallshire

In the previous article in this series on transducers we looked at lazily evaluating transducers. This time we'll look not at pulling output through a transducer chain from downstream, but at pushing input items into the chain from upstream.

All of the uses of transducers we've demonstrated in Python so …

Lazy Transducer Evaluation

Posted on Tue 20 January 2015 by Rob Smallshire

In the previous article in this series on transducers we looked at transducers which push more items downstream through the reducer chain than they receive from upstream. We promised that this would make lazy evaluation of transducer chains quite interesting.

When used with our transduce() function, our mapping and filtering …

Item Injecting Transducers

Posted on Mon 19 January 2015 by Rob Smallshire

In the previous article in our series on understanding transducers through Python we showed how to support early termination of a reduction operation. This time, we'll demonstrate how transducers can produce more items than they consume. Although this may seem obvious, it leads to some important consequences for implementing lazy …

Terminating Transducers

Posted on Mon 19 January 2015 by Rob Smallshire

In the previous article in this series on transducers, we showed how to implement stateful transducers, and how to deal with any left-over state or other clean-up operations when the reduction operation is complete. Sometimes, however, there is no need to process a whole series of items in order to …

Stateful Transducers

Posted on Mon 19 January 2015 by Rob Smallshire

In the previous article in this series on transducers we saw how we can develop the notion of the transducer from a single function which literally transforms reducers to a more capable protocol which supports two further capabilities: First of all, the association of initial 'seed' values with a reduction …

Enriching the Transducer Protocol

Posted on Mon 19 January 2015 by Rob Smallshire

In the previous article in the series we looked at improving the experience of composing transducers together in Python, by introducing a compose() function. We finished by showing this snippet, which composes a filtering transducer with a mapping transducer to produce a prime-squaring transducer. Recalling that transducers are used to …

Improving Transducer Composition

Posted on Mon 19 January 2015 by Rob Smallshire

In the previous article in this series we derived a Python implementation of transducers from first principles. We finished by showing how transducers can be composed together using regular function call application to give us a single composite reducer which can perform many operations with a single pass of reduce …

Deriving Transducers from First Principles

Posted on Mon 19 January 2015 by Rob Smallshire

What is a transducer?

Transducers - a portmanteau of ‘transform reducers’ - are a new functional programming concept introduced into the Clojure programming language. Although transducers are actually pretty straightforward in retrospect, wrapping your brain around them, especially if you’re not already a competent Clojureist, can be challenging. In this series …

Understanding Transducers through Python

Posted on Mon 19 January 2015 by Rob Smallshire

In this series we take an in-depth look at transducers. Transducers - a portmanteau of "transform reducers" - are a new functional programming concept introduced into the Clojure programming language. Although transducers are actually pretty straightforward in retrospect, wrapping your brain around them, especially if you're not already a competent Clojureist, can …

A More Full-Featured Emacs company-mode Backend

Posted on Tue 04 November 2014 by Austin Bingham

In the first article in this series we looked at how to define the simplest company-mode backend. [1] This backend drew completion candidates from a predefined list of options, and allowed you to do completion in buffers in fundamental mode. The main purpose of that article was to introduce the …

Predictive Models of Development Teams and the Systems They Build

Posted on Thu 11 September 2014 by Rob Smallshire

In 1968 Melvin Conway pointed out a seemingly inevitable symmetry between organisations and the software systems they construct. Organisations today are more fluid than 40 years ago, with short developer tenure, and frequent migration of individuals between projects and employers. In this article we’ll examine data on the tenure …

How to write a company-mode backends

Posted on Tue 09 September 2014 by Austin Bingham

In Emacs, company-mode (short for "complete anything") is a framework for performing completion in buffers. It's an alternative to the popular auto-complete-mode. company-mode supports extension via backends which provide the framework with lists of possible completions in various contexts. So, for example, there's a backend that provides completion support for …

Writing the Simplest Emacs company-mode Backend

Posted on Tue 09 September 2014 by Austin Bingham

In Emacs, company-mode (short for "complete anything") is a framework for performing completion in buffers. [1] It's an alternative to the popular auto-complete-mode. company-mode supports extension via backends which provide the framework with lists of possible completions in various contexts. So, for example, there's a backend th(at provides completion …

The super() Mystery Resolved

Posted on Wed 20 August 2014 by Austin Bingham

In the previous articles in this series [1] we uncovered a small mystery regarding how Python's super() works, and we looked at some of the underlying mechanics of how super() really works. In this article we'll see how those details work together to resolve the mystery.

The mystery revisited

As …

Method Resolution Order, C3, and Super Proxies

Posted on Thu 31 July 2014 by Austin Bingham

In the previous article in this series we looked at a seemingly simple class graph with some surprising behavior. The central mystery was how a class with two bases can seem to invoke two different method implementations with just a single invocation of super(). In order to understand how that …

Rational Computational Geometry in Python

Posted on Thu 03 July 2014 by Rob Smallshire

In the previous article, we looked at how a standard technique for determining the collinearity of points, based on computing the sign of the area of the triangle formed by two points on the line and a third query point. We discovered, that when used with Python's float type [1 …

Python's super() explained

Posted on Fri 20 June 2014 by Austin Bingham

You probably already know how to use Python's super() to call base-class implementations of methods. But do you really know what it's doing? The details of super() are elegant, interesting, and powerful, and while super() is probably more complex than you expect, it's also surprisingly easy to understand. In this …

Python's super(): Not as Simple as You Thought

Posted on Fri 20 June 2014 by Austin Bingham

Python's super() is one of those aspects of the language that many developers use without really understanding what it does or how it works. [1] To many people, super() is simply how you access your base-class's implementation of a method. And while this is true, it's far from the full …

Robust Geometric Computation in Python

Posted on Fri 20 June 2014 by Rob Smallshire

In this series we look in detail at the behaviour of one of the simplest geometric functions, demonstrate its flawed behaviour when implemented with floating point numbers, and fix it using an exact number type provided in the Python Standard Library.

The Folly of Floating-Point for Robust Geometric Computation

Posted on Fri 20 June 2014 by Rob Smallshire

Computational geometry - a world where lines have zero thickness, circles are perfectly round and points are dimensionless. Creating robust geometric algorithms using finite precision number types such as float is fiendishly difficult because it's not possible to exactly represent numbers such as one-third, which rather gets in the way of …

The Primacy of Testability: Modularity

Posted on Wed 14 May 2014 by Austin Bingham

In the first post in this series I set the stage for a discussion of how testability can serve as a proxy or enabler for other, more directly desirable qualities in a software system. In this post I'd like to look at the first such quality, modularity.

Modularity is perhaps …

Series: The Primacy of Testability

Posted on Fri 02 May 2014 by Austin Bingham

In this series we look at how software architects - or really anyone involved in creating software - can use testability to help manage other quality attributes. From modularity to performance to the SOLID principles, testability can act as a proxy and an enabler for many of the cross-cutting, interacting concerns that …

The Primacy of Testability

Posted on Fri 02 May 2014 by Austin Bingham

The job of a software architect [1] is difficult, just like almost every role in software development. They have to keep track of many subtly interacting quality attributes, often on multiple projects, any one of which may be too big or evolving too quickly to meaningfully keep in mental cache …

How to write Boost.Python type converters

Posted on Fri 25 April 2014 by Austin Bingham

Boost.Python [1] makes it possible to write C++ that "feels" like Python. The library is powerful and sometimes subtle. This is as compared with the Python C API, where the experience is very far removed from writing Python code.

Part of making C++ feel more like Python is allowing …

Top four JavaZone 2013 talk - The Unreasonable Effectiveness of Dynamic Typing

Posted on Tue 08 April 2014 by Rob Smallshire

I'm very happy to see that my talk on The Unreasonable Effectiveness of Dynamic Typing was rated fourth of all the talks in the show. Thanks to everyone who attended and voted.

Page 1 / 3 »