Showing posts with label flask. Show all posts
Showing posts with label flask. Show all posts

Tuesday, August 17, 2010

Managing Trac

Today I 'launched' the first release of an internal tool for managing our various Trac instances at work.  We've been trying to keep all the projects contained in there for issue tracking and source control, and I ended up being the one administrating the whole thing.  Mostly because I asked 'Hey, have you guys given any thought to version control and bug tracking?'  Hopefully I can use a similar approach to get more people doing unit testing, too...

So, in order to get people off my back, I worked on a relatively small Flask application to create the database, VCS directory (with a choice of Bazaar and Subversion; no one wanted git or mercurial, though I'm liking them a lot) and finally the Trac instance.

It manages security through some Apache group files and PAM users hooked up to our central Kerberos server.  I don't like having the local users, but it's less painful to manage with the web interface now.  We have a CAS system that would work for this, except the Subversion and Bazaar repos require authentication, too, and the standard clients break when they hit CAS's 403 redirects.  Oh well.

I might try to release the code as open source, but for now it's going to have to stay internal for a few reasons.  Not to mention, some of the stuff is dependent on our environment and wouldn't move very well.

Feels good to have my first self-directed project up and going; I've finished a few other things since starting in February, but nothing where I had pretty much free reign in managing the whole project.  Admittedly, a lot of time was wasted while I bikeshedded over whether to stick with Python, Ruby (with something like Sinatra rather than Rails), or try a server-side JavaScript implementation.  Other than node.js, though, I couldn't find one that excited me.  Most were based on the Rhino JVM implementation; it'd be cool to see some other server-side JS implementations use V8.

Sunday, August 15, 2010

Flask

I started using Flask soon after it was announced back in April, but I've been really digging into it in the last 2-3 weeks.  It's for a small project at work, building an  interface to generate Trac and Subversion/Bazaar repositories for new projects.  Hopefully I'll be deploying the first iteration of the interface to the production server this week.


What I like about Flask is that it's got a few things that make it ideal for small projects over something like Rails, Django, or Pylons:


Locality of reference
All my routes and view functions are in one place, no need to track them down between a controller, model, and view folder.  Obviously, this doesn't necessarily scale well, given that the main file will be a pain in the ass to edit before long.  That being said, we're looking into using Flask and it's Module architecture for a larger project.


Simplicity
Given that it's a 'microframework', Flask doesn't come with the huge file structure and extra utilities that big frameworks do.  I like that.  It also cuts out the controller; routes are applied directly to the view functions, which manipulate the model.  The repoze.bfg framework does this as well, and I think it's a sensible approach, at least for small projects.  Again, I'm not sure how this will scale, but it definitely cuts down the learning curve.


Amazing documentation
While Rails has great documentation, I have to say that Flask stands alone in documentation among the Python frameworks I've looked at.  Django's pretty close, but also really big for what I was planning on doing.  Also, their 'hello world' example on the main page is awesome, because it really does give a flavor of how the thing works in only a few lines of code.  None of the other major ones can say that.


Loose structure
Flask seems to be largely hands-off in determining how your code should be structured, again unlike the larger and more well-known frameworks.  This also means there's mode code you have to write, but you're not forced to program in someone else's style.


Active community
A really active community has sprung up around Flask.  There are plenty of extensions getting written, and people are experimenting with larger projects.  It will be interesting to see where they go.


So, while I'm sure I'll end up pulling out one of the existing, bigger frameworks for something, I'm going to work with Flask on my projects, both in my free time and at work.  We've started on doing some REST-based peer-to-peer work this week, and it'll be interesting to see how that plays out.