{ "info": { "author": "Jan Hermann", "author_email": "dev@jan.hermann.name", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Environment :: Web Environment", "Framework :: IPython", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Utilities" ], "description": "# Knitj\n\n![python](https://img.shields.io/pypi/pyversions/knitj.svg)\n[![pypi](https://img.shields.io/pypi/v/knitj.svg)](https://pypi.org/project/knitj/)\n[![commits since](https://img.shields.io/github/commits-since/jhrmnn/knitj/latest.svg)](https://github.com/jhrmnn/knitj/releases)\n[![last commit](https://img.shields.io/github/last-commit/jhrmnn/knitj.svg)](https://github.com/jhrmnn/knitj/commits/master)\n[![license](https://img.shields.io/github/license/jhrmnn/knitj.svg)](https://github.com/jhrmnn/knitj/blob/master/LICENSE)\n[![code style](https://img.shields.io/badge/code%20style-black-202020.svg)](https://github.com/ambv/black)\n\nKnitj is an alternative front-end to Jupyter kernels. Inspired by [knitr](https://yihui.name/knitr/) and [R Markdown](http://rmarkdown.rstudio.com), Knitj renders a mix of markdown and source code into HTML by evaluating the code in a Jupyter kernel.\n\nIn addition to a one-off conversion, Knitj can serve the HTML document via HTTP and watch the source file for changes. When the source file is changed, Knitj reevaluates only the changed bits (defined by boundaries between markdown and source code), and pushes the updates into the HTML document via WebSocket.\n\n## Example\n\nEither of the two following files renders into the same HTML document below with\n\n```bash\nknitj $SOURCE >$SOURCE.html\n```\n\n~~~markdown\n```python\n#::hide\nimport numpy as np\nfrom matplotlib import pyplot as plt\n%matplotlib inline\n```\n\n## Example\n\nLet's plot\n\n$$ f(x)=\\frac{\\sin x}x $$\n\n```python\nx = np.linspace(-20, 20, 200)\nplt.plot(x, np.sin(x)/x)\n```\n~~~\n\n```python\n# ::hide\nimport numpy as np\nfrom matplotlib import pyplot as plt\n# ::%matplotlib inline\n\n# ::>\n# ## Example\n#\n# Let's plot\n#\n# $$ f(x)=\\frac{\\sin x}x $$\n\nx = np.linspace(-20, 20, 200)\nplt.plot(x, np.sin(x)/x)\n```\n\n![](docs/static/example.png)\n\nAlternatively, one can start the Knitj server, which starts watching the source file for changes and opens a browser window with the rendered and live-updated HTML document\n\n```\n$ knitj --server test.py\n[22:19:14.718] INFO:knitj: Entered Knitj\n[22:19:14.722] INFO:knitj.document: File change: 3/0 new cells, 0 dropped\n[22:19:14.732] INFO:knitj.document: 2 code cells loaded from output\n[22:19:14.732] INFO:knitj.kernel: Starting kernel...\n[22:19:15.145] INFO:knitj.kernel: Kernel started\n[22:19:15.160] INFO:knitj.knitj: Started web server on port 8081\n[22:19:15.441] INFO:knitj.knitj: Started broadcasting to browsers\n[22:19:15.462] INFO:knitj.source: Started watching file test.md for changes\n[22:19:15.881] INFO:knitj.webserver: Browser connected: 4542074160\n[22:19:41.477] INFO:knitj.document: File change: 1/3 new cells, 1 dropped\n[22:19:41.683] INFO:knitj.document: 72fea2: Got an error\n[22:19:41.698] INFO:knitj.document: 72fea2: Cell done\n[22:19:41.716] INFO:knitj.document: 72fea2: Got an error execution reply\n^C[22:19:46.179] INFO:knitj.webserver: Closing websockets\n[22:19:46.180] INFO:knitj.webserver: Browser disconnected: 4542074160\n[22:19:46.181] INFO:knitj.kernel: Kernel shut down\n[22:19:46.186] INFO:knitj: Leaving Knitj\n```\n\n## Installing\n\nInstall and update using [Pip](https://pip.pypa.io/en/stable/quickstart/).\n\n```\npip install -U knitj\n```\n\nThe following dependencies are installed:\n\n- [Jupyter Client](https://github.com/jupyter/jupyter_client) for communicating with the Jupyter kernels\n- [Watchdog](https://pythonhosted.org/watchdog/) for watching a file for changes\n- [ansi2html](https://github.com/ralphbean/ansi2html) for converting ANSI color codes into HTML\n- [Misaka](http://misaka.61924.nl) for rendering Markdown\n- [aiohttp](http://aiohttp.readthedocs.io) for running a http and WebSocket server\n- [Pygments](http://pygments.org) for syntax highlighting\n- [Jinja](http://jinja.pocoo.org) for HTML templates\n- [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/) for parsing HTML\n\nTo use Knitj, you also need some Jupyter kernel on your system. If you don\u2019t have one, you can get the IPython kernel with\n\n```\npip install ipykernel\n```\n\n## Usage\n\n```\nusage: knitj [-h] [-s] [-f FORMAT] [-o FILE] [-k KERNEL] [-b BROWSER] [-n]\n [FILE]\n\npositional arguments:\n FILE input file\n\noptional arguments:\n -h, --help show this help message and exit\n -s, --server run in server mode\n -f FORMAT, --format FORMAT\n input format\n -o FILE, --output FILE\n output HTML file\n -k KERNEL, --kernel KERNEL\n Jupyter kernel to use\n -b BROWSER, --browser BROWSER\n browser to open\n -n, --no-browser do not open a browser\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jhrmnn/knitj", "keywords": "", "license": "MPL-2.0", "maintainer": "Jan Hermann", "maintainer_email": "dev@jan.hermann.name", "name": "knitj", "package_url": "https://pypi.org/project/knitj/", "platform": "", "project_url": "https://pypi.org/project/knitj/", "project_urls": { "Homepage": "https://github.com/jhrmnn/knitj", "Repository": "https://github.com/jhrmnn/knitj" }, "release_url": "https://pypi.org/project/knitj/0.3.1/", "requires_dist": [ "watchdog (>=0.9.0,<0.10.0)", "jupyter-client (>=5.2,<6.0)", "ansi2html (>=1.5,<2.0)", "misaka (>=2.1,<3.0)", "aiohttp (>=3.4,<4.0)", "pygments (>=2.2,<3.0)", "Jinja2 (>=2.10,<3.0)", "beautifulsoup4 (>=4.6,<5.0)", "pyyaml (>=3.13,<4.0)" ], "requires_python": ">=3.6,<4.0", "summary": "Alternative Jupyter front-end", "version": "0.3.1" }, "last_serial": 4866673, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "c08097842e8b46e35c776869f1a61c42", "sha256": "27eb9485819476519cc529e0bb497936aa494f0c0a655939050ae8889e489e0d" }, "downloads": -1, "filename": "knitj-0.2.1.tar.gz", "has_sig": false, "md5_digest": "c08097842e8b46e35c776869f1a61c42", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 18497, "upload_time": "2018-10-30T22:11:22", "url": "https://files.pythonhosted.org/packages/22/05/5a04345af677265dafc4d0ed78fbf194a678f0e2b276f3c4cfa1aa82fbe5/knitj-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "baf62178039da87544b5f6415deda152", "sha256": "f54d37e064dec6c3abe748116d50fd3967adb824eebcc175f5a3a03b0f7ee1b9" }, "downloads": -1, "filename": "knitj-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "baf62178039da87544b5f6415deda152", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 129433, "upload_time": "2018-10-31T08:57:40", "url": "https://files.pythonhosted.org/packages/e9/cf/36e7bf91e4626bfb20a3e94d00fbe6f51c264ef213c9f02feff7ed2fd385/knitj-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "57da3811b6322b804a503d03f7a07537", "sha256": "374542a544c66b6c21a4bdecd8349c6589942f5dd681f5f3fa5403d2520fd92f" }, "downloads": -1, "filename": "knitj-0.2.2.tar.gz", "has_sig": false, "md5_digest": "57da3811b6322b804a503d03f7a07537", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 38491, "upload_time": "2018-10-31T08:57:41", "url": "https://files.pythonhosted.org/packages/97/e9/30124e55e47c5f81c68ac468d86654348b3a12b61dbf40ec5eabee11ea01/knitj-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "5816757da115693b50deedbfe10f2946", "sha256": "af44cb7cfb323dc1856211b5731cef101b9808d6a3c9aab93a3c2f77eb41c911" }, "downloads": -1, "filename": "knitj-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5816757da115693b50deedbfe10f2946", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 131353, "upload_time": "2018-11-28T21:42:02", "url": "https://files.pythonhosted.org/packages/dd/35/01818c1a223c2fc442e5adbc260dbccff3b0c62dbf82e3f7da8345736114/knitj-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45b6e4041270c5053ec6c60e96174161", "sha256": "9f2261139ed2b3accde723f81ffca3935ae6f1d06419c02958a292dbaecc268c" }, "downloads": -1, "filename": "knitj-0.3.0.tar.gz", "has_sig": false, "md5_digest": "45b6e4041270c5053ec6c60e96174161", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 38985, "upload_time": "2018-11-28T21:42:04", "url": "https://files.pythonhosted.org/packages/6f/34/28e3ee8b53d0b35e20ecf5aa8268794fb4fdcb683f1ad3566dc6290deb93/knitj-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "74f4f31da9ff93f386d36e30e0450da6", "sha256": "2dcd7c60888e172488733feb0f40ca61623dd73aacfb9c68b93c13829bb2563c" }, "downloads": -1, "filename": "knitj-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "74f4f31da9ff93f386d36e30e0450da6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 131401, "upload_time": "2019-02-25T21:00:28", "url": "https://files.pythonhosted.org/packages/f1/df/5a0fc16d087acb87ba3e4aadbfab15b056902e263e7087210503070f1b58/knitj-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0889997a037899e946bc21b38f458095", "sha256": "d91db650b58d18ed1559927a170cccebcd6f5313e45827bdd4b6cc293fc323cd" }, "downloads": -1, "filename": "knitj-0.3.1.tar.gz", "has_sig": false, "md5_digest": "0889997a037899e946bc21b38f458095", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 39051, "upload_time": "2019-02-25T21:00:30", "url": "https://files.pythonhosted.org/packages/08/12/b6269f653adab7bec0ca91d7cd6be35fecdd878c592d931eff8b2bb0bb26/knitj-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "74f4f31da9ff93f386d36e30e0450da6", "sha256": "2dcd7c60888e172488733feb0f40ca61623dd73aacfb9c68b93c13829bb2563c" }, "downloads": -1, "filename": "knitj-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "74f4f31da9ff93f386d36e30e0450da6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 131401, "upload_time": "2019-02-25T21:00:28", "url": "https://files.pythonhosted.org/packages/f1/df/5a0fc16d087acb87ba3e4aadbfab15b056902e263e7087210503070f1b58/knitj-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0889997a037899e946bc21b38f458095", "sha256": "d91db650b58d18ed1559927a170cccebcd6f5313e45827bdd4b6cc293fc323cd" }, "downloads": -1, "filename": "knitj-0.3.1.tar.gz", "has_sig": false, "md5_digest": "0889997a037899e946bc21b38f458095", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 39051, "upload_time": "2019-02-25T21:00:30", "url": "https://files.pythonhosted.org/packages/08/12/b6269f653adab7bec0ca91d7cd6be35fecdd878c592d931eff8b2bb0bb26/knitj-0.3.1.tar.gz" } ] }