Hate, hate, hate everywhere

Armin Ronacher is one of my favorite Python bloggers these days, and his post Python Packaging: Hate, hate, hate everywhere continues the trend of context and depth. You should read it. I immediately identified with the title: setuptools/easy_install isn’t (wasn’t?) perfect and it had maintenance problems, but when I get pull requests that reference propoganda labeling it as “craptastic”, I feel a little sad.

date:2012-06-23 16:04:54

Mapping file paths for pdbtrack

I saw python-mode 6.0.8 was release two weeks ago, and that reminded me to look and see if my change was included. Turns out it was included in 6.0.6, released in April:

– files inside a virtual machine made visible for pdbtrack

That’s my contribution.

python-mode provides support for developing with Python in Emacs. One of its most powerful (and often unknown) features is pdbtrack. pdbtrack recognizes when you’re interacting with a Python Debugger (PDB) session within Emacs, and opens the relevant files for you as you step through the program. When you’re digging into something very deep (lots of calls on the stack) or very broad (using lots of supporting libraries), this is invaluable for providing perspective on “where” your program is.

At work we develop using a Vagrant-managed virtual machine. The source checkout is stored “locally” and exported to the virtual machine using NFS. That’s great for development — edit locally, run from within the virtual machine — but broke pdbtrack. When Python reported it was at a certain line of a certain file, it was referring to a file inside the virtual machine. When pdbtrack tried to find that path, it didn’t exist because Emacs was running outside the virtual machine. When I want to use pdbtrack I’m usually pretty confused and in need of perspective, so it’s a pretty important tool for me. So I decided to fix this.

Starting with python-mode 6.0.6, you can customize the py-pdbtrack-filename-mapping variable. This is an alist which maps paths the Python interpreter sees to paths Emacs can see. If pdbtrack can’t find the buffer to open directly, it checks this mapping to see if the file exists in a different location. For example, my configuration has the following customization:

'(py-pdbtrack-filename-mapping (quote
   (("/home/vagrant/eventbritecore/" . "/Volumes/eb_home/work/eventbritecore/"))

Using Vagrant means we are able to develop on a configuration far closer to production than we would [easily] be able to otherwise. And starting with python-mode 6.0.6, I don’t have to give up pdbtrack to do that.

date:2012-06-07 07:04:03
tags:emacs, pdbtrack, python-mode

Hieroglyph 0.3.2: Slide Table and Interlinking

Since PyCon I’ve continued to think about how I can make slides from ReStructured Text documents and vice versa. I tend to write a lot of notes and text while I’m putting together a talk, and I like the idea of being able to keep slides and text output in sync. I’ve just a batch of changes to Hieroglyph, my tool for doing that. There’s some clean-up there — better handling of output paths when using things like blockdiag, code clean-up, etc — but there are two things I’m really excited about. First, two pull requests (one for Python 3 support, another for some documentation bugs), and second some new features that I think make Hieroglyph much more powerful.

Thinking about keeping slides and text (HTML) output in sync, it occurred to me there were probably times you’d want to easily switch between slides that provide an overview, and the HTML document for more details and context. Much of the work for 0.3.2 focused on enabling this interlinking. When enabled, Hieroglyph will add links to your HTML and Slide output that links to the other format. For HTML this can be enabled in the sidebar, as well as at the section level. For slides, the link is added next to each slide’s header, and shows up when you hover over the header. Check it out on the Hieroglyph documentation — just hover over any header and click the § link for the corresponding slides.

When I was working on my PyCon talk, I had anywhere from 50 to 70 slides in the deck at any given time (NB: yes, this is too many for a talk of that length). Navigating between them was challenging at times. The second feature I’ve added to Hieroglyph is designed to address this. When viewing a Hieroglyph presentation, you can now press the Escape key to see the Slide Table.

An example of the slide table in use for the Hieroglyph documentation (full size).

Press Escape again to return to the slide you were on, or click a slide to jump directly to it. You can try this with the Hieroglyph documentation slides.

Finally, what should really be considered the third new feature: expanded documentation. You can find expanded documentation on configuring Hieroglyph, styling your slides, etc in the docs online.

There are several additional things I’m working on for Hieroglyph. As Ilya points out in “All Presentation Software Is Broken”, web analytics are your “free lunch” if you use HTML-based slides. I plan to bake support for that directly into Hieroglyph. As I’m using Hieroglyph, I’m also realizing that slides don’t always correspond directly to sections in a document — sometimes (but not always) they’re a paragraph, list, or something else. Some way to indicate this may be helpful. If you find Hieroglyph useful (or interesting), let me know what you’d like to see.

date:2012-06-05 13:22:29
tags:hieroglyph, rst, slides