Announcing a New Python Book and Questions for Readers

by Jeremy Jones

A couple of weeks ago, Noah Gift and I signed a contract with O'Reilly to write a book on Python for System Administrators. We'll be covering topics ranging from creating command line utilities to processing text to interacting with databases to SNMP to a bunch of other fun stuff.

Noah just stumbled across Storm, an ORM created by Canonical (the folks who brought us Ubuntu) and has blogged about it.

Question one for the readers: is Storm something you'd like to see covered in the book?

Question two for the readers: is there something you'd specifically like to see in the book Noah and I are working on (taking into consideration this is a Python book for system administrators)?

Your thoughts are graciously welcome.

28 Comments

Simon Hibbs
2007-07-10 08:02:35
Why Storm? Why not SQLAlchemy, or SQLObject? Django has an ORM layer built into it. I can see the reason, I suppose Canonical use this in their system tools for Ubuntu, but great as it is, Ubuntu is only one distro. Maybe it's better suited for that than the others, but I'd be interested to know in what way.
Lawrence Oluyede
2007-07-10 13:58:00
Kudos to the Storm author but what an ORM has to do with system programming? And I second the opinion of Simon. I don't know if Storm is great or not because I haven't tested yet but SQLAlchemy and Django's ORM are far more used in the community. So why not them?


Matt Doar
2007-07-10 14:20:12
That book sounds useful to me! I'm a toolsmith and I often end up using python to hook stuff together one way or another. The subjects I'd like to see in the book include:


LDAP - script to read data from an Exchange server and create HTML pages showing who's in each group, or an svn acl file mapping LDAP groups to svn groups for access control.


XML processing - scripts that read XML, build up a structure, tweak it and write it out again. xslt is hard to get right, so I lean to python for development time this these days.


pyMOTW - great posts, and the one at http://blog.doughellmann.com/2007/07/pymotw-subprocess.html
about subprocess is essential reading for anyone who wants to make a python script do shell-like things.


SCons - perhaps more of a developer's tool, but as a replacement for make, all those make-based ideas for sysadmins apply in just the same way.


Good luck with the writing. Feel free to contact me directly if you want to chat more.


~Matt

Grzegorz Staniak
2007-07-10 17:03:20
As a sysadmin, I'd rather you left ORMs, web frameworks etc. out of the book. It is alwyas an advantage to be able to code a web front-end for some system, or a database interface, but let's keep programmers' skills and admin's skills a bit separate - I'm occasionally a programmer, but everyday an admin. Working with text, files and directories, OS interfaces are much more important in daily work. I'd also love to read about TCP/IP programming, SNMP, directory services, XML (more and more visible in system configurations). I guess the key lies in proportions - ORMs, IMVHO, are not what admins think about every day.
Jeremy M. Jones
2007-07-10 17:52:33
@Simon and Lawrence,


Thanks for the feedback. Sorry - SQLAlchemy is pretty much a given and we're probably doing a spot on Django as well. So, I should have asked if anyone would be interested in Storm *in addition to* SA and Django rather than the implied *in place of*.

Jeremy M. Jones
2007-07-10 17:54:49
@Lawrence,


Forgot to address your question of what ORMs have to do with system programming. It is tangential, to be sure, but important enough that it deserves a little coverage. Sometimes an RDBMS is a good tool to do SA-type work with. And rather than futzing with the DB API, an ORM can lessen the learning curve. It's not a critical topic, but again, it's important enough I think to warrant a little spot.

Jeremy M. Jones
2007-07-10 17:56:16
@Matt,


Thanks for the suggestions. We're definitely slated for doing some of these topics. Some, it's hard to be able to work in. But thanks again for the suggestions!

Jeremy M. Jones
2007-07-10 18:01:10
@Grzegorz,


