Positive Incline Mike Burrows (@asplake) moving on up, positively

June 1, 2009

New on github: path-to-py (path-to for Python)

Filed under: Web Integration — Tags: , , , — Mike @ 9:04 am

Best to go to the path-to-py repository where the README is nicely rendered on the front page, but here’s a sneak preview:

Initialise a client with the metadata shown in the appendix at the end of this file. Typically provided by the server in JSON or YAML.

>>> from path_to import Application
>>> app = Application(...)

Chaining, indexing, following relationships between resources:

>>> print app.users['dojo'].edit
http://example.com/users/dojo/edit

Positional and named parameters:

>>> print app.user_article('dojo', 'foo', format='json')
http://example.com/users/dojo/articles/foo.json

I’ve improved the described_routes-py README (not to mention fixing the odd bug) also.

As I hinted in my previous post, I’m taking to Python much more readily than I expected.  The Python ports of both path-to and described-routes are much cleaner than their Ruby originals (the benefit of rewriting, not Ruby’s fault), are just as nice to use, and (Rails integration aside) have almost equivalent functionality already.  There are some significant differences under the covers but I’ve not yet missed a Ruby feature.  In a future post I’ll write up some of the more interesting changes.

1 Comment

  1. […] Positive Incline Mike Burrows (asplake) moving on up « New on github: path-to-py (path-to for Python) […]

    Pingback by Dynamically extending object behaviour in Ruby and Python - a quick warts-and-all comparison « Positive Incline — June 1, 2009 @ 1:25 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress