Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An attempt at porting dnode to python

branch: master
README.md

dnode-python

"There's a reason I didn't implement it in python."

--James Halliday

dnode-python aims to implement a DNode client in python. It is very much a work in progress.

Status

You may have come here from the nice write-up Marak did for The Changelog on dnode proper. While I think everybody that uses dnode appreciates the publicity, I have to admit it may have been a bit premature in this case. Writing my thesis took most of my time this Spring, and in the meantime a lot of the inner workings of dnode (as my ad-hoc spec) have changed, probably for the better.

However, I just finished my masters degree and now have the time to spend writing this library. Plus, I suppose I can take the article in The Changelog as a sort of mandate. ;)

The Plan

Twisted looks like a perfect fit for what I want to do, but it's gonna be a bit of a learning curve since it's pretty heavyweight and tackles stuff in a pretty different style from node.js (singleton classes and promises, instead of, say, JS objects/functions and CPS). I'm starting to get a general feel for it, though!

Twisted uses classes and inheritance that naturally separate the "protocol" and the "factory." Step one is to implement the dnode protocol as a Twisted protocol and a Twisted factory, in the way(s) that make the most sense. Getting a Twisted reactor/listening deal to communicate with some node.js dnode instances is the goal.

This will, in part, mean converting a python object or class into JSON. Because python differentiates between dicts and objects and doesn't have a way to inline new objects (afaik) there has to be some sort of non-trivial transform in order to use the standard library's JSON tools. Hopefully this can be integrated with Twisted in a sane manner.

The second step, after this, is to add some sugar such that dnode-python has an API sufficiently reminiscent to that of dnode proper, and hides the Twisted boilerplate. By the time part one is complete, my understanding of Twisted should be such that this is the easy part.

Wanna help?

Help is encouraged! If this project interests you and/or you have opinions on how to best implement dnode in python, you can fork the project and/or get ahold of me somehow (jesusabdullah in the #node.js and #stackvm channels).

License?

MIT, same as dnode itself.

Something went wrong with that request. Please try again.