<!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>Usage — polyloader 0.1.0 documentation</title> <link rel="stylesheet" href="default.css" type="text/css" /> <link rel="stylesheet" href="pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', VERSION: '0.1.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="underscore.js"></script> <script type="text/javascript" src="doctools.js"></script> <link rel="top" title="polyloader 0.1.0 documentation" href="index.html" /> <link rel="next" title="Details on Import and Polyloader" href="details.html" /> <link rel="prev" title="Installation" href="installation.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="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="details.html" title="Details on Import and Polyloader" accesskey="N">next</a> |</li> <li class="right" > <a href="installation.html" title="Installation" accesskey="P">previous</a> |</li> <li><a href="index.html">polyloader 0.1.0 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="usage"> <h1>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">ΒΆ</a></h1> <p>Import polyloader in your python script’s launcher or library, as well as the syntax compiler(s) you plan to use. For example, if you have <a class="reference external" href="https://github.com/i2y/mochi">Mochi</a> and <a class="reference external" href="http://docs.hylang.org/en/latest/">Hy</a> installed, and you wanted to write a Django app, edit manage.py and add the following lines at the top:</p> <div class="highlight-python"><div class="highlight"><pre>from mochi.main import compile_file as mochi_compile from hy.importer import ast_compile as hy_compile import polyloader polyloader.install(mochi_compile, ['.mochi']) polyloader.install(hy_compile, ['.hy'])} </pre></div> </div> <p>Now your views can be written in Hy and your models in Mochi, and everything will just work.</p> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="installation.html" title="previous chapter">Installation</a></p> <h4>Next topic</h4> <p class="topless"><a href="details.html" title="next chapter">Details on Import and Polyloader</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/usage.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" /> <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="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="details.html" title="Details on Import and Polyloader" >next</a> |</li> <li class="right" > <a href="installation.html" title="Installation" >previous</a> |</li> <li><a href="index.html">polyloader 0.1.0 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2016, Kenneth M. "Elf" Sternberg. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2. </div> </body> </html>