Planet TurboGears

April 20, 2014

Curia

Announcing the pyramid_assetmutator package

If you’re like me, one of the first things you do when starting a new web application project is set up a CSS alternative such as LESS or SASS/SCSS. Those who aren’t particularly fond of JavaScript might also tend to add CoffeeScript. These “metalanguages” can assist in making client-side/asset code more pleasurable to work with, as they typically provide functionality that’s “missing” in the the languages they get interpreted into.

Some frameworks (e.g. Ruby on Rails) give you support for these alternatives out-of-the-box, but in the land of less opinionated software things can require a bit more work. Since I am personally a fan of the Pyramid web framework, I’ve used the pyramid_webassets and pyramid_fanstatic packages in the past to provide this support. However, these packages are so powerful and comprehensive that they can also tend to be somewhat involved in regards to configuration, so I recently decided to roll my own Pyramid add-on: pyramid_assetmutator

Although definitely not as “feature-full” as the packages I have mentioned earlier, as of this writing it provides the following:

  • Support for piping (a.k.a “mutating”) assets through pretty much any command you like (its core functionality is quite rudimentary).
  • The ability to specify whether to have your assets “mutated” during each request, or on each “application boot” (typically best for prod setups).
  • Partial support for template language parsing in your asset files (e.g. Mako or Jinja2 template tags in your JavaScript or CSS files).
  • A unified Python 2/3 codebase.

Feel free to check it out on GitHub or browse the documentation, and share here or open a GitHub issue if you have any comments or suggestions.

by Seth at April 20, 2014 01:07 AM

April 03, 2014

Christpher Arndt

Select a Python code block in Geany with Lua

Here's a nifty little Lua script for the Geanylua plug-in for the Geany text editor to select a Python code block in Geany with Lua. When the script is activated, it will select the block corresponding to the current code folding level of the line the cursor is on in the active document. E.g. if you place the cursor in the body of a Python function on a line that is on the same indentation level as the first line of the body of the function, it will select the whole function. Also, if the cursor is on the opening line of a block, e.g. a line starting with class, def, if, etc., the script will select the block started by this line.

by Chris at April 03, 2014 11:09 PM

March 10, 2014

Matthew Wilson

RIP hen #1

For two years now, I’ve been letting my hens free range around in a fenced-in section in my back yard during the day. They love it.

Went out to check for eggs today after work and found one of my girls had been killed in the coop.

Head bitten off. No other signs of predation. Internet forums say this was likely a possum or a raccoon.

Going to set up a live trap tonight. And some wire snares.

I raised these girls since they were a day old. Can’t really remember the last time I was this angry and sad.

by matt at March 10, 2014 11:01 PM