{ "info": { "author": "Yannic Wehner", "author_email": "yannic.wehner@elcapitan.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Build Tools" ], "description": "# ProgressPrinter\n\n![Code Examples](https://raw.githubusercontent.com/ElCap1tan/ProgressPrinter/master/docs/static/ProgressPrinterDemo_v0.1.1.gif)\n\n## Progress Bar:\n\n### For the full example see examples_progress_bar.py and examples_byte_progress_bar.py\n#### A first really bare version of a html documentation is available [here](https://elcapitan.io/ProgressPrinter/index.html)\n#### This will be edited in the next days to make things clearer.\n\n### ProgressBar Examples\n\n```Python\nfrom time import sleep\n\nfrom ProgressPrinter import ProgressBar\n```\n```Python\ndef ex1():\n pb1 = ProgressBar(100, '%', pre='Downloading file', post='Download finished', length=25)\n pb1.print_progress() # Prints the initial empty progress bar\n for mb in range(1, 101):\n pb1.print_progress(mb)\n sleep(0.15)\n```\n```\nDownloading file\n[========================>] - Finished 100 % of 100 %\nDownload finished\n```\n```Python\ndef ex2():\n pb2 = ProgressBar(500, 'MB', pre='Downloading file', post='Download finished', head='#')\n pb2.print_progress() # Prints the initial empty progress bar\n for mb in range(1, 501):\n pb2.print_progress(mb)\n sleep(0.02)\n```\n```\nDownloading file\n[=================================================#] - Finished 500 MB of 500 MB\nDownload finished\n```\n```Python\ndef ex3():\n pb3 = ProgressBar(1000.12, 'MB', pre='Downloading file', post='Download finished', length=100)\n pb3.print_progress() # Prints the initial empty progress bar\n for mb in range(1, 1001):\n if mb != 1000 and mb % 2 == 0:\n mb = mb + 0.5\n elif mb != 1000:\n mb = mb + 0.25\n else:\n mb = mb + 0.12\n pb3.print_progress(mb)\n sleep(0.025)\n```\n```\nDownloading file\n[===================================================================================================>] - Finished 1000.12 MB of 1000.12 MB\nDownload finished\n```\n```Python\ndef ex4():\n pb4 = ProgressBar(5, 'files', pre='Deleting files', post='Finished!', length=25, empty='*', fill='#')\n pb4.print_progress() # Prints the initial empty progress bar\n for file in range(1, 6):\n pp4.print_progress(file, pre=\"Deleting file file{}.txt\".format(file))\n sleep(1)\n```\n```\nDeleting files\nDeleting file file1.txt\nDeleting file file2.txt\nDeleting file file3.txt\nDeleting file file4.txt\nDeleting file file5.txt\n[########################>] - Finished 5 files of 5 files\nFinished!\n```\n```Python\ndef ex5():\n with open('example.txt', 'r') as f:\n pb5 = ProgressBar(len(f.readlines()), 'lines', pre=\"Reading lines from file {}\".format(f.name), post='Finished reading file!')\n f.seek(0) # Return to start of line after obtaining line count\n pb5.print_progress() # Prints the initial empty progress bar\n for lineno, line in enumerate(f, start=1):\n pb5.print_progress(lineno, pre=line.replace('\\n', ''))\n sleep(1)\n```\n```\nReading lines from file example.txt\nLine 1\nLine 2\nLine 3\nLine 4\n...\n[=================================================>] - Finished 5 lines of 5 lines\nFinished reading file!\n```\n\n### ByteProgressBar Example\n```Python\nimport requests\n\nfrom ProgressPrinter import ByteProgressBar\n\ndef ex1():\n # The ByteProgressBar is a extension of the normal progress bar that supports automatic unit conversion\n # from bytes, the base unit you will work with most of the time, to KB, MB, etc.\n # This for example is useful when downloading or working with a file (see example below)\n #\n # UNCOMMENT TO LINK YOU WANT TO USE FOR THE TEST DOWNLOAD\n # -------------------------------------------------------\n # 100MB.bin [100 MB] - Auto conversion to MB\n # link = 'https://speed.hetzner.de/100MB.bin'\n # -------------------------------------------------------------------------------------------\n # Linux Mint Cinnamon x64.iso [ca. 1.87 GB] - Auto conversion to GB\n link = 'http://mirrors.evowise.com/linuxmint/stable/19.2/linuxmint-19.2-cinnamon-64bit.iso'\n # -------------------------------------------------------------------------------------------\n\n file_name = link.split('/')[-1]\n with open(file_name, 'wb') as f:\n response = requests.get(link, stream=True)\n byte_size = int(response.headers.get('content-length'))\n if byte_size is None:\n f.write(response.content)\n else:\n # Set to ByteProgressBar.UNITS.AUTO to automatically interfere a fitting unit from the byte size\n # -----------------------------------------------------------------------------------------------\n # Supported values: ByteProgressBar.UNITS.{BYTES, KILOBYTES, MEGABYTES, GIGABYTES, TERABYTES, AUTO}\n\n bpb1 = ByteProgressBar(byte_size, ByteProgressBar.UNITS.AUTO, pre='Downloading {} from {}'\n .format(file_name, link), post='Finished download!')\n bpb1.print_progress()\n loaded_bytes = 0\n for chunk in response.iter_content(chunk_size=1048576): # 1 MB\n loaded_bytes += len(chunk)\n f.write(chunk)\n bpb1.print_progress(loaded_bytes)\n```\n```\nDownloading linuxmint-19.2-cinnamon-64bit.iso from http://mirrors.evowise.com/linuxmint/stable/19.2/linuxmint-19.2-cinnamon-64bit.iso\n[======> ] - Finished 0.27 GB of 1.87 GB\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/ElCap1tan/ProgressPrinter/archive/v0.1.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ElCap1tan/ProgressPrinter", "keywords": "terminal,console,shell,progress bar", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ProgressPrinter", "package_url": "https://pypi.org/project/ProgressPrinter/", "platform": "", "project_url": "https://pypi.org/project/ProgressPrinter/", "project_urls": { "Download": "https://github.com/ElCap1tan/ProgressPrinter/archive/v0.1.1.tar.gz", "Homepage": "https://github.com/ElCap1tan/ProgressPrinter" }, "release_url": "https://pypi.org/project/ProgressPrinter/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Simple library that allows you to add a progress bar to your console output.", "version": "0.1.1" }, "last_serial": 5826007, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7ee2840e57bab4198e12aff8543e550d", "sha256": "a0bd41605f4cec1f30b604ba32a3fcd62130322a9117657b85dd5632d7bff60b" }, "downloads": -1, "filename": "ProgressPrinter-0.1.tar.gz", "has_sig": false, "md5_digest": "7ee2840e57bab4198e12aff8543e550d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1602, "upload_time": "2019-09-08T21:16:30", "url": "https://files.pythonhosted.org/packages/8b/f1/dae1503a4946e3d71402a51854ddba61239f2770782d8f02380570fa53e9/ProgressPrinter-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2c5d9d634a8543f3b47d47bbc148eb90", "sha256": "5bfa35125390a6412dc7e3c267a93273c2c21f9fd3b266634c3fc89a86c4fb8b" }, "downloads": -1, "filename": "ProgressPrinter-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2c5d9d634a8543f3b47d47bbc148eb90", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7040, "upload_time": "2019-09-13T14:31:59", "url": "https://files.pythonhosted.org/packages/97/dc/6f918127310301b98a9cf51efe16d5635ae1654e1a0c5bd3d68d2c3fa509/ProgressPrinter-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7b66d4a82da54cede2678038957fe9a5", "sha256": "9bd17de391dab898f4b423bc9a78479f0856ff2ad65a868ac70bd974d1e5cbc0" }, "downloads": -1, "filename": "ProgressPrinter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7b66d4a82da54cede2678038957fe9a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5179, "upload_time": "2019-09-13T14:32:00", "url": "https://files.pythonhosted.org/packages/2c/d2/c6c23305804aab174e5374f8846d34a65bd9028ca69c98fc98ee0f478995/ProgressPrinter-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2c5d9d634a8543f3b47d47bbc148eb90", "sha256": "5bfa35125390a6412dc7e3c267a93273c2c21f9fd3b266634c3fc89a86c4fb8b" }, "downloads": -1, "filename": "ProgressPrinter-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2c5d9d634a8543f3b47d47bbc148eb90", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7040, "upload_time": "2019-09-13T14:31:59", "url": "https://files.pythonhosted.org/packages/97/dc/6f918127310301b98a9cf51efe16d5635ae1654e1a0c5bd3d68d2c3fa509/ProgressPrinter-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7b66d4a82da54cede2678038957fe9a5", "sha256": "9bd17de391dab898f4b423bc9a78479f0856ff2ad65a868ac70bd974d1e5cbc0" }, "downloads": -1, "filename": "ProgressPrinter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7b66d4a82da54cede2678038957fe9a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5179, "upload_time": "2019-09-13T14:32:00", "url": "https://files.pythonhosted.org/packages/2c/d2/c6c23305804aab174e5374f8846d34a65bd9028ca69c98fc98ee0f478995/ProgressPrinter-0.1.1.tar.gz" } ] }