James CookeJames Cooke

Latest posts

Pipx’s upgrade is shallow, let’s go deeper

Software installed in pipx’s managed virtual environments can get stale. How can we update those packages and their dependencies?

Missing tiny data breaks pipeline

At work, when our usage and revenue reporting pipelines fail, they usually fail because of tiny data.

hledger failure messages are better than Ledger’s

About six months ago, I upgraded our family accounts from Ledger to hledger. The CLI API of hledger is better than that of Ledger and the feedback received when a balance assertion fails is just one example.

An Ode to pipx

Using pipx has improved my daily development experience considerably.

Pytest’s cache and gitignore

Sanity checking Pytest’s .gitignore files.

Migrating Open Source projects on Travis CI to fix GitHub API limit problems

Open source maintainers can move their projects from travis-ci.org to travis-ci.com to get more reliable GitHub integration.

Travis hitting GitHub’s API limits for Open Source projects

GitHub’s API rate limits are hurting Travis CI’s service quality. What does this mean for the future of the GitHub ecosystem?

It’s good to extract

Thoughts on the benefits of extracting library code from Python projects into their own packages.

AAA Part 2: Extracting Arrange code to make fixtures

This post explores how to extract arrangement code when working with the Arrange Act Assert pattern so that it can be used with certainty across the test suite.

Arrange Act Assert pattern for Python developers

This post introduces the Arrange Act Assert pattern of testing and shows how it can be used in a Python context with Pytest.

Comparing Django Q Objects in Python 3 with pytest

An updated simple assertion helper for comparing instances of Django’s Q objects using pytest in Python 3.

My Vim setup for Python development

My current Vim setup for Python development.

A successful pip-tools workflow for managing Python package requirements

Using pip-tools with multiple requirements files can be difficult. This post describes my current workflow that manages the complexity with a Makefile.

Django Factory Audit

Exploring the various model instance factories available for Django. Each factory is tested based on the quality of the instances it creates. Bonus: talk version and slides also available.

Cleaner unit testing with the Arrange Act Assert pattern

My PyConUK 2016 talk about the AAA pattern for unit tests and how using it can help us all make our tests cleaner, easier to read and as Pythonic as possible.

Python unittest: assertTrue is truthy, assertFalse is falsy

Exploring Python’s unittest module boolean assert methods and how they can be misleading in certain situations, but not if you RTFM of course.

API Documentation and the Communication Illusion

How can documenting an API help us to communicate with our team and API consumer developers efficiently?

Comparing Django Q Objects

A super simple assertion helper for comparing instances of Django’s Q objects.

Django’s model save vs full_clean

Confirming that Django can screw up your data when saving, and exploring why this is still the case.

Irregular Vim

At July’s Vim London I gave a talk about some of Vim’s irregular behaviours. Using bare-bones Vim to present and demonstrate from is a risky business!

Things I wish I’d known about Django

Django has been my go-to web framework for about three years. But I wish I’d started with it sooner. This became a talk which I gave at the London Django meetup in July this year.

A water pouring problem sketched in Python

A small Python 3 sketch of a solution to a water pouring problem.

Django Contexts and get

Found that tests on a recent project started breaking for no clear reason, and it turned out it was because I’d used get to retrieve values from Contexts.

Current state of Codeship

For the last month I’ve been using Codeship for Continuous Integration on my current client project. These are my current thoughts on this hosted service that works with Github and BitBucket repositories.

Flat designs to website specification - a checklist

Agencies often provide flat designs to web developers as a specification, but these only scratch the surface of a true website functional specification. This is a check-list of features which can be fleshed out to start the journey towards a full functional spec.

Seinfeld method and coding

A presentation I made at ustwo’s Tech Thursday about Seinfeld Technique and how it can help coders to get their personal projects moving.

Python generators and yield

Notes to myself on generators and how to create them with generator expressions and the yield statement.

Git: To squash or not to squash?

Should detailed history be kept for development features, if so, where?

vi-nature everywhere - lightning talk

This week I presented at Vim-London about vi nature and the benefits for using it in more than vim.

Things to remember about decorators

Notes to myself about Python decorators with a focus on making them testable.

Calculating your day rate for spare time freelance work

So you want to earn some extra cash on your weekends, what should you charge?

Pyramid London talk - A testing strategy for Pyramid Applications

Talk at Pyramid London meetup about testing strategies for Pyramid applications.

Pyramid London talk - Pyramid Router

Talk at the first Pyramid London meetup about the Pyramid Router, URL Traversal and Dispatch.

Reincublog Django app

Reincublog is a super mini Django blog weekend hack, coded as part of a recruitment process.

Migrating from Django 1.4 to 1.5 - Lessons learned

Migrating a project from Django 1.4 to Django 1.5 had a couple of gotchas that cost me dev time.

Pelican Svbtle theme tweaks

A tweaked fork of the Pelican Svbtle theme with some cleaned CSS and HTML.

jsFiddle documentation update

A newly structured documentation site and tutorial for the online editor.

Setting up this homepage with Pelican

Using Pelican to generate this blog, a move away from Jekyll and to some pure Python.

Got the Stack Overflow tumbleweed badge for Mako filters question

My Mako question got no views and no answers - should we be using Mako if things are so quiet?

Password cases and test fixes on pyramid_simpleauth

Updates to pyramid_simpleauth to allow for uppercase passwords and some bug fixes.

Django-mailchimp compatability with v1.3 API

Some small updates to the django-mailchimp library to upgrade to the latest Mailchimp API.

Fixing exception in django-menu

A tiny pull request to stop django-menu from throwing exceptions on new unconfigured sites.