changeset 51:fabd3f2271fa

Added some basic, incomplete docs on the pymonkey module, which include a doctest that's run when pymonkey is built.
author Atul Varma <varmaa@toolness.com>
date Wed, 08 Jul 2009 09:32:31 -0700
parents 405f03166009
children 427b01954b22
files .hgignore docs/rendered/_sources/index.txt docs/rendered/_sources/pymonkey.txt docs/rendered/genindex.html docs/rendered/index.html docs/rendered/modindex.html docs/rendered/pymonkey.html docs/rendered/search.html docs/rendered/searchindex.js docs/src/conf.py docs/src/index.txt docs/src/pymonkey.txt manage.py
diffstat 13 files changed, 420 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Jul 07 09:28:29 2009 -0700
+++ b/.hgignore	Wed Jul 08 09:32:31 2009 -0700
@@ -2,6 +2,6 @@
 *.so
 *.pyc
 docs/rendered/.buildinfo
-docs/rendered/.doctrees/environment.pickle
-docs/rendered/.doctrees/index.doctree
+docs/rendered/.doctrees
 docs/rendered/objects.inv
+_doctest_output
--- a/docs/rendered/_sources/index.txt	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/rendered/_sources/index.txt	Wed Jul 08 09:32:31 2009 -0700
@@ -14,6 +14,8 @@
 .. toctree::
    :maxdepth: 2
 
+   pymonkey
+
 Rationale and Goals:
 
 * Python and JS are fairly complementary languages. Python provides
@@ -85,12 +87,6 @@
 
 Note that at the moment, the build script is only tested on OS X.
 
-Example Code
-============
-
-Right now the only example code that exists is in the test suite at
-``test_pymonkey.py``. Check it out and feel free to add more.
-
 Challenges
 ==========
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/rendered/_sources/pymonkey.txt	Wed Jul 08 09:32:31 2009 -0700
@@ -0,0 +1,42 @@
+:mod:`pymonkey` --- Access SpiderMonkey from Python
+===================================================
+
+.. module:: pymonkey
+   :synopsis: Access SpiderMonkey from Python
+
+.. testsetup:: *
+
+   import pymonkey
+
+This module offers a low-level interface to the `Mozilla SpiderMonkey
+<https://developer.mozilla.org/en/SpiderMonkey>`_ JavaScript engine.
+
+.. exception:: error
+
+   This is the type of any SpiderMonkey-related errors thrown by this
+   module.
+
+.. class:: Context
+
+   This is the type of JavaScript context objects. Contexts can only
+   be created via a call to :meth:`Runtime.new_context()`, but this
+   type object can be used with Python's built-in :func:`isinstance()`
+   to verify that an object is a context, like so:
+
+     >>> cx = pymonkey.Runtime().new_context()
+     >>> isinstance(cx, pymonkey.Context)
+     True
+
+.. class:: Runtime()
+
+   Creates a new JavaScript runtime. JS objects created by the
+   runtime may interact with other JS objects of the runtime, but
+   they can't interact with objects from other runtimes.
+
+   .. method:: new_context()
+
+      Creates a new Context object and returns it. Contexts are best
+      conceptualized as threads of execution in a JS runtme; each one
+      has a program counter, a current exception state, and so
+      forth. JS objects may be freely accessed and changed by contexts
+      that are associated with the same JS runtime as the objects.
--- a/docs/rendered/genindex.html	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/rendered/genindex.html	Wed Jul 08 09:32:31 2009 -0700
@@ -28,6 +28,9 @@
         <li class="right" style="margin-right: 10px">
           <a href="" title="General Index"
              accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             accesskey="M">modules</a> |</li>
         <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
       </ul>
     </div>  
@@ -40,11 +43,46 @@
 
    <h1 id="index">Index</h1>
 
-   
+   <a href="#C"><strong>C</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#N"><strong>N</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#R"><strong>R</strong></a> 
 
    <hr />
 
    