The things that you mentioned as being very important to you are definitely the majority of the book. ORMs and web frameworks are only two pieces. We definitely get into text processing (I'm working on that chapter right now). I'll also be doing a chapter on networking stuff which will definitely get into TCP/IP. I know that Noah is going to be doing a chapter on SNMP. Given what you've just mentioned, I believe you'll be pleased with the book. Thanks for the comments!

Noah
2007-07-10 18:30:03
Matt,


I happen to work with Doug, so I will second, that I like his blog PMOTW! I think you might be pleased that our theme is Guerilla Warfare. The code you have to write as a sysadmin is drastically different than the code you need to write as a Software Engineer, but the lines are slowly starting to blur a bit.


I have a been, in my opinion at least, a great sysadmin for some big places and I learned to survive by being quick, efficient, and deadly :) The stuff you would expect will be covered in great detail, like how to make command line tools in python, how to deal with processes, processing text, using SNMP, automating things...etc.

Matt Doar
2007-07-11 11:04:51
Noah, please pass on my thanks to Doug. I'll look forward to the book!
Shawn Wheatley
2007-07-15 18:48:05
Definitely cover Windows sys admin topics if possible. I gave a very introductory talk on Python to my sys admin co-workers a few years back and it was pretty well received. It's my experience that admins on the Windows side of the world don't have as much exposure to scripting.
George V. Reilly
2007-07-17 01:04:10
I regularly work with Windows and Mac and Linux, so I'd like to see some coverage of all three. I realize that each platform probably merits its own book, but a chapter on each seems perfectly reasonable.
Simon Hibbs
2007-07-17 02:36:35
I'm wondering if you plan on covering Python admin on Windows? I spend about half my time supporting Windows boxes and this might be useful to me, but it's also likely that a lot of a unix-only book would still be useful on Windows.


One problem right now is that the OReilly "Python Programming on Win32" book is so far out of date. If there was a more recent edition out I'd say focus on Unix and I could use the Win32 book to bridge the gap.

Simon Hibbs
2007-07-17 02:50:38
One suggestion if you do cover Windows is showing how to read from and write to the clipboard. This is a great way to do text processing. Just cerate a shortcut to your script and assign a shortcut key to it. You select the text, hit Ctrl-C, invoke the script and then just paste out the results. Just like casting spells on your keyboard!
Robert
2007-07-17 07:42:24
Your scope is too wide! What does Django have to do with being a sysadmin? Nada. I can see an ORM though but it wouldn't be that high on my list.


- xml
- mail/email
- log stuff
- db stuff

Jeremy M. Jones
2007-07-17 12:22:24
Unfortunately, in order to limit the already broad scope of the book, we're planning on not covering Windows. But I think we're pretty well planning everything else....xml, email, logging, database. Check. Simon's way cool clipboard incantation...sorry. I might have to look at that, though. That would rock.
Anthony
2007-07-18 09:48:58
A few things that I think you need to cover:
Active Directory (LDAP, ADSI Interfaces)
DNS
SNMP
.ini editing with the libraries
changing every file in a directory (eg updating bind)
automate telnet sessions with routers, other servers and other devices.
Urllib2 (current documentation is not that great)
pysqlite
Packaging windows apps




Anthony Barker
2007-07-18 09:55:31
Oh - I think making cross platform tools is important too (windows/Unix). Mention of legacy Operating systems would be cool. zOS, Tandem, etc.


I used Python for sys admin in a Bank for a couple of years. (The scripts were running on 20,000 desktops and dozens of servers). Excellent tool that makes VBS look like a joke and makes Perl look unmanageable.

