{ "info": { "author": "JP Senior", "author_email": "jp.senior@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Sphinx :: Extension", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2.7" ], "description": "sphinx-execute-code\n===================\n\nSphinx-execute-code is an extension for Sphinx that allows a document author\nto insert arbitrary python code samples in code blocks, or run python code\nfrom python files on the filesystem.\n\nThis was written as an alternative to other code execution functions which\nrelied on doctest formats, and attempts to be more flexible, similar to\nliteral-block and code-block statements.\n\n.. warning:: This module allows you to run arbitrary code, and should be treated with caution.\n\nOptions\n-------\nOptions right now (as of version 0.2) are:\n\nlinenos\n If specified, will show line numbers\noutput_language\n Customizes pygments lexxer for specified language (Eg, Javascript, bash)\nhide_code\n If specified, will hide the code block and only show results\nhide_headers\n If specified, hides the 'Code' and 'Results' caption headers around\n the literal blocks\nfilename\n If specified, will load code from a file (relative to sphinx doc root)\n and ignore content.\n\nexecute_code\n------------\nRunning 'execute_code' as a directive allows the administrator to embed exact\npython code as if it was pasted in a normal code-block.\n\nExecuting python code and showing the result output::\n\n .. execute_code::\n :linenos:\n\n print 'python highlight code'\n\n class Foo(object):\n def __init__(self):\n self.bar = 'baz'\n def out(self):\n print self.bar\n\n f = Foo()\n f.out()\n\nOutput language\n---------------\nCustomizing the output syntax can be helpful to make it easy to document\nany other pygments lexxer - eg ini, javascript\n\nWe can customize the output language parser (for JSON/Javascript)::\n\n .. execute_code::\n :output_language: javascript\n\n print \"'{foo-bar-baz}'\"\n\nHiding code\n-----------\nYou may want to hide the example code that is executing\n(avoiding highlighting/etc) and display the results only.\n\nWe can also hide the code input, showing only the executed code results::\n\n .. execute_code::\n :hide_code:\n\n print 'This should not print the example code'\n\nSuppressing output headers\n--------------------------\nSuppressing the 'Headers' outputs for Code and Results header::\n\n .. execute_code::\n :hide_headers:\n\n foo = 32\n print 'This will hide the Code and Results text - and foo is %d' % foo\n\nExecuting python code from a file\n---------------------------------\nexecute_code also allows you to import a python file and execute\nit within a document.\n\nRunning a Python file from filename from the .py example::\n\n .. execute_code::\n :filename: tests/example_class.py\n\nThis function also supports the argument 'hide_filename'::\n\n .. execute_code::\n :filename: tests/example_class.py\n :hide_filename:\n\nInstallation\n============\n\nInstallation from source::\n\n $ git clone git@github.com:jpsenior/sphinx-execute-code.git\n $ python setup.py install\n\nInstallation from pypi::\n\n $ pip install sphinx-execute-code\n\nActivating on Sphinx\n====================\n\nTo activate the extension, add it to your extensions variable in conf.py\nfor your project.\n\nActivating the extension in sphinx::\n\n extensions.append('sphinx_execute_code')\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jpsenior/sphinx-execute-code", "keywords": "sphinx extension directive execute code", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sphinx_execute_code", "package_url": "https://pypi.org/project/sphinx_execute_code/", "platform": "any", "project_url": "https://pypi.org/project/sphinx_execute_code/", "project_urls": { "Homepage": "https://github.com/jpsenior/sphinx-execute-code" }, "release_url": "https://pypi.org/project/sphinx_execute_code/0.2a2/", "requires_dist": null, "requires_python": "", "summary": "Sphinx support for execution of python code from code blocks or files", "version": "0.2a2" }, "last_serial": 3063551, "releases": { "0.2a1": [ { "comment_text": "", "digests": { "md5": "2f63e1541b2bd58a6979adf732c7c158", "sha256": "45f98f33599755d8e90ff52a19c25fc293756aaaf25d13c5b7b95c7976f014be" }, "downloads": -1, "filename": "sphinx_execute_code-0.2a1.tar.gz", "has_sig": false, "md5_digest": "2f63e1541b2bd58a6979adf732c7c158", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5489, "upload_time": "2017-08-01T05:34:40", "url": "https://files.pythonhosted.org/packages/59/cd/a9297052e073b4924b7519624876b2192dca8d2d6ddc86105c2057fcbf50/sphinx_execute_code-0.2a1.tar.gz" } ], "0.2a2": [ { "comment_text": "", "digests": { "md5": "5f4db07ff67141faa05b44f3bacbfaaf", "sha256": "3d9ce2c5c0bf1f888207fb4fc6aea0b9efdb7c3f92b60cd1c7bce2409a7f1937" }, "downloads": -1, "filename": "sphinx_execute_code-0.2a2.tar.gz", "has_sig": false, "md5_digest": "5f4db07ff67141faa05b44f3bacbfaaf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6609, "upload_time": "2017-08-01T06:46:20", "url": "https://files.pythonhosted.org/packages/97/63/474333fff6a81f3b4fd392f7dcb3bb11d40712b03954518741f9a3cce420/sphinx_execute_code-0.2a2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5f4db07ff67141faa05b44f3bacbfaaf", "sha256": "3d9ce2c5c0bf1f888207fb4fc6aea0b9efdb7c3f92b60cd1c7bce2409a7f1937" }, "downloads": -1, "filename": "sphinx_execute_code-0.2a2.tar.gz", "has_sig": false, "md5_digest": "5f4db07ff67141faa05b44f3bacbfaaf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6609, "upload_time": "2017-08-01T06:46:20", "url": "https://files.pythonhosted.org/packages/97/63/474333fff6a81f3b4fd392f7dcb3bb11d40712b03954518741f9a3cce420/sphinx_execute_code-0.2a2.tar.gz" } ] }