{ "info": { "author": "Andreas Dominik Cullmann", "author_email": "fvafrcu@mailbox.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Documentation" ], "description": "Excerpt Lines from Files\n========================\n.. image:: https://gitlab.com/fvafrCU/excerpts/badges/master/pipeline.svg\n :target: https://gitlab.com/fvafrCU/excerpts/commits/master\n.. image:: https://gitlab.com/fvafrCU/excerpts/badges/master/coverage.svg\n :target: https://gitlab.com/fvafrCU/excerpts/commits/master\n.. image:: https://img.shields.io/pypi/v/excerpts.svg\n :target: https://pypi.python.org/pypi/excerpts\n\nIntroduction\n------------\n\nEver read or wrote source files containing sectioning comments?\nEspecially in scientific and/or data analysis scripts I see a lot like\n\n.. code:: python\n\n ### Collect Data\n\n\n\nor \n\n.. code:: python\n\n ###\n ### Remove Outliers\n ###\n\n\n\nor even\n\n.. code:: python\n\n ### 2.1 Descriptive Statistics\n\n\n\n\n(`RStudio `_, an IDE for the\n`programming language R `_ has\neven come up with their own\n`code sectioning and folding feature\n`_\nthat requires comments like\n\n.. code:: python\n\n # Hypothesis Testing ----\n\n\n\n)\n\nIf these comments are markdown style section comments, we can excerpt them and\nset a table of contents.\n\nA First Example\n---------------\nSuppose you have the following code:\n\n.. code::\n\n #!/usr/bin/env python3\n\n # #% A Tutorial Introduction\n\n # ##% Getting Started\n\n # no need to import anything\n print('hello, world')\n\n # ###% The First Python Function\n def main():\n print('hello, world')\n\n\n main()\n\n # ##% Variables and Arithmetic Expressions\n print('some code')\n\n # a comment\n print('more code')\n\n\n\n\n\n\nWe can excerpt the comments marked by '%':\n\n.. code::\n\n # A Tutorial Introduction\n ## Getting Started\n ### The First Python Function\n ## Variables and Arithmetic Expressions\n\n\n\n\n\nwhich is valid \n`markdown `_\nthat we can convert using \n`pandoc `_\n.\n\nA Bit More Elaborated\n---------------------\nSuppose you have a file 'tests/files/some_file.txt' reading:\n\n.. code::\n\n #######% % All About Me\n #######% % Me\n ####### The above defines a pandoc markdown header.\n ####### This is more text that will not be extracted.\n #######% **This** is an example of a markdown paragraph: markdown\n #######% recognizes only six levels of heading, so we use seven or\n #######% more levels to mark \"normal\" text.\n #######% Here you can use the full markdown\n #######% [syntax](http://daringfireball.net/projects/markdown/syntax).\n #######% *Note* the trailing line: markdown needs an empty line to end\n #######% a paragraph.\n #######%\n\n #% A section\n ##% A subsection\n ### Not a subsubsection but a plain comment.\n ############% Another markdown paragraph.\n ############%\n ####### More text that will not be extracted.\n\n\n\n\n\n\nThen excerpting the marked comments via\n\n.. code:: python\n\n import excerpts\n file_name = 'tests/files/some_file.txt'\n with open(file_name) as infile:\n lines = infile.readlines()\n\n excerpted = excerpts.excerpt(lines = lines, comment_character=\"#\",\n magic_character=\"%\")\n\n\n\n\n\n.. code:: python\n\n print (''.join(str(p) for p in excerpted))\n\n\n\ngives\n\n.. code::\n\n % All About Me\n % Me\n **This** is an example of a markdown paragraph: markdown\n recognizes only six levels of heading, so we use seven or\n more levels to mark \"normal\" text.\n Here you can use the full markdown\n [syntax](http://daringfireball.net/projects/markdown/syntax).\n *Note* the trailing line: markdown needs an empty line to end\n a paragraph.\n\n # A section\n ## A subsection\n Another markdown paragraph.\n\n\n\n\n\n\nwhich again is valid \n`markdown `_\nfor \n`pandoc `_\n.\n\nWorking with Files\n~~~~~~~~~~~~~~~~~~\nIf you want to excerpt from a file and run pandoc on the result, you can use\n\n\n.. code:: python\n\n excerpts.excerpts(file_name = file_name, comment_character=\"#\",\n magic_character=\"%\", output_path=\"output\", run_pandoc=True,\n pandoc_formats=\"html\")\n\n\n\nto generate \n`this file. `_\n\nCommand Line Interface\n......................\nExcerpts has a command line interface that you may call from your\noperating systems' command line instead of from python3:\n\n.. code::\n\n usage: excerpts [-h] [-O OUTPUT_PATH] [-o POSTFIX] [-e PREFIX]\n [-c COMMENT_CHARACTER] [-m MAGIC_CHARACTER] [-v] [-x]\n [-p]\n [-n] [-l] [--no-latex] [--formats PANDOC_FORMATS]\n [--no-pep8]\n file\n\n excerpt markdown-style comments from a file to markdown and\n\n\n\n\n\nPEP8 \n----\nPEP8 requires each \"line of a block comment starts with a # and a single space\".\nexcerpts takes care of this requirement by removing a single comment character\nthat is followed by a space and a sequence of comments characters.\nShould you need to disable this behaviour, you can set allow_pep8 to False.\n\n\nRequirements\n------------\n\nExcerpts needs python3.\n\nInstallation\n------------\nTry \n pip3 install git+git://gitlab.com/fvafrcu/excerpts --upgrade --user\n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/fvafrcu/excerpts", "keywords": "table of contents,structure comments", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "excerpts", "package_url": "https://pypi.org/project/excerpts/", "platform": "", "project_url": "https://pypi.org/project/excerpts/", "project_urls": { "Homepage": "https://gitlab.com/fvafrcu/excerpts" }, "release_url": "https://pypi.org/project/excerpts/2.1.0/", "requires_dist": [ "coverage; extra == 'test'" ], "requires_python": "", "summary": "Excerpt Markdown Style Comments From a File", "version": "2.1.0" }, "last_serial": 5007959, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "b7e8baa7af069df736da958e5f8890da", "sha256": "d626f011a5e0a5b600ba014626706c267768970fc11bdddc38fa90ff7d732397" }, "downloads": -1, "filename": "excerpts-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b7e8baa7af069df736da958e5f8890da", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11435, "upload_time": "2017-04-07T21:36:38", "url": "https://files.pythonhosted.org/packages/ef/cb/a4b3019866470daa2123109af1233d64ed5331869352830506663c84fe4b/excerpts-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4cc6f01a7eca2616f23e224b3cb1b01c", "sha256": "d7eff82746dfdb5c0ab18e02b1b2b4c699270db274e90a6ce27343ea66c6b606" }, "downloads": -1, "filename": "excerpts-1.0.0.tar.gz", "has_sig": false, "md5_digest": "4cc6f01a7eca2616f23e224b3cb1b01c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 285656, "upload_time": "2017-04-07T21:36:43", "url": "https://files.pythonhosted.org/packages/b5/09/737a96ba7060fa4ec6c11441f2cb9b1e71adea35d07dca9bafa14976d73e/excerpts-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "b2ab2601ef8790306fa1df9ddb783ce5", "sha256": "a150334bcd306d6186bf9bc16912ba7c752e96c83898bba1a23bd7a8950439d5" }, "downloads": -1, "filename": "excerpts-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b2ab2601ef8790306fa1df9ddb783ce5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11540, "upload_time": "2017-05-21T20:35:29", "url": "https://files.pythonhosted.org/packages/49/5a/ffba118f5659a861e442fa77321b925d0b683702bbac748431bb99c2287e/excerpts-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6eb30f5ec649de3cd8eae964d9efd2e2", "sha256": "8a9a552800b15a323622ef649e5c092226d3bc7e5687ad9e2eddb920a9f2a96f" }, "downloads": -1, "filename": "excerpts-1.1.0.tar.gz", "has_sig": false, "md5_digest": "6eb30f5ec649de3cd8eae964d9efd2e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 167168, "upload_time": "2017-05-21T20:35:33", "url": "https://files.pythonhosted.org/packages/f3/a3/9fd20a4e4993be13fb185348d09aa97c3df2cbb2bd8f891fb9f2e786a912/excerpts-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "5b0783238105cab7673ee1141fb17d5c", "sha256": "a7788b4d4492fbdc6e5829325b13c94084a3fa4c2ac036f23de19ae24260855e" }, "downloads": -1, "filename": "excerpts-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5b0783238105cab7673ee1141fb17d5c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11663, "upload_time": "2017-06-01T07:01:54", "url": "https://files.pythonhosted.org/packages/4f/bd/233780c4d084906599c94b342d45f34cf0cb74b3db713744b22ca903d638/excerpts-1.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6de0ebe2ede6a36c69684a6af8794a4b", "sha256": "edcfde79f1d2c6263d90a0d07d3d859f2f6d467040a51812927c7d08d6fc5a3e" }, "downloads": -1, "filename": "excerpts-1.2.0.tar.gz", "has_sig": false, "md5_digest": "6de0ebe2ede6a36c69684a6af8794a4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 167818, "upload_time": "2017-06-01T07:01:57", "url": "https://files.pythonhosted.org/packages/5c/fa/57bd36e5a7ab4e9dd2cc7deb3737fefccc420f3bfc4d3720cdc4897d252b/excerpts-1.2.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "f5697ea8fcea0b2c6fec58eddc2c36f2", "sha256": "33f67355d718c249d9d0db29e467e4498eaa7b7d446d1850c69ce52266c42f1f" }, "downloads": -1, "filename": "excerpts-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f5697ea8fcea0b2c6fec58eddc2c36f2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11710, "upload_time": "2017-06-16T19:39:23", "url": "https://files.pythonhosted.org/packages/e6/c5/9464c643bda644d80fbac76ab41b284f95e2d12f6170411db7d399047cba/excerpts-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6ed406e9b4b04fdc4f4c20906a7a6c4", "sha256": "f4dc82fbaf850e8b9faa4497631e549df698729a80870d545e356e93e49fab5d" }, "downloads": -1, "filename": "excerpts-2.0.0.tar.gz", "has_sig": false, "md5_digest": "f6ed406e9b4b04fdc4f4c20906a7a6c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 168265, "upload_time": "2017-06-16T19:39:26", "url": "https://files.pythonhosted.org/packages/f2/4d/f659ee5e371c0706c4240101e0ac4176b59a1207dcacb35f09efc40a014a/excerpts-2.0.0.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "bf9056c32d8d6bb745d3badfcec79ec9", "sha256": "0d99ecaf3dc45bd394c60f6cf46f27353252b1dd8ba87ad2680aa6d89ac9f379" }, "downloads": -1, "filename": "excerpts-2.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "bf9056c32d8d6bb745d3badfcec79ec9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11688, "upload_time": "2019-03-30T21:13:59", "url": "https://files.pythonhosted.org/packages/86/58/1ba1ba7b5a2679498540817539f838885a6282a3da973eb996725fd86623/excerpts-2.1.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bf9056c32d8d6bb745d3badfcec79ec9", "sha256": "0d99ecaf3dc45bd394c60f6cf46f27353252b1dd8ba87ad2680aa6d89ac9f379" }, "downloads": -1, "filename": "excerpts-2.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "bf9056c32d8d6bb745d3badfcec79ec9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11688, "upload_time": "2019-03-30T21:13:59", "url": "https://files.pythonhosted.org/packages/86/58/1ba1ba7b5a2679498540817539f838885a6282a3da973eb996725fd86623/excerpts-2.1.0-py3-none-any.whl" } ] }