+<h2 id="C">C</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="pymonkey.html#pymonkey.Context">Context (class in pymonkey)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="E">E</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="pymonkey.html#pymonkey.error">error</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="N">N</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="pymonkey.html#pymonkey.Runtime.new_context">new_context() (pymonkey.Runtime method)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="P">P</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="pymonkey.html#module-pymonkey">pymonkey (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
+<h2 id="R">R</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="pymonkey.html#pymonkey.Runtime">Runtime (class in pymonkey)</a></dt></dl></td><td width="33%" valign="top"><dl>
+</dl></td></tr></table>
+
 
 
           </div>
@@ -78,6 +116,9 @@
         <li class="right" style="margin-right: 10px">
           <a href="" title="General Index"
              >index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             >modules</a> |</li>
         <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
       </ul>
     </div>
--- a/docs/rendered/index.html	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/rendered/index.html	Wed Jul 08 09:32:31 2009 -0700
@@ -19,7 +19,8 @@
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <script type="text/javascript" src="_static/doctools.js"></script>
-    <link rel="top" title="Pymonkey v0.0.1 documentation" href="" /> 
+    <link rel="top" title="Pymonkey v0.0.1 documentation" href="" />
+    <link rel="next" title="pymonkey — Access SpiderMonkey from Python" href="pymonkey.html" /> 
   </head>
   <body>
     <div class="related">
@@ -28,6 +29,12 @@
         <li class="right" style="margin-right: 10px">
           <a href="genindex.html" title="General Index"
              accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             accesskey="M">modules</a> |</li>
+        <li class="right" >
+          <a href="pymonkey.html" title="pymonkey — Access SpiderMonkey from Python"
+             accesskey="N">next</a> |</li>
         <li><a href="">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
       </ul>
     </div>  
@@ -42,7 +49,8 @@
 <p>Pymonkey is a Python C extension module to expose the <a class="reference" href="https://developer.mozilla.org/en/SpiderMonkey">Mozilla
 SpiderMonkey</a> engine
 to Python.</p>
-<ul class="simple">
+<ul>
+<li class="toctree-l1"><a class="reference" href="pymonkey.html"><tt class="docutils literal"><span class="pre">pymonkey</span></tt> &#8212; Access SpiderMonkey from Python</a></li>
 </ul>
 <p>Rationale and Goals:</p>
 <ul>
@@ -109,11 +117,6 @@
 objdir.</p>
 <p>Note that at the moment, the build script is only tested on OS X.</p>
 </div>
-<div class="section" id="example-code">
-<h2>Example Code<a class="headerlink" href="#example-code" title="Permalink to this headline">¶</a></h2>
-<p>Right now the only example code that exists is in the test suite at
-<tt class="docutils literal"><span class="pre">test_pymonkey.py</span></tt>. Check it out and feel free to add more.</p>
-</div>
 <div class="section" id="challenges">
 <h2>Challenges<a class="headerlink" href="#challenges" title="Permalink to this headline">¶</a></h2>
 <p>There&#8217;s a number of challenges that need to be resolved before
@@ -147,13 +150,15 @@
             <ul>
 <li><a class="reference" href="">Pymonkey Documentation</a><ul>
 <li><a class="reference" href="#building-and-testing">Building and Testing</a></li>
-<li><a class="reference" href="#example-code">Example Code</a></li>
 <li><a class="reference" href="#challenges">Challenges</a></li>
 <li><a class="reference" href="#indices-and-tables">Indices and Tables</a></li>
 </ul>
 </li>
 </ul>
 
+            <h4>Next topic</h4>
+            <p class="topless"><a href="pymonkey.html"
+                                  title="next chapter"><tt class="docutils literal"><span class="pre">pymonkey</span></tt> &#8212; Access SpiderMonkey from Python</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
               <li><a href="_sources/index.txt"
@@ -182,6 +187,12 @@
         <li class="right" style="margin-right: 10px">
           <a href="genindex.html" title="General Index"
              >index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             >modules</a> |</li>
+        <li class="right" >
+          <a href="pymonkey.html" title="pymonkey — Access SpiderMonkey from Python"
+             >next</a> |</li>
         <li><a href="">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
       </ul>
     </div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/rendered/modindex.html	Wed Jul 08 09:32:31 2009 -0700
@@ -0,0 +1,103 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>Global Module Index &mdash; Pymonkey v0.0.1 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '',
+        VERSION:     '0.0.1',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="top" title="Pymonkey v0.0.1 documentation" href="index.html" />
+ 
+
+    <script type="text/javascript">
+      DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX = true;
+    </script>
+
+
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="" title="Global Module Index"
+             accesskey="M">modules</a> |</li>
+        <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+
+   <h1 id="global-module-index">Global Module Index</h1>
+   <a href="#cap-P"><strong>P</strong></a> 
+   <hr/>
+
+   <table width="100%" class="indextable" cellspacing="0" cellpadding="2"><tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
+   <tr class="cap"><td></td><td><a name="cap-P"><strong>P</strong></a></td><td></td></tr><tr>
+     <td></td>
+     <td>
+     <a href="pymonkey.html#module-pymonkey"><tt class="xref">pymonkey</tt></a></td><td>
+     <em>Access SpiderMonkey from Python</em></td></tr>
+   </table>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+          <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+              <p class="searchtip" style="font-size: 90%">
+              Enter search terms or a module, class or function name.
+              </p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="" title="Global Module Index"
+             >modules</a> |</li>
+        <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2009, Atul Varma.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/rendered/pymonkey.html	Wed Jul 08 09:32:31 2009 -0700
@@ -0,0 +1,143 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>pymonkey — Access SpiderMonkey from Python &mdash; Pymonkey v0.0.1 documentation</title>
+    <link rel="stylesheet" href="_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '',
+        VERSION:     '0.0.1',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="top" title="Pymonkey v0.0.1 documentation" href="index.html" />
+    <link rel="prev" title="Pymonkey Documentation" href="index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             accesskey="M">modules</a> |</li>
+        <li class="right" >
+          <a href="index.html" title="Pymonkey Documentation"
+             accesskey="P">previous</a> |</li>
+        <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <div class="section" id="module-pymonkey">
+<h1><tt class="xref docutils literal"><span class="pre">pymonkey</span></tt> &#8212; Access SpiderMonkey from Python<a class="headerlink" href="#module-pymonkey" title="Permalink to this headline">¶</a></h1>
+<p>This module offers a low-level interface to the <a class="reference" href="https://developer.mozilla.org/en/SpiderMonkey">Mozilla SpiderMonkey</a> JavaScript engine.</p>
+<dl class="exception">
+<dt id="pymonkey.error">
+<em class="property">
+exception </em><tt class="descclassname">pymonkey.</tt><tt class="descname">error</tt><a class="headerlink" href="#pymonkey.error" title="Permalink to this definition">¶</a></dt>
+<dd>This is the type of any SpiderMonkey-related errors thrown by this
+module.</dd></dl>
+
+<dl class="class">
+<dt id="pymonkey.Context">
+<em class="property">
+class </em><tt class="descclassname">pymonkey.</tt><tt class="descname">Context</tt><a class="headerlink" href="#pymonkey.Context" title="Permalink to this definition">¶</a></dt>
+<dd><p>This is the type of JavaScript context objects. Contexts can only
+be created via a call to <a title="pymonkey.Runtime.new_context" class="reference" href="#pymonkey.Runtime.new_context"><tt class="xref docutils literal"><span class="pre">Runtime.new_context()</span></tt></a>, but this
+type object can be used with Python&#8217;s built-in <tt class="xref docutils literal"><span class="pre">isinstance()</span></tt>
+to verify that an object is a context, like so:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">cx</span> <span class="o">=</span> <span class="n">pymonkey</span><span class="o">.</span><span class="n">Runtime</span><span class="p">()</span><span class="o">.</span><span class="n">new_context</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span> <span class="n">pymonkey</span><span class="o">.</span><span class="n">Context</span><span class="p">)</span>
+<span class="go">True</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="class">
+<dt id="pymonkey.Runtime">
+<em class="property">
+class </em><tt class="descclassname">pymonkey.</tt><tt class="descname">Runtime</tt><a class="headerlink" href="#pymonkey.Runtime" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a new JavaScript runtime. JS objects created by the
+runtime may interact with other JS objects of the runtime, but
+they can&#8217;t interact with objects from other runtimes.</p>
+<dl class="method">
+<dt id="pymonkey.Runtime.new_context">
+<tt class="descname">new_context</tt><big>(</big><big>)</big><a class="headerlink" href="#pymonkey.Runtime.new_context" title="Permalink to this definition">¶</a></dt>
+<dd>Creates a new Context object and returns it. Contexts are best
+conceptualized as threads of execution in a JS runtme; each one
+has a program counter, a current exception state, and so
+forth. JS objects may be freely accessed and changed by contexts
+that are associated with the same JS runtime as the objects.</dd></dl>
+
+</dd></dl>
+
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+            <h4>Previous topic</h4>
+            <p class="topless"><a href="index.html"
+                                  title="previous chapter">Pymonkey Documentation</a></p>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/pymonkey.txt"
+                     rel="nofollow">Show Source</a></li>
+            </ul>
+          <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+              <p class="searchtip" style="font-size: 90%">
+              Enter search terms or a module, class or function name.
+              </p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             >modules</a> |</li>
+        <li class="right" >
+          <a href="index.html" title="Pymonkey Documentation"
+             >previous</a> |</li>
+        <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+      &copy; Copyright 2009, Atul Varma.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- a/docs/rendered/search.html	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/rendered/search.html	Wed Jul 08 09:32:31 2009 -0700
@@ -29,6 +29,9 @@
         <li class="right" style="margin-right: 10px">
           <a href="genindex.html" title="General Index"
              accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             accesskey="M">modules</a> |</li>
         <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
       </ul>
     </div>  
@@ -77,6 +80,9 @@
         <li class="right" style="margin-right: 10px">
           <a href="genindex.html" title="General Index"
              >index</a></li>
+        <li class="right" >
+          <a href="modindex.html" title="Global Module Index"
+             >modules</a> |</li>
         <li><a href="index.html">Pymonkey v0.0.1 documentation</a> &raquo;</li> 
       </ul>
     </div>
--- a/docs/rendered/searchindex.js	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/rendered/searchindex.js	Wed Jul 08 09:32:31 2009 -0700
@@ -1,1 +1,1 @@
-Search.setIndex({desctypes:{},terms:{spidermonkei:0,all:0,code:0,just:0,less:0,abl:0,untrust:0,lack:0,becaus:0,cross:0,veri:0,concept:0,particularli:0,languag:0,involv:0,web:0,onli:0,depend:0,execut:0,expos:0,how:0,readabl:0,should:0,platform:0,add:0,busi:0,requir:0,easier:0,them:0,around:0,python:0,swig:0,pave:0,obtain:0,envis:0,capi:0,increas:0,world:0,now:0,vast:0,enabl:0,xpcom:0,like:0,anyth:0,vibrant:0,resolv:0,server:0,"try":0,easili:0,either:0,debug:0,where:0,side:0,mean:0,right:0,some:0,back:0,realli:0,"static":0,mirror:0,disadvantag:0,collector:0,casual:0,librari:0,out:0,index:0,detect:0,collect:0,facil:0,someth:0,path_to_objdir:0,rhino:0,current:0,matur:0,outstand:0,dynam:0,rational:0,between:0,atul:0,objdir:0,sphinx:0,refer:0,full:0,run:0,garbag:0,javascript:0,situat:0,here:0,standard:0,extens:0,base:0,preprocessor:0,repositori:0,complementari:0,path:0,come:0,don:0,about:0,actual:0,easi:0,fairli:0,root:0,traceback:0,plai:0,manag:0,instanc:0,doctest:0,logic:0,com:0,other:0,tremend:0,via:0,obviou:0,pyrex:0,feel:0,solut:0,modul:0,number:0,header:0,instruct:0,api:0,serverj:0,contributor:0,custom:0,test_pymonkei:0,your:0,duplic:0,quit:0,java:0,creat:0,wai:0,script:0,ergonom:0,due:0,mark:0,avail:0,sweep:0,too:0,lot:0,suit:0,"final":0,more:0,free:0,field:0,from:0,relationship:0,tool:0,mozilla:0,search:0,ctype:0,doesn:0,known:0,central:0,eas:0,than:0,must:0,count:0,wide:0,made:0,provid:0,straight:0,work:0,defin:0,can:0,learn:0,akin:0,similar:0,browser:0,would:0,have:0,advantag:0,give:0,process:0,challeng:0,readm:0,ani:0,indic:0,trap:0,packag:0,exist:0,file:0,tabl:0,need:0,featur:0,check:0,probabl:0,alwai:0,write:0,engin:0,goal:0,want:0,secur:0,parti:0,make:0,intermediari:0,access:0,client:0,note:0,also:0,ideal:0,complex:0,build:0,which:0,test:0,you:0,document:0,noth:0,product:0,http:0,clone:0,object:0,wherea:0,usabl:0,hand:0,befor:0,moment:0,never:0,develop:0,stack:0,pymonkei:0,directori:0,memori:0,land:0,off:0,third:0,read:0,macro:0,cycl:0,page:0,without:0,sandbox:0,exampl:0,environ:0,awesom:0,thi:0,programm:0,model:0,profil:0,latter:0,contribut:0},titles:["Pymonkey Documentation"],modules:{},descrefs:{},filenames:["index"]})
\ No newline at end of file
+Search.setIndex({desctypes:{"0":"exception","1":"class","2":"method"},terms:{spidermonkei:[0,1],all:0,code:0,just:0,less:0,abl:0,untrust:0,lack:0,becaus:0,cross:0,veri:0,concept:0,particularli:0,matur:0,languag:0,involv:0,web:0,onli:[0,1],depend:0,execut:[0,1],expos:0,how:0,readabl:0,except:1,should:0,platform:0,add:[],busi:0,requir:0,counter:1,easier:0,isinst:1,build:0,them:0,liter:1,"return":1,around:0,thei:1,python:[0,1],swig:0,pave:0,obtain:0,envis:0,capi:0,increas:0,world:0,now:[],"class":1,vast:0,enabl:0,xpcom:0,document:0,like:[0,1],level:1,vibrant:0,anyth:0,resolv:0,server:0,"try":0,easili:0,either:0,each:1,debug:0,where:0,manag:0,mean:0,right:[],new_context:1,some:0,back:0,realli:0,"static":0,mirror:0,disadvantag:0,collector:0,casual:0,best:1,out:0,index:0,detect:0,collect:0,facil:0,someth:0,path_to_objdir:0,rhino:0,access:[0,1],state:1,outstand:0,dynam:0,rational:0,between:0,atul:0,"new":1,objdir:0,forth:1,sphinx:0,refer:0,docutil:1,full:0,run:0,garbag:0,javascript:[0,1],situat:0,here:0,standard:0,objcec:[],extens:0,base:0,preprocessor:0,repositori:0,complementari:0,path:0,come:0,don:0,thrown:1,about:0,actual:0,easi:0,thread:1,fairli:0,root:0,current:[0,1],plai:0,page:0,instanc:0,doctest:0,context:1,logic:0,freeli:1,chang:1,com:0,other:[0,1],tremend:0,via:[0,1],obviou:0,pyrex:0,feel:[],solut:0,modul:[0,1],runtm:1,number:0,header:0,instruct:0,api:0,serverj:0,contributor:0,custom:0,test_pymonkei:[],your:0,duplic:0,quit:0,span:1,creat:[0,1],wai:0,script:0,ergonom:0,interact:1,due:0,mark:0,avail:0,program:1,call:1,too:0,lot:0,suit:[],interfac:1,type:1,"final":0,more:0,free:[],field:0,from:[0,1],relationship:0,offer:1,tool:0,mozilla:[0,1],search:0,ctype:0,doesn:0,known:0,central:0,eas:0,"true":1,than:0,must:0,count:0,wide:0,made:0,blah:[],provid:0,straight:0,work:0,conceptu:1,can:[0,1],learn:0,akin:0,similar:0,browser:0,pre:1,would:0,traceback:0,have:0,advantag:0,give:0,process:0,challeng:0,readm:0,ani:[0,1],indic:0,trap:0,packag:0,exist:0,file:0,tabl:0,need:0,featur:0,check:[],contribut:0,low:1,alwai:0,sweep:0,engin:[0,1],goal:0,want:0,secur:0,boop:[],parti:0,make:0,error:1,intermediari:0,same:1,client:0,note:0,also:0,ideal:0,complex:0,librari:0,which:0,test:0,verifi:1,you:0,probabl:0,noth:0,product:0,relat:1,http:0,clone:0,object:[0,1],wherea:0,usabl:0,hand:0,befor:0,moment:0,never:0,mai:1,develop:0,defin:0,associ:1,stack:0,pymonkei:[0,1],built:1,directori:0,memori:0,land:0,off:0,write:0,third:0,java:0,read:0,macro:0,cycl:0,side:0,without:0,sandbox:0,exampl:[],environ:0,runtim:1,thi:[0,1],programm:0,model:0,profil:0,latter:0,awesom:0},titles:["Pymonkey Documentation","<tt class=\"docutils literal docutils literal\"><span class=\"pre\">pymonkey</span></tt> &#8212; Access SpiderMonkey from Python"],modules:{pymonkey:1},descrefs:{"pymonkey.Runtime":{new_context:[1,2]},pymonkey:{Runtime:[1,1],Context:[1,1],error:[1,0]}},filenames:["index","pymonkey"]})
\ No newline at end of file
--- a/docs/src/conf.py	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/src/conf.py	Wed Jul 08 09:32:31 2009 -0700
@@ -192,3 +192,5 @@
 
 # If false, no module index is generated.
 #latex_use_modindex = True
+
+doctest_test_doctest_blocks = 'default'
--- a/docs/src/index.txt	Tue Jul 07 09:28:29 2009 -0700
+++ b/docs/src/index.txt	Wed Jul 08 09:32:31 2009 -0700
@@ -14,6 +14,8 @@
 .. toctree::
    :maxdepth: 2
 
+   pymonkey
+
 Rationale and Goals:
 
 * Python and JS are fairly complementary languages. Python provides
@@ -85,12 +87,6 @@
 
 Note that at the moment, the build script is only tested on OS X.
 
-Example Code
-============
-
-Right now the only example code that exists is in the test suite at
-``test_pymonkey.py``. Check it out and feel free to add more.
-
 Challenges
 ==========
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/pymonkey.txt	Wed Jul 08 09:32:31 2009 -0700
@@ -0,0 +1,42 @@
+:mod:`pymonkey` --- Access SpiderMonkey from Python
+===================================================
+
+.. module:: pymonkey
+   :synopsis: Access SpiderMonkey from Python
+
+.. testsetup:: *
+
+   import pymonkey
+
+This module offers a low-level interface to the `Mozilla SpiderMonkey
+<https://developer.mozilla.org/en/SpiderMonkey>`_ JavaScript engine.
+
+.. exception:: error
+
+   This is the type of any SpiderMonkey-related errors thrown by this
+   module.
+
+.. class:: Context
+
+   This is the type of JavaScript context objects. Contexts can only
+   be created via a call to :meth:`Runtime.new_context()`, but this
+   type object can be used with Python's built-in :func:`isinstance()`
+   to verify that an object is a context, like so:
+
+     >>> cx = pymonkey.Runtime().new_context()
+     >>> isinstance(cx, pymonkey.Context)
+     True
+
+.. class:: Runtime()
+
+   Creates a new JavaScript runtime. JS objects created by the
+   runtime may interact with other JS objects of the runtime, but
+   they can't interact with objects from other runtimes.
+
+   .. method:: new_context()
+
+      Creates a new Context object and returns it. Contexts are best
+      conceptualized as threads of execution in a JS runtme; each one
+      has a program counter, a current exception state, and so
+      forth. JS objects may be freely accessed and changed by contexts
+      that are associated with the same JS runtime as the objects.
--- a/manage.py	Tue Jul 07 09:28:29 2009 -0700
+++ b/manage.py	Wed Jul 08 09:32:31 2009 -0700
@@ -49,7 +49,7 @@
                               os.path.join("docs", "src"),
                               os.path.join("docs", "rendered")])
     if retval:
-        sys.exit(1)
+        sys.exit(retval)
 
 @task
 @cmdopts([("objdir=", "o", "The root of your Mozilla objdir"),
@@ -113,3 +113,16 @@
 
     if result:
         sys.exit(result)
+
+    print "Running doctests."
+
+    # We have to add our current directory to the python path so that
+    # our doctests can find the pymonkey module.
+    new_env['PYTHONPATH'] = os.path.abspath('.')
+    retval = subprocess.call(["sphinx-build",
+                              "-b", "doctest",
+                              os.path.join("docs", "src"),
+                              "_doctest_output"],
+                             env = new_env)
+    if retval:
+        sys.exit(retval)