{ "info": { "author": "Lukasz Balcerzak", "author_email": "lukaszbalcerzak@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "=====================================\nfrogress - a progress tool for humans\n=====================================\n\n.. image:: https://secure.travis-ci.org/lukaszb/frogress.png?branch=master\n :target: http://travis-ci.org/lukaszb/frogress\n\n.. image:: https://coveralls.io/repos/lukaszb/frogress/badge.png?branch=master\n :target: https://coveralls.io/r/lukaszb/frogress/\n\n.. image:: https://pypip.in/v/frogress/badge.png\n :target: https://crate.io/packages/frogress/\n\n::\n\n /----------------------------------------------------------------------------------\\\n | |\n @..@ /| [###.......] Progress: 34.2MB / 125.8MB | 25.0% | Time: 14min3s | ETA: 19min52s |\n (----) / | |\n ( >__< ) \\----------------------------------------------------------------------------------/\n ^^ ~~ ^^\n\n\nfrogress is small progress indication tool to be used for fast prototyping.\nWhy *frogress* anyway? Because it's a bar (most of the time) and it jumps on\nyour terminal, that's why!\n\n- Does NOT break your workflow (in most cases there is no need to call\n progress bar to render itself)\n- It can guess if you `iterate over a list`_ (or similar iterable) ...\n- or if iterate over a file ...\n- or if iterate over generator - provided you know it's total length ...\n- or not! (no eta, no total steps, no percentage and indicator instead of a bar\n but it works!)\n- And you can easily teach it how to show progress of fat, gzipped xml file\n when using lxml_ to parse it\n- Supports Python 2.6+, Python 3, PyPY\n- Fully tested\n\n\nIteration examples\n==================\n\n\n.. _iterate over a list:\n\nIterate over a list\n-------------------\n\n::\n\n >>> import frogress\n >>> items = [1, 2, 3, 4, 5]\n >>> for item in frogress.bar(items):\n ... pass # do something with item\n\n [##........] Step 2/5 | 20.0% | Time: 0.1s | ETA: 0.5s\n\n\nIterate over a file\n-------------------\n\n::\n\n >>> import frogress\n >>> for line in frogress.bar(open('/path/to/file', steps_label='Progress')):\n ... pass # do something cruel with a line\n\n [###.......] Progress: 3.2MB / 12.8MB | 25.0% | Time: 14min3s | ETA: 19min52s\n\n\nIterate over generator\n----------------------\n\n::\n\n >>> import frogress\n >>> count = 100\n >>> items = range(count)\n >>> for item in frogress.bar(items, steps=count):\n ... pass # do something with item\n\n [#########.] Step 86/100 | 86.0% | Time: 1.2s | ETA: 7.3s\n\n\nIterate over a generator with unknown total number of steps\n-----------------------------------------------------------\n\n::\n\n >>> import frogress\n >>> def counter():\n ... num = 1\n ... while True:\n ... yield num\n ... num += 1\n ...\n >>> items = counter()\n >>> for item in frogress.bar(items):\n ... pass # do something with item\n\n [........#.] Step: 1410 | Time: 2min14s\n [.........#] Step: 1411 | Time: 2min15s\n [........#.] Step: 1412 | Time: 2min16s\n [.......#..] Step: 1413 | Time: 2min17s\n\n\n\nIterate over gzipped xml file using lxml\n----------------------------------------\n\nThe only problem with how to present a progress of file that's being processed\nis the source from which frogress should extract progress information. We can\ntry to do this simple way (without knowledge of how much of the file is already\nprocessed) or give ``frogress`` a *source*.\n\n\nSimple way\n~~~~~~~~~~\n\n::\n\n >>> import frogress\n >>> import gzip\n >>> from lxml.etree import iterparse\n >>> stream = gzip.open('my-fat.xml.gz')\n >>> context = iterparse(stream)\n >>> for action, element in frogress.bar(context):\n ... pass # do something with element\n ... element.clear() # don't forget about the memory!\n\n [...#......] Progress: 41923 | Time: 1h42min\n\nThis is perfectly fine: we passed an iterable that doesn't provide information\non how many total items there is to process - so we have an bar activity\nindicator, no total steps at the progress and no ETA.\n\nHowever, there is clearly a way of retrieving this information - after all this\nis only a file that's being processed. And that file should be passed as\n``source`` argument to the ``frogress.bar`` function.\n\nPass source\n~~~~~~~~~~~\n\n::\n\n >>> import frogress\n >>> import gzip\n >>> from lxml.etree import iterparse\n >>> stream = gzip.open('my-fat.xml.gz')\n >>> context = iterparse(stream)\n >>> for action, element in frogress.bar(context, source=stream.myfileobj):\n ... pass # do something with element\n ... element.clear() # don't forget about the memory!\n\n [#####.....] Progress: 73.5MB / 156.4MB | 47.3% | Time: 1h42min | ETA: 1h53min\n\nJust remember to pass file that is actually processed, not a wrapper! Standard\nfile would be passed directly, however in example, ``gzip`` module wraps stream\nit is working on and it's available as attribute ``myfileobj``. On the other\nhand ``bz2`` module doesn't wrap streams. And so on. ``frogress`` can guess if\na stream is file like object, however passing proper source is responsibility\nof the user.\n\n\nProgress bar class API\n======================\n\nMost of the time you won't need to call those API directly - ``frogress.bar``\nfunction should work for majority of the use cases. If, however, you feel like\nyou need to make some customization, here we present some examples::\n\n >>> import frogress\n >>> items = [1, 2, 3, 4, 5]\n >>> progressbar = frogress.Bar(items)\n >>> progressbar.step\n 0\n >>> progressbar.started # it's still None\n >>> progressbar.finished # here too\n >>> for item in progressbar:\n ... pass # process the item (it will draw progressbar during iteration)\n >>> progressbar.step\n 5\n >>> progressbar.widgets\n [, , , , ]\n >>> len(progressbar)\n 5\n >>> progressbar.output\n ', mode 'w' at 0x103df61e0>\n >>> progressbar.started\n datetime.datetime(2013, 5, 12, 22, 2, 26, 752454)\n >>> progressbar.finished\n datetime.datetime(2013, 5, 12, 22, 2, 26, 792901)\n\n\nTips & Tricks\n=============\n\nHow to change label of the progress widget\n------------------------------------------\n\n::\n\n >>> import frogress\n >>> items = [1, 2, 3, 4, 5]\n >>> widgets = [frogress.BarWidget, frogress.ProgressWidget('Items: '), frogress.TimerWidget]\n >>> for item in frogress.bar(items, widgets=widgets):\n >>> pass\n\n\n.. _lxml: http://lxml.de/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lukaszb/frogress", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "frogress", "package_url": "https://pypi.org/project/frogress/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/frogress/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/lukaszb/frogress" }, "release_url": "https://pypi.org/project/frogress/0.9.1/", "requires_dist": null, "requires_python": null, "summary": "frogress is simple progress tool", "version": "0.9.1" }, "last_serial": 777537, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "cf6d22a5cf5b8cd7e6b2cc7507a50813", "sha256": "00a0a6c8734aedd41029c944673204d0a446aa03024b9389cc77f1f9bdd62445" }, "downloads": -1, "filename": "frogress-0.9.0.tar.gz", "has_sig": false, "md5_digest": "cf6d22a5cf5b8cd7e6b2cc7507a50813", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10513, "upload_time": "2013-06-04T23:50:19", "url": "https://files.pythonhosted.org/packages/d3/14/36c31b0b6f1e12c05dde12a203350b8c5a6adb8b16f44c0f35eeabd2901d/frogress-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "63df68b172eeae8cb4166cd938a6b0de", "sha256": "da5b8206bce00ae245002975f50b73362e5d2e81151b48c66cfd4b15ba28952c" }, "downloads": -1, "filename": "frogress-0.9.1.tar.gz", "has_sig": false, "md5_digest": "63df68b172eeae8cb4166cd938a6b0de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15677, "upload_time": "2013-06-23T17:36:48", "url": "https://files.pythonhosted.org/packages/23/1e/d1498145bd80fc0b08cb35eeb1212c664d86efe91426ec83b0637901c0ef/frogress-0.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "63df68b172eeae8cb4166cd938a6b0de", "sha256": "da5b8206bce00ae245002975f50b73362e5d2e81151b48c66cfd4b15ba28952c" }, "downloads": -1, "filename": "frogress-0.9.1.tar.gz", "has_sig": false, "md5_digest": "63df68b172eeae8cb4166cd938a6b0de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15677, "upload_time": "2013-06-23T17:36:48", "url": "https://files.pythonhosted.org/packages/23/1e/d1498145bd80fc0b08cb35eeb1212c664d86efe91426ec83b0637901c0ef/frogress-0.9.1.tar.gz" } ] }