Foundations Of Agile Python Development
Download
Introduction
If you’re embarking on a Python development project, then you should buy this book—there’s
nothing quite like it. I know this because I was looking for it last year, and I couldn’t find it.
This book introduces the tools you’ll need to get started on agile projects in Python, and
unlike any other book out there, it shows you how to tie them all together.
Sure, there are many good books on agile development. A lot of them cover the development
processes in great detail, and this is a good thing.
Agile development is very much about
human interactions and the environment surrounding software development, but there is a
whole ecology of tooling to make everything work at a practical level.
Agile development eschews extensive up-front specification, and it anticipates that the
product will constantly change, but it puts in place rigorous checks to compensate for anticipated
change. Testing is an integral part of agile development from the very start, and it is
pursued with ferocious rigor. You need software tools to facilitate testing.
Agile projects have very short release cycles, and this has implications for tooling, too.
There’s no way to have two-week release cycles if it takes you days to integrate changes, days
to perform QA, and days to package and deploy the software. This means that agile development
puts a high value on build and release automation.
While agile development techniques can be applied to any project, both testing tools and
build automation tend to be very language specific. These tools do exist in Python. They’re
widely available, and by and large they’re free, too, but the documentation tends to be . . .
um . . . spotty. And while there may be documentation on the individual tools, the documentation
telling you how to tie these tools together is usually sparse to nonexistent. This book
provides that missing documentation
Who This Book Is For
This book is written for a person who knows how to program and is already familiar with
Python. If you have some Python under your belt and you’re thinking of starting a new project,
but you don’t know how to get started, then this book is for you. If you’re an experienced
Python programmer and you want to give this agile stuff a whirl, then this book is for you. If
you’re a release engineer who has been thrown headlong into the world of Python, then this
book is for you, too. If you’re brand new to programming or don’t really know Python, this is
not the best book to start with. There are some wonderful books out there that will introduce
you to the language, but this isn’t one of them.
What’s Really in Here?
Each chapter in this book addresses a different aspect of tooling in an agile development environment.
These are collected roughly into two parts, with the first focusing on basic tooling,
and the second focusing on specific practices. If you’re already familiar with Subversion,
Setuptools, and Buildbot, then you should have no problem jumping between Chapters 6
through 11. If you’re not, then you’ll want to look at the earlier chapters first.
Chapter 1: What Is Agile Development?
Chapter 1 provides an overview of the methods that characterize agile development methodologies,
with a focus on those not directly related to tooling
.
Chapter 2: The IDE: Eclipsing the Command Line
This book uses the command line throughout, but modern IDEs provide many benefits. This
chapter introduces you to Python development using Eclipse and the Pydev plug-in.
Chapter 3: Revision Control: Subverting Your Code
A revision control system is part of the core infrastructure for any agile development environment.
Subversion is an excellent choice. I show you how to use it from the command line and
from Eclipse using the Subversive plug-in.
Chapter 4: Setuptools: Harnessing Your Code
You can’t replicate your work for testing purposes without some sort of a framework. In
Python, a natural choice is Setuptools, which provides a solid basis for automated builds.
Chapter 5: A Build for Every Check-In
Automated build systems form the core of a continuous integration system. Here I introduce
Buildbot, an excellent system that happens to be written in Python. It ensures that the code
you check in builds correctly.
Chapter 6: Testing: The Horse and the Cart
Unit testing ensures that your code runs as you expect it to, and it prevents regression
(reappearance of old bugs) when you change existing code. I introduce the unit-testing packages
unittest and Nose, and I show how to use Nose to run tests from within Eclipse and
Setuptools. Finally, I show how to link them into Buildbot.
Chapter 7: Test-Driven Development and Impostors
Test-driven development (TDD) is the practice of writing tests before writing the code they
test. Imposters (a.k.a. mock objects) provide a powerful unit-testing technique to isolate units
of code. I examine two mock object frameworks, pMock and PyMock, and I work through a
sizable example to show how TDD, refactoring, and imposters are used, and how they affect
the code that you produce with them
Chapter 8: Everybody Needs Feedback
Improving your code requires feedback—useful information that sometimes comes from your
coworkers, and sometimes from software. Accurate feedback requires standards. This chapter
looks at code coverage, complexity measures, and development velocity. It also examines coding
standards, how they can be enforced from within Eclipse, and how you can prevent bad
code from reaching your repository by using Subversion pre-commit hooks.
Chapter 9: Databases
Databases are very widely used these days, and they pose their own special challenges for
agile development. This chapter examines the object-relational mappers SQLObject and
SQLAlchemy, and then examines how to version databases using the DBMigrate tool.
Chapter 10:Web Testing
The web is everywhere, and web development has its own set of issues. This chapter examines
general approaches to testing web applications, and introduces HTML/XML verification using
ElementTree and BeautifulSoup. It also looks into JavaScript unit testing with JsUnit.
Chapter 11: Functional Testing
This chapter examines functional testing with a particular emphasis on acceptance testing
using PyFit. The chapter shows how to use PyFit, and more importantly, how to tie PyFit into
Setuptools and Buildbot. (In my view, this alone is worth the price of the book.)