Wow, almost a month since the last post. Am i becoming such an old fart already that i'm constantly amazed at how fast time flies by?
Okay, so first, a few site updates (nothing visible to the outside world, except for a small bug fix with the archive listbox):
- I've set up a git repository to host the whole code. I was a bit hesitant to tackle this, as i'm too cheap to pay for a GitHub private repo and too scared of setting up my own, but it turns out that BitBucket is just as nice and its policy nicely compliments GitHub's: Indeed, it limit the number of contributors that can work on a free repository, but allows unlimited repository to anyone, private or not. So from now on, i'll just keep uploading most of my stuff to GitHub (or Gist) and switch to BitBucket whenever i need the code to stay private (which should typically happen on personal stuff which will only interest me anyway).
- I've intalled a TinyMCE editor on the admin site, so that posting should be a bit less of a pain in the butt. I still need to tweak its config a bit, but it's already quite nice.
I still have a few things to do before I can get back to doing some actual dev with it, the first of which will be to set up a new dev environment on my local machines (this should take about 15 minutes, but i've already been putting this off for about 3 weeks. Lazyness, sweet lazyness...). Then, I'll have to investigate South to handle model changes without having to trash the database everytime i tweak the site's apps. Once that's done, everything should be okay, but i'll probably also get started using Fabric as well to automate deployment, because it seems pretty cool and simple enough.
But in the meantime, I'll probably be working on a small project that i've uploaded to GitHub a few days ago:
I've noticed, while hacking on some other projects, that I often needed some small templating features. Some of them were trivial to implement using only python's (or any language, for that matter) string formatting utillities, but some others were just complex enough to become a small pain in the butt, while still too simple to warrant the use of a full blown template engine.
So I came up with this idea of a minimalist templating engine to deal with that kind of small use cases. The idea is to handle most of the template processing, but to let the user define his own syntax and provide callbacks to handle his custom processing needs, if any. I've written a first, probably naive version, which should work well enough for a first draft. I'm still tinkering a bit on the API and trying to decide how to structure it so that it'll be easy to extend or expand, and i'll need to provide a lot more tests and documentation, but once that's done i'll probably upload a 0.1 release on PyPI, just to see how that works. (I've tested it mostly with python 2.7 & 3.2 for now, and some VERY superficial shell testing worked well enough with 2.6, although its outdated unittest lib failed to handle my current test suites. Oh, and i'll try not to depend on anything but the python standard library, which should be more than enough).
Oh, and yes, the lib's name is pretty lame. I was trying to think of a cool acronym involving the words Template & Engine, and once i thought of that one i just couldn't discard it.
As usual, I've tried to drill down some good habits while coding this. I started out by diving in head first and quickly hacked up an awful, but working first version, all in a single file. It was a mess, but it allowed me to experiment quite a bit and helped me to "design" a nice (I hope) API and overall code structure. I don't know if this could be called good prototyping, but I thought it was a nice way to get thinking without the frustration of trying to supress that coding urge. Python's dynamism and interactivity made it pretty fun, too.
I then started over from scratch, this time striving to keep the code as clean as I could and writing tests along the way (Trying to adopt a TDD methodology - Still getting the hang of it, but it's quite nice. Building up the test suite definitely comes quite handy when it's time to refactor the crap out of some class: watch the whole thing catch fire, then calmly fix the mess one failure at a time until it's back to green. There's a kind of badass feel to it, like you're Clint Eastwood and all hell just broke loose: Just keep chewing on that cigar and shoot the buggers down, then crack a joke when they're all down - That's definitely cooler than banging your head on the wall and yelling at some dumb code for two hours).
I've also gone with a more OO design than I usually do. Nothing too fancy, but definitely a step up from the much more procedural feel i usually go for. As much as I hate Java/C# style mandatory OO, I figured I still should force myself to do a little bit more of it, and it actually made sense for what i was trying to do, so that's cool.
Oh, and lastly, I decided to code it all in Vim. I'd already picked up the very basics, but I figured forcing myself to only use it would help me get a bit more efficient with it. Still a long way from mastery, but i've picked up some habits and don't feel like i'm wasting too much time anymore, so that's cool too. I'm also liking it more and more, so i'll probably keep working with it for a while. I haven't tried any fancy plugin yet, as i'd like to get the basics down cold first, but i've looked a bit at wat's out there and some of them look quite nice, so i'll have to play with those sometime too.
So yeah, that's about it for reflecting on TIE's humble beginings for now. I figure sitting down and thinking back about what you done good is a good way to let it sink, and I needed to test this fancy TinyMCE toy, so this post was pretty much an excuse to do both.
Oh, and on a completely unrelated note, Mad Sin is playing here tonight and this time I've got tickets. Revenge will be mine \o/
Edit:
Hmm, while TineMCE makes for nicer editing, it seems to mess up the presentation a bit by adding an useless newline between paragraphs. I'm not sure if i'll need to configure the js script or finally start hacking on the CSS. All i know is that i can't be bothered now, so yeah, whetavar.