Foundations of Agile Python Development.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
CYAN YELLOW MAGENTA BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® THE EXPERT’S VOICE® IN OPEN SOURCE Companion eBook Available Foundations of Agile Python Development Foundations of Dear Reader, Python is your chosen development language. You love its power, clarity, and interactivity. But what is the best way to build and maintain Python applications? How can you blend its unique strengths with the best of agile methods to reach still higher levels of productivity and quality? And, at a practical level, where are the tools to automate it all? In this book, I give answers to these questions, Foundations of backed up by a wealth of down-to-earth examples and working code. The short development cycles of agile projects require far more automation than traditional processes. There’s simply no way to have a two-week release cycle if development involves a day of integration, a week of QA, and three days Agile Python Development for production deployment. You must automate to succeed. But all too often, the best-known tools are language specific. For this reason, this book gives you a complete set of open source tools to turbocharge your Python projects, and shows you how to integrate them into a smoothly functioning whole. Agile Python Eclipse and Pydev make an excellent Python IDE. Python ships with an xUnit-based unit-testing framework. Nose is great for running tests, supplemented by PyFit for functional testing. Setuptools is your build harness and packaging mechanism, with functionality similar to Maven in Java. Subversion provides a place to store your code, and Buildbot is an ideal continuous integration server. What makes this book different from others is that I show you how to tie all of these pieces together into one continuous tool chain that builds your software from start to finish—fast! Development While the information I present is steeped in the language of agile develop- ment, the details are not limited to that approach. This book is as much about release engineering in Python as it is about agile development. Jeff Younker Python, agile project methods, and a comprehensive open source tool chain! Companion eBook THE APRESS ROADMAP Beginning Python: Foundations of From Novice to Professional Agile Python Development See last page for details Foundations of Python Dive into Python on $10 eBook version Network Programming Younker SOURCE CODE ONLINE ISBN-13: 978-1-59059-981-5 www.apress.com ISBN-10: 1-59059-981-0 Jeff Younker 5 4 2 9 9 US $42.99 Shelve in Python User level: 9 781590 599815 Intermediate–Advanced this print for content only—size & color not accurate spine = 0.7904" 416 page count 9810FM.qxd 6/3/08 2:37 PM Page i Foundations of Agile Python Development Jeff Younker 9810FM.qxd 6/3/08 2:37 PM Page ii Foundations of Agile Python Development Copyright © 2008 by Jeff Younker All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-59059-981-5 ISBN-10 (pbk): 1-59059-981-0 ISBN-13 (electronic): 978-1-4302-0636-1 ISBN-10 (electronic): 1-4302-0636-5 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Tom Welsh Technical Reviewer: Will McGugan Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Susannah Davidson Pfalzer Copy Editor: Damon Larson Associate Production Director: Kari Brooks-Copony Production Editor: Elizabeth Berry Compositor: Dina Quan Proofreaders: Nancy Bell, April Eddy Indexer: John Collin Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precau- tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. 9810FM.qxd 6/3/08 2:37 PM Page iii Contents at a Glance About the Author . xiii About the Technical Reviewer. xv Acknowledgments . xvii Introduction. xix ICHAPTER 1 What Is Agile Development? . 1 ICHAPTER 2 The IDE: Eclipsing the Command Line . 21 ICHAPTER 3 Revision Control: Subverting Your Code . 41 ICHAPTER 4 Setuptools: Harnessing Your Code . 81 ICHAPTER 5 A Build for Every Check-In . 103 ICHAPTER 6 Testing: The Horse and the Cart . 139 ICHAPTER 7 Test-Driven Development and Impostors . 175 ICHAPTER 8 Everybody Needs Feedback . 233 ICHAPTER 9 Databases. 263 ICHAPTER 10 Web Testing . 309 ICHAPTER 11 Functional Testing . 339 IINDEX . 369 iii 9810FM.qxd 6/3/08 2:37 PM Page iv 9810FM.qxd 6/3/08 2:37 PM Page v Contents About the Author . xiii About the Technical Reviewer. xv Acknowledgments . xvii Introduction. xix ICHAPTER 1 What Is Agile Development? . 1 Why More Methodologies? . 1 A Little History . 3 Planning and Agile Development . 4 What Are Agile Methods?. 4 Pair Programming . 5 User Stories . 7 The System Metaphor. 8 On-Site Customers . 8 Unit Tests . 9 Test-Driven Development. 10 Refactoring . 11 Simple Design . 12 Collective Code Ownership . 12 Short Iterations. 13 Continuous Reflection . 15 Continuous Integration . 16 Documentation. 17 Summary. 18 ICHAPTER 2 The IDE: Eclipsing the Command Line . 21 Installing Eclipse . 23 Installing Plug-Ins . 25 Installing and Configuring Pydev. 31 Your First Project . 32 Looking Under the Hood. 38 Paying for More Functionality . 39 Summary . 40 v 9810FM.qxd 6/3/08 2:37 PM Page vi vi ICONTENTS ICHAPTER 3 Revision Control: Subverting Your Code. 41 Revision Control Phylum. 42 What Subversion Does for You . 43 Getting Subverted . 44 Working with Your Subverted Code . 47 Examining Files . 49 Adding Files . 50 Copying and Moving Files . 51 Deleting Files . 52 Reverting Changes. 53 Modifying a File . ..