{ "info": { "author": "Michael Henry", "author_email": "drmikehenry@drmikehenry.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Text Processing :: Filters", "Topic :: Utilities" ], "description": "*******************************************************************************\n\"Progress Tee\" - an enhanced \"tee\" program with in-place overwriting of status.\n*******************************************************************************\n\nIntroduction\n============\n\n``ptee`` (for \"Progress Tee\") is a console utility that builds upon the basic\nfunctionality provided by the standard Unix ``tee`` command. It accepts lines\nof text from a running command (such as an invocation of ``make``) and displays\nthem to the console such that consecutive less-important lines are overwritten\nin-place, providing feedback regarding the progress of the overall operation\nwithout allowing the more-important lines (such as compiler warnings and errors)\nto scroll away and be overlooked. In addition, as with standard ``tee``, a copy\nof the text from stdin may optionally be written verbatim to one or more output\nfiles.\n\nThese less-important lines are called \"context\" lines, as they provide context\nleading up to the important lines; the more-important lines are called \"regular\"\nlines. Each new context overwrites previous context lines in-place on the\nconsole, forming a \"status\" line that stays put without scrolling. When a\nregular line appears, the text composing the status line is kept (i.e., scrolled\nup) to provide context for the regular text.\n\nFor example, suppose an invocation of ``make`` generates the following output::\n\n $ make\n gcc -c -Wall -W -o file1.o file1.c\n gcc -c -Wall -W -o file2.o file2.c\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n gcc -c -Wall -W -o file3.o file3.c\n gcc -c -Wall -W -o file4.o file4.c\n gcc -c -Wall -W -o file5.o file5.c\n gcc -o app file1.o file2.o file3.o file4.o file5.o\n\nThe compiler invocation lines (``gcc -c ...``) become uninteresting as soon as\nthe next line shows up, unless there are warnings or errors associated with that\ninvocation. With ``ptee``, you can supply a regular expression to match these\n\"context\" lines to allow them to overwrite each other on the console. Lines not\nmatching the regular expression will be displayed on a line of their own (along\nwith the previous context line, if any). In the above example, the output would\nultimately look like this::\n\n $ make 2>&1 | ptee --regex '^gcc'\n gcc -c -Wall -W -o file2.o file2.c\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n\nThe ``2>&1`` in the above invocation redirects stderr to the same location as\nstdout, so that both stdout and stderr are piped into ``ptee``. This is needed\nbecause gcc's diagnostic messages go to stderr by default.\n\nDuring the run of ``make``, each line of status will be written on top of the\nprevious line of status, providing continuous feedback while keeping the\ninteresting lines from scrolling too far off the screen.\n\nContext Levels\n==============\n\nContext lines may have an associated level, indicating their position in a\nhierarchy. Levels are integers, starting at zero. When a context line of\nlevel N is detected, the status line will be built of the most recent lines of\ncontext from levels zero through N, concatenated into a single status line.\nThis can be useful for retaining bigger-picture context information while\nmore detailed context information is coming in.\n\nFor example, consider a build system invoked with a script named ``buildall``,\nwhich generates the following output::\n\n $ ./buildall\n x86:\n Building component1:\n [compile] file1.o\n [compile] file2.o\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n [link] component1\n Building component2:\n [compile] file3.o\n [link] component2\n x86_64:\n Building component3:\n [compile] file4.o\n [link] component3\n\nIn this build output, some components are being built, first for the x86\nplatform, then for the x86_64 platform. This output has three levels of\ncontext hierarchy:\n\n- Level 0: the platform (``x86:`` or ``x86_64``);\n- Level 1: the component (e.g., ``Building component1``);\n- Level 2: the build step (e.g., ``[compile] source1``, ``[link] component3``).\n\nConsider the following shell script to invoke ``buildall``::\n\n #!/bin/sh\n\n ./buildall 2>&1 | ptee build.out \\\n --level-regex 0 '^(x86|x86_64):' \\\n --level-regex 1 '^Building ' \\\n --level-regex 2 '^\\[.*\\]'\n\nThe filename ``build.out`` is passed to ``ptee`` such that a verbatim copy of\nthe build output will be recorded in the file ``build.out`` for possible future\nanalysis. When running ``./ba``, the uninteresting context lines are stripped\naway, leaving only the regular lines (the warning message, in this case) and the\ncontext lines at each level leading up to each regular line::\n\n $ ./ba\n x86:\n Building component1:\n [compile] file2.c\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n\nMore text actually goes to the console for status and feedback, but it is\noverwritten by writing a carriage return (``\\r``) instead of a newline (``\\n``).\nBelow is the actual output, post-processed to show the carriage returns and the\nsubsequent overwriting taking place::\n\n x86:\\r\n x86: Building component1:\\r\n x86: Building component1: [compile] file1.o\\r\n x86: Building component1: [compile] file2.o\\r\n \\r\n x86:\n Building component1:\n [compile] file2.o\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n x86: Building component1: [link] component1\\r\n x86: Building component2: \\r\n x86: Building component2: [compile] file3.o\\r\n x86: Building component2: [link] component2\\r\n x86_64: \\r\n x86_64: Building component3:\\r\n x86_64: Building component3: [compile] file4.o\\r\n x86_64: Building component3: [link] component3\\r\n\nNotice that the status line that appears briefly during compilation of file1.c\ncontains all three levels of context line, and that the first two levels of\ncontext are the same when subsequently compiling file2.c, so that\nbigger-picture context persists longer in the status line::\n\n x86: Building component1: [compile] file1.o\\r\n x86: Building component1: [compile] file2.o\\r\n\nHeading lines\n=============\n\nIn addition to context lines, ``ptee`` supports the notion of \"heading\" line.\nThese lines do not contribute to the status line; instead, they are printed\nas-is on the console. Unlike regular lines, however, no context lines are\nprinted before a heading line. This can be useful for long lines that would be\nawkward if prepended to the status line. Consider a second example with the\nfollowing modified output::\n\n $ ./buildall2\n ------------------------------ x86 ------------------------------\n Building component1:\n [compile] file1.o\n [compile] file2.o\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n [link] component1\n Building component2:\n [compile] file3.o\n [link] component2\n ------------------------------ x86_64 ---------------------------\n Building component3:\n [compile] file4.o\n [link] component3\n\nThe banner lines starting with ``------`` are too long to conveniently prepend\nto the status line. Instead, the ``ba2`` script treats them as headings::\n\n #!/bin/sh\n\n ./buildall2 2>&1 | ptee build.out \\\n --heading-regex '^-----' \\\n --level-regex 1 '^Building ' \\\n --level-regex 2 '^\\[.*\\]'\n\nLeading to this output::\n\n $ ./ba2\n ------------------------------ x86 ------------------------------\n Building component1:\n [compile] file2.o\n file2.c:1:12: warning: \u2018x\u2019 defined but not used [-Wunused-variable]\n ------------------------------ x86_64 ---------------------------\n\nSkipping lines\n==============\n\nSometimes input contains lines that should be skipped entirely, rather than\nbeing treated as status lines. An example might include spurious compiler\nwarnings that can't easily be suppressed. The switch\n``--skip-regex COUNT SKIP_REGEX`` provides a way to skip one or more lines that\nmatch a given pattern. For example, given the following input::\n\n [compile] file1.o\n system-header.h:999:18: warning: this is a spurious message\n in argument 2 of function `badly_written(x, y)`\n --------------------------------------------^\n [compile] file2.o\n\nTo skip the three lines of spurious warning, use this invocation::\n\n ptee --skip-regex 3 system-header.h:999:18:\n\nThis effectively transforms the input to::\n\n [compile] file1.o\n [compile] file2.o\n\nStripping overwritten lines\n===========================\n\nWhen writing to the console, status lines are continuously written and\noverwritten to provide feedback on overall progress. When the operation\ncompletes, only the important lines of text remain. But if this console output\nwere redirected to a file or piped into another program, the illusion of the\nstatus lines being overwritten would fall apart, because all of the status lines\nwould be still be present in the output. Therefore, when not writing to the\nconsole, ``ptee`` strips out any status lines that would be overwritten. This\ndefault behavior can be overridden via the ``--strip`` option (to force the\nstatus to be removed even when writing to a console) and the ``--no-strip``\noption (to retain the status lines even when not writing to a console). As an\nexample, the post-processed output shown above was generated something like\nthis::\n\n ./buildall 2>&1 | ptee [switches] --no-strip | perl -0777 -pe 's/\\r/\\\\r\\n/g'\n\nPartial lines\n=============\n\nIn general, ptee processes whole lines of text. But sometimes the input stream\nmay pause after a partial line, such as when a program displays a prompt to the\nuser and pauses for a response. To allow the user to see such partial lines,\nptee by default will wait an amount of time controlled by the\n--partial-line-timeout switch; if the input stream stalls for longer than this\namount of time, the partial input will be displayed without further processing,\nand all future input up to the next newline will be immediately displayed.\nSetting the timeout value to zero disables the timeout feature.\n\nText encoding option\n====================\n\nBy default, text is assumed to be in UTF-8 format on stdin and stdout. This\nmay be overridden using the ``--encoding`` option, e.g., for a hypothetical\nprogram that generates latin1 text::\n\n generate-latin1-text | ptee --encoding latin1 --regex ''\n\nSee ``ptee --help`` for more information.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/drmikehenry/ptee", "keywords": "progress tee in-place overwriting status", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ptee", "package_url": "https://pypi.org/project/ptee/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ptee/", "project_urls": { "Homepage": "https://github.com/drmikehenry/ptee" }, "release_url": "https://pypi.org/project/ptee/0.3.2/", "requires_dist": null, "requires_python": "", "summary": "\"Progress tee\", an enhanced \"tee\" program with in-place overwriting of \"status\".", "version": "0.3.2" }, "last_serial": 2374970, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e3a8d7e5ae611984a2213bac7e66d078", "sha256": "e4f6b108e46ecc7253683774d29753f70cb4d6382e5fc4767313b214c412c8fb" }, "downloads": -1, "filename": "ptee-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e3a8d7e5ae611984a2213bac7e66d078", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5203, "upload_time": "2015-05-31T20:50:50", "url": "https://files.pythonhosted.org/packages/f3/80/833029785d2d63da03d0994087e963af0f2da6dc99edf9fec1df094935b0/ptee-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "03832edb0afa0f0bce72bf44b0ccd860", "sha256": "1efeef4f483dba8ea760ba8b8f91894cfaec6e86e534541db8b9a9facbeadd3a" }, "downloads": -1, "filename": "ptee-0.2.0.tar.gz", "has_sig": false, "md5_digest": "03832edb0afa0f0bce72bf44b0ccd860", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5878, "upload_time": "2015-06-23T01:20:14", "url": "https://files.pythonhosted.org/packages/6b/bd/fb30e952886490c4359a0d3202634dd55b501f945e01b33f5db3fa2b395f/ptee-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "5d6d78f492155da3bb660a7b268c81be", "sha256": "eb5ae3857879975364835f61c5b4ef1428819800656415d5edd6fde12d82733b" }, "downloads": -1, "filename": "ptee-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5d6d78f492155da3bb660a7b268c81be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9269, "upload_time": "2016-03-01T11:39:39", "url": "https://files.pythonhosted.org/packages/fe/e3/96ecd64adf9aa59387672c49820e4a059a8b595d2ace1b1dd776d85e0b63/ptee-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "20d7b053c6396736446dd116f21ea247", "sha256": "2cd4a67e65c035d92c3e666bb004c27cad3570eaef5b8b0626bbdcf1cfe0f9b7" }, "downloads": -1, "filename": "ptee-0.3.1.tar.gz", "has_sig": false, "md5_digest": "20d7b053c6396736446dd116f21ea247", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11974, "upload_time": "2016-09-11T20:51:23", "url": "https://files.pythonhosted.org/packages/b3/e1/7dea38f0906a2e426765a9a7caad2e0c101aa5ad1bd7d38db0dae5848aa0/ptee-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "e26d8b1a70da415bc7aef740965ce483", "sha256": "9f7377fa98feeb5adf192f0b9e1d0533ef12d0bca76f1d160c3f2dd75787ad40" }, "downloads": -1, "filename": "ptee-0.3.2.tar.gz", "has_sig": false, "md5_digest": "e26d8b1a70da415bc7aef740965ce483", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11996, "upload_time": "2016-10-01T14:39:07", "url": "https://files.pythonhosted.org/packages/2b/2c/95652c1395357de83a602d1bf76c506bafd5f1a2dc8a08adc84deafe0e2e/ptee-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e26d8b1a70da415bc7aef740965ce483", "sha256": "9f7377fa98feeb5adf192f0b9e1d0533ef12d0bca76f1d160c3f2dd75787ad40" }, "downloads": -1, "filename": "ptee-0.3.2.tar.gz", "has_sig": false, "md5_digest": "e26d8b1a70da415bc7aef740965ce483", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11996, "upload_time": "2016-10-01T14:39:07", "url": "https://files.pythonhosted.org/packages/2b/2c/95652c1395357de83a602d1bf76c506bafd5f1a2dc8a08adc84deafe0e2e/ptee-0.3.2.tar.gz" } ] }