The Sporum - The Official Spore Forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to forum index 
[Login] Login 
Async Spore Python API  XML
Forum Index » Developer Corner
Author Message
oubiwann


Microbe

Joined: 09/11/2009 05:29:37
Messages: 8
Offline

For those that prefer to do their network code asynchronously (and in Python), I've started up a small project on Launchpad.net that ports the regular Python Spore API to use Twisted:
  • http://launchpad.net/txspore

  • The synchronous/blocking Python API is actually included in the source tree of the async one (in txspore.original). As much of the sync Python API is being used as possible, with some references in different modules for namespace convenience.

    The work that is up right now is from one night of hacking; I should have some time in the coming week or two to finish it up. However, anyone familiar with Twisted and the Twisted coding style is more than welcome to contribute; just create a branch on launchpad and submit it for review when you're ready.

    As for using it, if you're familiar with deferreds and callbacks, you'll have no problem. If you're interested in learning more about Twisted, be sure to check the project site out (http://twistedmatrix.com/).

    I'll post an update when the API is complete.

    Thanks!

    This message was edited 1 time. Last update was at 09/17/2009 05:11:44

    oubiwann


    Microbe

    Joined: 09/11/2009 05:29:37
    Messages: 8
    Offline

    Quick update:

    Launchpad has tons of features and can be difficult to navigate if you haven't used it before. If you're just looking to browse the source code, you can go here:
  • http://bazaar.launchpad.net/%7Etxspore-dev-team/txspore/trunk/files


  • Enjoy!

    This message was edited 2 times. Last update was at 09/17/2009 05:10:55

    oubiwann


    Microbe

    Joined: 09/11/2009 05:29:37
    Messages: 8
    Offline

    Hey all, I finished up the code tonight (well, the code I wanted to get done for this milestone). There are some items in the TODO that I'm going to hit in the near future, but it's ready to start using now.

    In the top-level directory, I've included a demo. It's a small web application that shows how to use the txSpore client (with deferreds and callbacks). The demo has a docstring that tells you how to run it and the URL to access it with your web browser.

    You can view the latest code at the link in my previous post. If you have bzr (Bazaar Version Control) installed, you can also get it with this command:

    I'm going to build and publish a release for http://pypi.python.org/pypi and write up a blog post. I'll update this thread again when a tarball has been uploaded to PyPI.

    This API is now several methods more feature-complete than the sync/blocking Python API. This one has also updated a couple of the REST URLs (the other API is out of date on those). What's more, I've added a fair number of unit tests. In addition to the usual benefits of unit tests, these will be helpful for learning how to use the async API.

    A note about the other Python API: I wouldn't be averse to the notion of combining an async and sync API in the same codebase (I've done it on other projects). If there's sufficient interest (one or two dedicated users) who would like to have an updated sync API, I'll start making those changes. The goal would be for such a user to download, install, and use txSpore (sync) without having to install Twisted.

    Let me know...

    This message was edited 2 times. Last update was at 09/17/2009 05:11:22

    oubiwann


    Microbe

    Joined: 09/11/2009 05:29:37
    Messages: 8
    Offline

    As promised, the package has been uploaded and is available here:
  • http://pypi.python.org/pypi/txSpore/

  • Note that the page above has example usage (pasted interactive Python prompt session, rendered from the docs), in case you want to get a quick feel for the API.

    This message was edited 1 time. Last update was at 09/15/2009 03:32:50

    oubiwann


    Microbe

    Joined: 09/11/2009 05:29:37
    Messages: 8
    Offline

    The past few nights have seen some significant improvements in the code... enough so that I've released version 0.0.2 already! Here's a quick summary of what's been done:

  • Added a new client object; calls are made with methods now, instead of module-level functions.

  • Added support for caching method results.

  • Moved the REST service API methods into their own object and instantiated it on a ".rest" attribute of the client class.

  • Moved the static data service API methods into their own object and instantiated it on a ".data" attribute of the client class.

  • Added support for Spore Atom data, available on the ".atom" client attribute.

  • Implemented the last remaining Spore API method that hadn't been added, as well as more unit tests and some code cleanup.

  • In addition to lots of other useful info, the package description on PyPI has been updated to include a brief summary of the public API methods for txSpore (only version 0.0.2):

    http://pypi.python.org/pypi/txSpore/0.0.2

    The latest changes are always available at the following URL. More history is available via a link towards the bottom of this page:

    https://code.launchpad.net/~txspore-dev-team/txspore/trunk

    This message was edited 2 times. Last update was at 09/17/2009 05:07:28

    oubiwann


    Microbe

    Joined: 09/11/2009 05:29:37
    Messages: 8
    Offline

    A fellow developer and I are planning to submit a proposal to PyCon 2010 that would include discussing txSpore. We've got an awesome Spore demo app planned and some nice API features in the works that will make txSpore even easier and more fun to use!

    Even if the proposal is not accepted, we'll be working on the changes

    Stay tuned...

    http://us.pycon.org/2010/about/
     
    Forum Index » Developer Corner
    Go to:   
     
    Powered by JForum 2.1.8 © ( EA Dev Build 2013-06-21 16:12:06 ) JForum Team