Tracking Commits With Twitter And Twyt

By Andrew Price, 2008-04-04 12:46:22 in General. Twyt Logo

The python-twyt package provides a Twitter client API library ('from twyt import twitter') and a command line client ('twyt') which uses the library. One way to use it is to integrate twyt into a shell script to automate your Twitter updates. Here's an example.

Sally the software maintainer wants to let her development team keep track of repository commits while they're away from their computers. She installs python-twyt, sets up a Twitter account for her project and tells twyt the username and password for that account. She then writes a shell script which parses from the email details such as the short commit log and the link to the commit diff in the repository's web interface and calls:

twyt tweet "$devname $shortlog $link"

Sally also sets up a procmail rule to pipe emails from her project's commits list into her script.

So when an email arrives from the commits list procmail triggers the script, sending the summary to Twitter. It then gets distributed to Sally's followers, whether they're using email, SMS or any of the other supported notification methods. The developers (who are clearly very dedicated) smile at being able to keep track of the project on their mobile devices while they're out grocery shopping or in the bath.

I'm not sure if this would be a highly desirable real-world application of twyt but it's one possibility. If anyone implements it, do let me know. It's worth noting, however, that Twitter does have usage limits and won't accept over a certain amount of updates per hour or send over a certain number of SMS messages to each user per week.

[Update: Dave Murphy has just reminded me that you can bypass the whole mailing list stage by using the commit hooks for your code repository to trigger the script]