Press "Enter" to skip to content

Enter Colaboratory (AKA “A Spoonful of the Tracking Soup”)

centaur 0

As an author, I’m interested in how well my books are doing: not only do I want people reading them, I also want to compare what my publisher and booksellers claim about my books with my actual sales. (Also, I want to know how close to retirement I am.)

In the past, I used to read a bunch of web pages on Amazon (and Barnes and Noble too, before they changed their format) and entered them into an Excel spreadsheet called “Writing Popularity” (but just as easily could have been called “Writing Obscurity”, yuk yuk yuk). That was fine when I had one book, but now I have four novels and an anthology out. This could take out half an a hour or more, which I needed for valuable writing time. I needed a better system.

I knew about tools for parsing web pages, like the parsing library Beautiful Soup, but it had been half a decade since I touched that library and I just never had the time to sit down and do it. But, recently, I’ve realized the value of a great force multiplier for exploratory software development (and I don’t mean Stack Exchange): interactive programming notebooks. Pioneered by Mathematica in 1988 and picked up by tools like iPython and its descendent Jupyter, an interactive programming notebook is like a mix of a command line – where you can dynamically enter commands and get answers – and literate programming, where code is written into the documents that document (and produce it). But Mathematica isn’t the best tool for either web parsing or for producing code that will one day become a library – it’s written in the Wolfram Language, which is optimized for mathematical computations – and Jupyter notebooks require setting up a Jupyter server or otherwise jumping through hoops.

Enter Google’s Colaboratory.

Colab is a free service provided by Google that hosts Jupyter notebooks. It’s got most of the standard libraries that you might need, it provides its own backends to run the code, and it saves copies of the notebooks to Google Drive, so you don’t have to worry about acquiring software or running a server or even saving your data (but do please hit save). Because you can try code out and see the results right away, it’s perfect on iterating ideas: no need to re-start a changed program, losing valuable seconds; if something doesn’t work, you can tweak the code and try it right away. In this sense Colab has some of the force multiplier effects of a debugger, but it’s far more powerful. Heck, in this version of the system you can ask a question on Stack Overflow right from the Help menu. How cool is that?

My prototyping session got a bit long, so rather than try to insert it inline here, I wrote this blog post in Colab! To read more, go take a look at the Colaboratory notebook itself, “A Sip of the Tracking Soup”, available at: https://goo.gl/Mihf1n

-the Centaur

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.