James CookeJames Cooke

Posts in 'Code'

Missing tiny data breaks pipeline

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

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.

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.

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.

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?

Things to remember about decorators

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

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.

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.

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?