chromatic
2007-07-18 17:25:08
Showing how to manipulate COM objects from Python would be a tremendous help to Python administrators on Windows. In theory, it only takes a few pages to get people over the initial work (though you might want to punt an explanation of how to browse and discover the interfaces; that's the second 80%).
Lindsay Holmwood
2007-07-18 18:30:35
Automating desktop Linux stuff with Sabayon and Python would be interesting.
Robert Smol
2007-07-20 02:23:11
Hi,
great idea. I would like to see in the book:
how to create distributable packages of modules one write in python (newegg??)
SNMP management
how to write something that does tail in python
how to write daemon programs
sending mail
how to use unix commands in python (like `exec` in perl)
how to write bindings for other worlds (C,Java,....)
something about extended python shells out there.


just my two cents


Best regads,


Robert

Stephen Ferg
2007-07-24 07:15:44
I'd vote against Storm. In fact, I'd vote against anything cutting edge.


This will be the first Python book on the market specifically for sysadmins. So I think the priorities should be to cover the basics. That is, to maximize the book's usefulness for the maximum number of sysadmins, many of whom have zero familiarity with Python. And are too busy to sit down and read the book cover to cover.


So I say:
* stick to the basics;
* cover all of the basics
* make the book as short, concise and readable as possible
* have lots of example code
* make it easy to dip into and find out how to do some specific task without having to read the whole book.


Some of the basic topics I know our sysadmins would find useful are:


* how to use subprocess to shell out and run os commands
* how to automate using telnet
* how to automate using ftp
* how to automate installs
* how to automate the sending of email with warning or informatory messages.
* how to automate cron-job like capabilities. This might be a good place to include coverage of Pexpect.
* how to automate the setup/initialization of new servers
* how to automate the checking of configurations (are all necessary files installed, and installed in the right places, on a new server).
* how to automate backups and restores of both filesystem and database files.
* how to implement an easy-to-use GUI interface to utilities. This might be a good place to mention EasyGui.
* and of course logging, DNS, etc. that other posters have mentioned.


My guess is that a winning strategy is to keep this first book short and super accessible, and put more advanced topics (ORMs, XML, etc.) into a second, follow-on book: "Advanced System Administration with Python".


Keeping it short and basic also maximizes your chances of getting the book out the door before you drop of exhaustion. Making a book is HARD! :-) And of course you'll learn a lot about book-authoring that will help make the second book better and easier to write.


Given that you're going to aim a *nix admins, I guess the last thing that I'd wish for is for a book that isn't Linux-centric. There are a lot of sysadmins out there using Unix and Solaris and never deal with (for example) RPM.

deadhead
2007-08-16 03:45:35
I'd love to see a sort of Rosetta stone between all you actually can do in bash and the replacement in python. Sometimes you can start with good purpose, but when a line of bash make your day, you ask yourself "Is it worth to switch?"


I agree with people asking for basic things first, so: txt log analysis, db interaction, and all the things you can do fast in bash.


Any idea about when it'll be ready?


cheers

Jeremy M. Jones
2007-08-16 05:13:15
@deadhead,


I think I've heard myself say similar things about using bash vs. Python. Python really shines when your complexity starts to grow. While I typically reach for Python first on nearly any problem, there are still some things that I'll hammer out a quick shell script for or pound at a bash prompt until I get the result I want.


We should be writing complete about March of next year. Not sure when the final editing will be done nor when it'll go to press. Keep watching here. We'll keep you posted.

AConsul
2007-08-19 21:13:51
Most interesting to me:


1. Why python is better than perl for system administration (if you cannot make the case, then I'm not interested in your book since I'm looking for arguments I can bring to IT shops with perl cruft).


1a. A sample perl to python script conversion giving a specific example of converting from Python to perl.


2. What System Administration tasks are *not* appropriate for Python (e.g. when to use bash, Perl, or other languages).


3. Python in Java shops


4. Java vs. Ruby for System administration (e.g. addressing Ruby hype).




Michael R. Bernstein
2007-09-11 18:36:55
Jeremy, sorry I didn't see this question before. I would say no, no need to cover Storm, SQLAlchemy, or other ORMs, unless you feel it is useful as a tool for systems administration, or that deploying them has some special challenges for systems administrators.
Michael R. Bernstein
2007-09-11 18:41:07
If you are going to cover ORM's as useful tools for SysAdmins, you might want to consider adding coverage of Python Object Databases as well. Start off with the standard pickle and shelve modules, and move on to ZODB, Durus, etc.
Cory
2008-01-29 19:41:20
Any update on the release? This is something I have been looking for!! Thanx!